This commit is contained in:
Jelle Meeus
2025-07-13 10:37:14 +02:00
parent b14029d3af
commit fb007b6629

View File

@@ -104,12 +104,9 @@ public:
struct boss_sapphiron_40AI : public BossAI struct boss_sapphiron_40AI : public BossAI
{ {
explicit boss_sapphiron_40AI(Creature* c) : BossAI(c, BOSS_SAPPHIRON) explicit boss_sapphiron_40AI(Creature* c) : BossAI(c, BOSS_SAPPHIRON)
{ {}
pInstance = me->GetInstanceScript();
}
EventMap events; EventMap events;
InstanceScript* pInstance;
uint8 iceboltCount{}; uint8 iceboltCount{};
uint32 spawnTimer{}; uint32 spawnTimer{};
GuidList blockList; GuidList blockList;
@@ -117,7 +114,7 @@ public:
void InitializeAI() override void InitializeAI() override
{ {
if (pInstance->GetBossState(BOSS_SAPPHIRON) != DONE) if (instance->GetBossState(BOSS_SAPPHIRON) != DONE)
{ {
me->SummonGameObject(GO_SAPPHIRON_BIRTH, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0); me->SummonGameObject(GO_SAPPHIRON_BIRTH, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, 0, 0, 0, 0, 0);
me->SetVisible(false); me->SetVisible(false);
@@ -157,7 +154,7 @@ public:
if (PlList.IsEmpty()) if (PlList.IsEmpty())
return; return;
for (const auto& i : PlList) for (auto const& i : PlList)
{ {
if (Player* player = i.GetSource()) if (Player* player = i.GetSource())
{ {
@@ -179,20 +176,16 @@ public:
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
EnterCombatSelfFunction(); EnterCombatSelfFunction();
if (isNaxx40Sapp(me->GetEntry())) if (isNaxx40Sapp(me->GetEntry()))
{
me->CastSpell(me, SPELL_FROST_AURA, true); me->CastSpell(me, SPELL_FROST_AURA, true);
}
else else
{
me->CastSpell(me, RAID_MODE(SPELL_FROST_AURA_10, SPELL_FROST_AURA_25), true); me->CastSpell(me, RAID_MODE(SPELL_FROST_AURA_10, SPELL_FROST_AURA_25), true);
} events.ScheduleEvent(EVENT_BERSERK, 15min);
events.ScheduleEvent(EVENT_BERSERK, 900000); events.ScheduleEvent(EVENT_CLEAVE, 5s);
events.ScheduleEvent(EVENT_CLEAVE, 5000); events.ScheduleEvent(EVENT_TAIL_SWEEP, 10s);
events.ScheduleEvent(EVENT_TAIL_SWEEP, 10000); events.ScheduleEvent(EVENT_LIFE_DRAIN, 17s);
events.ScheduleEvent(EVENT_LIFE_DRAIN, 17000); events.ScheduleEvent(EVENT_BLIZZARD, 17s);
events.ScheduleEvent(EVENT_BLIZZARD, 17000); events.ScheduleEvent(EVENT_FLIGHT_START, 45s);
events.ScheduleEvent(EVENT_FLIGHT_START, 45000); events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5s);
events.ScheduleEvent(EVENT_HUNDRED_CLUB, 5000);
} }
void JustDied(Unit* killer) override void JustDied(Unit* killer) override
@@ -213,7 +206,7 @@ public:
{ {
if (type == POINT_MOTION_TYPE && id == POINT_CENTER) if (type == POINT_MOTION_TYPE && id == POINT_CENTER)
{ {
events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500); events.ScheduleEvent(EVENT_FLIGHT_LIFTOFF, 500ms);
} }
} }
@@ -243,10 +236,8 @@ public:
void KilledUnit(Unit* who) override void KilledUnit(Unit* who) override
{ {
if (who->GetTypeId() == TYPEID_PLAYER && pInstance) if (who->IsPlayer())
{ instance->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -282,18 +273,11 @@ public:
return; return;
case EVENT_CLEAVE: case EVENT_CLEAVE:
me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false); me->CastSpell(me->GetVictim(), SPELL_CLEAVE, false);
events.RepeatEvent(10000); events.Repeat(10s);
return; return;
case EVENT_TAIL_SWEEP: case EVENT_TAIL_SWEEP:
if (isNaxx40Sapp(me->GetEntry())) me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25, SPELL_TAIL_SWEEP, SPELL_TAIL_SWEEP_25), false);
{ events.Repeat(10s);
me->CastSpell(me, SPELL_TAIL_SWEEP, false);
}
else
{
me->CastSpell(me, RAID_MODE(SPELL_TAIL_SWEEP_10, SPELL_TAIL_SWEEP_25), false);
}
events.RepeatEvent(10000);
return; return;
case EVENT_LIFE_DRAIN: case EVENT_LIFE_DRAIN:
if (isNaxx40Sapp(me->GetEntry())) if (isNaxx40Sapp(me->GetEntry()))
@@ -308,7 +292,7 @@ public:
{ {
me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false); me->CastCustomSpell(RAID_MODE(SPELL_LIFE_DRAIN_10, SPELL_LIFE_DRAIN_25), SPELLVALUE_MAX_TARGETS, RAID_MODE(2, 5), me, false);
} }
events.RepeatEvent(24000); events.Repeat(24s);
return; return;
case EVENT_BLIZZARD: case EVENT_BLIZZARD:
{ {
@@ -325,14 +309,7 @@ public:
{ {
cr->GetMotionMaster()->MoveRandom(40); cr->GetMotionMaster()->MoveRandom(40);
} }
if (isNaxx40Sapp(me->GetEntry())) events.RepeatEvent(RAID_MODE(8000, 6500, 6500, 6500));
{
events.RepeatEvent(6500);
}
else
{
events.RepeatEvent(RAID_MODE(8000, 6500));
}
return; return;
} }
case EVENT_FLIGHT_START: case EVENT_FLIGHT_START:
@@ -340,8 +317,8 @@ public:
{ {
return; return;
} }
events.RepeatEvent(45000); events.Repeat(45s);
events.DelayEvents(35000); events.DelayEvents(35s);
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->AttackStop(); me->AttackStop();
float x, y, z, o; float x, y, z, o;
@@ -355,15 +332,8 @@ public:
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->SetDisableGravity(true); me->SetDisableGravity(true);
currentTarget.Clear(); currentTarget.Clear();
events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3000); events.ScheduleEvent(EVENT_FLIGHT_ICEBOLT, 3s);
if (isNaxx40Sapp(me->GetEntry())) iceboltCount = RAID_MODE(2, 3, 3, 3);
{
iceboltCount = 3;
}
else
{
iceboltCount = RAID_MODE(2, 3);
}
return; return;
case EVENT_FLIGHT_ICEBOLT: case EVENT_FLIGHT_ICEBOLT:
{ {
@@ -379,7 +349,7 @@ public:
auto i = me->GetThreatMgr().GetThreatList().begin(); auto i = me->GetThreatMgr().GetThreatList().begin();
for (; i != me->GetThreatMgr().GetThreatList().end(); ++i) for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
{ {
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER) if ((*i)->getTarget()->IsPlayer())
{ {
bool inList = false; bool inList = false;
if (!blockList.empty()) if (!blockList.empty())
@@ -412,7 +382,7 @@ public:
} }
else else
{ {
events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1000); events.ScheduleEvent(EVENT_FLIGHT_BREATH, 1s);
} }
return; return;
} }
@@ -420,11 +390,11 @@ public:
currentTarget.Clear(); currentTarget.Clear();
Talk(EMOTE_BREATH); Talk(EMOTE_BREATH);
me->CastSpell(me, SPELL_FROST_MISSILE, false); me->CastSpell(me, SPELL_FROST_MISSILE, false);
events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500); events.ScheduleEvent(EVENT_FLIGHT_SPELL_EXPLOSION, 8500ms);
return; return;
case EVENT_FLIGHT_SPELL_EXPLOSION: case EVENT_FLIGHT_SPELL_EXPLOSION:
me->CastSpell(me, SPELL_FROST_EXPLOSION, true); me->CastSpell(me, SPELL_FROST_EXPLOSION, true);
events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3000); events.ScheduleEvent(EVENT_FLIGHT_START_LAND, 3s);
return; return;
case EVENT_FLIGHT_START_LAND: case EVENT_FLIGHT_START_LAND:
if (!blockList.empty()) if (!blockList.empty())
@@ -439,12 +409,12 @@ public:
} }
blockList.clear(); blockList.clear();
me->RemoveAllGameObjects(); me->RemoveAllGameObjects();
events.ScheduleEvent(EVENT_LAND, 1000); events.ScheduleEvent(EVENT_LAND, 1s);
return; return;
case EVENT_LAND: case EVENT_LAND:
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->SetDisableGravity(false); me->SetDisableGravity(false);
events.ScheduleEvent(EVENT_GROUND, 1500); events.ScheduleEvent(EVENT_GROUND, 1500ms);
return; return;
case EVENT_GROUND: case EVENT_GROUND:
Talk(EMOTE_GROUND_PHASE); Talk(EMOTE_GROUND_PHASE);
@@ -454,15 +424,15 @@ public:
case EVENT_HUNDRED_CLUB: case EVENT_HUNDRED_CLUB:
{ {
Map::PlayerList const& pList = me->GetMap()->GetPlayers(); Map::PlayerList const& pList = me->GetMap()->GetPlayers();
for (const auto& itr : pList) for (auto const& itr : pList)
{ {
if (itr.GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100 && pInstance) if (itr.GetSource()->GetResistance(SPELL_SCHOOL_FROST) > 100)
{ {
pInstance->SetData(DATA_HUNDRED_CLUB, 0); instance->SetData(DATA_HUNDRED_CLUB, 0);
return; return;
} }
} }
events.RepeatEvent(5000); events.Repeat(5s);
return; return;
} }
} }