mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Scripts/Spells: Implement Anger Management talent (#31066)
This commit is contained in:
3
sql/updates/world/master/2025_08_29_00_world.sql
Normal file
3
sql/updates/world/master/2025_08_29_00_world.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_warr_anger_management_proc';
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(152278, 'spell_warr_anger_management_proc');
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user