From 6263a0a8a56b7b65de6a788e02cb41a2b095b280 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Sat, 15 Oct 2022 12:14:57 -0300 Subject: [PATCH] fix(Scripts/TempleOfAhnQiraj): Fix double spawns during Cthun phase 2 and several other fixes (#13413) * fix(Scripts/TempleOfAhnQiraj): Fix double spawns during Cthun phase 2 * Update boss_cthun.cpp * dont teleport if you move away from the teleport pad * clear events * prevent portals from chasing pets * fix the jump tele timer * update eye combat reach * delay the transition slightly * Update boss_cthun.cpp * Update boss_cthun.cpp * make exit trigger cast rubble rocky * Update boss_cthun.cpp * fix tentacle animations * Update rev_1665784753998414100.sql * eye tentacle animations * only spit out if alive * Update rev_1665784753998414100.sql * Update rev_1665784753998414100.sql --- .../rev_1665784753998414100.sql | 4 + .../Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 78 ++++++++++--------- 2 files changed, 46 insertions(+), 36 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1665784753998414100.sql diff --git a/data/sql/updates/pending_db_world/rev_1665784753998414100.sql b/data/sql/updates/pending_db_world/rev_1665784753998414100.sql new file mode 100644 index 000000000..c5a9fcbb8 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1665784753998414100.sql @@ -0,0 +1,4 @@ +-- +UPDATE `creature_template` SET `unit_flags` = `unit_flags` |256|512 WHERE `entry` IN (15910, 15904, 15896); +UPDATE `creature_model_info` SET `CombatReach` = 15 WHERE `displayID` IN (15556, 15790, 15793); +UPDATE `creature_summon_groups` SET `summonType` = 6, `summonTime` = 500 WHERE `summonerId` = 15589 AND `summonerType` = 0; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index b0e57f64d..a5e3efe93 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -102,6 +102,7 @@ enum Misc { MAX_TENTACLE_GROUPS = 5, NPC_TRIGGER = 15384, + NPC_EXIT_TRIGGER = 15800 }; enum Yells @@ -260,7 +261,7 @@ struct boss_eye_of_cthun : public BossAI { if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true)) { - if (Creature* tentacle = me->SummonCreature(NPC_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 1000)) + if (Creature* tentacle = me->SummonCreature(NPC_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { tentacle->AI()->AttackStart(target); } @@ -310,17 +311,9 @@ struct boss_eye_of_cthun : public BossAI me->SetTarget(ObjectGuid::Empty); me->StopMoving(); - if (ClockWise) - { - me->SetFacingTo(DarkGlareAngle + DarkGlareTick * float(M_PI) / 35); - me->SetOrientation(DarkGlareAngle + DarkGlareTick * float(M_PI) / 35); - - } - else - { - me->SetFacingTo(DarkGlareAngle - DarkGlareTick * float(M_PI) / 35); - me->SetOrientation(DarkGlareAngle - DarkGlareTick * float(M_PI) / 35); - } + float angle = ClockWise ? DarkGlareAngle + DarkGlareTick * float(M_PI) / 35 : DarkGlareAngle - DarkGlareTick * float(M_PI) / 35; + me->SetFacingTo(angle); + me->SetOrientation(angle); DoCastSelf(SPELL_DARK_GLARE); @@ -354,7 +347,7 @@ struct boss_eye_of_cthun : public BossAI void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override { //Only if it will kill - if (damage < me->GetHealth()) + if (damage < me->GetHealth() || !me->GetHealth()) return; //Fake death in phase 0 or 1 (green beam or dark glare phase) @@ -376,10 +369,13 @@ struct boss_eye_of_cthun : public BossAI me->RemoveAllAuras(); _scheduler.CancelAll(); - if (Creature* cthun = instance->GetCreature(DATA_CTHUN)) + me->m_Events.AddEventAtOffset([this]() { - cthun->AI()->DoAction(ACTION_START_PHASE_TWO); - } + if (Creature* cthun = instance->GetCreature(DATA_CTHUN)) + { + cthun->AI()->DoAction(ACTION_START_PHASE_TWO); + } + }, 3s); } private: @@ -476,7 +472,7 @@ struct boss_cthun : public BossAI if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID)) { //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(NPC_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (Creature* spawned = me->SummonCreature(NPC_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { spawned->AI()->AttackStart(target); } @@ -488,7 +484,7 @@ struct boss_cthun : public BossAI if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true, -SPELL_DIGESTIVE_ACID)) { //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(NPC_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (Creature* spawned = me->SummonCreature(NPC_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { spawned->AI()->AttackStart(target); } @@ -579,7 +575,7 @@ struct boss_cthun : public BossAI //Spawn flesh tentacle for (uint8 i = 0; i < 2; i++) { - me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); } }); } @@ -985,30 +981,37 @@ public: { if (Creature* cthun = instance->GetCreature(DATA_CTHUN)) { - player->CastSpell(player, SPELL_RUBBLE_ROCKY, true); - - player->m_Events.AddEventAtOffset([player]() + if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f)) { - if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f)) + trigger->CastSpell(player, SPELL_EXIT_STOMACH, true); + + if (Creature* exittrigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 15.0f)) { - trigger->CastSpell(player, SPELL_EXIT_STOMACH, true); + exittrigger->CastSpell(player, SPELL_RUBBLE_ROCKY, true); } - }, 3s); - - player->m_Events.AddEventAtOffset([player]() - { - player->JumpTo(0.0f, 80.0f, false); - }, 5s); + } player->m_Events.AddEventAtOffset([player, cthun]() { - if (cthun) + if (Creature* trigger = player->FindNearestCreature(NPC_EXIT_TRIGGER, 10.0f)) { - player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6)); - } + player->JumpTo(0.0f, 80.0f, false); - player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); - }, 6s); + player->m_Events.AddEventAtOffset([player, cthun]() + { + if (cthun) + { + player->NearTeleportTo(cthun->GetPositionX(), cthun->GetPositionY(), cthun->GetPositionZ() + 10, float(rand32() % 6)); + } + + player->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + }, 1s); + } + else + { + player->m_Events.KillAllEvents(false); + } + }, 3s); } } @@ -1027,7 +1030,10 @@ public: { if (Creature* cthun = instance->GetCreature(DATA_CTHUN)) { - cthun->CastSpell(player, SPELL_SPIT_OUT, true); + if (cthun->IsAlive()) + { + cthun->CastSpell(player, SPELL_SPIT_OUT, true); + } } }