void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) { PreventDefaultAction(); DamageInfo damageInfo = eventInfo.GetDamageInfo(); if (damageInfo == null || damageInfo.GetDamage() == 0) { return; } int amount = aurEff.GetAmount() - (int)damageInfo.GetDamage(); if (amount > 0) { aurEff.SetAmount(amount); return; } Remove(); Unit caster = GetCaster(); if (!caster) { return; } caster.CastSpell(eventInfo.GetActionTarget(), SpellIds.SeedOfCorruptionGeneric, true, null, aurEff); }
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo) { PreventDefaultAction(); DamageInfo damageInfo = eventInfo.GetDamageInfo(); if (damageInfo == null || damageInfo.GetDamage() == 0) { return; } int amount = (int)(aurEff.GetAmount() - damageInfo.GetDamage()); if (amount > 0) { aurEff.SetAmount(amount); if (!GetTarget().HealthBelowPctDamaged(1, damageInfo.GetDamage())) { return; } } Remove(); Unit caster = GetCaster(); if (!caster) { return; } caster.CastSpell(eventInfo.GetActionTarget(), SpellIds.SeedOfCorruptionDamage, true); }
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); }
void HandleAfterHit() { Aura aura = GetHitAura(); if (aura != null) { AuraEffect aurEff = aura.GetEffect(1); if (aurEff != null) { aurEff.SetAmount(MathFunctions.CalculatePct(aurEff.GetAmount(), GetHitDamage())); } } }
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); } }