From 63bcedbb433840d193c9e076821e2e4d90529349 Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Mon, 20 Apr 2026 04:36:25 -0500 Subject: [PATCH] fix(Scripts/Items): HP-gated proc for low-HP tank trinkets (#25478) Co-authored-by: blinkysc Co-authored-by: ariel- Co-authored-by: Shauren --- .../rev_1776289351038929863.sql | 8 + src/server/scripts/Spells/spell_item.cpp | 164 ++---------------- 2 files changed, 25 insertions(+), 147 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1776289351038929863.sql diff --git a/data/sql/updates/pending_db_world/rev_1776289351038929863.sql b/data/sql/updates/pending_db_world/rev_1776289351038929863.sql new file mode 100644 index 000000000..66c57ed69 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1776289351038929863.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (45057, 52420, 71634, 71640, 75475, 75481) OR `ScriptName` IN ('spell_item_commendation_of_kaelthas', 'spell_item_corpse_tongue_coin', 'spell_item_corpse_tongue_coin_heroic', 'spell_item_petrified_twilight_scale', 'spell_item_petrified_twilight_scale_heroic', 'spell_item_soul_harvesters_charm'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(45057, 'spell_item_proc_below_pct_damaged'), +(52420, 'spell_item_proc_below_pct_damaged'), +(71634, 'spell_item_proc_below_pct_damaged'), +(71640, 'spell_item_proc_below_pct_damaged'), +(75475, 'spell_item_proc_below_pct_damaged'), +(75481, 'spell_item_proc_below_pct_damaged'); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index cda844dbb..93ed12599 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -214,27 +214,11 @@ enum UnstablePower SPELL_UNSTABLE_POWER_AURA = 24659 }; -enum CommendationOfKaelthas -{ - SPELL_COMMENDATION_OF_KAELTHAS = 45480 -}; - -enum CorpseTongueCoin -{ - SPELL_CORPSE_TONGUE_COIN = 71633, - SPELL_CORPSE_TONGUE_COIN_HERO = 71634 -}; - enum CrystalSpireOfKarabor { SPELL_CRYSTAL_SPIRE_OF_KARABOR_MANA = 35476 }; -enum SoulHarvestersCharm -{ - SPELL_SOUL_HARVESTERS_CHARM = 60513 -}; - enum SunwellExaltedNeck { SPELL_LIGHTS_WRATH = 45479, @@ -260,12 +244,6 @@ enum TotemOfFlowingWater SPELL_TOTEM_OF_FLOWING_WATER_MANA = 28857 }; -enum PetrifiedTwilightScale -{ - SPELL_PETRIFIED_TWILIGHT_SCALE_HC = 75480, - SPELL_PETRIFIED_TWILIGHT_SCALE = 75477 -}; - enum ShardOfTheScale { SPELL_PURIFIED_CAUTERIZING_HEAL = 69733, @@ -5706,67 +5684,30 @@ class spell_item_unstable_power : public AuraScript } }; -// 45478 - Commendation of Kael'thas -class spell_item_commendation_of_kaelthas : public AuraScript +// 45057 - Evasive Maneuvers (Commendation of Kael'thas) +// 52420 - Deflection (Soul Harvester's Charm) +// 71634 - Item - Icecrown 25 Normal Tank Trinket 1 (Corpse Tongue Coin) +// 71640 - Item - Icecrown 25 Heroic Tank Trinket 1 (Corpse Tongue Coin (Heroic)) +// 75475 - Item - Chamber of Aspects 25 Tank Trinket (Petrified Twilight Scale) +// 75481 - Item - Chamber of Aspects 25 Heroic Tank Trinket (Petrified Twilight Scale (Heroic)) +// Trinkets that proc only when a melee hit drops you below EFFECT_0 % HP. +class spell_item_proc_below_pct_damaged : public AuraScript { - PrepareAuraScript(spell_item_commendation_of_kaelthas); + PrepareAuraScript(spell_item_proc_below_pct_damaged); bool CheckProc(ProcEventInfo& eventInfo) { - if (HealInfo* healInfo = eventInfo.GetHealInfo()) - if (Unit* target = healInfo->GetTarget()) - if (target->GetHealth() + healInfo->GetEffectiveHeal() >= target->GetMaxHealth()) - return true; - return false; + DamageInfo* damageInfo = eventInfo.GetDamageInfo(); + if (!damageInfo || !damageInfo->GetDamage()) + return false; + + int32 pct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + return eventInfo.GetActionTarget()->HealthBelowPctDamaged(pct, damageInfo->GetDamage()); } void Register() override { - DoCheckProc += AuraCheckProcFn(spell_item_commendation_of_kaelthas::CheckProc); - } -}; - -// 71632 - Corpse Tongue Coin -class spell_item_corpse_tongue_coin : public AuraScript -{ - PrepareAuraScript(spell_item_corpse_tongue_coin); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_CORPSE_TONGUE_COIN }); - } - - void HandleProc(ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_CORPSE_TONGUE_COIN, true, nullptr, GetEffect(EFFECT_0)); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_corpse_tongue_coin::HandleProc); - } -}; - -// 71639 - Corpse Tongue Coin (Heroic) -class spell_item_corpse_tongue_coin_heroic : public AuraScript -{ - PrepareAuraScript(spell_item_corpse_tongue_coin_heroic); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_CORPSE_TONGUE_COIN_HERO }); - } - - void HandleProc(ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_CORPSE_TONGUE_COIN_HERO, true, nullptr, GetEffect(EFFECT_0)); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_corpse_tongue_coin_heroic::HandleProc); + DoCheckProc += AuraCheckProcFn(spell_item_proc_below_pct_damaged::CheckProc); } }; @@ -5788,28 +5729,6 @@ class spell_item_crystal_spire_of_karabor : public AuraScript } }; -// 60512 - Soul Harvester's Charm -class spell_item_soul_harvesters_charm : public AuraScript -{ - PrepareAuraScript(spell_item_soul_harvesters_charm); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_SOUL_HARVESTERS_CHARM }); - } - - void HandleProc(ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActor()->CastSpell((Unit*)nullptr, SPELL_SOUL_HARVESTERS_CHARM, true, nullptr, GetEffect(EFFECT_0)); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_soul_harvesters_charm::HandleProc); - } -}; - // 45481 - Sunwell Exalted Caster Neck class spell_item_sunwell_exalted_caster_neck : public AuraScript { @@ -6025,50 +5944,6 @@ class spell_item_totem_of_flowing_water : public AuraScript } }; -// 75466 - Petrified Twilight Scale -class spell_item_petrified_twilight_scale : public AuraScript -{ - PrepareAuraScript(spell_item_petrified_twilight_scale); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PETRIFIED_TWILIGHT_SCALE }); - } - - void HandleProc(ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_PETRIFIED_TWILIGHT_SCALE, true, nullptr, GetEffect(EFFECT_0)); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_petrified_twilight_scale::HandleProc); - } -}; - -// 75473 - Petrified Twilight Scale (Heroic) -class spell_item_petrified_twilight_scale_heroic : public AuraScript -{ - PrepareAuraScript(spell_item_petrified_twilight_scale_heroic); - - bool Validate(SpellInfo const* /*spellInfo*/) override - { - return ValidateSpellInfo({ SPELL_PETRIFIED_TWILIGHT_SCALE_HC }); - } - - void HandleProc(ProcEventInfo& eventInfo) - { - PreventDefaultAction(); - eventInfo.GetActionTarget()->CastSpell((Unit*)nullptr, SPELL_PETRIFIED_TWILIGHT_SCALE_HC, true, nullptr, GetEffect(EFFECT_0)); - } - - void Register() override - { - OnProc += AuraProcFn(spell_item_petrified_twilight_scale_heroic::HandleProc); - } -}; - // 69739 - Purified Shard of the Scale class spell_item_purified_shard_of_the_scale : public AuraScript { @@ -6355,11 +6230,8 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_pet_healing); RegisterSpellScript(spell_item_restless_strength); RegisterSpellScript(spell_item_unstable_power); - RegisterSpellScript(spell_item_commendation_of_kaelthas); - RegisterSpellScript(spell_item_corpse_tongue_coin); - RegisterSpellScript(spell_item_corpse_tongue_coin_heroic); + RegisterSpellScript(spell_item_proc_below_pct_damaged); RegisterSpellScript(spell_item_crystal_spire_of_karabor); - RegisterSpellScript(spell_item_soul_harvesters_charm); RegisterSpellScript(spell_item_sunwell_exalted_caster_neck); RegisterSpellScript(spell_item_sunwell_exalted_healer_neck); RegisterSpellScript(spell_item_sunwell_exalted_melee_neck); @@ -6368,8 +6240,6 @@ void AddSC_item_spell_scripts() RegisterSpellScript(spell_item_tiny_abomination_in_a_jar); RegisterSpellScript(spell_item_tiny_abomination_in_a_jar_hero); RegisterSpellScript(spell_item_totem_of_flowing_water); - RegisterSpellScript(spell_item_petrified_twilight_scale); - RegisterSpellScript(spell_item_petrified_twilight_scale_heroic); RegisterSpellScript(spell_item_purified_shard_of_the_scale); RegisterSpellScript(spell_item_shiny_shard_of_the_scale); RegisterSpellScript(spell_item_living_root_of_the_wildheart);