aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-09-18 15:03:44 +0200
committerShauren <shauren.trinity@gmail.com>2025-09-18 15:03:44 +0200
commit3a62fefd0a6aeeb8bd15c015be6fc7824a2fc8de (patch)
tree03c9e9654f0f36239e7c057b9c669c9cc7f8ff3d
parentece0cde2fde2a8f54b03cc74613425dbce793736 (diff)
Scripts/Spells: Merge spell_mage_wildfire_crit script classes
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp45
1 files changed, 12 insertions, 33 deletions
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 1f10515f33b..927a0467525 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -1844,20 +1844,21 @@ class spell_mage_water_elemental_freeze : public SpellScript
};
// 383493 - Wildfire
-class spell_mage_wildfire_area_crit : public AuraScript
+// 383492 - Wildfire
+class spell_mage_wildfire_crit : public AuraScript
{
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return ValidateSpellEffect({ { SPELL_MAGE_WILDFIRE_TALENT, EFFECT_3 } });
+ return ValidateSpellEffect({ { SPELL_MAGE_WILDFIRE_TALENT, _effIndex } });
}
- void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
+ void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) const
{
Unit* caster = GetCaster();
if (!caster)
return;
- AuraEffect const* wildfireCritEffect = caster->GetAuraEffect(SPELL_MAGE_WILDFIRE_TALENT, EFFECT_3);
+ AuraEffect const* wildfireCritEffect = caster->GetAuraEffect(SPELL_MAGE_WILDFIRE_TALENT, _effIndex);
if (!wildfireCritEffect)
return;
@@ -1867,36 +1868,14 @@ class spell_mage_wildfire_area_crit : public AuraScript
void Register() override
{
- DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_wildfire_area_crit::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_CRIT_PCT);
+ DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_wildfire_crit::CalculateAmount, EFFECT_0, _auraType);
}
-};
-
-// 383492 - Wildfire
-class spell_mage_wildfire_caster_crit : public AuraScript
-{
- bool Validate(SpellInfo const* /*spellInfo*/) override
- {
- return ValidateSpellEffect({ { SPELL_MAGE_WILDFIRE_TALENT, EFFECT_2 } });
- }
-
- void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
- {
- Unit* caster = GetCaster();
- if (!caster)
- return;
- AuraEffect const* wildfireCritEffect = caster->GetAuraEffect(SPELL_MAGE_WILDFIRE_TALENT, EFFECT_2);
- if (!wildfireCritEffect)
- return;
+ AuraType _auraType;
+ SpellEffIndex _effIndex;
- canBeRecalculated = false;
- amount = wildfireCritEffect->GetAmount();
- }
-
- void Register() override
- {
- DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_mage_wildfire_caster_crit::CalculateAmount, EFFECT_0, SPELL_AURA_ADD_PCT_MODIFIER);
- }
+public:
+ explicit spell_mage_wildfire_crit(AuraType auraType, SpellEffIndex effIndex) : _auraType(auraType), _effIndex(effIndex) { }
};
void AddSC_mage_spell_scripts()
@@ -1959,6 +1938,6 @@ void AddSC_mage_spell_scripts()
RegisterSpellScript(spell_mage_tempest_barrier);
RegisterSpellScript(spell_mage_touch_of_the_magi_aura);
RegisterSpellScript(spell_mage_water_elemental_freeze);
- RegisterSpellScript(spell_mage_wildfire_area_crit);
- RegisterSpellScript(spell_mage_wildfire_caster_crit);
+ RegisterSpellScriptWithArgs(spell_mage_wildfire_crit, "spell_mage_wildfire_area_crit", SPELL_AURA_MOD_CRIT_PCT, EFFECT_3);
+ RegisterSpellScriptWithArgs(spell_mage_wildfire_crit, "spell_mage_wildfire_caster_crit", SPELL_AURA_ADD_PCT_MODIFIER, EFFECT_2);
}