Beispiel #1
0
 /// <summary>
 /// Refreshes this aura.
 /// If this Aura is stackable, will also increase the StackCount by one.
 /// </summary>
 public void Refresh(ObjectReference caster)
 {
     if (!IsAdded)
     {
         return;
     }
     RemoveNonPeriodicEffects();
     m_CasterReference = caster;
     if (m_spell.InitialStackCount > 1)
     {
         m_stackCount = (byte)m_spell.InitialStackCount;
     }
     else if (m_stackCount < m_spell.MaxStackCount)
     {
         ++m_stackCount;
     }
     foreach (AuraEffectHandler handler in m_handlers)
     {
         handler.UpdateEffectValue();
     }
     ApplyNonPeriodicEffects();
     TimeLeft = m_spell.GetDuration(caster, m_auras.Owner);
     if (!IsVisible)
     {
         return;
     }
     AuraHandler.SendAuraUpdate(m_auras.Owner, this);
 }
Beispiel #2
0
        public void TriggerProc(Unit triggerer, IUnitAction action)
        {
            bool flag = false;

            if (m_spell.ProcTriggerEffects != null)
            {
                foreach (AuraEffectHandler handler in m_handlers)
                {
                    if (handler.SpellEffect.IsProc && handler.CanProcBeTriggeredBy(action) &&
                        handler.SpellEffect.CanProcBeTriggeredBy(action.Spell))
                    {
                        handler.OnProc(triggerer, action);
                        flag = true;
                    }
                }
            }
            else
            {
                flag = true;
            }

            if (!flag || m_spell.ProcCharges <= 0)
            {
                return;
            }
            --m_stackCount;
            if (m_stackCount == 0)
            {
                Remove(false);
            }
            else
            {
                AuraHandler.SendAuraUpdate(m_auras.Owner, this);
            }
        }
Beispiel #3
0
 protected internal void SendToClient()
 {
     if (!IsVisible)
     {
         return;
     }
     AuraHandler.SendAuraUpdate(m_auras.Owner, this);
 }
Beispiel #4
0
        protected internal void SendToClient()
        {
            if (!IsVisible)
            {
                return;
            }

#if DEBUG
            //log.Info("Sending Aura: " + this);
#endif

            //AuraHandler.SendAuraInfo(m_auras.Owner, (byte)m_index, m_spell.Id, (uint)m_duration, (uint)m_duration);
            AuraHandler.SendAuraUpdate(m_auras.Owner, this);
        }
Beispiel #5
0
        public void TriggerProc(Unit triggerer, IUnitAction action)
        {
            var proced = false;

            var hasProcEffects = m_spell.ProcTriggerEffects != null;

            if (hasProcEffects)
            {
                foreach (var handler in m_handlers)
                {
                    if (handler.SpellEffect.IsProc)
                    {
                        // only trigger proc effects or all effects, if there arent any proc-specific effects
                        if (handler.CanProcBeTriggeredBy(action) &&
                            handler.SpellEffect.CanProcBeTriggeredBy(action.Spell))
                        {
                            // only trigger if no AffectMask or spell, or the trigger spell matches the affect mask
                            handler.OnProc(triggerer, action);
                            proced = true;
                        }
                    }
                }
            }
            else
            {
                // Simply reduce stack count and remove aura eventually
                proced = true;
            }

            if (proced && m_spell.ProcCharges > 0)
            {
                // consume a charge
                m_stackCount--;
                if (m_stackCount == 0)
                {
                    Remove(false);
                }
                else
                {
                    AuraHandler.SendAuraUpdate(m_auras.Owner, this);
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// Refreshes this aura.
        /// If this Aura is stackable, will also increase the StackCount by one.
        /// </summary>
        public void Refresh(ObjectReference caster)
        {
            if (IsAdded)
            {
                // remove non-periodic effects:
                RemoveNonPeriodicEffects();

                m_CasterReference = caster;

                if (m_spell.InitialStackCount > 1)
                {
                    m_stackCount = (byte)m_spell.InitialStackCount;
                }
                else if (m_stackCount < m_spell.MaxStackCount)
                {
                    m_stackCount++;
                }

                // update effect values
                foreach (var handler in m_handlers)
                {
                    handler.UpdateEffectValue();
                }

                // re-apply non-periodic effects:
                ApplyNonPeriodicEffects();

                // reset timer:
                TimeLeft = m_spell.GetDuration(caster, m_auras.Owner);

                if (IsVisible)
                {
                    AuraHandler.SendAuraUpdate(m_auras.Owner, this);
                }
            }
        }