TrinityCore
boss_alizabal.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "baradin_hold.h"
20#include "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "Player.h"
24#include "ScriptedCreature.h"
25
27{
35 SAY_DEATH = 12
36};
37
39{
43 SPELL_SKEWER = 104936,
44 SPELL_BERSERK = 47008
45};
46
48{
49 ACTION_INTRO = 1
50};
51
53{
54 POINT_STORM = 1
55};
56
58{
63};
64
66{
67 public:
68 at_alizabal_intro() : AreaTriggerScript("at_alizabal_intro") { }
69
70 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
71 {
72 if (InstanceScript* instance = player->GetInstanceScript())
73 if (Creature* alizabal = instance->GetCreature(BOSS_ALIZABAL))
74 alizabal->AI()->DoAction(ACTION_INTRO);
75 return true;
76 }
77};
78
80{
81 public:
82 boss_alizabal() : CreatureScript("boss_alizabal") { }
83
84 struct boss_alizabalAI : public BossAI
85 {
86 boss_alizabalAI(Creature* creature) : BossAI(creature, BOSS_ALIZABAL) { }
87
88 void Reset() override
89 {
90 _Reset();
91 _hate = false;
92 _skewer = false;
93 }
94
95 void JustEngagedWith(Unit* who) override
96 {
101 }
102
103 void JustDied(Unit* /*killer*/) override
104 {
105 _JustDied();
108 }
109
110 void KilledUnit(Unit* who) override
111 {
112 if (who->GetTypeId() == TYPEID_PLAYER)
113 Talk(SAY_SLAY);
114 }
115
116 void EnterEvadeMode(EvadeReason /*why*/) override
117 {
121 }
122
123 void DoAction(int32 action) override
124 {
125 switch (action)
126 {
127 case ACTION_INTRO:
128 if (!_intro)
129 {
131 _intro = true;
132 }
133 break;
134 }
135 }
136
137 void MovementInform(uint32 /*type*/, uint32 pointId) override
138 {
139 switch (pointId)
140 {
141 case POINT_STORM:
143 break;
144 }
145 }
146
147 void UpdateAI(uint32 diff) override
148 {
149 if (!UpdateVictim())
150 return;
151
152 events.Update(diff);
153
154 while (uint32 eventId = events.ExecuteEvent())
155 {
156 switch (eventId)
157 {
159 switch (urand(0, 1))
160 {
161 case 0:
162 if (!_skewer)
163 {
165 {
166 DoCast(target, SPELL_SKEWER, true);
168 Talk(SAY_SKEWER_ANNOUNCE, target);
169 }
170 _skewer = true;
172 }
173 else if (!_hate)
174 {
176 {
177 DoCast(target, SPELL_SEETHING_HATE, true);
178 Talk(SAY_HATE);
179 }
180 _hate = true;
182 }
183 else if (_hate && _skewer)
184 {
191 }
192 break;
193 case 1:
194 if (!_hate)
195 {
197 {
198 DoCast(target, SPELL_SEETHING_HATE, true);
199 Talk(SAY_HATE);
200 }
201 _hate = true;
203 }
204 else if (!_skewer)
205 {
207 {
208 DoCast(target, SPELL_SKEWER, true);
210 Talk(SAY_SKEWER_ANNOUNCE, target);
211 }
212 _skewer = true;
214 }
215 else if (_hate && _skewer)
216 {
223 }
224 break;
225 }
226 break;
227 case EVENT_MOVE_STORM:
228 me->SetSpeedRate(MOVE_RUN, 4.0f);
229 me->SetSpeedRate(MOVE_WALK, 4.0f);
231 me->GetMotionMaster()->MovePoint(POINT_STORM, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
233 break;
234 case EVENT_STOP_STORM:
237 me->SetSpeedRate(MOVE_WALK, 1.0f);
238 me->SetSpeedRate(MOVE_RUN, 1.14f);
240 _hate = false;
241 _skewer = false;
242 break;
243 case EVENT_CAST_STORM:
245 break;
246 }
247 }
248 }
249
250 private:
251 bool _intro = false;
252 bool _hate = false;
253 bool _skewer = false;
254 };
255
256 CreatureAI* GetAI(Creature* creature) const override
257 {
258 return GetBaradinHoldAI<boss_alizabalAI>(creature);
259 }
260};
261
263{
264 new boss_alizabal();
265 new at_alizabal_intro();
266}
Texts
Actions
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ ENCOUNTER_FRAME_DISENGAGE
@ ENCOUNTER_FRAME_ENGAGE
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
EvadeReason
Definition: UnitAICommon.h:30
@ MOVE_RUN
Definition: UnitDefines.h:118
@ MOVE_WALK
Definition: UnitDefines.h:117
@ BOSS_ALIZABAL
Definition: baradin_hold.h:33
void AddSC_boss_alizabal()
@ ACTION_INTRO
@ POINT_STORM
@ SPELL_BLADE_DANCE
@ SPELL_SKEWER
@ SPELL_BLADE_DANCE_DUMMY
@ SPELL_BERSERK
@ SPELL_SEETHING_HATE
@ SAY_DEATH
@ SAY_HATE
@ SAY_AGGRO
@ SAY_BLADE_STORM
@ SAY_SKEWER_ANNOUNCE
@ SAY_SLAY
@ SAY_SKEWER
@ SAY_INTRO
@ EVENT_MOVE_STORM
@ EVENT_CAST_STORM
@ EVENT_RANDOM_CAST
@ EVENT_STOP_STORM
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void SendEncounterUnit(EncounterFrameType type, Unit const *unit, Optional< int32 > param1={}, Optional< int32 > param2={})
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
void MoveTargetedHome()
TypeID GetTypeId() const
Definition: Object.h:173
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
Unit * GetVictim() const
Definition: Unit.h:715
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.cpp:8525
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
CreatureAI * GetAI(Creature *creature) const override
void UpdateAI(uint32 diff) override
void DoAction(int32 action) override
void JustDied(Unit *) override
void KilledUnit(Unit *who) override
boss_alizabalAI(Creature *creature)
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *who) override
void MovementInform(uint32, uint32 pointId) override