TrinityCore
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
28enum Text
29{
34};
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 {
80 me->SetUninteractible(true);
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 {
143 me->SetUninteractible(false);
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 }
276 }
277};
278
279/*####
280## npc_blackhand_incarcerator
281####*/
282
284{
285 // OOC
287 // Combat
289 EVENT_ENCAGE = 3
291
293{
295
296 void JustAppeared() override
297 {
299 }
300
301 void JustEngagedWith(Unit* /*who*/) override
302 {
303 // Had to do this because CallForHelp will ignore any npcs without LOS
304 std::list<Creature*> creatureList;
306 for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
307 {
308 if (Creature* creature = *itr)
309 DoZoneInCombat(creature); // AI()->AttackStart(me->GetVictim());
310 }
311
314 }
315
316 void JustReachedHome() override
317 {
319
320 me->SetImmuneToAll(true);
321 }
322
323 void UpdateAI(uint32 diff) override
324 {
325 if (!UpdateVictim())
326 return;
327
328 _events.Update(diff);
329
330 while (uint32 eventId = _events.ExecuteEvent())
331 {
332 switch (eventId)
333 {
334 case EVENT_STRIKE:
336 _events.Repeat(Seconds(14), Seconds(23));
337 break;
338 case EVENT_ENCAGE:
340 _events.Repeat(Seconds(6), Seconds(12));
341 break;
342 default:
343 break;
344 }
345 }
346 }
347
348 private:
350};
351
353{
356}
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
Spells
Definition: PlayerAI.cpp:32
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
GOState
@ GO_STATE_READY
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:591
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#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_ENCAGE_EMBERSEER
@ SPELL_EMBERSEER_GROWING_TRIGGER
@ SPELL_EMBERSEER_OBJECT_VISUAL
@ SPELL_FIRE_SHIELD_TRIGGER
@ SPELL_ENCAGED_EMBERSEER
@ SPELL_EMBERSEER_GROWING
@ EVENT_ENCAGED_EMBERSEER
InstanceScript *const instance
EventMap events
void DoZoneInCombat()
Definition: CreatureAI.h:161
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 SetImmuneToPC(bool apply) override
Definition: Creature.h:170
void SetImmuneToAll(bool apply) override
Definition: Creature.h:167
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
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()
Definition: MapRefManager.h:35
iterator begin()
Definition: MapRefManager.h:34
PlayerList const & GetPlayers() const
Definition: Map.h:367
static Player * ToPlayer(Object *o)
Definition: Object.h:213
uint32 const Id
Definition: SpellInfo.h:325
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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 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
void SetUninteractible(bool apply)
Definition: Unit.cpp:8147
uint32 GetAuraCount(uint32 spellId) const
Definition: Unit.cpp:4648
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
Player * SelectNearestPlayer(float range) const
Definition: Object.cpp:2210
Map * GetMap() const
Definition: Object.h:624
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void JustEngagedWith(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
npc_blackhand_incarcerator(Creature *creature)