fix(Scripts/TempleOfAhnQiraj): C'thun (#13153)

This commit is contained in:
Skjalf
2022-10-05 22:17:45 -03:00
committed by GitHub
parent fab614d709
commit 26017b645e
2 changed files with 108 additions and 54 deletions

View File

@@ -0,0 +1,11 @@
--
DELETE FROM `creature_template_movement` WHERE `creatureId` IN (21221, 15728, 15334, 15802, 15725, 15726);
INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`, `InteractionPauseTimer`) VALUES
(21221, 1, 0, 0, 1, 0, 0, 0),
(15728, 1, 0, 0, 1, 0, 0, 0),
(15334, 1, 0, 0, 1, 0, 0, 0),
(15802, 1, 0, 0, 1, 0, 0, 0),
(15725, 1, 0, 0, 1, 0, 0, 0),
(15726, 1, 0, 0, 1, 0, 0, 0);
UPDATE `creature_template` SET `unit_flags` = `unit_flags` |33554432 WHERE `entry` IN (15910, 15904, 15896);

View File

@@ -70,6 +70,7 @@ enum Spells
// Tentacles
SPELL_SUBMERGE_VISUAL = 26234,
SPELL_BIRTH = 26262,
SPELL_ROCKY_GROUND_IMPACT = 26271,
// Areatriggers
SPELL_SPIT_OUT = 25383,
@@ -186,9 +187,9 @@ struct boss_eye_of_cthun : public BossAI
void EnterCombat(Unit* who) override
{
DoZoneInCombat();
ScheduleTasks();
BossAI::EnterCombat(who);
_beamTarget = who->GetGUID();
}
void MoveInLineOfSight(Unit* who) override
@@ -222,11 +223,29 @@ struct boss_eye_of_cthun : public BossAI
_scheduler.
Schedule(3s, [this](TaskContext task)
{
DoCastRandomTarget(SPELL_GREEN_BEAM);
if (task.GetRepeatCounter() < 3)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, _beamTarget))
{
DoCast(target, SPELL_GREEN_BEAM);
}
task.Repeat();
}
else
{
_scheduler.Schedule(5s, [this](TaskContext task)
{
DoCastRandomTarget(SPELL_GREEN_BEAM);
task.SetGroup(GROUP_BEAM_PHASE);
task.Repeat(3s);
});
}
task.SetGroup(GROUP_BEAM_PHASE);
task.Repeat();
})
.Schedule(12s, [this](TaskContext task)
.Schedule(8s, [this](TaskContext task)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
{
@@ -324,48 +343,32 @@ struct boss_eye_of_cthun : public BossAI
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override
{
switch (instance->GetData(DATA_CTHUN_PHASE))
//Only if it will kill
if (damage < me->GetHealth())
return;
//Fake death in phase 0 or 1 (green beam or dark glare phase)
me->InterruptNonMeleeSpells(false);
//Remove Red coloration from c'thun
me->RemoveAurasDueToSpell(SPELL_RED_COLORATION);
//Reset to normal emote state and prevent select and attack
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Remove Target field
me->SetTarget();
me->SetHealth(0);
damage = 0;
me->InterruptNonMeleeSpells(true);
me->RemoveAllAuras();
_scheduler.CancelAll();
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
case PHASE_EYE_GREEN_BEAM:
case PHASE_EYE_RED_BEAM:
//Only if it will kill
if (damage < me->GetHealth())
return;
//Fake death in phase 0 or 1 (green beam or dark glare phase)
me->InterruptNonMeleeSpells(false);
//Remove Red coloration from c'thun
me->RemoveAurasDueToSpell(SPELL_RED_COLORATION);
//Reset to normal emote state and prevent select and attack
me->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
//Remove Target field
me->SetTarget();
me->SetHealth(0);
damage = 0;
me->InterruptNonMeleeSpells(true);
me->RemoveAllAuras();
_scheduler.CancelAll();
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->AI()->DoAction(ACTION_START_PHASE_TWO);
}
break;
case PHASE_CTHUN_DONE:
//Allow death here
return;
default:
//Prevent death in these phases
damage = 0;
return;
cthun->AI()->DoAction(ACTION_START_PHASE_TWO);
}
}
@@ -376,6 +379,7 @@ private:
bool ClockWise;
uint32 _eyeTentacleCounter;
ObjectGuid _beamTarget;
TaskScheduler _scheduler;
};
@@ -424,7 +428,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);
}
ScheduleTasks();
@@ -457,25 +461,27 @@ struct boss_cthun : public BossAI
}
context.Repeat(30s);
}).Schedule(15s, [this](TaskContext context)
}).Schedule(8s, [this](TaskContext context)
{
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 (spawned->AI())
spawned->AI()->AttackStart(target);
{
spawned->AI()->AttackStart(target);
}
}
context.Repeat(1min);
}).Schedule(15s, [this](TaskContext context)
}).Schedule(38s, [this](TaskContext context)
{
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 (spawned->AI())
spawned->AI()->AttackStart(target);
{
spawned->AI()->AttackStart(target);
}
}
context.Repeat(1min);
@@ -536,6 +542,8 @@ struct boss_cthun : public BossAI
{
++_fleshTentaclesKilled;
creature->CastSpell(creature, SPELL_ROCKY_GROUND_IMPACT, true);
if (_fleshTentaclesKilled > 1)
{
_scheduler.CancelAll();
@@ -580,6 +588,14 @@ struct npc_eye_tentacle : public ScriptedAI
{
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
SetCombatMovement(false);
@@ -643,6 +659,14 @@ struct npc_claw_tentacle : public ScriptedAI
{
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -702,6 +726,14 @@ struct npc_giant_claw_tentacle : public ScriptedAI
{
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -835,6 +867,14 @@ struct npc_giant_eye_tentacle : public ScriptedAI
{
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -931,9 +971,12 @@ public:
bool OnTrigger(Player* player, AreaTrigger const* /*at*/) override
{
if (Creature* trigger = player->FindNearestCreature(NPC_TRIGGER, 15.0f))
if (InstanceScript* instance = player->GetInstanceScript())
{
trigger->CastSpell(player, SPELL_SPIT_OUT, true);
if (Creature* cthun = instance->GetCreature(DATA_CTHUN))
{
cthun->CastSpell(player, SPELL_SPIT_OUT, true);
}
}
return true;