aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp1568
1 files changed, 1566 insertions, 2 deletions
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 27cb0d3bb71..5c1eb2f1ccd 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -36,6 +36,7 @@ enum HunterPetCalculate
SPELL_HUNTER_PET_SCALING_02 = 34903,
SPELL_HUNTER_PET_SCALING_03 = 34904,
SPELL_HUNTER_PET_SCALING_04 = 61017,
+ SPELL_HUNTER_ANIMAL_HANDLER = 34453,
};
enum WarlockPetCalculate
@@ -47,10 +48,15 @@ enum WarlockPetCalculate
SPELL_WARLOCK_PET_SCALING_03 = 34957,
SPELL_WARLOCK_PET_SCALING_04 = 34958,
SPELL_WARLOCK_PET_SCALING_05 = 61013,
+ ENTRY_FELGUARD = 17252,
+ ENTRY_VOIDWALKER = 1860,
+ ENTRY_FELHUNTER = 417,
+ ENTRY_SUCCUBUS = 1863,
};
enum DKPetCalculate
{
+ SPELL_DEATH_KNIGHT_RUNE_WEAPON_02 = 51906,
SPELL_DEATH_KNIGHT_PET_SCALING_01 = 54566,
SPELL_DEATH_KNIGHT_PET_SCALING_02 = 51996,
SPELL_DEATH_KNIGHT_PET_SCALING_03 = 61697,
@@ -69,7 +75,7 @@ enum MiscPetCalculate
SPELL_MAGE_PET_PASSIVE_ELEMENTAL = 44559,
SPELL_PET_HEALTH_SCALING = 61679,
SPELL_PET_UNK_01 = 67561,
- SPELL_PET_UNK_01 = 67557,
+ SPELL_PET_UNK_02 = 67557,
};
class spell_gen_pet_calculate : public SpellScriptLoader
@@ -190,7 +196,7 @@ class spell_gen_pet_calculate : public SpellScriptLoader
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
break;
case SPELL_DEATH_KNIGHT_PET_SCALING_03:
- case SPELL_SHAMAN_PET_HIT:
+// case SPELL_SHAMAN_PET_HIT:
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_gen_pet_calculate_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
break;
@@ -206,6 +212,1564 @@ class spell_gen_pet_calculate : public SpellScriptLoader
}
};
+class spell_warl_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_01() : SpellScriptLoader("spell_warl_pet_scaling_01") { }
+
+ class spell_warl_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_01_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempHealth = 0;
+ return true;
+ }
+
+ void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetStat(STAT_STAMINA), 75);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempHealth)
+ pet->SetHealth(_tempHealth);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempHealth = pet->GetHealth();
+ }
+
+ void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 maximum = (fire > shadow) ? fire : shadow;
+ if (maximum < 0)
+ maximum = 0;
+ float bonusAP = maximum * 0.57f;
+
+ amount += bonusAP;
+
+ // Glyph of felguard
+ if (pet->GetEntry() == ENTRY_FELGUARD)
+ {
+ if (AuraEffect* aurEffect = owner->GetAuraEffect(56246, EFFECT_0))
+ {
+ float base_attPower = pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE) * pet->GetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_PCT);
+ amount += CalculatePctN(amount+base_attPower, aurEffect->GetAmount());
+ }
+ }
+ }
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ //the damage bonus used for pets is either fire or shadow damage, whatever is higher
+ int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
+ int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
+ int32 maximum = (fire > shadow) ? fire : shadow;
+ if (maximum < 0)
+ maximum = 0;
+ float bonusDamage = maximum * 0.15f;
+
+ amount += bonusDamage;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
+ }
+
+ private:
+ uint32 _tempHealth;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_02() : SpellScriptLoader("spell_warl_pet_scaling_02") { }
+
+ class spell_warl_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempMana = 0;
+ return true;
+ }
+
+ void CalculateIntellectAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempMana)
+ pet->SetPower(POWER_MANA, _tempMana);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempMana = pet->GetPower(POWER_MANA);
+ }
+
+ void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_warl_pet_scaling_02_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_warl_pet_scaling_02_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateArmorAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+
+ private:
+ uint32 _tempMana;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_03() : SpellScriptLoader("spell_warl_pet_scaling_03") { }
+
+ class spell_warl_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateFrostResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_03_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_03_AuraScript();
+ }
+};
+
+
+class spell_warl_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_04() : SpellScriptLoader("spell_warl_pet_scaling_04") { }
+
+ class spell_warl_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_04_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_warl_pet_scaling_05 : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_scaling_05() : SpellScriptLoader("spell_warl_pet_scaling_05") { }
+
+ class spell_warl_pet_scaling_05_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_scaling_05_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float Expertise = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ Expertise += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(Expertise);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_scaling_05_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_scaling_05_AuraScript();
+ }
+};
+
+class spell_warl_pet_passive : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive() : SpellScriptLoader("spell_warl_pet_passive") { }
+
+ class spell_warl_pet_passive_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritSpell = 0.0f;
+ // Crit from Intellect
+ CritSpell += owner->GetSpellCritFromIntellect();
+ // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit spell from spell crit ratings
+ CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
+
+ if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
+ if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
+ if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
+ amount += CalculatePctN(CritSpell, improvedDemonicTacticsEffect->GetAmount());
+ }
+ }
+
+ void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritMelee = 0.0f;
+ // Crit from Agility
+ CritMelee += owner->GetMeleeCritFromAgility();
+ // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit melee from melee crit ratings
+ CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
+
+ if (AuraApplication* improvedDemonicTacticsApp = owner->GetAuraApplicationOfRankedSpell(54347))
+ if (Aura* improvedDemonicTactics = improvedDemonicTacticsApp->GetBase())
+ if (AuraEffect* improvedDemonicTacticsEffect = improvedDemonicTactics->GetEffect(EFFECT_0))
+ amount += CalculatePctN(CritMelee, improvedDemonicTacticsEffect->GetAmount());
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritSpell, EFFECT_0, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_AuraScript::CalculateAmountCritMelee, EFFECT_1, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_AuraScript();
+ }
+};
+
+class spell_warl_pet_passive_damage_done : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive_damage_done() : SpellScriptLoader("spell_warl_pet_passive_damage_done") { }
+
+ class spell_warl_pet_passive_damage_done_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_damage_done_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ switch (GetCaster()->GetEntry())
+ {
+ case ENTRY_VOIDWALKER:
+ amount += -16;
+ break;
+ case ENTRY_FELHUNTER:
+ amount += -20;
+ break;
+ case ENTRY_SUCCUBUS:
+ case ENTRY_FELGUARD:
+ amount += 5;
+ break;
+ }
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_damage_done_AuraScript();
+ }
+};
+
+class spell_warl_pet_passive_voidwalker : public SpellScriptLoader
+{
+public:
+ spell_warl_pet_passive_voidwalker() : SpellScriptLoader("spell_warl_pet_passive_voidwalker") { }
+
+ class spell_warl_pet_passive_voidwalker_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_warl_pet_passive_voidwalker_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ if (AuraEffect* aurEffect = owner->GetAuraEffect(56247, EFFECT_0))
+ amount += aurEffect->GetAmount();
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_warl_pet_passive_voidwalker_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_warl_pet_passive_voidwalker_AuraScript();
+ }
+};
+
+
+class spell_sha_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_sha_pet_scaling_04() : SpellScriptLoader("spell_sha_pet_scaling_04") { }
+
+ class spell_sha_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_sha_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_sha_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_01() : SpellScriptLoader("spell_hun_pet_scaling_01") { }
+
+ class spell_hun_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_01_AuraScript);
+
+ void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 0.45f;
+ float ownerBonus = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
+ }
+
+ ownerBonus = owner->GetStat(STAT_STAMINA)*mod;
+
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempHealth)
+ pet->SetHealth(_tempHealth);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempHealth = pet->GetHealth();
+ }
+
+ void CalculateAttackPowerAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 1.0f; //Hunter contribution modifier
+ float bonusAP = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ }
+
+ bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
+
+ amount += bonusAP;
+ }
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 1.0f; //Hunter contribution modifier
+ float bonusDamage = 0.0f;
+
+ PetSpellMap::const_iterator itr = (pet->ToPet()->m_spells.find(62758)); // Wild Hunt rank 1
+ if (itr == pet->ToPet()->m_spells.end())
+ itr = pet->ToPet()->m_spells.find(62762); // Wild Hunt rank 2
+
+ if (itr != pet->ToPet()->m_spells.end()) // If pet has Wild Hunt
+ {
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
+ mod += CalculatePctN(1.0f, spellInfo->Effects[EFFECT_1].CalcValue());
+ }
+
+ bonusDamage = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod;
+
+ amount += bonusDamage;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_hun_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_hun_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_01_AuraScript::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE);
+ }
+
+ private:
+ uint32 _tempHealth;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_02() : SpellScriptLoader("spell_hun_pet_scaling_02") { }
+
+ class spell_hun_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFrostResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateFireResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_02_AuraScript::CalculateNatureResistanceAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_03() : SpellScriptLoader("spell_hun_pet_scaling_03") { }
+
+ class spell_hun_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isPet())
+ return;
+
+ Unit* owner = pet->ToPet()->GetOwner();
+ if (!owner)
+ return;
+
+ float ownerBonus = 0.0f;
+
+ ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateShadowResistanceAmount, EFFECT_0, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArcaneResistanceAmount, EFFECT_1, SPELL_AURA_MOD_RESISTANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_03_AuraScript::CalculateArmorAmount, EFFECT_2, SPELL_AURA_MOD_RESISTANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_03_AuraScript();
+ }
+};
+
+class spell_hun_pet_scaling_04 : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_scaling_04() : SpellScriptLoader("spell_hun_pet_scaling_04") { }
+
+ class spell_hun_pet_scaling_04_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_scaling_04_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float Expertise = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_EXPERTISE
+ Expertise += owner->GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE);
+ // Increase Expertise from Expertise ratings
+ Expertise += owner->GetRatingBonusValue(CR_EXPERTISE);
+
+ amount += int32(Expertise);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_scaling_04_AuraScript::CalculateAmountExpertise, EFFECT_2, SPELL_AURA_MOD_EXPERTISE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_scaling_04_AuraScript();
+ }
+};
+
+class spell_hun_pet_passive_crit : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_passive_crit() : SpellScriptLoader("spell_hun_pet_passive_crit") { }
+
+ class spell_hun_pet_passive_crit_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_passive_crit_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritSpell = 0.0f;
+ // Crit from Intellect
+ // CritSpell += owner->GetSpellCritFromIntellect();
+ // Increase crit from SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ // CritSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit spell from spell crit ratings
+ // CritSpell += owner->GetRatingBonusValue(CR_CRIT_SPELL);
+
+ amount += (CritSpell*0.8f);
+ }
+ }
+
+ void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float CritMelee = 0.0f;
+ // Crit from Agility
+ // CritMelee += owner->GetMeleeCritFromAgility();
+ // Increase crit from SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
+ // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ // Increase crit from SPELL_AURA_MOD_CRIT_PCT
+ // CritMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_CRIT_PCT);
+ // Increase crit melee from melee crit ratings
+ // CritMelee += owner->GetRatingBonusValue(CR_CRIT_MELEE);
+
+ amount += (CritMelee*0.8f);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritSpell, EFFECT_1, SPELL_AURA_MOD_SPELL_CRIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_crit_AuraScript::CalculateAmountCritMelee, EFFECT_0, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_passive_crit_AuraScript();
+ }
+};
+
+class spell_hun_pet_passive_damage_done : public SpellScriptLoader
+{
+public:
+ spell_hun_pet_passive_damage_done() : SpellScriptLoader("spell_hun_pet_passive_damage_done") { }
+
+ class spell_hun_pet_passive_damage_done_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_pet_passive_damage_done_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // Pet's base damage changes depending on happiness
+ if (GetCaster()->isPet() && GetCaster()->ToPet()->isHunterPet())
+ {
+ switch (GetCaster()->ToPet()->GetHappinessState())
+ {
+ case HAPPY:
+ // 125% of normal damage
+ amount += 25.0f;
+ break;
+ case CONTENT:
+ // 100% of normal damage, nothing to modify
+ break;
+ case UNHAPPY:
+ // 75% of normal damage
+ amount += -25.0f;
+ break;
+ }
+ }
+ // Cobra Reflexes
+ if (AuraEffect* cobraReflexes = GetCaster()->GetAuraEffectOfRankedSpell(61682, EFFECT_0))
+ amount -= cobraReflexes->GetAmount();
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_pet_passive_damage_done_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_pet_passive_damage_done_AuraScript();
+ }
+};
+
+class spell_hun_animal_handler : public SpellScriptLoader
+{
+public:
+ spell_hun_animal_handler() : SpellScriptLoader("spell_hun_animal_handler") { }
+
+ class spell_hun_animal_handler_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_hun_animal_handler_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountDamageDone(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ if (AuraEffect* aurEffect = owner->GetAuraEffectOfRankedSpell(SPELL_HUNTER_ANIMAL_HANDLER, EFFECT_1))
+ amount = aurEffect->GetAmount();
+ else
+ amount = 0;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_hun_animal_handler_AuraScript::CalculateAmountDamageDone, EFFECT_0, SPELL_AURA_MOD_ATTACK_POWER_PCT);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_hun_animal_handler_AuraScript();
+ }
+};
+
+
+class spell_dk_avoidance_passive : public SpellScriptLoader
+{
+public:
+ spell_dk_avoidance_passive() : SpellScriptLoader("spell_dk_avoidance_passive") { }
+
+ class spell_dk_avoidance_passive_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_avoidance_passive_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAvoidanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ // Army of the dead ghoul
+ if (pet->GetEntry() == 24207)
+ amount = -90;
+ // Night of the dead
+ else if (owner->HasAura(55623))
+ amount = -90;
+ else if (owner->HasAura(55620))
+ amount = -45;
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_avoidance_passive_AuraScript::CalculateAvoidanceAmount, EFFECT_0, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_avoidance_passive_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_01 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_01() : SpellScriptLoader("spell_dk_pet_scaling_01") { }
+
+ class spell_dk_pet_scaling_01_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_01_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ _tempHealth = 0;
+ return true;
+ }
+
+ void CalculateStaminaAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isGuardian())
+ return;
+
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 0.3f;
+
+ // Ravenous Dead
+ AuraEffect const* aurEff = NULL;
+ // Check just if owner has Ravenous Dead since it's effect is not an aura
+ aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
+ if (aurEff)
+ {
+ mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ }
+ // Glyph of the Ghoul
+ aurEff = owner->GetAuraEffect(58686, 0);
+ if (aurEff)
+ mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ float ownerBonus = float(owner->GetStat(STAT_STAMINA)) * mod;
+ amount += ownerBonus;
+ }
+ }
+
+ void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ if (_tempHealth)
+ pet->SetHealth(_tempHealth);
+ }
+
+ void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ _tempHealth = pet->GetHealth();
+ }
+
+ void CalculateStrengthAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ if (!pet->isGuardian())
+ return;
+
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ float mod = 0.7f;
+
+ // Ravenous Dead
+ AuraEffect const* aurEff = NULL;
+ // Check just if owner has Ravenous Dead since it's effect is not an aura
+ aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
+ if (aurEff)
+ {
+ mod += CalculatePctN(mod, aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
+ }
+ // Glyph of the Ghoul
+ aurEff = owner->GetAuraEffect(58686, 0);
+ if (aurEff)
+ mod += CalculatePctN(1.0f, aurEff->GetAmount()); // Glyph of the Ghoul adds a flat value to the scale mod
+ float ownerBonus = float(owner->GetStat(STAT_STRENGTH)) * mod;
+ amount += ownerBonus;
+ }
+ }
+
+ void Register()
+ {
+ OnEffectRemove += AuraEffectRemoveFn(spell_dk_pet_scaling_01_AuraScript::RemoveEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ AfterEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling_01_AuraScript::ApplyEffect, EFFECT_0, SPELL_AURA_MOD_STAT, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_01_AuraScript::CalculateStrengthAmount, EFFECT_1, SPELL_AURA_MOD_STAT);
+ }
+
+ private:
+ uint32 _tempHealth;
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_01_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_02() : SpellScriptLoader("spell_dk_pet_scaling_02") { }
+
+ class spell_dk_pet_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HasteMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
+
+ amount += int32(HasteMelee);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_02_AuraScript();
+ }
+};
+
+class spell_dk_pet_scaling_03 : public SpellScriptLoader
+{
+public:
+ spell_dk_pet_scaling_03() : SpellScriptLoader("spell_dk_pet_scaling_03") { }
+
+ class spell_dk_pet_scaling_03_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_pet_scaling_03_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HitMelee += owner->GetTotalAuraModifier(SPELL_AURA_MOD_HIT_CHANCE);
+ // Increase hit melee from meele hit ratings
+ HitMelee += owner->GetRatingBonusValue(CR_HIT_MELEE);
+
+ amount += int32(HitMelee);
+ }
+ }
+
+ void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HitSpell = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ HitSpell += owner->GetTotalAuraModifier(SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ // Increase hit spell from spell hit ratings
+ HitSpell += owner->GetRatingBonusValue(CR_HIT_SPELL);
+
+ amount += int32(HitSpell);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountMeleeHit, EFFECT_0, SPELL_AURA_MOD_HIT_CHANCE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling_03_AuraScript::CalculateAmountSpellHit, EFFECT_1, SPELL_AURA_MOD_SPELL_HIT_CHANCE);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_pet_scaling_03_AuraScript();
+ }
+};
+
+class spell_dk_rune_weapon_scaling_02 : public SpellScriptLoader
+{
+public:
+ spell_dk_rune_weapon_scaling_02() : SpellScriptLoader("spell_dk_rune_weapon_scaling_02") { }
+
+ class spell_dk_rune_weapon_scaling_02_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_dk_rune_weapon_scaling_02_AuraScript);
+
+ bool Load()
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
+ return false;
+ return true;
+ }
+
+ void CalculateDamageDoneAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (Unit* pet = GetUnitOwner())
+ {
+ Unit* owner = pet->GetOwner();
+ if (!owner)
+ return;
+
+ if (pet->isGuardian())
+ ((Guardian*)pet)->SetBonusDamage(owner->GetTotalAttackPowerValue(BASE_ATTACK));
+
+ amount += owner->CalculateDamage(BASE_ATTACK, true, true);;
+ }
+ }
+
+ void CalculateAmountMeleeHaste(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
+ {
+ if (!GetCaster() || !GetCaster()->GetOwner())
+ return;
+ if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
+ {
+ // For others recalculate it from:
+ float HasteMelee = 0.0f;
+ // Increase hit from SPELL_AURA_MOD_HIT_CHANCE
+ HasteMelee += (1-owner->m_modAttackSpeedPct[BASE_ATTACK])*100;
+
+ amount += int32(HasteMelee);
+ }
+ }
+
+ void Register()
+ {
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateDamageDoneAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_DONE);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_rune_weapon_scaling_02_AuraScript::CalculateAmountMeleeHaste, EFFECT_1, SPELL_AURA_MELEE_SLOW);
+ }
+ };
+
+ AuraScript* GetAuraScript() const
+ {
+ return new spell_dk_rune_weapon_scaling_02_AuraScript();
+ }
+};
+
void AddSC_pet_spell_scripts()
{
new spell_gen_pet_calculate();