示例#1
0
        /// <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);
        }
示例#2
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);
        }
示例#3
0
 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;
         }
     }
 }
示例#4
0
        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);
        }
示例#5
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);
		}