TrinityCore
Loading...
Searching...
No Matches
boss_anzu.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/*
19 * Timers requires to be revisited
20 * Birds-helpers are NYI
21 */
22
23#include "ScriptMgr.h"
24#include "Map.h"
25#include "MotionMaster.h"
26#include "ScriptedCreature.h"
27#include "sethekk_halls.h"
28
36
46
60
67
81
83{
84 PATH_BROOD_1 = 1475160,
85 PATH_BROOD_2 = 1475170,
86 NPC_ANZU = 23035,
88};
89
100
101static constexpr std::array<uint32, 3> HelpersSpawnGroupsData =
102{
106};
107
108// 23035 - Anzu
109struct boss_anzu : public BossAI
110{
112
113 void JustAppeared() override
114 {
116 }
117
118 void Reset() override
119 {
120 _Reset();
122 _deadBroodCount = 0;
124 }
125
134
135 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
136 {
137 if (_phase < PHASE_HEALTH_70 && me->HealthBelowPctDamaged(70, damage))
138 {
139 _phase++;
141 }
142
143 if (_phase < PHASE_HEALTH_33 && me->HealthBelowPctDamaged(33, damage))
144 {
145 _phase++;
147 }
148 }
149
150 void DoAction(int32 action) override
151 {
152 if (action == ACTION_INFORM_ANZU)
153 {
155
157 {
159 _deadBroodCount = 0;
160 }
161 }
162 }
163
164 void EnterEvadeMode(EvadeReason why) override
165 {
166 for (uint32 group : BroodSpawnGroupsData)
167 me->GetMap()->SpawnGroupDespawn(group);
168
170 }
171
172 void JustDied(Unit* /*killer*/) override
173 {
174 _JustDied();
175
176 for (uint32 group : HelpersSpawnGroupsData)
177 me->GetMap()->SpawnGroupDespawn(group);
178 }
179
180 void UpdateAI(uint32 diff) override
181 {
182 if (!UpdateVictim())
183 {
184 events.Update(diff);
185
186 while (uint32 eventId = events.ExecuteEvent())
187 {
188 switch (eventId)
189 {
190 case EVENT_INTRO_1:
194 break;
195 case EVENT_INTRO_2:
198 break;
199 case EVENT_INTRO_3:
201 me->SetImmuneToAll(false);
202 for (uint32 group : HelpersSpawnGroupsData)
203 me->GetMap()->SpawnGroupSpawn(group, true);
204 break;
205 default:
206 break;
207 }
208 }
209 return;
210 }
211
212 events.Update(diff);
213
215 return;
216
217 while (uint32 eventId = events.ExecuteEvent())
218 {
219 switch (eventId)
220 {
223 events.Repeat(25s, 35s);
224 break;
225 case EVENT_SPELL_BOMB:
226 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, [](Unit const* unit) { return unit && unit->GetPowerType() == POWER_MANA; }))
227 {
228 DoCast(target, SPELL_SPELL_BOMB);
229 Talk(SAY_BOMB, target);
230 }
231 events.Repeat(20s, 30s);
232 break;
236 events.Repeat(20s, 25s);
237 break;
238
239 case EVENT_SUMMON_1:
242
243 _deadBroodCount = 0;
244
245 for (uint32 group : BroodSpawnGroupsData)
246 me->GetMap()->SpawnGroupSpawn(group, true, true);
247
249 break;
250 case EVENT_SUMMON_2:
253 break;
254 default:
255 break;
256 }
257
259 return;
260 }
261 }
262
263private:
266};
267
268// 23132 - Brood of Anzu
270{
272
273 void JustAppeared() override
274 {
275 me->SetDisableGravity(true);
277
278 _scheduler.Schedule(0s, 5s, [this](TaskContext const& /*task*/)
279 {
280 me->GetMotionMaster()->MovePath(RAND(PATH_BROOD_1, PATH_BROOD_2), false);
281 });
282 }
283
284 void WaypointPathEnded(uint32 /*nodeId*/, uint32 /*pathId*/) override
285 {
287 me->SetDisableGravity(false);
289 }
290
291 void JustDied(Unit* /*killer*/) override
292 {
293 if (Creature* anzu = me->FindNearestCreature(NPC_ANZU, 200.0f))
294 anzu->AI()->DoAction(ACTION_INFORM_ANZU);
295 }
296
297 void UpdateAI(uint32 diff) override
298 {
299 _scheduler.Update(diff);
300
301 UpdateVictim();
302 }
303
304private:
306};
307
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ POWER_MANA
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
AnzuPhases
Definition boss_anzu.cpp:62
@ PHASE_HEALTH_70
Definition boss_anzu.cpp:64
@ PHASE_NONE
Definition boss_anzu.cpp:63
@ PHASE_HEALTH_33
Definition boss_anzu.cpp:65
AnzuEvents
Definition boss_anzu.cpp:48
@ EVENT_INTRO_1
Definition boss_anzu.cpp:56
@ EVENT_INTRO_2
Definition boss_anzu.cpp:57
@ EVENT_SUMMON_2
Definition boss_anzu.cpp:54
@ EVENT_CYCLONE_OF_FEATHERS
Definition boss_anzu.cpp:51
@ EVENT_PARALYZING_SCREECH
Definition boss_anzu.cpp:49
@ EVENT_SPELL_BOMB
Definition boss_anzu.cpp:50
@ EVENT_SUMMON_1
Definition boss_anzu.cpp:53
@ EVENT_INTRO_3
Definition boss_anzu.cpp:58
AnzuTexts
Definition boss_anzu.cpp:30
@ SAY_INTRO_2
Definition boss_anzu.cpp:32
@ SAY_INTRO_1
Definition boss_anzu.cpp:31
@ SAY_BOMB
Definition boss_anzu.cpp:34
@ SAY_SUMMON
Definition boss_anzu.cpp:33
AnzuSpawnGroups
Definition boss_anzu.cpp:69
@ SPAWN_GROUP_FALCON
Definition boss_anzu.cpp:78
@ SPAWN_GROUP_BROOD_1
Definition boss_anzu.cpp:70
@ SPAWN_GROUP_BROOD_3
Definition boss_anzu.cpp:72
@ SPAWN_GROUP_HAWK
Definition boss_anzu.cpp:77
@ SPAWN_GROUP_BROOD_4
Definition boss_anzu.cpp:73
@ SPAWN_GROUP_BROOD_6
Definition boss_anzu.cpp:75
@ SPAWN_GROUP_EAGLE
Definition boss_anzu.cpp:79
@ SPAWN_GROUP_BROOD_2
Definition boss_anzu.cpp:71
@ SPAWN_GROUP_BROOD_5
Definition boss_anzu.cpp:74
@ SPAWN_GROUP_BROOD_7
Definition boss_anzu.cpp:76
AnzuMisc
Definition boss_anzu.cpp:83
@ ACTION_INFORM_ANZU
Definition boss_anzu.cpp:87
@ PATH_BROOD_2
Definition boss_anzu.cpp:85
@ NPC_ANZU
Definition boss_anzu.cpp:86
@ PATH_BROOD_1
Definition boss_anzu.cpp:84
static constexpr std::array< uint32, 7 > BroodSpawnGroupsData
Definition boss_anzu.cpp:90
void AddSC_boss_anzu()
AnzuSpells
Definition boss_anzu.cpp:38
@ SPELL_SPELL_BOMB
Definition boss_anzu.cpp:42
@ SPELL_SHADOWFORM
Definition boss_anzu.cpp:39
@ SPELL_BANISH_SELF
Definition boss_anzu.cpp:44
@ SPELL_CYCLONE_OF_FEATHERS
Definition boss_anzu.cpp:43
@ SPELL_PARALYZING_SCREECH
Definition boss_anzu.cpp:41
static constexpr std::array< uint32, 3 > HelpersSpawnGroupsData
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void SetImmuneToAll(bool apply) override
Definition Creature.h:187
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition Map.cpp:2449
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
Powers GetPowerType() const
Definition Unit.h:823
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool SetDisableGravity(bool disable, bool updateAnimTier=true, bool updatePlayHoverAnim=true)
Definition Unit.cpp:13440
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
Map * GetMap() const
Definition Object.h:411
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1522
@ DATA_ANZU
#define RegisterSethekkHallsCreatureAI(ai_name)
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void Reset() override
void JustDied(Unit *) override
void JustAppeared() override
void DoAction(int32 action) override
uint8 _deadBroodCount
boss_anzu(Creature *creature)
void EnterEvadeMode(EvadeReason why) override
uint8 _phase
void JustDied(Unit *) override
void WaypointPathEnded(uint32, uint32) override
void UpdateAI(uint32 diff) override
void JustAppeared() override
TaskScheduler _scheduler