Exemple #1
0
 public override void OnDefend(DamageAction action)
 {
     RemainingValue = action.Absorb(RemainingValue, (DamageSchoolMask)m_spellEffect.MiscValueC);
     if (RemainingValue <= 0)
     {
         Owner.AddMessage(m_aura.Cancel);
     }
 }
        public override void OnProc(Unit triggerer, IUnitAction action)
        {
            var dmgAction = action as DamageAction;

            if (dmgAction == null)
            {
                return;
            }
            dmgAction.ReferenceCount++;

            Owner.AddMessage(() =>
            {
                var nextTarget = Owner.GetRandomVisibleUnit(Owner.MaxAttackRange, unit => Owner.MayAttack(unit) && unit != triggerer);
                if (nextTarget != null)
                {
                    dmgAction.Victim      = nextTarget;
                    dmgAction.SpellEffect = m_spellEffect;
                    triggerer.DoRawDamage(dmgAction);
                }
                // TODO: To ensure correct pooling, must ensure that reference count gets counted down
                // But object messages don't get executed if the object gets removed before execution
                dmgAction.ReferenceCount--;
            });
        }