diff --git a/data/sql/updates/pending_db_world/rev_1676992538163701600.sql b/data/sql/updates/pending_db_world/rev_1676992538163701600.sql new file mode 100644 index 000000000..c1312cf12 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1676992538163701600.sql @@ -0,0 +1,2 @@ +-- Ahn'kahet: The Old Kingdom - Jedoga Shadowseeker +DELETE FROM `spell_script_names` WHERE `spell_id`=56150 AND `ScriptName`='spell_jedoga_sacrafice_beam'; diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index ac0277874..9416b371f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -69,6 +69,7 @@ enum Events EVENT_JEDOGA_PREPARE_RITUAL, EVENT_JEDOGA_MOVE_UP, EVENT_JEDOGA_MOVE_DOWN, + EVENT_JEDGA_START_RITUAL, // Initiate EVENT_RITUAL_BEGIN_MOVE, @@ -384,11 +385,9 @@ struct boss_jedoga_shadowseeker : public BossAI if (!summons.empty()) { sacraficeTarget_GUID = Acore::Containers::SelectRandomContainerElement(summons); - if (Creature* volunteer = ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID)) + if (ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID)) { - Talk(SAY_SACRIFICE_1); - sacraficeTarget_GUID = volunteer->GetGUID(); - volunteer->AI()->DoAction(ACTION_RITUAL_BEGIN); + events.ScheduleEvent(EVENT_JEDGA_START_RITUAL, 3s, 0, PHASE_RITUAL); } // Something failed, let players continue but do not grant achievement else @@ -506,6 +505,17 @@ struct boss_jedoga_shadowseeker : public BossAI me->GetMotionMaster()->MovePoint(POINT_DOWN, JedogaPosition[1], false); break; } + case EVENT_JEDGA_START_RITUAL: + { + sacraficeTarget_GUID = Acore::Containers::SelectRandomContainerElement(summons); + if (Creature* volunteer = ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID)) + { + Talk(SAY_SACRIFICE_1); + sacraficeTarget_GUID = volunteer->GetGUID(); + volunteer->AI()->DoAction(ACTION_RITUAL_BEGIN); + } + break; + } } } @@ -632,12 +642,8 @@ struct npc_twilight_volunteer : public ScriptedAI if (Creature* jedoga = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER))) { jedoga->AI()->Talk(SAY_SACRIFICE_2); - jedoga->CastSpell(nullptr, SPELL_SACRIFICE_BEAM); - - if (Creature* ritualTrigger = jedoga->SummonCreature(NPC_JEDOGA_CONTROLLER, JedogaPosition[2], TEMPSUMMON_TIMED_DESPAWN, 5000)) - { - ritualTrigger->CastSpell(ritualTrigger, SPELL_SACRIFICE_VISUAL); - } + jedoga->CastSpell(nullptr, SPELL_SACRIFICE_BEAM); /// @todo: Visual is not working. (cosmetic) + jedoga->AI()->DoAction(ACTION_SACRAFICE); } Talk(SAY_SACRIFICED); @@ -656,6 +662,14 @@ struct npc_twilight_volunteer : public ScriptedAI me->SetHomePosition(JedogaPosition[2]); me->SetWalk(true); me->GetMotionMaster()->MovePoint(POINT_RITUAL, JedogaPosition[2], false); + + if (Creature* jedoga = ObjectAccessor::GetCreature(*me, pInstance->GetGuidData(DATA_JEDOGA_SHADOWSEEKER))) + { + if (Creature* ritualTrigger = jedoga->SummonCreature(NPC_JEDOGA_CONTROLLER, JedogaPosition[2], TEMPSUMMON_TIMED_DESPAWN, 15000)) + { + ritualTrigger->CastSpell(ritualTrigger, SPELL_SACRIFICE_VISUAL); + } + } } } @@ -688,31 +702,6 @@ class spell_random_lightning_visual_effect : public SpellScript } }; -// 56150 - Sacrifice Beam -class spell_jedoga_sacrafice_beam : public AuraScript -{ - PrepareAuraScript(spell_jedoga_sacrafice_beam); - - bool Load() override - { - return GetCaster()->GetTypeId() == TYPEID_UNIT; - } - - void HandleRemoval(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - AuraRemoveMode const removeMode = GetTargetApplication()->GetRemoveMode(); - if (removeMode == AURA_REMOVE_BY_DEFAULT || removeMode == AURA_REMOVE_BY_EXPIRE) - { - GetCaster()->ToCreature()->AI()->DoAction(ACTION_SACRAFICE); - } - } - - void Register() override - { - AfterEffectRemove += AuraEffectRemoveFn(spell_jedoga_sacrafice_beam::HandleRemoval, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL, AURA_EFFECT_HANDLE_REAL); - } -}; - // CriteriaID 7359, Volunteer Work (2056) class achievement_volunteer_work : public AchievementCriteriaScript { @@ -740,7 +729,6 @@ void AddSC_boss_jedoga_shadowseeker() // Spells RegisterSpellScript(spell_random_lightning_visual_effect); - RegisterSpellScript(spell_jedoga_sacrafice_beam); // Achievements new achievement_volunteer_work();