I need to make a SpellScript for Anger Management (Level 100 talent of Warrior Class). But i don’t found a requiered event on SpellScript, to make something like this.
/// Anger Management - 152278
class spell_warr_anger_management: public PlayerScript
{
public:
spell_warr_anger_management() : PlayerScript(“spell_warr_anger_management”) {}
enum eSpells
{
AngerManagement = 152278,
};
uint16 m_RageSpend = 0;
void OnModifyPower(Player* p_Player, Powers p_Power, int32 p_OldValue, int32& p_NewValue, bool p_Regen, bool p_After)
{
if (p_After)
return;
if (!p_Player || p_Player->getClass() != CLASS_WARRIOR || p_Power != POWER_RAGE || p_Regen)
return;
AuraEffect* l_AngerManagementAura = p_Player->GetAuraEffect(eSpells::AngerManagement, EFFECT_0);
if (!l_AngerManagementAura)
return;
// Get the power earn (if > 0 ) or consum (if < 0)
int32 l_diffValue = p_NewValue - p_OldValue;
// Only get spended rage
if (l_diffValue > 0)
return;
m_RageSpend += -l_diffValue / p_Player->GetPowerCoeff(POWER_RAGE);
uint8 l_Nb = m_RageSpend / l_AngerManagementAura->GetAmount();
m_RageSpend = m_RageSpend % l_AngerManagementAura->GetAmount();
for (uint8 l_I = 0; l_I < l_Nb; ++l_I)
{
for (int l_I = 0; l_I < REDUCED_SPELLS_ID_MAX; l_I++)
{
if (p_Player->HasSpellCooldown(g_ReducedSpellsId[l_I]))
p_Player->ReduceSpellCooldown(g_ReducedSpellsId[l_I], 1 * IN_MILLISECONDS);
}
}
}
};
But i search in the playerscript and unitscript class and i don’t find nothing like this (i see this in other core).
void OnModifyPower(Player* p_Player, Powers p_Power, int32 p_OldValue, int32& p_NewValue, bool p_Regen, bool p_After)
To handle when the player gain/spend mana, energy, maelstrom, etc.
Some help with this or at least the correct form of implement this type of spells ?