mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/Spells: Implement Improved Whirlwind & Whirlwind target cap (#31064)
This commit is contained in:
3
sql/updates/world/master/2025_07_19_05_world.sql
Normal file
3
sql/updates/world/master/2025_07_19_05_world.sql
Normal file
@@ -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');
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user