fix(Script/Ahnkahet): Jedoga Shadowseeke sacrifice (#15153)

* fix(Script/Instance): Jedoga Shadowseeke sacrifice

* build

* std::chrono
This commit is contained in:
avarishd
2023-04-09 21:57:04 +03:00
committed by GitHub
parent 65347bc8ad
commit 421f0644cd
2 changed files with 26 additions and 36 deletions

View File

@@ -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();