From fdc4b75538f5f904ac81ebab38919feafdce1379 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Thu, 1 Nov 2018 04:30:54 +0100 Subject: [PATCH] Core/Pets: updated Water Elemental scalings based on some research to fit into the new pattern * update pet spell power now in UpdateAttackPowerAndDamage instead of using spell aura effects --- .../custom/custom_2018_11_01_02_world.sql | 3 ++ src/server/game/Entities/Unit/StatSystem.cpp | 23 +++++---------- .../game/Spells/Auras/SpellAuraEffects.cpp | 5 ---- src/server/scripts/Spells/spell_pet.cpp | 28 +++++++++++++++---- 4 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 sql/updates/world/custom/custom_2018_11_01_02_world.sql diff --git a/sql/updates/world/custom/custom_2018_11_01_02_world.sql b/sql/updates/world/custom/custom_2018_11_01_02_world.sql new file mode 100644 index 00000000000..a826a562363 --- /dev/null +++ b/sql/updates/world/custom/custom_2018_11_01_02_world.sql @@ -0,0 +1,3 @@ +UPDATE `spelleffect_dbc` SET `EffectApplyAuraName`= 230, `EffectMiscValue`= 0 WHERE `EffectSpellId`= 35657 AND `EffectIndex`= 0; +UPDATE `spelleffect_dbc` SET `EffectApplyAuraName`= 35, `EffectMiscValue`= 0 WHERE `EffectSpellId`= 35658 AND `EffectIndex`= 0; +UPDATE `creature_template` SET `modelid2`= 0 WHERE `entry`= 510; diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index fab4b52aeca..af625f7b3f4 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -1028,16 +1028,12 @@ void Guardian::UpdateMaxHealth() UnitMods unitMod = UNIT_MOD_HEALTH; float stamina = GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA); float multiplicator = 10.0f; - uint32 healthDamage = GetMaxHealth() - GetHealth(); switch (GetEntry()) { case ENTRY_BLOODWORM: multiplicator = 1.0f; break; - case ENTRY_WATER_ELEMENTAL: - multiplicator = 7.5f; - break; default: break; } @@ -1048,7 +1044,6 @@ void Guardian::UpdateMaxHealth() value *= GetModifierValue(unitMod, TOTAL_PCT); SetMaxHealth((uint32)value); - SetHealth(GetMaxHealth() - healthDamage); } void Guardian::UpdateMaxPower(Powers power) @@ -1057,16 +1052,6 @@ void Guardian::UpdateMaxPower(Powers power) float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f; float multiplicator = 15.0f; - uint32 usedPower = GetMaxPower(power) - GetPower(power); - - switch (GetEntry()) - { - case ENTRY_WATER_ELEMENTAL: - multiplicator = 5.0f; - break; - default: - break; - } float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power); value *= GetModifierValue(unitMod, BASE_PCT); @@ -1074,7 +1059,6 @@ void Guardian::UpdateMaxPower(Powers power) value *= GetModifierValue(unitMod, TOTAL_PCT); SetMaxPower(power, uint32(value)); - SetPower(power, GetMaxPower(power) - usedPower); } void Guardian::UpdateAttackPowerAndDamage(bool ranged) @@ -1107,6 +1091,13 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged) // automatically update weapon damage after attack power modification UpdateDamagePhysical(BASE_ATTACK); + + // update pet spell power + int32 spellDamage = 0; + for (auto itr : GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE)) + spellDamage += itr->GetAmount(); + + SetBonusDamage(spellDamage); } void Guardian::UpdateDamagePhysical(WeaponAttackType attType) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index f18ebd41c61..1daaf6e5efb 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4180,11 +4180,6 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, if (Guardian* pet = target->ToPlayer()->GetGuardianPet()) pet->UpdateAttackPowerAndDamage(); } - else if (target->IsPet()) - { - if (Unit* owner = target->GetOwner()) - owner->ApplyModUInt32Value(PLAYER_PET_SPELL_POWER, GetAmount(), apply); - } } void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool apply) const diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp index 2a5a5c16675..e7c3df6f1b9 100644 --- a/src/server/scripts/Spells/spell_pet.cpp +++ b/src/server/scripts/Spells/spell_pet.cpp @@ -1096,17 +1096,25 @@ class spell_mage_water_elemental_scaling_01 : public AuraScript } } - void CalculateStaminaAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + void CalculateHealthAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { canBeRecalculated = true; if (Pet* pet = GetUnitOwner()->ToPet()) + { if (Player* owner = pet->GetOwner()) - amount = CalculatePct(std::max(0.0f, (owner->GetStat(STAT_STAMINA) - owner->GetCreateStat(STAT_STAMINA))), 30); + { + float stamina = CalculatePct(std::max(0.0f, (owner->GetStat(STAT_STAMINA) - owner->GetCreateStat(STAT_STAMINA))), 30); + float staminaBonus = stamina * 7.5f; + float maxHealthBonus = owner->CountPctFromMaxHealth(50); + + amount = int32(staminaBonus + maxHealthBonus); + } + } } void Register() override { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_01::CalculateStaminaAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_01::CalculateHealthAmount, EFFECT_0, SPELL_AURA_MOD_MAX_HEALTH); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_01::CalculateAttackPowerAmount, EFFECT_1, SPELL_AURA_MOD_ATTACK_POWER); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_01::CalculateDamageDoneAmount, EFFECT_2, SPELL_AURA_MOD_DAMAGE_DONE); } @@ -1123,17 +1131,25 @@ class spell_mage_water_elemental_scaling_02 : public AuraScript return true; } - void CalculateIntellectAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + void CalculateManaAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) { canBeRecalculated = true; if (Pet* pet = GetUnitOwner()->ToPet()) + { if (Player* owner = pet->GetOwner()) - amount = int32(CalculatePct(owner->GetStat(STAT_INTELLECT), 30)); + { + float intellect = CalculatePct(owner->GetStat(STAT_INTELLECT), 30); + float intellectBonus = intellect * 5.0f; + float maxManaBonus = owner->CountPctFromMaxPower(POWER_MANA, 50); + + amount = int32(intellectBonus + maxManaBonus); + } + } } void Register() override { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_02::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_water_elemental_scaling_02::CalculateManaAmount, EFFECT_0, SPELL_AURA_MOD_INCREASE_ENERGY); } };