fix(Scripts/HoL): Fix Loken intro event (#23286)

This commit is contained in:
Andrew
2025-10-17 17:15:21 -03:00
committed by GitHub
parent acfebea21f
commit 4919e07a7f
3 changed files with 36 additions and 104 deletions

View File

@@ -62,36 +62,43 @@ enum LokenEvents
struct boss_loken : public BossAI struct boss_loken : public BossAI
{ {
boss_loken(Creature* creature) : BossAI(creature, DATA_LOKEN) boss_loken(Creature* creature) : BossAI(creature, DATA_LOKEN), _introDone(false) { }
{
isActive = instance->GetData(DATA_LOKEN_INTRO);
}
void MoveInLineOfSight(Unit*) override { }
void Reset() override void Reset() override
{ {
_Reset(); _Reset();
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEVEMENT_TIMELY_DEATH);
HealthCheck = 75;
IntroTimer = 0;
me->RemoveAllAuras(); me->RemoveAllAuras();
if (!isActive) ScheduleHealthCheckEvent(75, [&] {
{ Talk(SAY_75HEALTH);
me->SetControlled(true, UNIT_STATE_STUNNED); });
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
} ScheduleHealthCheckEvent(50, [&] {
else Talk(SAY_50HEALTH);
{ });
me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE); ScheduleHealthCheckEvent(25, [&] {
} Talk(SAY_25HEALTH);
});
}
void MoveInLineOfSight(Unit* who) override
{
BossAI::MoveInLineOfSight(who);
if (_introDone || !who->IsPlayer() || !me->IsWithinDistInMap(who, 40.0f))
return;
Talk(SAY_INTRO_1);
Talk(SAY_INTRO_2, 10s);
_introDone = true;
} }
void JustEngagedWith(Unit*) override void JustEngagedWith(Unit*) override
{ {
me->m_Events.KillAllEvents(false);
_JustEngagedWith(); _JustEngagedWith();
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
@@ -109,27 +116,6 @@ struct boss_loken : public BossAI
Talk(SAY_DEATH); Talk(SAY_DEATH);
} }
void LokenSpeach(bool hp)
{
if (hp)
{
switch (HealthCheck)
{
case 75:
Talk(SAY_75HEALTH);
break;
case 50:
Talk(SAY_50HEALTH);
break;
case 25:
Talk(SAY_25HEALTH);
break;
}
}
else
Talk(SAY_NOVA);
}
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (!victim->IsPlayer()) if (!victim->IsPlayer())
@@ -140,40 +126,6 @@ struct boss_loken : public BossAI
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!isActive)
{
IntroTimer += diff;
if (IntroTimer > 5000 && IntroTimer < 10000)
{
if (SelectTargetFromPlayerList(60))
{
Talk(SAY_INTRO_1);
IntroTimer = 10000;
}
else
IntroTimer = 0;
}
if (IntroTimer >= 30000 && IntroTimer < 40000)
{
Talk(SAY_INTRO_2);
IntroTimer = 40000;
}
if (IntroTimer >= 60000)
{
isActive = true;
instance->SetData(DATA_LOKEN_INTRO, 1);
me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
if (GameObject* globe = instance->GetGameObject(DATA_LOKEN_THRONE))
globe->SetGoState(GO_STATE_ACTIVE);
}
return;
}
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
@@ -185,16 +137,8 @@ struct boss_loken : public BossAI
switch (events.ExecuteEvent()) switch (events.ExecuteEvent())
{ {
case EVENT_CHECK_HEALTH:
if (HealthBelowPct(HealthCheck))
{
LokenSpeach(true);
HealthCheck -= 25;
}
events.Repeat(1s);
break;
case EVENT_LIGHTNING_NOVA: case EVENT_LIGHTNING_NOVA:
Talk(SAY_NOVA);
events.Repeat(15s); events.Repeat(15s);
me->CastSpell(me, SPELL_LIGHTNING_NOVA_VISUAL, true); me->CastSpell(me, SPELL_LIGHTNING_NOVA_VISUAL, true);
me->CastSpell(me, SPELL_LIGHTNING_NOVA_THUNDERS, true); me->CastSpell(me, SPELL_LIGHTNING_NOVA_THUNDERS, true);
@@ -221,9 +165,7 @@ struct boss_loken : public BossAI
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
bool isActive; bool _introDone;
uint32 IntroTimer;
uint8 HealthCheck;
}; };
class spell_loken_pulsing_shockwave : public SpellScript class spell_loken_pulsing_shockwave : public SpellScript

View File

@@ -35,8 +35,6 @@ enum HoLBossIds
enum HoLDataTypes enum HoLDataTypes
{ {
DATA_LOKEN_INTRO = 0,
// GameObject data // GameObject data
DATA_LOKEN_THRONE = 0, DATA_LOKEN_THRONE = 0,
@@ -57,7 +55,7 @@ enum HoLGOs
{ {
GO_VOLKHAN_DOOR = 191325, GO_VOLKHAN_DOOR = 191325,
GO_IONAR_DOOR = 191326, GO_IONAR_DOOR = 191326,
GO_LOKEN_THRONE = 192654, GO_LOKEN_THRONE = 192654
}; };
template <class AI, class T> template <class AI, class T>

View File

@@ -46,8 +46,8 @@ public:
SetBossNumber(MAX_ENCOUNTERS); SetBossNumber(MAX_ENCOUNTERS);
LoadDoorData(doorData); LoadDoorData(doorData);
LoadObjectData(nullptr, gameObjectData); LoadObjectData(nullptr, gameObjectData);
volkhanAchievement = false; _volkhanAchievement = false;
bjarngrimAchievement = false; _bjarngrimAchievement = false;
}; };
bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) override bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) override
@@ -55,33 +55,25 @@ public:
switch (criteria_id) switch (criteria_id)
{ {
case 7321: //Shatter Resistant (2042) case 7321: //Shatter Resistant (2042)
return volkhanAchievement; return _volkhanAchievement;
case 6835: // Lightning Struck (1834) case 6835: // Lightning Struck (1834)
return bjarngrimAchievement; return _bjarngrimAchievement;
} }
return false; return false;
} }
void SetData(uint32 uiType, uint32 uiData) override void SetData(uint32 uiType, uint32 uiData) override
{ {
if (uiType == DATA_LOKEN_INTRO)
SaveToDB();
// Achievements // Achievements
if (uiType == DATA_BJARNGRIM_ACHIEVEMENT) if (uiType == DATA_BJARNGRIM_ACHIEVEMENT)
bjarngrimAchievement = (bool)uiData; _bjarngrimAchievement = (bool)uiData;
else if (uiType == DATA_VOLKHAN_ACHIEVEMENT) else if (uiType == DATA_VOLKHAN_ACHIEVEMENT)
volkhanAchievement = (bool)uiData; _volkhanAchievement = (bool)uiData;
if (uiData != DONE)
return;
SaveToDB();
} }
private: private:
bool volkhanAchievement; bool _volkhanAchievement;
bool bjarngrimAchievement; bool _bjarngrimAchievement;
}; };
InstanceScript* GetInstanceScript(InstanceMap* pMap) const override InstanceScript* GetInstanceScript(InstanceMap* pMap) const override