/// <summary> /// Returns the delay until the given spell has cooled down in milliseconds /// </summary> public int GetRemainingCooldownMillis(Spell spell) { if (m_cooldowns == null) { return(0); } CooldownRemoveTimer cooldownRemoveTimer = m_cooldowns.Find( cd => (int)cd.Spell.Id == (int)spell.Id); if (cooldownRemoveTimer != null) { return(cooldownRemoveTimer.GetDelayUntilNextExecution(Owner)); } return(0); }
private void AddCooldown(Spell spell, int millis) { if (millis <= 0) { return; } m_readySpells.Remove(spell); var action = new CooldownRemoveTimer(millis, spell); Owner.AddUpdateAction(action); if (m_cooldowns == null) { m_cooldowns = new List <CooldownRemoveTimer>(); } m_cooldowns.Add(action); }
public override void ClearCooldown(Spell spell, bool alsoCategory = true) { if (m_cooldowns == null) { return; } for (int index = 0; index < m_cooldowns.Count; ++index) { CooldownRemoveTimer cooldown = m_cooldowns[index]; if ((int)cooldown.Spell.Id == (int)spell.Id) { m_cooldowns.Remove(cooldown); AddReadySpell(cooldown.Spell); break; } } }
private void AddCooldown(Spell spell, int millis) { if (millis <= 0) { return; } m_readySpells.Remove(spell); var action = new CooldownRemoveTimer(millis, spell); Owner.CallDelayed(millis, (o) => ((NPCSpellCollection)(Owner).Spells).AddReadySpell(spell)); if (m_cooldowns == null) { m_cooldowns = new List <CooldownRemoveTimer>(); } m_cooldowns.Add(action); }
private void AddCooldown(Spell spell, int millis) { if (millis <= 0) return; m_readySpells.Remove(spell); var action = new CooldownRemoveTimer(millis, spell); Owner.AddUpdateAction(action); if (m_cooldowns == null) { m_cooldowns = new List<CooldownRemoveTimer>(); } m_cooldowns.Add(action); }