Core/Scripts: dynamic_spawning follow-up, I had forgotten JustRespawned existed.

- Rename JustRespawned to JustAppeared, which better matches its behavior anyway.
- Properly invoke JustAppeared for new (re-)spawns - fixes #20111.
- Fix Thaddius script to work with dynamic_spawning (mostly unrelated to the above) - Feugen/Stalagg should really be a summon group, but I don't have time to fix that right now.
- Fix default value for DynamicEscortNPC to match worldserver.conf.dist.
This commit is contained in:
Treeston
2017-08-06 16:07:15 +02:00
parent dbda060ae7
commit 184c45cfe0
25 changed files with 54 additions and 91 deletions

View File

@@ -107,7 +107,7 @@ class npc_av_marshal_or_warmaster : public CreatureScript
events.ScheduleEvent(EVENT_CHECK_RESET, 5000);
}
void JustRespawned() override
void JustAppeared() override
{
Reset();
}

View File

@@ -71,7 +71,7 @@ public:
events.ScheduleEvent(EVENT_RANDOM_YELL, urand(20 * IN_MILLISECONDS, 30 * IN_MILLISECONDS)); //20 to 30 seconds
}
void JustRespawned() override
void JustAppeared() override
{
Reset();
Talk(SAY_RESPAWN);

View File

@@ -186,7 +186,7 @@ public:
Talk(YELL_KILL);
}
void JustRespawned() override
void JustAppeared() override
{
Talk(YELL_BIRTH);
}

View File

@@ -188,12 +188,12 @@ public:
Initialize();
}
void JustRespawned() override
void JustAppeared() override
{
_IsByOutrunner = false;
spawnId = 0;
npc_escortAI::JustRespawned();
npc_escortAI::JustAppeared();
}
void EnterCombat(Unit* who) override

View File

@@ -297,9 +297,9 @@ public:
Initialize();
}
void JustRespawned() override
void JustAppeared() override
{
BossAI::JustRespawned();
BossAI::JustAppeared();
Initialize();
}

View File

@@ -163,9 +163,9 @@ class boss_krik_thir : public CreatureScript
SummonAdds();
}
void JustRespawned() override
void JustAppeared() override
{
BossAI::JustRespawned();
BossAI::JustAppeared();
SummonAdds();
}

View File

@@ -566,7 +566,7 @@ class npc_halion_controller : public CreatureScript
_twilightDamageTaken = 0;
}
void JustRespawned() override
void JustAppeared() override
{
if (_instance->GetGuidData(DATA_HALION) || _instance->GetBossState(DATA_GENERAL_ZARITHRIAN) != DONE)
return;

View File

@@ -445,7 +445,7 @@ struct BloodPrincesBossAI : public BossAI
{
_spawnHealth = 1;
if (!me->isDead())
JustRespawned();
JustAppeared();
}
void Reset() override
@@ -493,7 +493,7 @@ struct BloodPrincesBossAI : public BossAI
}
}
void JustRespawned() override
void JustAppeared() override
{
if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BLOOD_PRINCES_CONTROL)))
if (controller->AI()->GetData(DATA_INTRO) != DATA_INTRO_DONE)

View File

@@ -688,9 +688,9 @@ class npc_spinestalker : public CreatureScript
}
}
void JustRespawned() override
void JustAppeared() override
{
ScriptedAI::JustRespawned();
ScriptedAI::JustAppeared();
_instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
}
@@ -825,9 +825,9 @@ class npc_rimefang : public CreatureScript
}
}
void JustRespawned() override
void JustAppeared() override
{
ScriptedAI::JustRespawned();
ScriptedAI::JustAppeared();
_instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, me->GetSpawnId()); // this cannot be in Reset because reset also happens on evade
}
@@ -991,9 +991,9 @@ class npc_sindragosa_trash : public CreatureScript
Initialize();
}
void JustRespawned() override
void JustAppeared() override
{
ScriptedAI::JustRespawned();
ScriptedAI::JustAppeared();
// Increase add count
if (me->GetEntry() == NPC_FROSTWING_WHELP)

View File

@@ -31,15 +31,12 @@ enum Phases
PHASE_NOT_ENGAGED = 1,
PHASE_PETS,
PHASE_TRANSITION,
PHASE_THADDIUS,
PHASE_RESETTING
PHASE_THADDIUS
};
enum AIActions
{
ACTION_RESET_ENCOUNTER_TIMER = -1, // sent from instance AI
ACTION_BEGIN_RESET_ENCOUNTER = 0, // sent from thaddius to pets to trigger despawn and encounter reset
ACTION_RESET_ENCOUNTER, // sent from thaddius to pets to trigger respawn and full reset
ACTION_FEUGEN_DIED, // sent from respective pet to thaddius to indicate death
ACTION_STALAGG_DIED, // ^
ACTION_FEUGEN_RESET, // pet to thaddius
@@ -171,9 +168,6 @@ struct boss_thaddius : public BossAI
{
events.SetPhase(PHASE_NOT_ENGAGED);
SetCombatMovement(false);
// initialize everything properly, and ensure that the coils are loaded by the time we initialize
BeginResetEncounter(true);
}
}
@@ -204,9 +198,9 @@ struct boss_thaddius : public BossAI
return false;
}
void JustRespawned() override
void JustAppeared() override
{
if (events.IsInPhase(PHASE_RESETTING))
if (instance->GetBossState(BOSS_THADDIUS) != DONE)
ResetEncounter();
}
@@ -225,22 +219,13 @@ struct boss_thaddius : public BossAI
{
switch (action)
{
case ACTION_RESET_ENCOUNTER_TIMER:
if (events.IsInPhase(PHASE_RESETTING))
ResetEncounter();
break;
case ACTION_FEUGEN_RESET:
case ACTION_STALAGG_RESET:
if (!events.IsInPhase(PHASE_NOT_ENGAGED) && !events.IsInPhase(PHASE_RESETTING))
if (!events.IsInPhase(PHASE_NOT_ENGAGED))
BeginResetEncounter();
break;
case ACTION_FEUGEN_AGGRO:
case ACTION_STALAGG_AGGRO:
if (events.IsInPhase(PHASE_RESETTING))
{
BeginResetEncounter();
return;
}
if (!events.IsInPhase(PHASE_NOT_ENGAGED))
return;
events.SetPhase(PHASE_PETS);
@@ -306,29 +291,24 @@ struct boss_thaddius : public BossAI
events.ScheduleEvent(EVENT_TRANSITION_3, Seconds(14), 0, PHASE_TRANSITION);
}
void BeginResetEncounter(bool initial = false)
void BeginResetEncounter()
{
if (instance->GetBossState(BOSS_THADDIUS) == DONE)
return;
if (events.IsInPhase(PHASE_RESETTING))
return;
// remove polarity shift debuffs on reset
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSITIVE_CHARGE_APPLY);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_NEGATIVE_CHARGE_APPLY);
me->DespawnOrUnsummon();
me->SetRespawnTime(initial ? 5 : 30);
me->DespawnOrUnsummon(0, Seconds(30));
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);
me->SetImmuneToPC(true);
events.SetPhase(PHASE_RESETTING);
me->setActive(false);
if (Creature* feugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN)))
feugen->AI()->DoAction(ACTION_BEGIN_RESET_ENCOUNTER);
if (Creature* stalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG)))
stalagg->AI()->DoAction(ACTION_BEGIN_RESET_ENCOUNTER);
me->setActive(false);
}
void ResetEncounter()
@@ -340,10 +320,9 @@ struct boss_thaddius : public BossAI
events.SetPhase(PHASE_NOT_ENGAGED);
me->SetReactState(REACT_PASSIVE);
if (Creature* feugen = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_FEUGEN)))
feugen->AI()->DoAction(ACTION_RESET_ENCOUNTER);
if (Creature* stalagg = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_STALAGG)))
stalagg->AI()->DoAction(ACTION_RESET_ENCOUNTER);
// @todo these guys should really be moved to a summon group - this is merely a hack to make them work in dynamic_spawning
instance->instance->RemoveRespawnTime(SPAWN_TYPE_CREATURE, 130958, true); // Stalagg
instance->instance->RemoveRespawnTime(SPAWN_TYPE_CREATURE, 130959, true); // Feugen
}
void UpdateAI(uint32 diff) override
@@ -515,7 +494,7 @@ public:
{
if (GameObject* coil = myCoilGO())
coil->SetGoState(GO_STATE_READY);
me->DespawnOrUnsummon();
me->DespawnOrUnsummon(0, Hours(24*7)); // will be force respawned by thaddius
me->setActive(false);
}
@@ -532,9 +511,6 @@ public:
case ACTION_BEGIN_RESET_ENCOUNTER:
BeginResetEncounter();
break;
case ACTION_RESET_ENCOUNTER:
ResetEncounter();
break;
case ACTION_STALAGG_REVIVING_FX:
break;
case ACTION_STALAGG_REVIVED:
@@ -559,7 +535,7 @@ public:
break;
case ACTION_TRANSITION:
me->KillSelf(); // true death
me->DespawnOrUnsummon();
me->DespawnOrUnsummon(0, Hours(24*7));
if (Creature* coil = myCoil())
{
@@ -781,16 +757,10 @@ public:
{
if (GameObject* coil = myCoilGO())
coil->SetGoState(GO_STATE_READY);
me->DespawnOrUnsummon();
me->DespawnOrUnsummon(0, Hours(24*7)); // will be force respawned by thaddius
me->setActive(false);
}
void ResetEncounter()
{
me->Respawn(true);
Initialize();
}
void DoAction(int32 action) override
{
switch (action)
@@ -798,9 +768,6 @@ public:
case ACTION_BEGIN_RESET_ENCOUNTER:
BeginResetEncounter();
break;
case ACTION_RESET_ENCOUNTER:
ResetEncounter();
break;
case ACTION_FEUGEN_REVIVING_FX:
break;
case ACTION_FEUGEN_REVIVED:
@@ -827,7 +794,7 @@ public:
break;
case ACTION_TRANSITION:
me->KillSelf(); // true death this time around
me->DespawnOrUnsummon();
me->DespawnOrUnsummon(0, Hours(24*7));
if (Creature* coil = myCoil())
{

View File

@@ -211,7 +211,7 @@ public:
me->CastSpell(me, SPELL_ICE_PRISON, true);
}
void JustRespawned() override
void JustAppeared() override
{
Reset();
}

View File

@@ -924,7 +924,7 @@ public:
me->CastSpell(me, STORM_VISUAL, true);
}
void JustRespawned() override
void JustAppeared() override
{
Reset();
}

View File

@@ -738,7 +738,7 @@ public:
instance->SetGuidData(DATA_LEOTHERAS_EVENT_STARTER, who->GetGUID());
}
void JustRespawned() override
void JustAppeared() override
{
AddedBanish = false;
Reset();

View File

@@ -83,7 +83,7 @@ class boss_doomlord_kazzak : public CreatureScript
_events.ScheduleEvent(EVENT_BERSERK, 180000);
}
void JustRespawned() override
void JustAppeared() override
{
Talk(SAY_INTRO);
}