Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Factions;
using Server.Items;
using Server.Mobiles;
@ -18,22 +19,7 @@ namespace Server.Spells.Fifth
Reagent.Nightshade
);
private static Hashtable m_Timers = new Hashtable();
private static int[] m_HairIDs =
{
0x2044, 0x2045, 0x2046,
0x203C, 0x203B, 0x203D,
0x2047, 0x2048, 0x2049,
0x204A, 0x0000
};
private static int[] m_BeardIDs =
{
0x203E, 0x203F, 0x2040,
0x2041, 0x204B, 0x204C,
0x204D, 0x0000
};
private static Dictionary<Mobile, InternalTimer> m_Timers = new Dictionary<Mobile, InternalTimer>();
public IncognitoSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -49,7 +35,7 @@ namespace Server.Spells.Fifth
return false;
}
if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
if (!Caster.CanBeginAction<IncognitoSpell>())
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
return false;
@ -70,7 +56,7 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1010445); // You cannot incognito if you have a sigil
}
else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
else if (!Caster.CanBeginAction<IncognitoSpell>())
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
@ -82,13 +68,13 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1061631); // You can't do that while disguised.
}
else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
else if (!Caster.CanBeginAction<PolymorphSpell>() || Caster.IsBodyMod)
{
DoFizzle();
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(IncognitoSpell)))
if (Caster.BeginAction<IncognitoSpell>())
{
DisguiseTimers.StopTimer(Caster);
@ -121,8 +107,7 @@ namespace Server.Spells.Fifth
TimeSpan length = TimeSpan.FromSeconds(timeVal);
Timer t = new InternalTimer(Caster, length);
InternalTimer t = new InternalTimer(Caster, length);
m_Timers[Caster] = t;
t.Start();
@ -138,18 +123,16 @@ namespace Server.Spells.Fifth
FinishSequence();
}
public static bool StopTimer(Mobile m)
public static void StopTimer(Mobile m)
{
Timer t = (Timer)m_Timers[m];
Timer t = m_Timers[m];
if (t != null)
{
t.Stop();
m_Timers.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
}
if (t == null)
return;
return t != null;
t.Stop();
m_Timers.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.Incognito);
}
private class InternalTimer : Timer
@ -173,14 +156,14 @@ namespace Server.Spells.Fifth
protected override void OnTick()
{
if (!m_Owner.CanBeginAction(typeof(IncognitoSpell)))
if (!m_Owner.CanBeginAction<IncognitoSpell>())
{
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
m_Owner.BodyMod = 0;
m_Owner.HueMod = -1;
m_Owner.NameMod = null;
m_Owner.EndAction(typeof(IncognitoSpell));
m_Owner.EndAction<IncognitoSpell>();
BaseArmor.ValidateMobile(m_Owner);
BaseClothing.ValidateMobile(m_Owner);
@ -188,4 +171,4 @@ namespace Server.Spells.Fifth
}
}
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections;
using System.Collections.Generic;
namespace Server.Spells.Fifth
{
@ -13,7 +14,7 @@ namespace Server.Spells.Fifth
Reagent.SpidersSilk
);
private static Hashtable m_Table = new Hashtable();
private static Dictionary<Mobile, ResistanceMod[]> m_Table = new Dictionary<Mobile, ResistanceMod[]>();
public MagicReflectSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
{
@ -32,7 +33,7 @@ namespace Server.Spells.Fifth
return false;
}
if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
@ -56,17 +57,17 @@ namespace Server.Spells.Fifth
{
Mobile targ = Caster;
ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];
ResistanceMod[] mods = m_Table[targ];
if (mods == null)
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
int physiMod = -25 + (int)(targ.Skills.Inscribe.Value / 20);
int otherMod = 10;
mods = new ResistanceMod[5]
mods = new[]
{
new ResistanceMod(ResistanceType.Physical, physiMod),
new ResistanceMod(ResistanceType.Fire, otherMod),
@ -106,15 +107,15 @@ namespace Server.Spells.Fifth
{
Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
}
else if (!Caster.CanBeginAction(typeof(DefensiveSpell)))
else if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
}
else if (CheckSequence())
{
if (Caster.BeginAction(typeof(DefensiveSpell)))
if (Caster.BeginAction<DefensiveSpell>())
{
int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
int value = (int)(Caster.Skills.Magery.Value + Caster.Skills.Inscribe.Value);
value = (int)(8 + value / 200 * 7.0); //absorb from 8 to 15 "circles"
Caster.MagicDamageAbsorb = value;
@ -134,17 +135,16 @@ namespace Server.Spells.Fifth
public static void EndReflect(Mobile m)
{
if (m_Table.Contains(m))
{
ResistanceMod[] mods = (ResistanceMod[])m_Table[m];
ResistanceMod[] mods = m_Table[m];
if (mods != null)
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
if (mods != null)
{
for (int i = 0; i < mods.Length; ++i)
m.RemoveResistanceMod(mods[i]);
m_Table.Remove(m);
BuffInfo.RemoveBuff(m, BuffIcon.MagicReflection);
}
}
}
}
}

View file

@ -30,14 +30,8 @@ namespace Server.Spells.Fifth
Caster.Target = new InternalTarget(this);
}
private void AosDelay_Callback(object state)
private void AosDelay_Callback(Mobile caster, Mobile target, Mobile defender, int damage)
{
object[] states = (object[])state;
Mobile caster = (Mobile)states[0];
Mobile target = (Mobile)states[1];
Mobile defender = (Mobile)states[2];
int damage = (int)states[3];
if (caster.HarmfulCheck(defender))
{
SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0);
@ -63,14 +57,13 @@ namespace Server.Spells.Fifth
SpellHelper.CheckReflect((int)Circle, ref from, ref target);
int damage = (int)((Caster.Skills[SkillName.Magery].Value + Caster.Int) / 5);
int damage = (int)((Caster.Skills.Magery.Value + Caster.Int) / 5);
if (damage > 60)
damage = 60;
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
new TimerStateCallback(AosDelay_Callback),
new object[] { Caster, target, m, damage });
() => AosDelay_Callback(Caster, target, m, damage));
}
}
else if (CheckHSequence(m))

View file

@ -65,7 +65,7 @@ namespace Server.Spells.Fifth
{
// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]
duration = 7.0 + Caster.Skills[SkillName.Magery].Value * 0.2;
duration = 7.0 + Caster.Skills.Magery.Value * 0.2;
if (CheckResisted(m))
duration *= 0.75;

View file

@ -72,7 +72,7 @@ namespace Server.Spells.Fifth
if (Core.AOS)
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
else
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills[SkillName.Magery].Value);
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);
SpellHelper.Summon(creature, Caster, 0x215, duration, false, false);
}