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

@ -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();
}