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

@ -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)