aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvah <dreadkiller@gmx.de>2019-12-06 07:37:34 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-19 01:05:59 +0100
commit04ed6e292cf762bac696f69f0f31de7fe3d510e0 (patch)
tree1862f96cd992ea017ea3acc372812e0a1cdff314
parent321ebc745ee9034676d8dbb9af91676422b6059a (diff)
Scripts/ScarletEnclave: reworked Eye of Acherus script (#23953)
* updated script model to new standard * corrected spell usage and timers based on sniff data * removed hacks (cherry picked from commit 60763fc5e2d7bb32150d8e03bfd0fb3e7cb890f3)
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp197
1 files changed, 94 insertions, 103 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index 4b41627b8c3..517882927e0 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -400,134 +400,125 @@ class spell_death_knight_initiate_visual : public SpellScript
}
};
- /*######
+/*######
## npc_eye_of_acherus
######*/
enum EyeOfAcherusMisc
{
- SPELL_THE_EYE_OF_ACHERUS = 51852,
- SPELL_EYE_VISUAL = 51892,
- SPELL_EYE_FLIGHT_BOOST = 51923,
- SPELL_EYE_FLIGHT = 51890,
+ SPELL_THE_EYE_OF_ACHERUS = 51852,
+ SPELL_EYE_OF_ACHERUS_VISUAL = 51892,
+ SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST = 51923,
+ SPELL_EYE_OF_ACHERUS_FLIGHT = 51890,
+ SPELL_ROOT_SELF = 51860,
- EVENT_MOVE_START = 1,
+ EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION = 1,
+ EVENT_UNROOT = 2,
+ EVENT_LAUNCH_TOWARDS_DESTINATION = 3,
+ EVENT_GRANT_CONTROL = 4,
- TALK_MOVE_START = 0,
- TALK_CONTROL = 1,
+ SAY_LAUNCH_TOWARDS_DESTINATION = 0,
+ SAY_EYE_UNDER_CONTROL = 1,
- POINT_EYE_FALL = 1,
- POINT_EYE_MOVE_END = 3
+ POINT_NEW_AVALON = 1
};
-Position const EyeOFAcherusFallPoint = { 2361.21f, -5660.45f, 496.7444f, 0.0f };
-
-G3D::Vector3 const EyeOfAcherusPath[] =
+static constexpr uint8 const EyeOfAcherusPathSize = 4;
+G3D::Vector3 const EyeOfAcherusPath[EyeOfAcherusPathSize] =
{
- { 2361.21f, -5660.45f, 496.744f },
- { 2341.57f, -5672.8f, 538.394f },
- { 1957.4f, -5844.1f, 273.867f },
- { 1758.01f, -5876.79f, 166.867f }
+ { 2361.21f, -5660.45f, 496.744f },
+ { 2341.571f, -5672.797f, 538.3942f },
+ { 1957.4f, -5844.1f, 273.867f },
+ { 1758.01f, -5876.79f, 166.867f }
};
-std::size_t constexpr EyeOfAcherusPathSize = std::extent<decltype(EyeOfAcherusPath)>::value;
-class npc_eye_of_acherus : public CreatureScript
+struct npc_eye_of_acherus : public ScriptedAI
{
- public:
- npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { }
-
- struct npc_eye_of_acherusAI : public ScriptedAI
- {
- npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature)
- {
- creature->SetDisplayFromModel(0);
- creature->SetReactState(REACT_PASSIVE);
- creature->SetDisableGravity(true);
- creature->SetControlled(true, UNIT_STATE_ROOT);
-
- if (creature->GetCharmInfo())
- creature->GetCharmInfo()->InitPossessCreateSpells();
- }
-
- void JustAppeared() override
- {
- ScriptedAI::JustAppeared();
-
- DoCastSelf(SPELL_EYE_VISUAL);
- DoCastSelf(SPELL_EYE_FLIGHT);
-
- Movement::MoveSplineInit init(me);
- init.MoveTo(PositionToVector3(EyeOFAcherusFallPoint), false);
- init.SetFall();
- me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_EYE_FALL, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
- }
-
- void OnCharmed(bool /*isNew*/) override
- {
- if (!me->IsCharmed())
- {
- me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_THE_EYE_OF_ACHERUS);
- me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_EYE_FLIGHT_BOOST);
- }
- }
-
- void UpdateAI(uint32 diff) override
- {
- _events.Update(diff);
-
- while (uint32 eventId = _events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_MOVE_START:
- {
- me->SetControlled(false, UNIT_STATE_ROOT);
+ npc_eye_of_acherus(Creature* creature) : ScriptedAI(creature)
+ {
+ creature->SetDisplayFromModel(0);
+ creature->SetReactState(REACT_PASSIVE);
+ if (creature->GetCharmInfo())
+ creature->GetCharmInfo()->InitPossessCreateSpells();
+ }
- DoCastSelf(SPELL_EYE_FLIGHT_BOOST);
+ void JustAppeared() override
+ {
+ DoCastSelf(SPELL_ROOT_SELF);
+ DoCastSelf(SPELL_EYE_OF_ACHERUS_VISUAL);
+ _events.ScheduleEvent(EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION, 7s);
+ }
- if (Unit* owner = me->GetCharmerOrOwner())
- Talk(TALK_MOVE_START, owner);
+ void OnCharmed(bool apply) override
+ {
+ if (!apply)
+ {
+ me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_THE_EYE_OF_ACHERUS);
+ me->GetCharmerOrOwner()->RemoveAurasDueToSpell(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST);
+ }
+ }
- Movement::PointsArray path(EyeOfAcherusPath, EyeOfAcherusPath + EyeOfAcherusPathSize);
- Movement::MoveSplineInit init(me);
- init.MovebyPath(path);
- me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_EYE_MOVE_END, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
- break;
- }
- default:
- break;
- }
- }
- }
+ void UpdateAI(uint32 diff) override
+ {
+ _events.Update(diff);
- void MovementInform(uint32 movementType, uint32 pointId) override
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
{
- if (movementType != POINT_MOTION_TYPE)
- return;
-
- switch (pointId)
+ case EVENT_ANNOUNCE_LAUNCH_TO_DESTINATION:
+ if (Unit* owner = me->GetCharmerOrOwner())
+ Talk(SAY_LAUNCH_TOWARDS_DESTINATION, owner);
+ _events.ScheduleEvent(EVENT_UNROOT, 1s + 200ms);
+ break;
+ case EVENT_UNROOT:
+ me->RemoveAurasDueToSpell(SPELL_ROOT_SELF);
+ DoCastSelf(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST);
+ _events.ScheduleEvent(EVENT_LAUNCH_TOWARDS_DESTINATION, 1s + 200ms);
+ break;
+ case EVENT_LAUNCH_TOWARDS_DESTINATION:
{
- case POINT_EYE_FALL:
- _events.ScheduleEvent(EVENT_MOVE_START, 2s);
- break;
- case POINT_EYE_MOVE_END:
- me->RemoveAurasDueToSpell(SPELL_EYE_FLIGHT_BOOST);
- if (Unit* owner = me->GetCharmerOrOwner())
- Talk(TALK_CONTROL, owner);
- break;
- default:
- break;
+ Movement::PointsArray path(EyeOfAcherusPath, EyeOfAcherusPath + EyeOfAcherusPathSize);
+ Movement::MoveSplineInit init(me);
+ init.MovebyPath(path);
+ init.SetFly();
+ if (Unit* owner = me->GetCharmerOrOwner())
+ init.SetVelocity(owner->GetSpeed(MOVE_RUN));
+
+ me->GetMotionMaster()->LaunchMoveSpline(std::move(init), POINT_NEW_AVALON, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
+ break;
}
+ case EVENT_GRANT_CONTROL:
+ me->RemoveAurasDueToSpell(SPELL_ROOT_SELF);
+ DoCastSelf(SPELL_EYE_OF_ACHERUS_FLIGHT);
+ me->RemoveAurasDueToSpell(SPELL_EYE_OF_ACHERUS_FLIGHT_BOOST);
+ if (Unit* owner = me->GetCharmerOrOwner())
+ Talk(SAY_EYE_UNDER_CONTROL, owner);
+ break;
+ default:
+ break;
}
+ }
+ }
- private:
- EventMap _events;
- };
+ void MovementInform(uint32 movementType, uint32 pointId) override
+ {
+ if (movementType != POINT_MOTION_TYPE)
+ return;
- CreatureAI* GetAI(Creature* creature) const override
+ switch (pointId)
{
- return new npc_eye_of_acherusAI(creature);
+ case POINT_NEW_AVALON:
+ DoCastSelf(SPELL_ROOT_SELF);
+ _events.ScheduleEvent(EVENT_GRANT_CONTROL, 2s + 500ms);
+ break;
+ default:
+ break;
}
+ }
+
+private:
+ EventMap _events;
};
/*######
@@ -1316,7 +1307,7 @@ void AddSC_the_scarlet_enclave_c1()
new npc_unworthy_initiate_anchor();
new go_acherus_soul_prison();
RegisterSpellScript(spell_death_knight_initiate_visual);
- new npc_eye_of_acherus();
+ RegisterCreatureAI(npc_eye_of_acherus);
new npc_death_knight_initiate();
RegisterCreatureAI(npc_dark_rider_of_acherus);
new npc_salanar_the_horseman();