Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -39,24 +39,18 @@ namespace Server.Spells.Ninjitsu
|
|||
if (m == null)
|
||||
return;
|
||||
|
||||
if (m_CloneCount.ContainsKey(m))
|
||||
m_CloneCount[m]++;
|
||||
else
|
||||
m_CloneCount[m] = 1;
|
||||
m_CloneCount[m] = 1 + (m_CloneCount.TryGetValue(m, out int count) ? count : 0);
|
||||
}
|
||||
|
||||
public static void RemoveClone(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
if (m == null || !m_CloneCount.TryGetValue(m, out int count))
|
||||
return;
|
||||
|
||||
if (m_CloneCount.ContainsKey(m))
|
||||
{
|
||||
if (count <= 1)
|
||||
m_CloneCount.Remove(m);
|
||||
else
|
||||
m_CloneCount[m]--;
|
||||
|
||||
if (m_CloneCount[m] == 0)
|
||||
m_CloneCount.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
|
|
@ -272,4 +266,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue