Fixes dictionary uses (#7)

This commit is contained in:
Kamron Batman 2018-11-02 08:16:42 -07:00 committed by GitHub
parent d4a52344f2
commit 916d404c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1211 additions and 1722 deletions

View file

@ -36,13 +36,12 @@ namespace Server.Spells.Second
return false;
}
if (!Caster.CanBeginAction<DefensiveSpell>())
{
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
}
if (Caster.CanBeginAction<DefensiveSpell>())
return true;
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
return false;
return true;
}
public static void Toggle(Mobile caster, Mobile target)
@ -56,9 +55,7 @@ namespace Server.Spells.Second
* even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
*/
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[target];
if (mods == null)
if (m_Table.TryGetValue(target, out Tuple<ResistanceMod, DefaultSkillMod> mods))
{
target.PlaySound(0x1E9);
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
@ -98,9 +95,7 @@ namespace Server.Spells.Second
public static void EndProtection(Mobile m)
{
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[m];
if (mods == null)
if (!m_Table.TryGetValue(m, out Tuple<ResistanceMod, DefaultSkillMod> mods))
return;
m_Table.Remove(m);