TrinityCore
boss_nexusprince_shaffar.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/* ScriptData
19SDName: Boss_NexusPrince_Shaffar
20SD%Complete: 80
21SDComment: Need more tuning of spell timers, it should not be as linear fight as current. Also should possibly find a better way to deal with his three initial beacons to make sure all aggro.
22SDCategory: Auchindoun, Mana Tombs
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "mana_tombs.h"
27#include "MotionMaster.h"
28#include "ScriptedCreature.h"
29
31{
36 SAY_DEAD = 4
37};
38
40{
41 SPELL_BLINK = 34605,
45
46 SPELL_ETHEREAL_BEACON = 32371, // Summons NPC_BEACON
48
49 // Ethereal Beacon
51 SPELL_ETHEREAL_APPRENTICE = 32372 // Summon 18430
52};
53
55{
56 NPC_BEACON = 18431,
57 NPC_SHAFFAR = 18344
58};
59
60enum Misc
61{
63};
64
66{
72};
73
75{
77 {
78 _hasTaunted = false;
79 }
80
81 void Reset() override
82 {
83 _Reset();
84
85 float dist = 8.0f;
86 float posX, posY, posZ, angle;
87 me->GetHomePosition(posX, posY, posZ, angle);
88
89 me->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2h);
90 me->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2h);
91 me->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2h);
92 }
93
94 void MoveInLineOfSight(Unit* who) override
95 {
96 if (!_hasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
97 {
99 _hasTaunted = true;
100 }
101 }
102
103 void JustEngagedWith(Unit* who) override
104 {
107
112 }
113
114 void JustSummoned(Creature* summoned) override
115 {
116 if (summoned->GetEntry() == NPC_BEACON)
117 {
118 summoned->CastSpell(summoned, SPELL_ETHEREAL_BEACON_VISUAL, false);
119
121 summoned->AI()->AttackStart(target);
122 }
123
124 summons.Summon(summoned);
125 }
126
127 void KilledUnit(Unit* victim) override
128 {
129 if (victim->GetTypeId() == TYPEID_PLAYER)
130 Talk(SAY_SLAY);
131 }
132
133 void JustDied(Unit* /*killer*/) override
134 {
135 Talk(SAY_DEAD);
136 _JustDied();
137 }
138
139 void ExecuteEvent(uint32 eventId) override
140 {
141 switch (eventId)
142 {
143 case EVENT_BLINK:
144 if (me->IsNonMeleeSpellCast(false))
146
147 // expire movement, will prevent from running right back to victim after cast
148 // (but should MoveChase be used again at a certain time or should he not move?)
150
152 break;
153 case EVENT_BEACON:
154 if (!urand(0, 3))
156
159 break;
160 case EVENT_FIREBALL:
163 break;
164 case EVENT_FROSTBOLT:
167 break;
168 case EVENT_FROST_NOVA:
172 break;
173 default:
174 break;
175 }
176 }
177
178private:
180};
181
183{
187
189{
190 npc_ethereal_beacon(Creature* creature) : ScriptedAI(creature) { }
191
192 void Reset() override
193 {
194 _events.Reset();
195 }
196
197 void JustEngagedWith(Unit* who) override
198 {
199 if (Creature* shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100.0f))
200 if (!shaffar->IsInCombat())
201 shaffar->AI()->AttackStart(who);
202
205 }
206
207 void JustSummoned(Creature* summoned) override
208 {
209 summoned->AI()->AttackStart(me->GetVictim());
210 }
211
212 void UpdateAI(uint32 diff) override
213 {
214 if (!UpdateVictim())
215 return;
216
217 _events.Update(diff);
218
220 return;
221
222 while (uint32 eventId = _events.ExecuteEvent())
223 {
224 switch (eventId)
225 {
226 case EVENT_APPRENTICE:
229 break;
233 break;
234 default:
235 break;
236 }
237 }
238 }
239
240private:
242};
243
245{
251
253{
254 npc_ethereal_apprentice(Creature* creature) : ScriptedAI(creature) { }
255
256 void Reset() override
257 {
258 _events.Reset();
259 }
260
261 void JustEngagedWith(Unit* /*who*/) override
262 {
264 }
265
266 void UpdateAI(uint32 diff) override
267 {
268 if (!UpdateVictim())
269 return;
270
271 _events.Update(diff);
272
274 return;
275
276 while (uint32 eventId = _events.ExecuteEvent())
277 {
278 switch (eventId)
279 {
283 break;
287 break;
288 default:
289 break;
290 }
291 }
292 }
293
294private:
296};
297
298enum Yor
299{
303
304struct npc_yor : public ScriptedAI
305{
306 npc_yor(Creature* creature) : ScriptedAI(creature) { }
307
308 void Reset() override { }
309
310 void JustEngagedWith(Unit* /*who*/) override
311 {
313 }
314
315 void UpdateAI(uint32 diff) override
316 {
317 if (!UpdateVictim())
318 return;
319
320 _events.Update(diff);
321
322 while (uint32 eventId = _events.ExecuteEvent())
323 {
324 switch (eventId)
325 {
330 break;
331 default:
332 break;
333 }
334 }
335 }
336
337 private:
339};
340
342{
347}
uint32_t uint32
Definition: Define.h:142
@ MOTION_PRIORITY_NORMAL
#define ATTACK_DISTANCE
Definition: ObjectDefines.h:25
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SPELL_ETHEREAL_APPRENTICE_FROSTBOLT
@ EVENT_ETHEREAL_APPRENTICE_FROSTBOLT
@ EVENT_ETHEREAL_APPRENTICE_FIREBOLT
@ SPELL_ETHEREAL_APPRENTICE_FIREBOLT
@ SPELL_ETHEREAL_APPRENTICE
@ SPELL_ETHEREAL_BEACON
@ SPELL_ETHEREAL_BEACON_VISUAL
void AddSC_boss_nexusprince_shaffar()
Yells
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:373
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
CreatureAI * AI() const
Definition: Creature.h:214
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 Reset()
Definition: EventMap.cpp:21
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
void Summon(Creature const *summon)
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 InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1147
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1142
#define RegisterManaTombsCreatureAI(ai_name)
Definition: mana_tombs.h:48
@ DATA_NEXUSPRINCE_SHAFFAR
Definition: mana_tombs.h:33
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
void JustSummoned(Creature *summoned) override
boss_nexusprince_shaffar(Creature *creature)
void ExecuteEvent(uint32 eventId) override
void MoveInLineOfSight(Unit *who) override
void JustEngagedWith(Unit *who) override
void KilledUnit(Unit *victim) override
void UpdateAI(uint32 diff) override
npc_ethereal_apprentice(Creature *creature)
void JustEngagedWith(Unit *) override
npc_ethereal_beacon(Creature *creature)
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void JustSummoned(Creature *summoned) override
npc_yor(Creature *creature)
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override
void Reset() override