TrinityCore
boss_broodlord_lashlayer.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 "blackwing_lair.h"
20#include "GameObject.h"
21#include "GameObjectAI.h"
22#include "InstanceScript.h"
23#include "ScriptedCreature.h"
24
25enum Say
26{
28 SAY_LEASH = 1
29};
30
32{
33 SPELL_CLEAVE = 26350,
37 SPELL_SUPPRESSION_AURA = 22247 // Suppression Device Spell
38};
39
41{
47 // Suppression Device Events
50};
51
53{
55};
56
57struct boss_broodlord : public BossAI
58{
60
61 void JustEngagedWith(Unit* who) override
62 {
65
71 }
72
73 void JustDied(Unit* /*killer*/) override
74 {
75 _JustDied();
76
77 std::list<GameObject*> _goList;
79 for (std::list<GameObject*>::const_iterator itr = _goList.begin(); itr != _goList.end(); itr++)
80 ((*itr)->AI()->DoAction(ACTION_DEACTIVATE));
81 }
82
83 void UpdateAI(uint32 diff) override
84 {
85 if (!UpdateVictim())
86 return;
87
88 events.Update(diff);
89
90 while (uint32 eventId = events.ExecuteEvent())
91 {
92 switch (eventId)
93 {
94 case EVENT_CLEAVE:
97 break;
98 case EVENT_BLASTWAVE:
101 break;
105 break;
106 case EVENT_KNOCKBACK:
108 if (GetThreat(me->GetVictim()))
111 break;
112 case EVENT_CHECK:
113 if (me->GetDistance(me->GetHomePosition()) > 150.0f)
114 {
117 }
119 break;
120 }
121 }
122 }
123};
124
126{
127 go_suppression_device(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { }
128
129 void InitializeAI() override
130 {
132 {
133 Deactivate();
134 return;
135 }
136
138 }
139
140 void UpdateAI(uint32 diff) override
141 {
142 _events.Update(diff);
143
144 while (uint32 eventId = _events.ExecuteEvent())
145 {
146 switch (eventId)
147 {
149 if (me->GetGoState() == GO_STATE_READY)
150 {
151 me->CastSpell(nullptr, SPELL_SUPPRESSION_AURA, true);
152 me->SendCustomAnim(0);
153 }
155 break;
157 Activate();
158 break;
159 }
160 }
161 }
162
163 void OnLootStateChanged(uint32 state, Unit* /*unit*/) override
164 {
165 switch (state)
166 {
167 case GO_ACTIVATED:
168 Deactivate();
171 break;
172 case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap
174 break;
175 }
176 }
177
178 void DoAction(int32 action) override
179 {
180 if (action == ACTION_DEACTIVATE)
181 {
182 Deactivate();
184 }
185 }
186
187 void Activate()
188 {
189 if (_active)
190 return;
191 _active = true;
192 if (me->GetGoState() == GO_STATE_ACTIVE)
197 }
198
200 {
201 if (!_active)
202 return;
203 _active = false;
207 }
208
209private:
213};
214
216{
219}
Actions
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ GO_ACTIVATED
Definition: GameObject.h:158
@ GO_READY
Definition: GameObject.h:157
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:159
@ DONE
Spells
Definition: PlayerAI.cpp:32
void GetGameObjectListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ GO_FLAG_NOT_SELECTABLE
@ GO_STATE_READY
@ GO_STATE_ACTIVE
@ GO_SUPPRESSION_DEVICE
#define RegisterBlackwingLairCreatureAI(ai_name)
#define RegisterBlackwingLairGameObjectAI(ai_name)
@ DATA_BROODLORD_LASHLAYER
void AddSC_boss_broodlord()
@ SPELL_SUPPRESSION_AURA
@ EVENT_SUPPRESSION_CAST
@ EVENT_SUPPRESSION_RESET
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:373
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 CancelEvent(uint32 eventId)
Definition: EventMap.cpp:131
GameObject *const me
Definition: GameObjectAI.h:50
void SetGoState(GOState state)
GOState GetGoState() const
Definition: GameObject.h:281
void RemoveFlag(GameObjectFlags flags)
Definition: GameObject.h:275
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:274
void SetLootState(LootState s, Unit *unit=nullptr)
void SendCustomAnim(uint32 anim)
EncounterState GetBossState(uint32 id) const
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
boss_broodlord(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void DoAction(int32 action) override
void OnLootStateChanged(uint32 state, Unit *) override