public override void OnDefend(DamageAction action)
 {
     action.Victim.AddMessage((Action)(() =>
     {
         if (!action.Victim.MayAttack((IFactionMember)action.Attacker))
         {
             return;
         }
         action.Attacker.DealSpellDamage(action.Victim, this.SpellEffect,
                                         action.Damage * (this.SpellEffect.MiscValue / 100), true, true, false, true);
         Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(this.m_aura.CasterUnit as Character,
                                                                  this.Owner as Character, this.Owner as NPC, action.ActualDamage);
     }));
     if (this.SpellEffect.MiscValueB == 0)
     {
         action.Resisted = action.Damage;
     }
     else
     {
         if (this.SpellEffect.MiscValueB != 20)
         {
             return;
         }
         Character casterUnit = this.m_aura.CasterUnit as Character;
         if (casterUnit == null || !casterUnit.IsInGroup)
         {
             return;
         }
         foreach (GroupMember groupMember in casterUnit.Group)
         {
             groupMember.Character.Heal(action.Damage * this.SpellEffect.MiscValue / 100, (Unit)null,
                                        (SpellEffect)null);
         }
     }
 }
예제 #2
0
        protected override void Apply()
        {
            Unit owner = Owner;

            if (!owner.IsAlive)
            {
                return;
            }
            float num = (float)(SpellEffect.MiscValue * (m_aura.CasterUnit != null
                             ? (m_aura.CasterUnit.Class == ClassId.AtackMage ||
                                m_aura.CasterUnit.Class == ClassId.SupportMage ||
                                m_aura.CasterUnit.Class == ClassId.HealMage
                               ? m_aura.CasterUnit.RandomMagicDamage
                               : m_aura.CasterUnit.RandomDamage)
                             : 666.0) / 100.0 * 3.0);

            if (m_aura.Spell.Mechanic == SpellMechanic.Bleeding)
            {
                int bleedBonusPercent = m_aura.Auras.GetBleedBonusPercent();
                num += (float)((num * (double)bleedBonusPercent + 50.0) / 100.0);
                m_aura.Owner.IncMechanicCount(SpellMechanic.Bleeding, false);
            }

            DamageAction damageAction = owner.DealSpellDamage(m_aura.CasterUnit, m_spellEffect, (int)num,
                                                              true, true, false, false);

            if (damageAction == null)
            {
                return;
            }
            Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(m_aura.CasterUnit as Character,
                                                                     Owner as Character, Owner as NPC, damageAction.ActualDamage);
            damageAction.OnFinished();
        }
        public override void OnAttack(DamageAction action)
        {
            if (action.Spell != null)
            {
                return;
            }
            if ((double)this.Owner.SplinterEffect > 0.0)
            {
                foreach (WorldObject objectsInRadiu in (IEnumerable <WorldObject>) this.Owner.GetObjectsInRadius <Unit>(
                             2.5f, ObjectTypes.Attackable, false, int.MaxValue))
                {
                    if (this.Owner.IsHostileWith((IFactionMember)objectsInRadiu) &&
                        !object.ReferenceEquals((object)objectsInRadiu, (object)this.Owner) &&
                        Utility.Random(0, 100000) <= this.Owner.SplinterEffectChange)
                    {
                        Character    targetChr    = objectsInRadiu as Character;
                        NPC          targetNpc    = objectsInRadiu as NPC;
                        DamageAction unusedAction = this.Owner.GetUnusedAction();
                        unusedAction.Damage =
                            (int)((double)this.Owner.RandomDamage * (double)this.Owner.SplinterEffect);
                        unusedAction.Attacker = objectsInRadiu as Unit;
                        unusedAction.Victim   = objectsInRadiu as Unit;
                        int num = (int)unusedAction.DoAttack();
                        if (this.Owner is Character)
                        {
                            Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse((Character)null, targetChr,
                                                                                     targetNpc, unusedAction.ActualDamage);
                        }
                        action.OnFinished();
                    }
                }
            }

            base.OnAttack(action);
        }
예제 #4
0
        protected override void Apply()
        {
            IList <WorldObject> objectsInRadius =
                this.Owner.GetObjectsInRadius <Unit>(6f, ObjectTypes.Unit, false, int.MaxValue);

            if (objectsInRadius == null)
            {
                return;
            }
            foreach (WorldObject worldObject in (IEnumerable <WorldObject>)objectsInRadius)
            {
                Unit unit = worldObject as Unit;
                if (unit != null && this.Owner != null &&
                    (this.m_aura != null && unit.IsHostileWith((IFactionMember)this.Owner)))
                {
                    DamageAction damageAction = unit.DealSpellDamage(this.Owner, this.SpellEffect,
                                                                     (int)((double)this.Owner.RandomDamage * (double)this.SpellEffect.MiscValue / 100.0), true,
                                                                     true, false, false);
                    if (damageAction != null)
                    {
                        Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(this.m_aura.CasterUnit as Character,
                                                                                 unit as Character, unit as NPC, damageAction.ActualDamage);
                        damageAction.OnFinished();
                    }
                }
            }
        }
예제 #5
0
 public override void OnAttack(WCell.RealmServer.Misc.DamageAction action)
 {
     if (action.Spell != null)
     {
         return;
     }
     if (Owner.SplinterEffect > 0)
     {
         var targets = Owner.GetObjectsInRadius(2.5f, ObjectTypes.Attackable, false);
         foreach (var worldObject in targets)
         {
             if (!Owner.IsHostileWith(worldObject) || ReferenceEquals(worldObject, Owner))
             {
                 continue;
             }
             if (Utility.Random(0, 100000) > Owner.SplinterEffectChange)
             {
                 continue;
             }
             var targetChr = worldObject as Character;
             var targetNpc = worldObject as NPC;
             var a         = Owner.GetUnusedAction();
             a.Damage   = (int)(Owner.RandomDamage * Owner.SplinterEffect);
             a.Attacker = worldObject as Unit;
             a.Victim   = worldObject as Unit;
             a.DoAttack();
             if (Owner is Character)
             {
                 Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(null, targetChr, targetNpc, a.ActualDamage);
             }
             action.OnFinished();
         }
     }
     base.OnAttack(action);
 }
 public override void OnAttack(DamageAction action)
 {
     if (action.Spell == null || action.SpellEffect.AuraType == AuraType.ExplosiveArrow)
     {
         return;
     }
     foreach (WorldObject objectsInRadiu in (IEnumerable <WorldObject>)action.Victim.GetObjectsInRadius <Unit>(6f,
                                                                                                               ObjectTypes.Unit, false, int.MaxValue))
     {
         if (objectsInRadiu.IsHostileWith((IFactionMember)action.Attacker))
         {
             Unit unit = objectsInRadiu as Unit;
             if (unit != null)
             {
                 DamageAction damageAction = unit.DealSpellDamage(action.Attacker, this.SpellEffect,
                                                                  (int)((double)action.Attacker.RandomDamage * (double)this.SpellEffect.MiscValue / 100.0),
                                                                  true, true, false, false);
                 if (damageAction != null)
                 {
                     Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(
                         this.m_aura.CasterUnit as Character, this.Owner as Character, unit as NPC,
                         damageAction.ActualDamage);
                     action.OnFinished();
                 }
             }
         }
     }
 }
예제 #7
0
        protected override void Remove(bool cancelled)
        {
            Unit casterUnit = m_aura.CasterUnit;

            if (casterUnit == null)
            {
                return;
            }
            foreach (WorldObject objectsInRadiu in Owner.GetObjectsInRadius(6f,
                                                                            ObjectTypes.Unit, false, int.MaxValue))
            {
                if (casterUnit.IsHostileWith(objectsInRadiu))
                {
                    Unit unit = objectsInRadiu as Unit;
                    if (unit != null)
                    {
                        DamageAction damageAction = unit.DealSpellDamage(casterUnit, SpellEffect,
                                                                         (int)(casterUnit.RandomDamage * (double)SpellEffect.MiscValue / 100.0),
                                                                         true, true, false, false);
                        if (damageAction != null)
                        {
                            Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(
                                m_aura.CasterUnit as Character, Owner as Character, unit as NPC,
                                damageAction.ActualDamage);
                            damageAction.OnFinished();
                        }
                    }
                }
            }
        }
예제 #8
0
        protected override void Apply()
        {
            IList <WorldObject> objectsInRadius =
                this.Owner.GetObjectsInRadius <Unit>(3f, ObjectTypes.Unit, false, int.MaxValue);
            bool flag = false;

            foreach (WorldObject worldObject in (IEnumerable <WorldObject>)objectsInRadius)
            {
                Unit unit = worldObject as Unit;
                if (unit != null && unit.IsHostileWith((IFactionMember)this.Owner))
                {
                    flag = true;
                    break;
                }
            }

            if (!flag)
            {
                return;
            }
            foreach (WorldObject objectsInRadiu in (IEnumerable <WorldObject>) this.Owner.GetObjectsInRadius <Unit>(12f,
                                                                                                                    ObjectTypes.Unit, false, int.MaxValue))
            {
                Unit pos = objectsInRadiu as Unit;
                if (pos != null && pos.IsHostileWith((IFactionMember)this.Owner))
                {
                    if (this.SpellEffect.MiscValueB == 1)
                    {
                        Spell spell = SpellHandler.Get(775U);
                        pos.Auras.CreateAndStartAura(this.Owner.SharedReference, spell, false, (Item)null);
                    }
                    else if (this.SpellEffect.MiscValueB == 0)
                    {
                        float dist = pos.GetDist((IHasPosition)this.Owner);
                        float num  = 1f;
                        if ((double)dist >= 3.0)
                        {
                            num /= (float)Math.Pow((double)dist, 0.600000023841858);
                        }
                        DamageAction damageAction = pos.DealSpellDamage(this.Owner, this.SpellEffect,
                                                                        (int)((double)this.Owner.RandomDamage * (double)this.SpellEffect.MiscValue / 100.0 *
                                                                              (double)num), true, true, false, false);
                        if (damageAction != null)
                        {
                            if (this.m_aura != null)
                            {
                                Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(
                                    this.m_aura.CasterUnit as Character, objectsInRadiu as Character,
                                    objectsInRadiu as NPC, damageAction.ActualDamage);
                            }
                            damageAction.OnFinished();
                        }
                    }
                }
            }

            this.Aura.Cancel();
        }
        protected override void Apply()
        {
            int dmg   = Owner.Health * SpellEffect.MiscValue / 100;
            NPC owner = Owner as NPC;

            if (owner != null && owner.Entry.IsBoss)
            {
                return;
            }
            DamageAction damageAction =
                Owner.DealSpellDamage(Owner, SpellEffect, dmg, true, true, false, false);

            if (damageAction == null || m_aura == null)
            {
                return;
            }
            Asda2SpellHandler.SendMonstrTakesDamageSecondaryResponse(m_aura.CasterUnit as Character,
                                                                     Owner as Character, Owner as NPC, damageAction.ActualDamage);
            damageAction.OnFinished();
            Aura.Cancel();
        }