Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -109,9 +109,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public static void RemoveEntry(Mobile m)
|
||||
{
|
||||
if (_Table.ContainsKey(m))
|
||||
if (_Table.TryGetValue(m, out int v))
|
||||
{
|
||||
int v = _Table[m];
|
||||
_Table.Remove(m);
|
||||
m.EndAction<ArchProtectionSpell>();
|
||||
m.VirtualArmorMod -= v;
|
||||
|
|
@ -162,4 +161,4 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Spells.Fourth
|
|||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_UnderEffect = new Dictionary<Mobile, Timer>();
|
||||
private static HashSet<Mobile> m_UnderEffect = new HashSet<Mobile>();
|
||||
|
||||
public CurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
|
|
@ -38,7 +38,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public static bool UnderEffect(Mobile m)
|
||||
{
|
||||
return m_UnderEffect.ContainsKey(m);
|
||||
return m_UnderEffect.Contains(m);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
@ -59,13 +59,12 @@ namespace Server.Spells.Fourth
|
|||
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
|
||||
SpellHelper.DisableSkillCheck = false;
|
||||
|
||||
Timer t = m_UnderEffect[m];
|
||||
|
||||
if (Caster.Player && m.Player /*&& Caster != m */ && t == null
|
||||
if (Caster.Player && m.Player /*&& Caster != m */ && !UnderEffect(m)
|
||||
) //On OSI you CAN curse yourself and get this effect.
|
||||
{
|
||||
TimeSpan duration = SpellHelper.GetDuration(Caster, m);
|
||||
m_UnderEffect[m] = Timer.DelayCall(duration, RemoveEffect, m);
|
||||
m_UnderEffect.Add(m);
|
||||
Timer.DelayCall(duration, RemoveEffect, m);
|
||||
m.UpdateResistances();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Spells.Fourth
|
|||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
private static HashSet<Mobile> m_Table = new HashSet<Mobile>();
|
||||
|
||||
public ManaDrainSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Spells.Fourth
|
|||
else if (toDrain > m.Mana)
|
||||
toDrain = m.Mana;
|
||||
|
||||
if (m_Table.ContainsKey(m))
|
||||
if (m_Table.Contains(m))
|
||||
toDrain = 0;
|
||||
|
||||
m.FixedParticles(0x3789, 10, 25, 5032, EffectLayer.Head);
|
||||
|
|
@ -76,7 +76,8 @@ namespace Server.Spells.Fourth
|
|||
{
|
||||
m.Mana -= toDrain;
|
||||
|
||||
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain));
|
||||
m_Table.Add(m);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -124,4 +125,4 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue