From 53e1cd553be3d294629bd96d3b5a27806efc9ad4 Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Sun, 20 Jul 2025 08:10:47 +0200 Subject: [PATCH] fix(Scripts/Spells): Update Death Knight Ebon Gargoyle auras and damage, and Ghoul auras (#22398) Co-authored-by: Tereneckla --- .../rev_1751268347648494124.sql | 12 +++++ src/server/game/Entities/Pet/Pet.cpp | 18 ++++--- src/server/game/Entities/Pet/PetDefines.h | 3 ++ src/server/scripts/Pet/pet_dk.cpp | 6 +-- src/server/scripts/Spells/spell_dk.cpp | 23 +++++---- src/server/scripts/Spells/spell_generic.cpp | 50 +++++++++++++++++++ 6 files changed, 93 insertions(+), 19 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1751268347648494124.sql diff --git a/data/sql/updates/pending_db_world/rev_1751268347648494124.sql b/data/sql/updates/pending_db_world/rev_1751268347648494124.sql new file mode 100644 index 000000000..fb6ecec36 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1751268347648494124.sql @@ -0,0 +1,12 @@ +-- +UPDATE `spell_dbc` SET `Attributes`=`Attributes`|64, `AttributesEx4`=34603008, `ProcChance`=101, `DurationIndex`=21, +`Effect_1`=6, `Effect_2`=6, `Effect_3`=6, `EffectBasePoints_1`=-1, `EffectBasePoints_2`=-1, `EffectBasePoints_3`=-1, +`ImplicitTargetA_1`=1, `ImplicitTargetA_2`=1, `ImplicitTargetA_3`=1, +`EffectAura_1`=29, `EffectAura_2`=29, `EffectAura_3`=189, +`EffectMultipleValue_1`=1.0, `EffectMultipleValue_2`=1.0, `EffectMultipleValue_3`=1.0, +`EffectMiscValue_1`=3, `EffectMiscValue_2`=4, `EffectMiscValue_3`=114688 +WHERE `ID`=67557; +DELETE FROM `spell_script_names` WHERE `spell_id` = 67557; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(67557, 'spell_pet_intellect_spirit_resilience_scaling'); +UPDATE `creature_template_addon` SET `auras` = '' WHERE (`entry` = 27829); diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 88521f9ad..300450e7e 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1345,11 +1345,14 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetCreateMana(28 + 10 * petlevel); SetCreateHealth(28 + 30 * petlevel); } - - AddAura(SPELL_HUNTER_PET_SCALING_04, this); + AddAura(SPELL_SUMMON_HEAL, this); AddAura(SPELL_DK_PET_SCALING_01, this); AddAura(SPELL_DK_PET_SCALING_02, this); AddAura(SPELL_DK_PET_SCALING_03, this); + AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this); + AddAura(SPELL_ORC_RACIAL_COMMAND_DK, this); + AddAura(SPELL_PET_SCALING_MASTER_03, this); + AddAura(SPELL_PET_SCALING_MASTER_06, this); break; } case NPC_BLOODWORM: @@ -1401,9 +1404,9 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) // 100% energy after summon SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); - // xinef: fixes orc death knight command racial - if (owner->getRace() == RACE_ORC) - CastSpell(this, SPELL_ORC_RACIAL_COMMAND_DK, true, nullptr, nullptr, owner->GetGUID()); + AddAura(SPELL_ORC_RACIAL_COMMAND_DK, this); + + AddAura(SPELL_RISEN_GHOUL_SELF_STUN, this); // Avoidance, Night of the Dead if (Aura* aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) @@ -1411,13 +1414,16 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) if (aur->GetEffect(0)) aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); - AddAura(SPELL_HUNTER_PET_SCALING_04, this); // Added to perm ghoul by default if (!IsPet()) { AddAura(SPELL_DK_PET_SCALING_01, this); AddAura(SPELL_DK_PET_SCALING_02, this); + AddAura(SPELL_DK_PET_SCALING_03, this); } + + AddAura(SPELL_PET_SCALING_MASTER_03, this); + AddAura(SPELL_PET_SCALING_MASTER_06, this); } sScriptMgr->OnInitStatsForLevel(this, petlevel); diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h index b0bbe57ac..6bb873258 100644 --- a/src/server/game/Entities/Pet/PetDefines.h +++ b/src/server/game/Entities/Pet/PetDefines.h @@ -134,6 +134,7 @@ enum NPCEntries enum PetScalingSpells { SPELL_PET_AVOIDANCE = 32233, + SPELL_PET_SCALING_MASTER_03 = 67557, // Serverside - Pet Scaling - Master Spell 03 - Intellect, Spirit, Resilience SPELL_PET_SCALING_MASTER_06 = 67561, // Serverside - Pet Scaling - Master Spell 06 - Spell Hit, Expertise, Spell Penetration // Hunter @@ -197,6 +198,8 @@ enum PetScalingSpells SPELL_DK_PET_SCALING_03 = 61697, SPELL_DK_AVOIDANCE = 65220, SPELL_DK_ARMY_OF_THE_DEAD_PASSIVE = 49040, + SPELL_SUMMON_HEAL = 36492, // Serverside - Summon Heal + SPELL_RISEN_GHOUL_SELF_STUN = 47466, }; #define PET_FOLLOW_DIST 1.0f diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index c5dd44fe2..39a648724 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -280,17 +280,17 @@ class spell_pet_dk_gargoyle_strike : public SpellScript void HandleDamageCalc(SpellEffIndex /*effIndex*/) { - int32 damage = 60; + int32 damage = GetEffectValue(); if (Unit* caster = GetCaster()) if (caster->GetLevel() >= 60) - damage += (caster->GetLevel() - 60) * 4; + damage += (caster->GetLevel() - 60) * 3; SetEffectValue(damage); } void Register() override { - OnEffectHitTarget += SpellEffectFn(spell_pet_dk_gargoyle_strike::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + OnEffectLaunchTarget += SpellEffectFn(spell_pet_dk_gargoyle_strike::HandleDamageCalc, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); } }; diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index c8cf3fb0d..8841b63dd 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -776,19 +776,19 @@ class spell_dk_pet_scaling : public AuraScript void CalculateSPAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { - // xinef: dk gargoyle inherits 33% of SP if (GetUnitOwner()->GetEntry() != NPC_EBON_GARGOYLE) return; if (Unit* owner = GetUnitOwner()->GetOwner()) { - int32 modifier = 33; + // Percentage of the owner's attack power to be inherited as spell power + // This value was chosen based on experimental damage of Gargoyle Strike + int32 modifier = 75; - // xinef: impurity - if (owner->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, 0)) - modifier = 40; + if (AuraEffect* impurityEff = owner->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 1986, EFFECT_0)) + AddPct(modifier, impurityEff->GetAmount()); - amount = CalculatePct(std::max(0, owner->GetTotalAttackPowerValue(BASE_ATTACK)), modifier); + amount = CalculatePct(std::max(0, static_cast(owner->GetTotalAttackPowerValue(BASE_ATTACK))), modifier); // xinef: Update appropriate player field if (owner->IsPlayer()) @@ -800,8 +800,11 @@ class spell_dk_pet_scaling : public AuraScript { // xinef: scale haste with owners melee haste if (Unit* owner = GetUnitOwner()->GetOwner()) - if (owner->m_modAttackSpeedPct[BASE_ATTACK] < 1.0f) // inherit haste only - amount = std::min(100, int32(((1.0f / owner->m_modAttackSpeedPct[BASE_ATTACK]) - 1.0f) * 100.0f)); + { + float modSpeed = owner->m_modAttackSpeedPct[BASE_ATTACK]; + modSpeed = std::ranges::clamp(modSpeed, 1e-6f, 1.0f); + amount = static_cast(((1.0f / modSpeed) - 1.0f) * 100.0f); + } } void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) @@ -860,13 +863,13 @@ class spell_dk_pet_scaling : public AuraScript void Register() override { - if (m_scriptSpellId == 54566) + if (m_scriptSpellId == SPELL_DK_PET_SCALING_01) { DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling::CalculateStatAmount, EFFECT_ALL, SPELL_AURA_MOD_STAT); DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling::CalculateSPAmount, EFFECT_ALL, SPELL_AURA_MOD_DAMAGE_DONE); } - if (m_scriptSpellId == 51996) + if (m_scriptSpellId == SPELL_DK_PET_SCALING_02) DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_pet_scaling::CalculateHasteAmount, EFFECT_ALL, SPELL_AURA_MELEE_SLOW); OnEffectApply += AuraEffectApplyFn(spell_dk_pet_scaling::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3c879a3e0..208b555ff 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5320,6 +5320,55 @@ class spell_gen_set_health : public SpellScript } }; +// 67557 - Serverside - Pet Scaling - Master Spell 03 - Intellect, Spirit, Resilience +class spell_pet_intellect_spirit_resilience_scaling : public AuraScript +{ + PrepareAuraScript(spell_pet_intellect_spirit_resilience_scaling) + + void CalculateIntellectAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) + amount = static_cast(CalculatePct(std::max(0, modOwner->GetStat(STAT_INTELLECT)), 30)); + } + + void CalculateSpiritAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) + { + if (Player* modOwner = GetUnitOwner()->GetSpellModOwner()) + amount = static_cast(CalculatePct(std::max(0, modOwner->GetStat(STAT_SPIRIT)), 30)); + } + + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + GetUnitOwner()->ApplySpellImmune(GetId(), IMMUNITY_STATE, aurEff->GetAuraType(), true, SPELL_BLOCK_TYPE_POSITIVE); + } + + void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude) + { + if (!GetUnitOwner()->IsPet()) + return; + + isPeriodic = true; + amplitude = 3 * IN_MILLISECONDS; + } + + void HandlePeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + GetEffect(aurEff->GetEffIndex())->RecalculateAmount(); + } + + void Register() override + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_intellect_spirit_resilience_scaling::CalculateIntellectAmount, EFFECT_0, SPELL_AURA_MOD_STAT); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_intellect_spirit_resilience_scaling::CalculateSpiritAmount, EFFECT_1,SPELL_AURA_MOD_STAT); + // The resilience scaling is not used. The owner's resilience is used directly + // DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pet_intellect_spirit_resilience_scaling::CalculateResilienceAmount, EFFECT_2, SPELL_AURA_MOD_RATING); + OnEffectApply += AuraEffectApplyFn(spell_pet_intellect_spirit_resilience_scaling::HandleEffectApply, EFFECT_ALL, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_pet_intellect_spirit_resilience_scaling::CalcPeriodic, EFFECT_ALL, SPELL_AURA_ANY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_pet_intellect_spirit_resilience_scaling::HandlePeriodic, EFFECT_ALL, SPELL_AURA_ANY); + } +}; + // 67561 - Serverside - Pet Scaling - Master Spell 06 - Spell Hit, Expertise, Spell Penetration class spell_pet_spellhit_expertise_spellpen_scaling : public AuraScript { @@ -5605,6 +5654,7 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_sober_up); RegisterSpellScript(spell_gen_steal_weapon); RegisterSpellScript(spell_gen_set_health); + RegisterSpellScript(spell_pet_intellect_spirit_resilience_scaling); RegisterSpellScript(spell_pet_spellhit_expertise_spellpen_scaling); RegisterSpellScript(spell_gen_proc_on_victim); RegisterSpellScriptWithArgs(spell_gen_translocate, "spell_gen_translocate_down", SPELL_TRANSLOCATION_DOWN);