Scripts/Spells: Fix Incanters Flow (#27395)

This commit is contained in:
aquadeus
2021-12-18 11:24:10 +01:00
committed by GitHub
parent 635b1721d6
commit da8d6b5180
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_mage_incanters_flow';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(1463,'spell_mage_incanters_flow');

View File

@@ -56,6 +56,7 @@ enum MageSpells
SPELL_MAGE_ICE_BARRIER = 11426,
SPELL_MAGE_ICE_BLOCK = 45438,
SPELL_MAGE_IGNITE = 12654,
SPELL_MAGE_INCANTERS_FLOW = 116267,
SPELL_MAGE_LIVING_BOMB_EXPLOSION = 44461,
SPELL_MAGE_LIVING_BOMB_PERIODIC = 217694,
SPELL_MAGE_MANA_SURGE = 37445,
@@ -724,6 +725,48 @@ class spell_mage_imp_mana_gems : public AuraScript
}
};
// 1463 - Incanter's Flow
class spell_mage_incanters_flow : public AuraScript
{
PrepareAuraScript(spell_mage_incanters_flow);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MAGE_INCANTERS_FLOW });
}
void HandlePeriodicTick(AuraEffect const* /*aurEff*/)
{
// Incanter's flow should not cycle out of combat
if (!GetTarget()->IsInCombat())
return;
if (Aura* aura = GetTarget()->GetAura(SPELL_MAGE_INCANTERS_FLOW))
{
uint32 stacks = aura->GetStackAmount();
// Force always to values between 1 and 5
if ((modifier == -1 && stacks == 1) || (modifier == 1 && stacks == 5))
{
modifier *= -1;
return;
}
aura->ModStackAmount(modifier);
}
else
GetTarget()->CastSpell(GetTarget(), SPELL_MAGE_INCANTERS_FLOW, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mage_incanters_flow::HandlePeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
private:
int8 modifier = 1;
};
// 44457 - Living Bomb
class spell_mage_living_bomb : public SpellScript
{
@@ -1118,6 +1161,7 @@ void AddSC_mage_spell_scripts()
RegisterSpellScript(spell_mage_ice_lance_damage);
RegisterAuraScript(spell_mage_ignite);
RegisterAuraScript(spell_mage_imp_mana_gems);
RegisterAuraScript(spell_mage_incanters_flow);
RegisterSpellScript(spell_mage_living_bomb);
RegisterSpellScript(spell_mage_living_bomb_explosion);
RegisterAuraScript(spell_mage_living_bomb_periodic);