diff options
author | Jeremy <Golrag@users.noreply.github.com> | 2025-07-19 16:46:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-19 16:46:50 +0200 |
commit | 2caeee0d16d5c70153c345f424dee13a2d726dac (patch) | |
tree | a8a3f06f3d5551b51a96d2fef08bd832c9c4c8fd | |
parent | eb2e5503af143ee3b25bd4561eb74d0c06f5442c (diff) |
Scripts/Spells: Implement Improved Whirlwind & Whirlwind target cap (#31064)
-rw-r--r-- | sql/updates/world/master/2025_07_19_05_world.sql | 3 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 69 |
3 files changed, 70 insertions, 8 deletions
diff --git a/sql/updates/world/master/2025_07_19_05_world.sql b/sql/updates/world/master/2025_07_19_05_world.sql new file mode 100644 index 00000000000..97304adc858 --- /dev/null +++ b/sql/updates/world/master/2025_07_19_05_world.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_improved_whirlwind'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(190411, 'spell_improved_whirlwind'); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 265d45a67a1..584daa8e372 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -5432,6 +5432,12 @@ void SpellMgr::LoadSpellInfoTargetCaps() spellInfo->_LoadSqrtTargetLimit(8, 0, {}, {}, {}, {}); }); + // Whirlwind + ApplySpellFix({ 199667, 44949, 199852, 199851 }, [](SpellInfo* spellInfo) + { + spellInfo->_LoadSqrtTargetLimit(5, 0, 190411, EFFECT_2, {}, {}); + }); + TC_LOG_INFO("server.loading", ">> Loaded SpellInfo target caps in {} ms", GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index df446261818..88d39450bd4 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -57,6 +57,7 @@ enum WarriorSpells SPELL_WARRIOR_HEROIC_LEAP_JUMP = 178368, SPELL_WARRIOR_IGNORE_PAIN = 190456, SPELL_WARRIOR_IMPROVED_RAGING_BLOW = 383854, + SPELL_WARRIOR_IMPROVED_WHIRLWIND = 12950, SPELL_WARRIOR_INTIMIDATING_SHOUT_MENACE_AOE = 316595, SPELL_WARRIOR_INVIGORATING_FURY = 385174, SPELL_WARRIOR_INVIGORATING_FURY_TALENT = 383468, @@ -90,6 +91,7 @@ enum WarriorSpells SPELL_WARRIOR_VICTORIOUS = 32216, SPELL_WARRIOR_VICTORY_RUSH_HEAL = 118779, SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA = 85739, + SPELL_WARRIOR_WHIRLWIND_ENERGIZE = 280715, SPELL_WARRIOR_WRATH_AND_FURY = 392936 }; @@ -98,6 +100,19 @@ enum WarriorMisc SPELL_VISUAL_BLAZING_CHARGE = 26423 }; +static void ApplyWhirlwindCleaveAura(Player* caster, Difficulty difficulty, Spell const* triggeringSpell) +{ + SpellInfo const* whirlwindCleaveAuraInfo = sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA, difficulty); + int32 stackAmount = static_cast<int32>(whirlwindCleaveAuraInfo->StackAmount); + caster->ApplySpellMod(whirlwindCleaveAuraInfo, SpellModOp::MaxAuraStacks, stackAmount); + + caster->CastSpell(nullptr, SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringSpell = triggeringSpell, + .SpellValueOverrides = { { SPELLVALUE_AURA_STACK, stackAmount } } + }); +} + // 107574 - Avatar class spell_warr_avatar : public SpellScript { @@ -692,6 +707,50 @@ class spell_warr_impending_victory : public SpellScript } }; +// 12950 - Improved Whirlwind (attached to 190411 - Whirlwind) +class spell_improved_whirlwind : public SpellScript +{ + bool Validate(SpellInfo const* spellInfo) override + { + return ValidateSpellInfo({ SPELL_WARRIOR_IMPROVED_WHIRLWIND, SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA }) + && ValidateSpellEffect({ { spellInfo->Id, EFFECT_2 }, { SPELL_WARRIOR_WHIRLWIND_ENERGIZE, EFFECT_0 } }); + } + + bool Load() override + { + return GetCaster()->HasAura(SPELL_WARRIOR_IMPROVED_WHIRLWIND); + } + + void HandleHit(SpellEffIndex /*effIndex*/) const + { + int64 const targetsHit = GetUnitTargetCountForEffect(EFFECT_0); + if (!targetsHit) + return; + + Player* caster = GetCaster()->ToPlayer(); + if (!caster) + return; + + int32 const ragePerTarget = GetEffectValue(); + int32 const baseRage = GetEffectInfo(EFFECT_0).CalcValue(); + int32 const maxRage = baseRage + (ragePerTarget * GetEffectInfo(EFFECT_2).CalcValue()); + int32 const rageGained = std::min<int32>(baseRage + (targetsHit * ragePerTarget), maxRage); + + caster->CastSpell(nullptr, SPELL_WARRIOR_WHIRLWIND_ENERGIZE, CastSpellExtraArgsInit{ + .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, + .TriggeringSpell = GetSpell(), + .SpellValueOverrides = {{ SPELLVALUE_BASE_POINT0, rageGained * 10 } } + }); + + ApplyWhirlwindCleaveAura(caster, GetCastDifficulty(), GetSpell()); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_improved_whirlwind::HandleHit, EFFECT_1, SPELL_EFFECT_DUMMY); + } +}; + // 5246 - Intimidating Shout class spell_warr_intimidating_shout : public SpellScript { @@ -1118,14 +1177,7 @@ class spell_warr_titanic_rage : public AuraScript .TriggeringSpell = eventInfo.GetProcSpell() }); - SpellInfo const* whirlwindCleaveAuraInfo = sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA, GetCastDifficulty()); - int32 stackAmount = static_cast<int32>(whirlwindCleaveAuraInfo->StackAmount); - target->ApplySpellMod(whirlwindCleaveAuraInfo, SpellModOp::MaxAuraStacks, stackAmount); - - target->CastSpell(nullptr, SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA, CastSpellExtraArgsInit{ - .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR, - .SpellValueOverrides = { { SPELLVALUE_AURA_STACK, stackAmount } } - }); + ApplyWhirlwindCleaveAura(target, GetCastDifficulty(), nullptr); } void Register() override @@ -1310,6 +1362,7 @@ void AddSC_warrior_spell_scripts() RegisterSpellScript(spell_warr_heroic_leap); RegisterSpellScript(spell_warr_heroic_leap_jump); RegisterSpellScript(spell_warr_impending_victory); + RegisterSpellScript(spell_improved_whirlwind); RegisterSpellScript(spell_warr_intimidating_shout); RegisterSpellScript(spell_warr_intimidating_shout_menace_knock_back); RegisterSpellScript(spell_warr_invigorating_fury); |