diff --git a/data/sql/updates/pending_db_world/rev_1665274040139039300.sql b/data/sql/updates/pending_db_world/rev_1665274040139039300.sql new file mode 100644 index 000000000..eab898bd5 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1665274040139039300.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_cthun_dark_glare'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(26029, 'spell_cthun_dark_glare'); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 6ae7c72bf..0a5bba9e7 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "Player.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellScript.h" #include "TaskScheduler.h" #include "temple_of_ahnqiraj.h" @@ -273,6 +274,9 @@ struct boss_eye_of_cthun : public BossAI me->InterruptNonMeleeSpells(false); me->SetTarget(ObjectGuid::Empty); + //Freeze animation + DoCast(me, SPELL_FREEZE_ANIM, true); + _scheduler.Schedule(1s, [this](TaskContext /*task*/) { //Select random target for dark beam to start on @@ -283,14 +287,9 @@ struct boss_eye_of_cthun : public BossAI DarkGlareTick = 0; ClockWise = RAND(true, false); - me->SetTarget(target->GetGUID()); - //Add red coloration to C'thun DoCast(me, SPELL_RED_COLORATION, true); - //Freeze animation - DoCast(me, SPELL_FREEZE_ANIM, true); - me->StopMoving(); me->SetFacingToObject(target); me->SetOrientation(DarkGlareAngle); @@ -927,6 +926,22 @@ private: ObjectGuid _portalGUID; }; +class spell_cthun_dark_glare : public SpellScript +{ + PrepareSpellScript(spell_cthun_dark_glare); + + void FilterTargets(std::list& targets) + { + Unit* caster = GetCaster(); + targets.remove_if([caster](WorldObject const* target) { return !caster->HasInLine(target, 5.0f); }); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_cthun_dark_glare::FilterTargets, EFFECT_ALL, TARGET_UNIT_CONE_ENEMY_24); + } +}; + // 4033 - At C'thun's stomach class at_cthun_stomach_exit : public AreaTriggerScript { @@ -997,6 +1012,7 @@ void AddSC_boss_cthun() RegisterTempleOfAhnQirajCreatureAI(npc_claw_tentacle); RegisterTempleOfAhnQirajCreatureAI(npc_giant_claw_tentacle); RegisterTempleOfAhnQirajCreatureAI(npc_giant_eye_tentacle); + RegisterSpellScript(spell_cthun_dark_glare); new at_cthun_stomach_exit(); new at_cthun_center(); }