fix(Scripts/AhnKahet): Elder Nadox enrage & health check (#22208)

This commit is contained in:
avarishd
2025-05-30 02:51:24 +03:00
committed by GitHub
parent 4ad99e2de8
commit c7aa50dfc0

View File

@@ -101,9 +101,7 @@ struct boss_elder_nadox : public BossAI
events.ScheduleEvent(EVENT_PLAGUE, 5s, 8s); events.ScheduleEvent(EVENT_PLAGUE, 5s, 8s);
if (IsHeroic()) if (IsHeroic())
{
events.ScheduleEvent(EVENT_BROOD_RAGE, 5s); events.ScheduleEvent(EVENT_BROOD_RAGE, 5s);
}
// Cache eggs // Cache eggs
std::list<Creature*> eggs; std::list<Creature*> eggs;
@@ -122,7 +120,7 @@ struct boss_elder_nadox : public BossAI
eggs.clear(); eggs.clear();
// Guardian eggs // Guardian eggs
me->GetCreatureListWithEntryInGrid(eggs, NPC_AHNKAHAR_GUARDIAN_EGG, 250.0f); me->GetCreatureListWithEntryInGrid(eggs, NPC_AHNKAHAR_GUARDIAN_EGG, 250.0f);
if (!eggs.empty()) if (!eggs.empty())
{ {
@@ -139,17 +137,13 @@ struct boss_elder_nadox : public BossAI
void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) override
{ {
if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN) if (summon->GetEntry() == NPC_AHNKAHAR_GUARDIAN)
{
respectYourElders = false; respectYourElders = false;
}
} }
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->IsPlayer()) if (victim->IsPlayer())
{
Talk(SAY_SLAY); Talk(SAY_SLAY);
}
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
@@ -160,7 +154,7 @@ struct boss_elder_nadox : public BossAI
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*school*/) override void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellSchoolMask /*school*/) override
{ {
if (!guardianSummoned && me->HealthBelowPctDamaged(55, damage)) if (!guardianSummoned && me->HealthBelowPctDamaged(50, damage))
{ {
SummonHelpers(false); SummonHelpers(false);
guardianSummoned = true; guardianSummoned = true;
@@ -170,9 +164,7 @@ struct boss_elder_nadox : public BossAI
uint32 GetData(uint32 type) const override uint32 GetData(uint32 type) const override
{ {
if (type == DATA_RESPECT_YOUR_ELDERS) if (type == DATA_RESPECT_YOUR_ELDERS)
{
return respectYourElders ? 1 : 0; return respectYourElders ? 1 : 0;
}
return 0; return 0;
} }
@@ -180,16 +172,12 @@ struct boss_elder_nadox : public BossAI
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (!UpdateVictim()) if (!UpdateVictim())
{
return; return;
}
events.Update(diff); events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING)) if (me->HasUnitState(UNIT_STATE_CASTING))
{
return; return;
}
while (uint32 const eventId = events.ExecuteEvent()) while (uint32 const eventId = events.ExecuteEvent())
{ {
@@ -218,9 +206,8 @@ struct boss_elder_nadox : public BossAI
case EVENT_CHECK_HOME: case EVENT_CHECK_HOME:
{ {
if (!me->HasAura(SPELL_ENRAGE) && (me->GetPositionZ() < 24.0f || !me->GetHomePosition().IsInDist(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 110.0f))) if (!me->HasAura(SPELL_ENRAGE) && (me->GetPositionZ() < 24.0f || !me->GetHomePosition().IsInDist(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 110.0f)))
{
DoCastSelf(SPELL_ENRAGE, true); DoCastSelf(SPELL_ENRAGE, true);
} events.Repeat(1s);
break; break;
} }
} }
@@ -241,9 +228,7 @@ private:
if (swarm) if (swarm)
{ {
if (swarmEggs.empty()) if (swarmEggs.empty())
{
return; return;
}
// Make a copy of guid list // Make a copy of guid list
GuidList swarmEggs2 = swarmEggs; GuidList swarmEggs2 = swarmEggs;
@@ -259,41 +244,29 @@ private:
} }
if (swarmEggs2.empty()) if (swarmEggs2.empty())
{
return; return;
}
previousSwarmEgg_GUID = Acore::Containers::SelectRandomContainerElement(swarmEggs2); previousSwarmEgg_GUID = Acore::Containers::SelectRandomContainerElement(swarmEggs2);
if (Creature* egg = ObjectAccessor::GetCreature(*me, previousSwarmEgg_GUID)) if (Creature* egg = ObjectAccessor::GetCreature(*me, previousSwarmEgg_GUID))
{
egg->CastSpell(egg, SPELL_SUMMON_SWARMERS, true, nullptr, nullptr, me->GetGUID()); egg->CastSpell(egg, SPELL_SUMMON_SWARMERS, true, nullptr, nullptr, me->GetGUID());
}
if (roll_chance_f(33)) if (roll_chance_f(33))
{
Talk(SAY_EGG_SAC); Talk(SAY_EGG_SAC);
}
} }
else else
{ {
if (guardianEggs.empty()) if (guardianEggs.empty())
{
return; return;
}
ObjectGuid const& guardianEggGUID = Acore::Containers::SelectRandomContainerElement(guardianEggs); ObjectGuid const& guardianEggGUID = Acore::Containers::SelectRandomContainerElement(guardianEggs);
if (Creature* egg = ObjectAccessor::GetCreature(*me, guardianEggGUID)) if (Creature* egg = ObjectAccessor::GetCreature(*me, guardianEggGUID))
{
egg->CastSpell(egg, SPELL_SUMMON_SWARM_GUARD, true, nullptr, nullptr, me->GetGUID()); egg->CastSpell(egg, SPELL_SUMMON_SWARM_GUARD, true, nullptr, nullptr, me->GetGUID());
}
Talk(EMOTE_HATCHES, me); Talk(EMOTE_HATCHES, me);
if (roll_chance_f(33)) if (roll_chance_f(33))
{
Talk(SAY_EGG_SAC); Talk(SAY_EGG_SAC);
}
} }
} }
}; };