Fixes NPE with Protection Spell (#179)

This commit is contained in:
Kamron Batman 2020-07-18 19:25:15 -07:00 committed by GitHub
parent 5052bf9af3
commit eb3f72da99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 39 deletions

View file

@ -55,7 +55,19 @@ namespace Server.Spells.Fifth
{
Mobile targ = Caster;
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
if (m_Table.TryGetValue(targ, out ResistanceMod[] mods))
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
else
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
@ -81,18 +93,6 @@ namespace Server.Spells.Fifth
BuffInfo.AddBuff(targ, new BuffInfo(BuffIcon.MagicReflection, 1075817, buffFormat, true));
}
else
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(targ, BuffIcon.MagicReflection);
}
}
FinishSequence();

View file

@ -56,7 +56,19 @@ namespace Server.Spells.First
{
Mobile targ = Caster;
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
if (m_Table.TryGetValue(targ, out ResistanceMod[] mods))
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(Caster, BuffIcon.ReactiveArmor);
}
else
{
targ.PlaySound(0x1E9);
targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
@ -81,18 +93,6 @@ namespace Server.Spells.First
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args));
}
else
{
targ.PlaySound(0x1ED);
targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
m_Table.Remove(targ);
for (int i = 0; i < mods.Length; ++i)
targ.RemoveResistanceMod(mods[i]);
BuffInfo.RemoveBuff(Caster, BuffIcon.ReactiveArmor);
}
}
FinishSequence();

View file

@ -53,6 +53,19 @@ namespace Server.Spells.Second
*/
if (m_Table.TryGetValue(target, out Tuple<ResistanceMod, DefaultSkillMod> mods))
{
target.PlaySound(0x1ED);
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
m_Table.Remove(target);
Registry.Remove(target);
target.RemoveResistanceMod(mods.Item1);
target.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(target, BuffIcon.Protection);
}
else
{
target.PlaySound(0x1E9);
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
@ -74,19 +87,6 @@ namespace Server.Spells.Second
string args = $"{physloss}\t{resistloss}";
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args));
}
else
{
target.PlaySound(0x1ED);
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
m_Table.Remove(target);
Registry.Remove(target);
target.RemoveResistanceMod(mods.Item1);
target.RemoveSkillMod(mods.Item2);
BuffInfo.RemoveBuff(target, BuffIcon.Protection);
}
}
public static void EndProtection(Mobile m)