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

@ -219,9 +219,7 @@ namespace Server.Spells
return null;
}
Table.TryGetValue(m, out SpecialMove move);
if (move != null && move.ValidatesDuringHit && !move.Validate(m))
if (Table.TryGetValue(m, out SpecialMove move) && move.ValidatesDuringHit && !move.Validate(m))
{
ClearCurrentMove(m);
return null;
@ -272,9 +270,9 @@ namespace Server.Spells
public static void ClearCurrentMove(Mobile m)
{
Table.TryGetValue(m, out SpecialMove move);
;
if (move != null)
if (Table.TryGetValue(m, out SpecialMove move))
{
move.OnClearMove(m);
@ -306,17 +304,7 @@ namespace Server.Spells
private static SpecialMoveContext GetContext(Mobile m)
{
return m_PlayersTable.ContainsKey(m) ? m_PlayersTable[m] : null;
}
public static bool GetContext(Mobile m, Type type)
{
m_PlayersTable.TryGetValue(m, out SpecialMoveContext context);
if (context == null)
return false;
return context.Type == type;
return m_PlayersTable.TryGetValue(m, out SpecialMoveContext context) ? context : null;
}
private class SpecialMoveTimer : Timer
@ -349,4 +337,4 @@ namespace Server.Spells
public Type Type{ get; }
}
}
}
}