Exemplo n.º 1
0
 void HandleEffectCalcSpellMod(AuraEffect aurEff, ref SpellModifier spellMod)
 {
     if (spellMod == null)
     {
         spellMod         = new SpellModifier(GetAura());
         spellMod.op      = SpellModOp.Dot;
         spellMod.type    = SpellModType.Flat;
         spellMod.spellId = GetId();
         spellMod.mask    = GetSpellInfo().GetEffect(aurEff.GetEffIndex()).SpellClassMask;
     }
     spellMod.value = aurEff.GetAmount() / 7;
 }
Exemplo n.º 2
0
        void CalculateAmount(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
        {
            Unit caster = GetCaster();

            if (caster)
            {
                canBeRecalculated = false;

                // $0.25 * (($MWB + $mwb) / 2 + $AP / 14 * $MWS) bonus per tick
                float ap     = caster.GetTotalAttackPowerValue(WeaponAttackType.BaseAttack);
                int   mws    = (int)caster.GetBaseAttackTime(WeaponAttackType.BaseAttack);
                float mwbMin = caster.GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MinDamage);
                float mwbMax = caster.GetWeaponDamageRange(WeaponAttackType.BaseAttack, WeaponDamageRange.MaxDamage);
                float mwb    = ((mwbMin + mwbMax) / 2 + ap * mws / 14000) * 0.25f;
                amount += (int)(caster.ApplyEffectModifiers(GetSpellInfo(), aurEff.GetEffIndex(), mwb));
            }
        }
Exemplo n.º 3
0
        void HandleUpdatePeriodic(AuraEffect aurEff)
        {
            Player playerTarget = GetUnitOwner().ToPlayer();

            if (playerTarget)
            {
                int baseAmount = aurEff.GetBaseAmount();
                int amount     = playerTarget.IsMoving() ?
                                 playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount) :
                                 aurEff.GetAmount() - 1;
                aurEff.SetAmount(amount);
            }
        }
Exemplo n.º 4
0
 void HandlePeriodic(AuraEffect aurEff)
 {
     PreventDefaultAction();
     if (aurEff.GetAmount() <= 0)
     {
         uint spellId = SpellIds.SniperTrainingBuffR1 + GetId() - SpellIds.SniperTrainingR1;
         Unit target  = GetTarget();
         target.CastSpell(target, spellId, true, null, aurEff);
         Player playerTarget = GetUnitOwner().ToPlayer();
         if (playerTarget)
         {
             int baseAmount = aurEff.GetBaseAmount();
             int amount     = playerTarget.CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff.GetEffIndex(), baseAmount);
             GetEffect(0).SetAmount(amount);
         }
     }
 }
Exemplo n.º 5
0
        void HandleTickUpdate(AuraEffect aurEff)
        {
            Unit caster = GetCaster();

            if (!caster)
            {
                return;
            }

            // calculate from base damage, not from aurEff->GetAmount() (already modified)
            float damage = caster.CalculateSpellDamage(GetUnitOwner(), GetSpellInfo(), aurEff.GetEffIndex());

            // Wild Growth = first tick gains a 6% bonus, reduced by 2% each tick
            float      reduction = 2.0f;
            AuraEffect bonus     = caster.GetAuraEffect(SpellIds.RestorationT102PBonus, 0);

            if (bonus != null)
            {
                reduction -= MathFunctions.CalculatePct(reduction, bonus.GetAmount());
            }
            reduction *= (aurEff.GetTickNumber() - 1);

            MathFunctions.AddPct(ref damage, 6.0f - reduction);
            aurEff.SetAmount((int)damage);
        }