fix(Scripts/IcecrownCitadel): Fix Sindragosa's icewall poping up prem… (#15836)

fix(Scripts/IcecrownCitadel): Fix Sindragosa's icewall poping up prematurely
This commit is contained in:
Skjalf
2023-04-05 16:36:18 -03:00
committed by GitHub
parent 98e071157a
commit 67dd96e502
2 changed files with 26 additions and 10 deletions

View File

@@ -282,6 +282,7 @@ public:
_didFirstFlyPhase = false; _didFirstFlyPhase = false;
_isBelow20Pct = false; _isBelow20Pct = false;
_isThirdPhase = false; _isThirdPhase = false;
_isLanding = false;
_bombCount = 0; _bombCount = 0;
_mysticBuffetStack = 0; _mysticBuffetStack = 0;
_Reset(); _Reset();
@@ -365,15 +366,16 @@ public:
void DoAction(int32 action) override void DoAction(int32 action) override
{ {
if (action == ACTION_START_FROSTWYRM) if (action == ACTION_START_FROSTWYRM && !_isLanding)
{ {
_isLanding = true;
if (TempSummon* summon = me->ToTempSummon()) if (TempSummon* summon = me->ToTempSummon())
summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN);
if (me->isDead()) if (me->isDead())
return; return;
instance->SetBossState(DATA_SINDRAGOSA, IN_PROGRESS);
me->setActive(true); me->setActive(true);
me->SetDisableGravity(true); me->SetDisableGravity(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE); me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
@@ -673,6 +675,7 @@ public:
bool _isBelow20Pct; bool _isBelow20Pct;
bool _isThirdPhase; bool _isThirdPhase;
bool _isInAirPhase; bool _isInAirPhase;
bool _isLanding;
}; };
CreatureAI* GetAI(Creature* creature) const override CreatureAI* GetAI(Creature* creature) const override

View File

@@ -116,6 +116,11 @@ DoorData const doorData[] =
{0, 0, DOOR_TYPE_ROOM } {0, 0, DOOR_TYPE_ROOM }
}; };
ObjectData const creatureData[] =
{
{ NPC_SINDRAGOSA, DATA_SINDRAGOSA }
};
// this doesnt have to only store questgivers, also can be used for related quest spawns // this doesnt have to only store questgivers, also can be used for related quest spawns
struct WeeklyQuest struct WeeklyQuest
{ {
@@ -203,6 +208,7 @@ public:
SetBossNumber(MAX_ENCOUNTERS); SetBossNumber(MAX_ENCOUNTERS);
SetPersistentDataCount(MAX_DATA_INDEXES); SetPersistentDataCount(MAX_DATA_INDEXES);
LoadBossBoundaries(boundaries); LoadBossBoundaries(boundaries);
LoadObjectData(creatureData, nullptr);
LoadDoorData(doorData); LoadDoorData(doorData);
TeamIdInInstance = TEAM_NEUTRAL; TeamIdInInstance = TEAM_NEUTRAL;
HeroicAttempts = MaxHeroicAttempts; HeroicAttempts = MaxHeroicAttempts;
@@ -257,7 +263,7 @@ public:
if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE && GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != DONE) if (GetBossState(DATA_LADY_DEATHWHISPER) == DONE && GetBossState(DATA_ICECROWN_GUNSHIP_BATTLE) != DONE)
SpawnGunship(); SpawnGunship();
if (GetBossState(DATA_SINDRAGOSA) != DONE && IsSindragosaIntroDone && SindragosaGUID.IsEmpty() && Events.GetTimeUntilEvent(EVENT_RESPAWN_SINDRAGOSA) == Milliseconds::max()) if (GetBossState(DATA_SINDRAGOSA) != DONE && IsSindragosaIntroDone && !GetCreature(DATA_SINDRAGOSA) && Events.GetTimeUntilEvent(EVENT_RESPAWN_SINDRAGOSA) == Milliseconds::max())
{ {
Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s); Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s);
} }
@@ -518,12 +524,16 @@ public:
default: default:
break; break;
} }
InstanceScript::OnCreatureCreate(creature);
} }
void OnCreatureRemove(Creature* creature) override void OnCreatureRemove(Creature* creature) override
{ {
if (creature->GetEntry() == NPC_SINDRAGOSA) if (creature->GetEntry() == NPC_SINDRAGOSA)
SindragosaGUID.Clear(); SindragosaGUID.Clear();
InstanceScript::OnCreatureRemove(creature);
} }
uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
@@ -1764,15 +1774,18 @@ public:
SpawnGunship(); SpawnGunship();
break; break;
case EVENT_RESPAWN_SINDRAGOSA: case EVENT_RESPAWN_SINDRAGOSA:
if (Creature* sindragosa = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos)) if (!GetCreature(DATA_SINDRAGOSA))
{ {
sindragosa->setActive(true); if (Creature* sindragosa = instance->SummonCreature(NPC_SINDRAGOSA, SindragosaSpawnPos))
sindragosa->SetDisableGravity(true);
sindragosa->GetMotionMaster()->MovePath(NPC_SINDRAGOSA * 10, true);
if (TempSummon* summon = sindragosa->ToTempSummon())
{ {
summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN); sindragosa->setActive(true);
sindragosa->SetDisableGravity(true);
sindragosa->GetMotionMaster()->MovePath(NPC_SINDRAGOSA * 10, true);
if (TempSummon* summon = sindragosa->ToTempSummon())
{
summon->SetTempSummonType(TEMPSUMMON_DEAD_DESPAWN);
}
} }
} }
// Could happen more than once if more than one player enters before she respawns. // Could happen more than once if more than one player enters before she respawns.