refactor(Scripts/ObsidianSanctum): Modernize script files (#24632)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+25
-226
@@ -253,19 +253,9 @@ const uint32 dragons[MAX_DRAGONS] = { DATA_TENEBRON, DATA_VESPERON, DATA_SHADRON
|
||||
// SARTHARION
|
||||
/////////////////////////////
|
||||
|
||||
class boss_sartharion : public CreatureScript
|
||||
struct boss_sartharion : public BossAI
|
||||
{
|
||||
public:
|
||||
boss_sartharion() : CreatureScript("boss_sartharion") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const override
|
||||
{
|
||||
return GetObsidianSanctumAI<boss_sartharionAI> (pCreature);
|
||||
}
|
||||
|
||||
struct boss_sartharionAI : public BossAI
|
||||
{
|
||||
boss_sartharionAI(Creature* pCreature) : BossAI(pCreature, DATA_SARTHARION),
|
||||
boss_sartharion(Creature* creature) : BossAI(creature, DATA_SARTHARION),
|
||||
dragonsCount(0),
|
||||
lastLavaSide(LAVA_RIGHT_SIDE),
|
||||
usedBerserk(false),
|
||||
@@ -289,14 +279,12 @@ public:
|
||||
void DoAction(int32 param) override
|
||||
{
|
||||
if (param == ACTION_DRAKE_DIED)
|
||||
{
|
||||
DoCastSelf(SPELL_SARTHARION_TWILIGHT_REVENGE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* pWho) override
|
||||
void JustEngagedWith(Unit* who) override
|
||||
{
|
||||
if (pWho && !IsTargetInBounds(pWho))
|
||||
if (who && !IsTargetInBounds(who))
|
||||
{
|
||||
EnterEvadeMode();
|
||||
return;
|
||||
@@ -322,9 +310,7 @@ public:
|
||||
{
|
||||
Creature* dragon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(dragons[i]));
|
||||
if (!dragon || !dragon->IsAlive() || instance->GetBossState(dragons[i]) == DONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dragon->SetImmuneToNPC(true);
|
||||
dragon->SetFullHealth();
|
||||
@@ -356,9 +342,7 @@ public:
|
||||
}
|
||||
|
||||
if (dragonsCount)
|
||||
{
|
||||
DoCastSelf(SPELL_WILL_OF_SARTHARION, true);
|
||||
}
|
||||
|
||||
me->CallForHelp(500.0f);
|
||||
}
|
||||
@@ -375,9 +359,7 @@ public:
|
||||
if (type == DATA_VOLCANO_BLOWS && data)
|
||||
{
|
||||
if (!volcanoBlows.empty() && std::find(volcanoBlows.begin(), volcanoBlows.end(), data) != volcanoBlows.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
volcanoBlows.push_back(data);
|
||||
}
|
||||
@@ -387,26 +369,20 @@ public:
|
||||
{
|
||||
// it means we want dragons count
|
||||
if (dataOrGuid == DATA_ACHIEVEMENT_DRAGONS_COUNT)
|
||||
{
|
||||
return dragonsCount;
|
||||
}
|
||||
|
||||
// otherwise it is guid to check if player was hit by lava strike :)
|
||||
if (!volcanoBlows.empty() && std::find(volcanoBlows.begin(), volcanoBlows.end(), dataOrGuid) != volcanoBlows.end())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* pVictim) override
|
||||
{
|
||||
if (!urand(0, 2) && pVictim->IsPlayer())
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (!urand(0, 2) && victim->IsPlayer())
|
||||
Talk(SAY_SARTHARION_SLAY);
|
||||
}
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summon) override
|
||||
{
|
||||
@@ -453,11 +429,9 @@ public:
|
||||
{
|
||||
Creature* summon = ObjectAccessor::GetCreature(*me, summonGuid);
|
||||
if (summon && summon->GetEntry() == NPC_FIRE_CYCLONE)
|
||||
{
|
||||
summon->CastSpell(summon, SPELL_CYCLONE_AURA_PERIODIC, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Talk(SAY_SARTHARION_BERSERK);
|
||||
below11PctReached = true;
|
||||
}
|
||||
@@ -466,13 +440,11 @@ public:
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
extraEvents.Update(diff);
|
||||
|
||||
// Special events which needs to be fired immidiately
|
||||
// Special events which needs to be fired immediately
|
||||
while (uint32 const eventId = extraEvents.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
@@ -480,21 +452,15 @@ public:
|
||||
case EVENT_SARTHARION_BOUNDARY:
|
||||
{
|
||||
if (!IsTargetInBounds(me->GetVictim()))
|
||||
{
|
||||
EnterEvadeMode();
|
||||
}
|
||||
else
|
||||
{
|
||||
extraEvents.Repeat(250ms);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_SARTHARION_SUMMON_LAVA:
|
||||
{
|
||||
if (!urand(0, 3))
|
||||
{
|
||||
Talk(SAY_SARTHARION_SPECIAL);
|
||||
}
|
||||
|
||||
SummonLavaWaves();
|
||||
extraEvents.Repeat(25s);
|
||||
@@ -516,40 +482,32 @@ public:
|
||||
{
|
||||
Talk(SAY_SARTHARION_CALL_TENEBRON);
|
||||
if (Creature* tenebron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_TENEBRON)))
|
||||
{
|
||||
tenebron->AI()->DoAction(ACTION_CALL_DRAGON);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_SARTHARION_CALL_SHADRON:
|
||||
{
|
||||
Talk(SAY_SARTHARION_CALL_SHADRON);
|
||||
if (Creature* shadron = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SHADRON)))
|
||||
{
|
||||
shadron->AI()->DoAction(ACTION_CALL_DRAGON);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_SARTHARION_CALL_VESPERON:
|
||||
{
|
||||
Talk(SAY_SARTHARION_CALL_VESPERON);
|
||||
if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
|
||||
{
|
||||
vesperon->AI()->DoAction(ACTION_CALL_DRAGON);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Sartharion combat abbilities
|
||||
// Handle Sartharion combat abilities
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (uint32 const eventId = events.ExecuteEvent())
|
||||
{
|
||||
@@ -576,12 +534,10 @@ public:
|
||||
case EVENT_SARTHARION_LAVA_STRIKE:
|
||||
{
|
||||
if (!urand(0, 2))
|
||||
{
|
||||
Talk(SAY_SARTHARION_SPECIAL_4);
|
||||
}
|
||||
|
||||
summons.RemoveNotExisting();
|
||||
uint8 rand = urand(0, MAX_CYCLONE_COUNT - 1); // 5 - numer of cyclones
|
||||
uint8 rand = urand(0, MAX_CYCLONE_COUNT - 1); // 5 - number of cyclones
|
||||
uint8 iter = 0;
|
||||
if (!summons.empty())
|
||||
{
|
||||
@@ -607,10 +563,8 @@ public:
|
||||
}
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
@@ -693,16 +647,12 @@ public:
|
||||
for (uint8 i = 0; i < MAX_DRAGONS; ++i)
|
||||
{
|
||||
if (instance->GetBossState(dragons[i]) == DONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Creature* dragon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(dragons[i])))
|
||||
{
|
||||
if (checkCombat && dragon->IsInCombat())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dragon->DespawnOrUnsummon();
|
||||
dragon->SetRespawnTime(5);
|
||||
@@ -715,15 +665,11 @@ public:
|
||||
bool IsTargetInBounds(Unit const* victim) const
|
||||
{
|
||||
if (!victim || victim->GetPositionX() < SartharionBoundary[0] || victim->GetPositionX() > SartharionBoundary[1] || victim->GetPositionY() > SartharionBoundary[3])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Big island handling
|
||||
if (victim->GetPositionY() < SartharionBoundary[2])
|
||||
{
|
||||
return victim->GetDistance(bigIslandMiddlePos) <= 6.0f;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -735,11 +681,10 @@ public:
|
||||
bool usedBerserk;
|
||||
bool below11PctReached;
|
||||
};
|
||||
};
|
||||
|
||||
struct boss_sartharion_dragonAI : public BossAI
|
||||
{
|
||||
boss_sartharion_dragonAI(Creature* pCreature, uint32 bossId) : BossAI(pCreature, bossId), isCalledBySartharion(false)
|
||||
boss_sartharion_dragonAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), isCalledBySartharion(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -778,34 +723,26 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
void MovementInform(uint32 type, uint32 pointId) final
|
||||
{
|
||||
if (type != WAYPOINT_MOTION_TYPE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
case NPC_TENEBRON:
|
||||
{
|
||||
if (pointId != POINT_FINAL_TENEBRON)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_SHADRON:
|
||||
{
|
||||
if (pointId != POINT_FINAL_SHADRON)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_VESPERON:
|
||||
{
|
||||
if (pointId != POINT_FINAL_VESPERON)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -820,10 +757,8 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
if (isCalledBySartharion && instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS)
|
||||
{
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->AI()->JustSummoned(summon);
|
||||
}
|
||||
}
|
||||
|
||||
BossAI::JustSummoned(summon);
|
||||
}
|
||||
@@ -863,18 +798,14 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
}
|
||||
|
||||
if (isCalledBySartharion || instance->GetBossState(DATA_SARTHARION) == DONE)
|
||||
{
|
||||
me->SetLootMode(0);
|
||||
}
|
||||
|
||||
if (isCalledBySartharion)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, 0, 500, true, false))
|
||||
{
|
||||
AttackStart(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
@@ -883,9 +814,7 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
|
||||
// Despawn minions only if not called by Sartharion
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
summons.DespawnAll();
|
||||
}
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
@@ -893,9 +822,7 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
{
|
||||
Talk(SAY_TENEBRON_DEATH);
|
||||
if (!isCalledBySartharion || instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS)
|
||||
{
|
||||
instance->SetBossState(DATA_TENEBRON, DONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_SHADRON:
|
||||
@@ -904,15 +831,11 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
if (isCalledBySartharion)
|
||||
{
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->RemoveAura(SPELL_GIFT_OF_TWILIGHT_FIRE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCalledBySartharion || instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS)
|
||||
{
|
||||
instance->SetBossState(DATA_SHADRON, DONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_VESPERON:
|
||||
@@ -920,32 +843,24 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
Talk(SAY_VESPERON_DEATH);
|
||||
instance->DoAction(ACTION_CLEAR_PORTAL);
|
||||
if (!isCalledBySartharion || instance->GetBossState(DATA_SARTHARION) != IN_PROGRESS)
|
||||
{
|
||||
instance->SetBossState(DATA_VESPERON, DONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
ClearInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->AI()->DoAction(ACTION_DRAKE_DIED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* victim) final
|
||||
{
|
||||
if (!victim->IsPlayer() || urand(0, 2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (me->GetEntry())
|
||||
{
|
||||
@@ -976,26 +891,20 @@ struct boss_sartharion_dragonAI : public BossAI
|
||||
}
|
||||
|
||||
if (!UpdateVictim())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (uint32 const eventId = events.ExecuteEvent())
|
||||
{
|
||||
ExecuteEvent(eventId);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
@@ -1016,9 +925,7 @@ protected:
|
||||
if (portalGUID)
|
||||
{
|
||||
if (GameObject* gobj = me->GetMap()->GetGameObject(portalGUID))
|
||||
{
|
||||
gobj->Delete();
|
||||
}
|
||||
|
||||
portalGUID.Clear();
|
||||
}
|
||||
@@ -1033,19 +940,9 @@ protected:
|
||||
// TENEBRON
|
||||
/////////////////////////////
|
||||
|
||||
class boss_sartharion_tenebron : public CreatureScript
|
||||
struct boss_sartharion_tenebron : public boss_sartharion_dragonAI
|
||||
{
|
||||
public:
|
||||
boss_sartharion_tenebron() : CreatureScript("boss_sartharion_tenebron") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const override
|
||||
{
|
||||
return GetObsidianSanctumAI<boss_sartharion_tenebronAI>(pCreature);
|
||||
}
|
||||
|
||||
struct boss_sartharion_tenebronAI : public boss_sartharion_dragonAI
|
||||
{
|
||||
boss_sartharion_tenebronAI(Creature* pCreature) : boss_sartharion_dragonAI(pCreature, DATA_TENEBRON), summons2(pCreature)
|
||||
boss_sartharion_tenebron(Creature* creature) : boss_sartharion_dragonAI(creature, DATA_TENEBRON), summons2(creature)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1053,9 +950,7 @@ public:
|
||||
{
|
||||
boss_sartharion_dragonAI::Reset();
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
summons2.DespawnAll();
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_FISSURE, 20s);
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_SHADOW_BREATH, 10s);
|
||||
@@ -1065,18 +960,14 @@ public:
|
||||
void JustSummoned(Creature* summon) override
|
||||
{
|
||||
if (summon->GetEntry() != NPC_TWILIGHT_EGG)
|
||||
{
|
||||
summons.Summon(summon);
|
||||
}
|
||||
// Summons to Sartharion are linked manually
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
summons2.DespawnAll();
|
||||
}
|
||||
|
||||
boss_sartharion_dragonAI::JustDied(killer);
|
||||
}
|
||||
@@ -1099,9 +990,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_BREATH:
|
||||
{
|
||||
if (!urand(0, 10))
|
||||
{
|
||||
Talk(SAY_TENEBRON_BREATH);
|
||||
}
|
||||
DoCastVictim(SPELL_SHADOW_BREATH, false);
|
||||
events.Repeat(17500ms);
|
||||
break;
|
||||
@@ -1109,9 +998,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_FISSURE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
||||
{
|
||||
DoCast(target, SPELL_SHADOW_FISSURE, false);
|
||||
}
|
||||
events.Repeat(22500ms);
|
||||
break;
|
||||
}
|
||||
@@ -1123,14 +1010,10 @@ public:
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[DATA_TENEBRON].GetPositionX(), portalPos[DATA_TENEBRON].GetPositionY(), portalPos[DATA_TENEBRON].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
portalGUID = Portal->GetGUID();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->DoAction(ACTION_ADD_PORTAL);
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2s);
|
||||
events.Repeat(60s);
|
||||
@@ -1147,10 +1030,8 @@ public:
|
||||
if (isCalledBySartharion && instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS)
|
||||
{
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->AI()->JustSummoned(egg);
|
||||
}
|
||||
}
|
||||
egg->SetPhaseMask(16, true);
|
||||
}
|
||||
}
|
||||
@@ -1166,9 +1047,7 @@ public:
|
||||
{
|
||||
Creature const* summon = ObjectAccessor::GetCreature(*me, summonGuid);
|
||||
if (!summon || !summon->IsAlive() || summon->GetEntry() != NPC_TWILIGHT_EGG)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Creature* whelp = me->SummonCreature(NPC_TWILIGHT_WHELP, summon->GetPosition(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000))
|
||||
{
|
||||
@@ -1176,12 +1055,10 @@ public:
|
||||
if (isCalledBySartharion && instance->GetBossState(DATA_SARTHARION) == IN_PROGRESS)
|
||||
{
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->AI()->JustSummoned(whelp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
@@ -1190,9 +1067,7 @@ public:
|
||||
RemoveTwilightPortal();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->DoAction(ACTION_CLEAR_PORTAL);
|
||||
}
|
||||
|
||||
EntryCheckPredicate pred(NPC_TWILIGHT_EGG);
|
||||
summons.DoAction(ACTION_SWITCH_PHASE, pred);
|
||||
@@ -1210,25 +1085,14 @@ public:
|
||||
private:
|
||||
SummonList summons2;
|
||||
};
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// SHADRON
|
||||
/////////////////////////////
|
||||
|
||||
class boss_sartharion_shadron : public CreatureScript
|
||||
struct boss_sartharion_shadron : public boss_sartharion_dragonAI
|
||||
{
|
||||
public:
|
||||
boss_sartharion_shadron() : CreatureScript("boss_sartharion_shadron") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const override
|
||||
{
|
||||
return GetObsidianSanctumAI<boss_sartharion_shadronAI>(pCreature);
|
||||
}
|
||||
|
||||
struct boss_sartharion_shadronAI : public boss_sartharion_dragonAI
|
||||
{
|
||||
boss_sartharion_shadronAI(Creature* pCreature) : boss_sartharion_dragonAI(pCreature, DATA_SHADRON)
|
||||
boss_sartharion_shadron(Creature* creature) : boss_sartharion_dragonAI(creature, DATA_SHADRON)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1240,21 +1104,17 @@ public:
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_OPEN_PORTAL, 15s);
|
||||
}
|
||||
|
||||
void SummonedCreatureDies(Creature* /*summon*/, Unit* /*summon*/) override
|
||||
void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) override
|
||||
{
|
||||
if (isCalledBySartharion)
|
||||
{
|
||||
// Acolytes are dead
|
||||
if (!summons.HasEntry(NPC_ACOLYTE_OF_SHADRON))
|
||||
{
|
||||
instance->DoAction(ACTION_CLEAR_PORTAL);
|
||||
}
|
||||
|
||||
if (Creature* sartharion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_SARTHARION)))
|
||||
{
|
||||
sartharion->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGHT_FIRE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearInstance();
|
||||
@@ -1282,9 +1142,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_BREATH:
|
||||
{
|
||||
if (!urand(0, 10))
|
||||
{
|
||||
Talk(SAY_SHADRON_BREATH);
|
||||
}
|
||||
|
||||
DoCastVictim(SPELL_SHADOW_BREATH, false);
|
||||
events.Repeat(17500ms);
|
||||
@@ -1293,9 +1151,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_FISSURE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
||||
{
|
||||
DoCast(target, SPELL_SHADOW_FISSURE, false);
|
||||
}
|
||||
events.Repeat(22500ms);
|
||||
break;
|
||||
}
|
||||
@@ -1306,14 +1162,10 @@ public:
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[DATA_SHADRON].GetPositionX(), portalPos[DATA_SHADRON].GetPositionY(), portalPos[DATA_SHADRON].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
portalGUID = Portal->GetGUID();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->DoAction(ACTION_ADD_PORTAL);
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2s);
|
||||
break;
|
||||
@@ -1325,7 +1177,7 @@ public:
|
||||
|
||||
if (Creature* acolyte = me->SummonCreature((isCalledBySartharion ? NPC_ACOLYTE_OF_SHADRON : NPC_DISCIPLE_OF_SHADRON), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()))
|
||||
{
|
||||
/// @todo: inpect JustSummoned
|
||||
/// @todo: inspect JustSummoned
|
||||
summons.Summon(acolyte);
|
||||
acolyte->SetPhaseMask(16, true);
|
||||
}
|
||||
@@ -1335,25 +1187,14 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
// VESPERON
|
||||
/////////////////////////////
|
||||
|
||||
class boss_sartharion_vesperon : public CreatureScript
|
||||
struct boss_sartharion_vesperon : public boss_sartharion_dragonAI
|
||||
{
|
||||
public:
|
||||
boss_sartharion_vesperon() : CreatureScript("boss_sartharion_vesperon") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const override
|
||||
{
|
||||
return GetObsidianSanctumAI<boss_sartharion_vesperonAI>(pCreature);
|
||||
}
|
||||
|
||||
struct boss_sartharion_vesperonAI : public boss_sartharion_dragonAI
|
||||
{
|
||||
boss_sartharion_vesperonAI(Creature* pCreature) : boss_sartharion_dragonAI(pCreature, DATA_VESPERON)
|
||||
boss_sartharion_vesperon(Creature* creature) : boss_sartharion_dragonAI(creature, DATA_VESPERON)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1368,9 +1209,7 @@ public:
|
||||
void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) override
|
||||
{
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
ClearInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION);
|
||||
@@ -1398,9 +1237,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_BREATH:
|
||||
{
|
||||
if (!urand(0, 10))
|
||||
{
|
||||
Talk(SAY_SHADRON_BREATH);
|
||||
}
|
||||
|
||||
DoCastVictim(SPELL_SHADOW_BREATH, false);
|
||||
events.Repeat(17s + 500ms);
|
||||
@@ -1409,9 +1246,7 @@ public:
|
||||
case EVENT_MINIBOSS_SHADOW_FISSURE:
|
||||
{
|
||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
||||
{
|
||||
DoCast(target, SPELL_SHADOW_FISSURE, false);
|
||||
}
|
||||
|
||||
events.Repeat(22s + 500ms);
|
||||
break;
|
||||
@@ -1423,14 +1258,10 @@ public:
|
||||
if (!isCalledBySartharion)
|
||||
{
|
||||
if (GameObject* Portal = me->GetVictim()->SummonGameObject(GO_TWILIGHT_PORTAL, portalPos[DATA_VESPERON].GetPositionX(), portalPos[DATA_VESPERON].GetPositionY(), portalPos[DATA_VESPERON].GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0))
|
||||
{
|
||||
portalGUID = Portal->GetGUID();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
instance->DoAction(ACTION_ADD_PORTAL);
|
||||
}
|
||||
|
||||
events.ScheduleEvent(EVENT_MINIBOSS_SPAWN_HELPERS, 2s);
|
||||
break;
|
||||
@@ -1460,22 +1291,11 @@ public:
|
||||
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_SARTHARION);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// other
|
||||
class npc_twilight_summon : public CreatureScript
|
||||
struct npc_twilight_summon : public ScriptedAI
|
||||
{
|
||||
public:
|
||||
npc_twilight_summon() : CreatureScript("npc_twilight_summon") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const override
|
||||
{
|
||||
return GetObsidianSanctumAI<npc_twilight_summonAI>(pCreature);
|
||||
}
|
||||
|
||||
struct npc_twilight_summonAI : public ScriptedAI
|
||||
{
|
||||
npc_twilight_summonAI(Creature* pCreature) : ScriptedAI(pCreature),
|
||||
npc_twilight_summon(Creature* creature) : ScriptedAI(creature),
|
||||
fadeArmorTimer(urand(0, 15000))
|
||||
{
|
||||
}
|
||||
@@ -1484,41 +1304,29 @@ public:
|
||||
{
|
||||
fadeArmorTimer = urand(0, 15000);
|
||||
if (me->GetEntry() == NPC_TWILIGHT_EGG)
|
||||
{
|
||||
me->SetControlled(true, UNIT_STATE_STUNNED);
|
||||
}
|
||||
else
|
||||
{
|
||||
me->SetInCombatWithZone();
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
{
|
||||
if (param == ACTION_SWITCH_PHASE)
|
||||
{
|
||||
me->DespawnOrUnsummon(1ms);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim() || me->GetEntry() == NPC_TWILIGHT_EGG)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fadeArmorTimer += diff;
|
||||
if (fadeArmorTimer >= 15000)
|
||||
{
|
||||
if (Aura* aur = me->GetVictim()->GetAura(SPELL_FADE_ARMOR))
|
||||
{
|
||||
aur->ModStackAmount(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoCastVictim(SPELL_FADE_ARMOR, false);
|
||||
}
|
||||
|
||||
fadeArmorTimer = 0;
|
||||
}
|
||||
@@ -1529,7 +1337,6 @@ public:
|
||||
private:
|
||||
uint32 fadeArmorTimer;
|
||||
};
|
||||
};
|
||||
|
||||
class spell_sartharion_lava_strike : public SpellScript
|
||||
{
|
||||
@@ -1549,9 +1356,7 @@ class spell_sartharion_lava_strike : public SpellScript
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (!GetCaster() || !GetHitUnit())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(GetHitUnit()->GetPositionX(), GetHitUnit()->GetPositionY(), GetHitUnit()->GetPositionZ(), SPELL_LAVA_STRIKE_DUMMY_TRIGGER, true);
|
||||
}
|
||||
@@ -1559,9 +1364,7 @@ class spell_sartharion_lava_strike : public SpellScript
|
||||
void HandleSchoolDamage(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (!GetCaster() || !GetHitUnit() || _spawned)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
{
|
||||
@@ -1577,14 +1380,10 @@ class spell_sartharion_lava_strike : public SpellScript
|
||||
void Register() override
|
||||
{
|
||||
if (m_scriptSpellId == SPELL_LAVA_STRIKE_DUMMY)
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sartharion_lava_strike::HandleSchoolDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool _spawned;
|
||||
@@ -1637,11 +1436,11 @@ class spell_obsidian_sanctum_flame_tsunami_leap : public SpellScript
|
||||
|
||||
void AddSC_boss_sartharion()
|
||||
{
|
||||
new boss_sartharion();
|
||||
new boss_sartharion_shadron();
|
||||
new boss_sartharion_tenebron();
|
||||
new boss_sartharion_vesperon();
|
||||
new npc_twilight_summon();
|
||||
RegisterObsidianSanctumCreatureAI(boss_sartharion);
|
||||
RegisterObsidianSanctumCreatureAI(boss_sartharion_shadron);
|
||||
RegisterObsidianSanctumCreatureAI(boss_sartharion_tenebron);
|
||||
RegisterObsidianSanctumCreatureAI(boss_sartharion_vesperon);
|
||||
RegisterObsidianSanctumCreatureAI(npc_twilight_summon);
|
||||
RegisterSpellScript(spell_sartharion_lava_strike);
|
||||
RegisterSpellScript(spell_obsidian_sanctum_flame_tsunami);
|
||||
RegisterSpellScript(spell_obsidian_sanctum_flame_tsunami_leap);
|
||||
|
||||
@@ -66,4 +66,6 @@ inline AI* GetObsidianSanctumAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, ObsidianSanctumScriptName);
|
||||
}
|
||||
|
||||
#define RegisterObsidianSanctumCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetObsidianSanctumAI)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user