aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy <Golrag@users.noreply.github.com>2025-08-29 19:37:55 +0200
committerGitHub <noreply@github.com>2025-08-29 19:37:55 +0200
commit8d8b0d1a3621e332e998007148c5a88f0dbf4212 (patch)
tree5f88a50b5f0ae46ef752a762d859921a25ccf3d1 /src
parenta884a5f4b4fff8d5a8f322f63e8eabe16a96b588 (diff)
Scripts/Spells: Implement Anger Management talent (#31066)
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp106
1 files changed, 106 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index 8f61fe4f753..35670b97c79 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -35,6 +35,8 @@
enum WarriorSpells
{
+ SPELL_WARRIOR_AVATAR = 107574,
+ SPELL_WARRIOR_BLADESTORM = 227847,
SPELL_WARRIOR_BLADESTORM_PERIODIC_WHIRLWIND = 50622,
SPELL_WARRIOR_BLOODTHIRST_HEAL = 117313,
SPELL_WARRIOR_CHARGE = 34846,
@@ -72,12 +74,14 @@ enum WarriorSpells
SPELL_WARRIOR_MORTAL_WOUNDS = 115804,
SPELL_WARRIOR_POWERFUL_ENRAGE = 440277,
SPELL_WARRIOR_RALLYING_CRY = 97463,
+ SPELL_WARRIOR_RAVAGER = 228920,
SPELL_WARRIOR_RECKLESSNESS = 1719,
SPELL_WARRIOR_RUMBLING_EARTH = 275339,
SPELL_WARRIOR_SHIELD_BLOCK_AURA = 132404,
SPELL_WARRIOR_SHIELD_CHARGE_EFFECT = 385953,
SPELL_WARRIOR_SHIELD_SLAM = 23922,
SPELL_WARRIOR_SHIELD_SLAM_MARKER = 224324,
+ SPELL_WARRIOR_SHIELD_WALL = 871,
SPELL_WARRIOR_SHOCKWAVE = 46968,
SPELL_WARRIOR_SHOCKWAVE_STUN = 132168,
SPELL_WARRIOR_STOICISM = 70845,
@@ -94,6 +98,7 @@ enum WarriorSpells
SPELL_WARRIOR_VICIOUS_CONTEMPT = 383885,
SPELL_WARRIOR_VICTORIOUS = 32216,
SPELL_WARRIOR_VICTORY_RUSH_HEAL = 118779,
+ SPELL_WARRIOR_WARBREAKER = 262161,
SPELL_WARRIOR_WHIRLWIND_CLEAVE_AURA = 85739,
SPELL_WARRIOR_WHIRLWIND_ENERGIZE = 280715,
SPELL_WARRIOR_WRATH_AND_FURY = 392936
@@ -117,6 +122,106 @@ static void ApplyWhirlwindCleaveAura(Player* caster, Difficulty difficulty, Spel
});
}
+// 152278 - Anger Management
+class spell_warr_anger_management_proc : public AuraScript
+{
+ static bool ValidateProc(AuraEffect const* aurEff, ProcEventInfo const& eventInfo, ChrSpecialization spec)
+ {
+ if (aurEff->GetAmount() == 0)
+ return false;
+
+ Player const* player = eventInfo.GetActor()->ToPlayer();
+ if (!player)
+ return false;
+
+ Spell const* procSpell = eventInfo.GetProcSpell();
+ if (!procSpell)
+ return false;
+
+ if (procSpell->GetPowerTypeCostAmount(POWER_RAGE) <= 0)
+ return false;
+
+ return player->GetPrimarySpecialization() == spec;
+ }
+
+ static bool CheckArmsProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
+ {
+ if (!ValidateProc(aurEff, eventInfo, ChrSpecialization::WarriorArms))
+ return false;
+
+ // exclude non-attacks such as Ignore Pain
+ if (!eventInfo.GetSpellInfo()->IsAffected(SPELLFAMILY_WARRIOR, { 0x100, 0x0, 0x0, 0x0 }))
+ return false;
+
+ return true;
+ }
+
+ static bool CheckFuryProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
+ {
+ return ValidateProc(aurEff, eventInfo, ChrSpecialization::WarriorFury);
+ }
+
+ static bool CheckProtectionProc(AuraScript const&, AuraEffect const* aurEff, ProcEventInfo const& eventInfo)
+ {
+ return ValidateProc(aurEff, eventInfo, ChrSpecialization::WarriorProtection);
+ }
+
+ bool Validate(SpellInfo const* /*spellInfo*/) override
+ {
+ return ValidateSpellInfo(
+ {
+ SPELL_WARRIOR_COLOSSUS_SMASH,
+ SPELL_WARRIOR_BLADESTORM,
+ SPELL_WARRIOR_RAVAGER,
+ SPELL_WARRIOR_WARBREAKER,
+ SPELL_WARRIOR_RECKLESSNESS,
+ SPELL_WARRIOR_AVATAR,
+ SPELL_WARRIOR_SHIELD_WALL
+ });
+ }
+
+ void HandleProc(AuraEffect const* aurEff, ProcEventInfo const& eventInfo, std::span<int32 const> spellIds) const
+ {
+ int32 rageCost = *eventInfo.GetProcSpell()->GetPowerTypeCostAmount(POWER_RAGE) / 10; // db values are 10x the actual rage cost
+ float multiplier = static_cast<float>(rageCost) / static_cast<float>(aurEff->GetAmount());
+ Milliseconds cooldownMod = -duration_cast<Milliseconds>(multiplier * CooldownReduction);
+
+ for (int32 spellId : spellIds)
+ GetTarget()->GetSpellHistory()->ModifyCooldown(spellId, cooldownMod);
+ }
+
+ void OnProcArms(AuraEffect const* aurEff, ProcEventInfo const& eventInfo) const
+ {
+ HandleProc(aurEff, eventInfo, ArmsSpellIds);
+ }
+
+ void OnProcFury(AuraEffect const* aurEff, ProcEventInfo const& eventInfo) const
+ {
+ HandleProc(aurEff, eventInfo, FurySpellIds);
+ }
+
+ void OnProcProtection(AuraEffect const* aurEff, ProcEventInfo const& eventInfo) const
+ {
+ HandleProc(aurEff, eventInfo, ProtectionSpellIds);
+ }
+
+ void Register() override
+ {
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_warr_anger_management_proc::CheckArmsProc, EFFECT_0, SPELL_AURA_DUMMY);
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_warr_anger_management_proc::CheckProtectionProc, EFFECT_1, SPELL_AURA_DUMMY);
+ DoCheckEffectProc += AuraCheckEffectProcFn(spell_warr_anger_management_proc::CheckFuryProc, EFFECT_2, SPELL_AURA_DUMMY);
+
+ OnEffectProc += AuraEffectProcFn(spell_warr_anger_management_proc::OnProcArms, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectProc += AuraEffectProcFn(spell_warr_anger_management_proc::OnProcProtection, EFFECT_1, SPELL_AURA_DUMMY);
+ OnEffectProc += AuraEffectProcFn(spell_warr_anger_management_proc::OnProcFury, EFFECT_2, SPELL_AURA_DUMMY);
+ }
+
+ static constexpr FloatMilliseconds CooldownReduction = 1s;
+ static constexpr std::array<int32, 4> ArmsSpellIds = { SPELL_WARRIOR_COLOSSUS_SMASH, SPELL_WARRIOR_WARBREAKER, SPELL_WARRIOR_BLADESTORM, SPELL_WARRIOR_RAVAGER };
+ static constexpr std::array<int32, 3> FurySpellIds = { SPELL_WARRIOR_RECKLESSNESS, SPELL_WARRIOR_BLADESTORM, SPELL_WARRIOR_RAVAGER };
+ static constexpr std::array<int32, 2> ProtectionSpellIds = { SPELL_WARRIOR_AVATAR, SPELL_WARRIOR_SHIELD_WALL };
+};
+
// 392536 - Ashen Juggernaut
class spell_warr_ashen_juggernaut : public AuraScript
{
@@ -1446,6 +1551,7 @@ class spell_warr_victory_rush : public SpellScript
void AddSC_warrior_spell_scripts()
{
+ RegisterSpellScript(spell_warr_anger_management_proc);
RegisterSpellScript(spell_warr_ashen_juggernaut);
RegisterSpellScript(spell_warr_avatar);
RegisterSpellScript(spell_warr_bloodthirst);