TrinityCore
Loading...
Searching...
No Matches
boss_pyroguard_emberseer.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 "blackrock_spire.h"
20#include "GameObject.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "ObjectAccessor.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27
35
37{
38 SPELL_ENCAGED_EMBERSEER = 15282, // Self on spawn
39 SPELL_FIRE_SHIELD_TRIGGER = 13377, // Self on spawn missing from 335 dbc triggers SPELL_FIRE_SHIELD every 3 sec
40 SPELL_FIRE_SHIELD = 13376, // Triggered by SPELL_FIRE_SHIELD_TRIGGER
41 SPELL_FREEZE_ANIM = 16245, // Self on event start
42 SPELL_EMBERSEER_GROWING = 16048, // Self on event start
43 SPELL_EMBERSEER_GROWING_TRIGGER = 16049, // Triggered by SPELL_EMBERSEER_GROWING
44 SPELL_EMBERSEER_FULL_STRENGTH = 16047, // Emberseer Full Strength
45 SPELL_FIRENOVA = 23462, // Combat
46 SPELL_FLAMEBUFFET = 23341, // Combat
47 SPELL_PYROBLAST = 17274, // Combat
48 // Blackhand Incarcerator Spells
49 SPELL_ENCAGE_EMBERSEER = 15281, // Emberseer on spawn
50 SPELL_STRIKE = 15580, // Combat
51 SPELL_ENCAGE = 16045, // Combat
52 // Cast on player by altar
54};
55
57{
58 // Respawn
60 // Pre fight
63 // Combat
67 // Hack due to trigger spell not in dbc
69 // Make sure all players have aura from altar
72};
73
75{
77
78 void Reset() override
79 {
81 me->SetImmuneToPC(true);
82 events.Reset();
83 // Apply auras on spawn and reset
84 // DoCast(me, SPELL_FIRE_SHIELD_TRIGGER); // Need to find this in old DBC if possible
89 // Hack for missing trigger spell
91 }
92
93 void SetData(uint32 /*type*/, uint32 data) override
94 {
95 switch (data)
96 {
97 case 1:
99 break;
100 default:
101 break;
102 }
103 }
104
105 void JustEngagedWith(Unit* /*who*/) override
106 {
107 // ### TODO Check combat timing ###
111 }
112
113 void JustDied(Unit* /*killer*/) override
114 {
115 // Activate all the runes
117 // Complete encounter
119 }
120
121 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
122 {
123 if (spellInfo->Id == SPELL_ENCAGE_EMBERSEER)
124 {
126 {
128 Reset();
129 }
130 }
131
132 if (spellInfo->Id == SPELL_EMBERSEER_GROWING_TRIGGER)
133 {
136
138 {
144 me->SetImmuneToPC(false);
146 }
147 }
148 }
149
151 {
152 // update all runes
154 rune1->SetGoState(state);
156 rune2->SetGoState(state);
158 rune3->SetGoState(state);
160 rune4->SetGoState(state);
162 rune5->SetGoState(state);
164 rune6->SetGoState(state);
166 rune7->SetGoState(state);
167 }
168
169 void UpdateAI(uint32 diff) override
170 {
171 if (!UpdateVictim())
172 {
173 events.Update(diff);
174
175 while (uint32 eventId = events.ExecuteEvent())
176 {
177 switch (eventId)
178 {
179 case EVENT_RESPAWN:
180 {
183 break;
184 }
186 {
187 // Set data on all Blackhand Incarcerators
188 std::list<Creature*> creatureList;
190 for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
191 {
192 if (Creature* creature = *itr)
193 {
194 creature->SetImmuneToAll(false);
195 creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
196 DoZoneInCombat(creature);
197 }
198 }
201 break;
202 }
207 break;
209 // #### Spell isn't doing any damage ??? ####
212 break;
214 {
215 // As of Patch 3.0.8 only one person needs to channel the altar
216 bool _hasAura = false;
217 Map::PlayerList const& players = me->GetMap()->GetPlayers();
218 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
219 if (Player* player = itr->GetSource()->ToPlayer())
220 if (player->HasAura(SPELL_EMBERSEER_OBJECT_VISUAL))
221 {
222 _hasAura = true;
223 break;
224 }
225
226 if (_hasAura)
227 {
230 }
231 break;
232 }
235 break;
236 default:
237 break;
238 }
239 }
240 return;
241 }
242
243 events.Update(diff);
244
246 return;
247
248 while (uint32 eventId = events.ExecuteEvent())
249 {
250 switch (eventId)
251 {
255 break;
256 case EVENT_FIRENOVA:
259 break;
262 events.Repeat(Seconds(14));
263 break;
264 case EVENT_PYROBLAST:
265 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
266 DoCast(target, SPELL_PYROBLAST);
267 events.Repeat(Seconds(15));
268 break;
269 default:
270 break;
271 }
272
274 return;
275 }
277 }
278};
279
280/*####
281## npc_blackhand_incarcerator
282####*/
283
285{
286 // OOC
288 // Combat
290 EVENT_ENCAGE = 3
292
294{
296
297 void JustAppeared() override
298 {
300 }
301
302 void JustEngagedWith(Unit* /*who*/) override
303 {
304 // Had to do this because CallForHelp will ignore any npcs without LOS
305 std::list<Creature*> creatureList;
307 for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
308 {
309 if (Creature* creature = *itr)
310 DoZoneInCombat(creature); // AI()->AttackStart(me->GetVictim());
311 }
312
315 }
316
317 void JustReachedHome() override
318 {
320
321 me->SetImmuneToAll(true);
322 }
323
324 void UpdateAI(uint32 diff) override
325 {
326 if (!UpdateVictim())
327 return;
328
329 _events.Update(diff);
330
331 while (uint32 eventId = _events.ExecuteEvent())
332 {
333 switch (eventId)
334 {
335 case EVENT_STRIKE:
337 _events.Repeat(Seconds(14), Seconds(23));
338 break;
339 case EVENT_ENCAGE:
341 _events.Repeat(Seconds(6), Seconds(12));
342 break;
343 default:
344 break;
345 }
346 }
347
349 }
350
351 private:
353};
354
uint32_t uint32
Definition Define.h:133
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:27
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition PlayerAI.cpp:32
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
GOState
@ GO_STATE_READY
@ UNIT_FLAG_UNINTERACTIBLE
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:608
@ UNIT_STATE_CASTING
Definition Unit.h:235
#define RegisterBlackrockSpireCreatureAI(ai_name)
@ GO_EMBERSEER_RUNE_3
@ GO_EMBERSEER_RUNE_7
@ GO_EMBERSEER_RUNE_4
@ GO_EMBERSEER_RUNE_2
@ GO_EMBERSEER_RUNE_1
@ GO_EMBERSEER_RUNE_5
@ GO_EMBERSEER_RUNE_6
@ NPC_BLACKHAND_INCARCERATOR
@ DATA_BLACKHAND_INCARCERATOR
@ DATA_PYROGAURD_EMBERSEER
void AddSC_boss_pyroguard_emberseer()
@ SPELL_EMBERSEER_FULL_STRENGTH
@ SPELL_EMBERSEER_GROWING_TRIGGER
@ SPELL_EMBERSEER_OBJECT_VISUAL
@ SPELL_FIRE_SHIELD_TRIGGER
@ SPELL_ENCAGED_EMBERSEER
@ SPELL_EMBERSEER_GROWING
InstanceScript *const instance
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
void SetImmuneToAll(bool apply) override
Definition Creature.h:126
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
virtual bool SetBossState(uint32 id, EncounterState state)
virtual ObjectGuid GetGuidData(uint32 type) const override
iterator end()
iterator begin()
PlayerList const & GetPlayers() const
Definition Map.h:448
static Player * ToPlayer(Object *o)
Definition Object.h:180
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3638
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:4519
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:955
Map * GetMap() const
Definition Object.h:449
Player * SelectNearestPlayer(float distance) const
Definition Object.cpp:2161
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
void AttackStart(Unit *) override
boss_pyroguard_emberseer(Creature *creature)
void SetData(uint32, uint32 data) override
void UpdateAI(uint32 diff) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override