mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
fix(Scripts/Mechanar): Fix Polarity shift mechanic (#16601)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_capacitus_polarity_charge_aura';
|
||||||
|
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||||
|
(39088, 'spell_capacitus_polarity_charge_aura'),
|
||||||
|
(39091, 'spell_capacitus_polarity_charge_aura');
|
||||||
@@ -144,17 +144,21 @@ class spell_capacitus_polarity_charge : public SpellScript
|
|||||||
void HandleTargets(std::list<WorldObject*>& targetList)
|
void HandleTargets(std::list<WorldObject*>& targetList)
|
||||||
{
|
{
|
||||||
uint8 count = 0;
|
uint8 count = 0;
|
||||||
for (std::list<WorldObject*>::iterator ihit = targetList.begin(); ihit != targetList.end(); ++ihit)
|
for (auto& ihit : targetList)
|
||||||
if ((*ihit)->GetGUID() != GetCaster()->GetGUID())
|
if (ihit->GetGUID() != GetCaster()->GetGUID())
|
||||||
if (Player* target = (*ihit)->ToPlayer())
|
if (Player* target = ihit->ToPlayer())
|
||||||
if (target->HasAura(GetTriggeringSpell()->Id))
|
if (target->HasAura(GetTriggeringSpell()->Id))
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
|
uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK;
|
||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
uint32 spellId = GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE ? SPELL_POSITIVE_CHARGE_STACK : SPELL_NEGATIVE_CHARGE_STACK;
|
|
||||||
GetCaster()->SetAuraStack(spellId, GetCaster(), count);
|
GetCaster()->SetAuraStack(spellId, GetCaster(), count);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetCaster()->RemoveAurasDueToSpell(spellId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleDamage(SpellEffIndex /*effIndex*/)
|
void HandleDamage(SpellEffIndex /*effIndex*/)
|
||||||
@@ -174,6 +178,29 @@ class spell_capacitus_polarity_charge : public SpellScript
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class spell_capacitus_polarity_charge_aura : public AuraScript
|
||||||
|
{
|
||||||
|
PrepareAuraScript(spell_capacitus_polarity_charge_aura);
|
||||||
|
|
||||||
|
void HandleAfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||||
|
{
|
||||||
|
if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
|
||||||
|
{
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (!target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
target->RemoveAurasDueToSpell(SPELL_POSITIVE_CHARGE_STACK);
|
||||||
|
target->RemoveAurasDueToSpell(SPELL_NEGATIVE_CHARGE_STACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register() override
|
||||||
|
{
|
||||||
|
AfterEffectRemove += AuraEffectRemoveFn(spell_capacitus_polarity_charge_aura::HandleAfterRemove, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class spell_capacitus_polarity_shift : public SpellScript
|
class spell_capacitus_polarity_shift : public SpellScript
|
||||||
{
|
{
|
||||||
PrepareSpellScript(spell_capacitus_polarity_shift);
|
PrepareSpellScript(spell_capacitus_polarity_shift);
|
||||||
@@ -194,5 +221,6 @@ void AddSC_boss_mechano_lord_capacitus()
|
|||||||
{
|
{
|
||||||
RegisterMechanarCreatureAI(boss_mechano_lord_capacitus);
|
RegisterMechanarCreatureAI(boss_mechano_lord_capacitus);
|
||||||
RegisterSpellScript(spell_capacitus_polarity_charge);
|
RegisterSpellScript(spell_capacitus_polarity_charge);
|
||||||
|
RegisterSpellScript(spell_capacitus_polarity_charge_aura);
|
||||||
RegisterSpellScript(spell_capacitus_polarity_shift);
|
RegisterSpellScript(spell_capacitus_polarity_shift);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user