fix(Scripts/TheEye): remove faulty aurascript and do visual transition in normal script instead (#18395)

This commit is contained in:
Dan
2024-02-25 15:49:49 +01:00
committed by GitHub
parent d273151ba6
commit a2f8922411
2 changed files with 25 additions and 39 deletions

View File

@@ -69,7 +69,8 @@ enum Misc
EVENT_SPELL_BERSERK = 3,
EVENT_MOVE_TO_PHASE_2 = 4,
EVENT_FINISH_DIVE = 5
EVENT_FINISH_DIVE = 5,
EVENT_INVISIBLE = 6
};
enum GroupAlar
@@ -172,22 +173,25 @@ struct boss_alar : public BossAI
if (damage >= me->GetHealth() && _platform < POINT_MIDDLE)
{
damage = 0;
me->SetReactState(REACT_PASSIVE);
scheduler.CancelAll();
me->CastStop();
me->SetHealth(me->GetMaxHealth());
DoCastSelf(SPELL_EMBER_BLAST, true); //spellscript doesn't trigger
DoCastSelf(SPELL_EMBER_BLAST, true);
PretendToDie(me);
ScheduleUniqueTimedEvent(1s, [&]{
me->SetVisible(false);
}, EVENT_INVISIBLE);
ScheduleUniqueTimedEvent(8s, [&]{
me->SetPosition(alarPoints[POINT_MIDDLE]);
}, EVENT_RELOCATE_MIDDLE);
ScheduleUniqueTimedEvent(12s, [&]
{
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetVisible(true);
DoCastSelf(SPELL_CLEAR_ALL_DEBUFFS, true);
DoCastSelf(SPELL_REBIRTH_PHASE2);
}, EVENT_MOVE_TO_PHASE_2);
ScheduleUniqueTimedEvent(16001ms, [&]{
me->SetHealth(me->GetMaxHealth());
me->SetReactState(REACT_AGGRESSIVE);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
_platform = POINT_MIDDLE;
me->GetMotionMaster()->MoveChase(me->GetVictim());
ScheduleAbilities();
@@ -195,6 +199,18 @@ struct boss_alar : public BossAI
}
}
void PretendToDie(Creature* creature)
{
scheduler.CancelAll();
creature->InterruptNonMeleeSpells(true);
creature->RemoveAllAuras();
creature->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
creature->SetReactState(REACT_PASSIVE);
creature->GetMotionMaster()->MovementExpired(false);
creature->GetMotionMaster()->MoveIdle();
creature->SetStandState(UNIT_STAND_STATE_DEAD);
}
void ScheduleAbilities()
{
ScheduleTimedEvent(57s, [&]
@@ -394,37 +410,6 @@ class spell_alar_ember_blast : public SpellScript
}
};
class spell_alar_ember_blast_death : public AuraScript
{
PrepareAuraScript(spell_alar_ember_blast_death);
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction(); // xinef: prevent default action after change that invisibility in instances is executed instantly even for creatures
Unit* target = GetTarget();
InvisibilityType type = InvisibilityType(aurEff->GetMiscValue());
target->m_invisibility.AddFlag(type);
target->m_invisibility.AddValue(type, aurEff->GetAmount());
GetUnitOwner()->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetStandState(UNIT_STAND_STATE_DEAD);
GetUnitOwner()->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f);
GetUnitOwner()->m_delayed_unit_relocation_timer = 1000;
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetUnitOwner()->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
GetUnitOwner()->SetStandState(UNIT_STAND_STATE_STAND);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_alar_ember_blast_death::OnApply, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_alar_ember_blast_death::OnRemove, EFFECT_2, SPELL_AURA_MOD_INVISIBILITY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_alar_dive_bomb : public AuraScript
{
PrepareAuraScript(spell_alar_dive_bomb);
@@ -446,7 +431,6 @@ void AddSC_boss_alar()
RegisterTheEyeAI(boss_alar);
RegisterSpellScript(spell_alar_flame_quills);
RegisterSpellScript(spell_alar_ember_blast);
RegisterSpellScript(spell_alar_ember_blast_death);
RegisterSpellScript(spell_alar_dive_bomb);
}