Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Scripts/TheEye): Fix Al'ar berserk timer #20572

Merged
merged 6 commits into from
Nov 15, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 15 additions & 42 deletions src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,14 @@ struct boss_alar : public BossAI
me->SetModelVisible(true);
me->SetReactState(REACT_AGGRESSIVE);
ConstructWaypointsAndMove();
me->m_Events.KillAllEvents(false);
}

void JustReachedHome() override
{
BossAI::JustReachedHome();
if (me->IsEngaged())
{
ConstructWaypointsAndMove();
}
}

void JustEngagedWith(Unit* who) override
Expand Down Expand Up @@ -158,6 +157,7 @@ struct boss_alar : public BossAI
}
context.Repeat(_platformMoveRepeatTimer);
});

ScheduleMainSpellAttack(0s);
}

Expand All @@ -172,15 +172,11 @@ struct boss_alar : public BossAI
void EnterEvadeMode(EvadeReason why) override
{
if (why == EVADE_REASON_BOUNDARY)
{
BossAI::EnterEvadeMode(why);
}
else
{
if (me->GetThreatMgr().GetThreatList().empty())
{
BossAI::EnterEvadeMode(why);
}
}
}

Expand All @@ -189,19 +185,11 @@ struct boss_alar : public BossAI
BossAI::JustDied(killer);
me->SetModelVisible(true);

if (Map* map = me->GetMap())
me->GetMap()->DoForAllPlayers([&](Player* player)
{
map->DoForAllPlayers([&](Player* player)
{
if (player->GetQuestStatus(QUEST_RUSE_OF_THE_ASHTONGUE) == QUEST_STATUS_INCOMPLETE)
{
if (player->HasAura(SPELL_ASHTONGUE_RUSE))
{
player->AreaExploredOrEventHappens(QUEST_RUSE_OF_THE_ASHTONGUE);
}
}
});
}
if (player->GetQuestStatus(QUEST_RUSE_OF_THE_ASHTONGUE) == QUEST_STATUS_INCOMPLETE && player->HasAura(SPELL_ASHTONGUE_RUSE))
player->AreaExploredOrEventHappens(QUEST_RUSE_OF_THE_ASHTONGUE);
});
}

void MoveInLineOfSight(Unit* /*who*/) override { }
Expand Down Expand Up @@ -235,7 +223,7 @@ struct boss_alar : public BossAI
_noMelee = false;
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
_platform = POINT_MIDDLE;
me->GetMotionMaster()->MoveChase(me->GetVictim());
me->ResumeChasingVictim();
ScheduleAbilities();
});
}
Expand Down Expand Up @@ -270,19 +258,18 @@ struct boss_alar : public BossAI
{
// find spell from sniffs?
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true))
{
me->SummonCreature(NPC_FLAME_PATCH, *target, TEMPSUMMON_TIMED_DESPAWN, 2 * MINUTE * IN_MILLISECONDS);
}
}, 30s);
ScheduleTimedEvent(34s, [&]
{
me->GetMotionMaster()->MovePoint(POINT_DIVE, alarPoints[POINT_DIVE], false, true);
scheduler.DelayAll(15s);
}, 57s);
ScheduleUniqueTimedEvent(10min, [&]
{
DoCastSelf(SPELL_BERSERK);
}, EVENT_SPELL_BERSERK);

me->m_Events.AddEventAtOffset([&] {
DoCastSelf(SPELL_BERSERK, true);
}, 10min);

ScheduleMainSpellAttack(0s);
}

Expand All @@ -304,16 +291,14 @@ struct boss_alar : public BossAI
scheduler.Schedule(2s, [this](TaskContext)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 110.0f, true))
{
SpawnPhoenixes(2, target);
}
}).Schedule(6s, [this](TaskContext)
{
me->SetModelVisible(true);
DoCastSelf(SPELL_REBIRTH_DIVE);
}).Schedule(10s, [this](TaskContext)
{
me->GetMotionMaster()->MoveChase(me->GetVictim());
me->ResumeChasingVictim();
_noMelee = false;
});
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 90.0f, true))
Expand All @@ -331,9 +316,8 @@ struct boss_alar : public BossAI
if (type != POINT_MOTION_TYPE)
{
if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized() && !me->IsInCombat())
{
ConstructWaypointsAndMove();
}

return;
}

Expand Down Expand Up @@ -366,9 +350,8 @@ struct boss_alar : public BossAI
scheduler.Schedule(timer, GROUP_FLAME_BUFFET, [this](TaskContext context)
{
if (!me->SelectNearestTarget(me->GetCombatReach()) && !me->isMoving())
{
DoCastVictim(SPELL_FLAME_BUFFET);
}

context.Repeat(2s);
});
}
Expand All @@ -394,21 +377,15 @@ struct boss_alar : public BossAI
_transitionScheduler.Update(diff);

if (!UpdateVictim())
{
return;
}

scheduler.Update(diff);

if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}

if (!_noMelee)
{
DoMeleeAttackIfReady();
}
}

Position DeterminePhoenixPosition(Position playerPosition)
Expand Down Expand Up @@ -498,13 +475,9 @@ class spell_alar_ember_blast : public SpellScript
void HandleCast()
{
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
{
if (Creature* alar = instance->GetCreature(DATA_ALAR))
{
if (!alar->HasAura(SPELL_MODEL_VISIBILITY))
Unit::DealDamage(GetCaster(), alar, alar->CountPctFromMaxHealth(2));
}
}
}

void Register() override
Expand Down
Loading