TrinityCore
Loading...
Searching...
No Matches
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/*
19 * Timers requires to be revisited
20 * Find a better way to deal with his three initial beacons to make sure all aggro
21 * His caster mode requires rechecks
22 * Move away after succesful Frost Nova cast (seems like doesn't always triggered)
23 */
24
25#include "ScriptMgr.h"
26#include "ScriptedCreature.h"
27#include "SpellInfo.h"
28#include "mana_tombs.h"
29#include "MotionMaster.h"
30
39
41{
42 // Shaffar
43 SPELL_BLINK = 34605,
47
49
50 // Ethereal Beacon
54};
55
67
69{
70 NPC_BEACON = 18431,
71 NPC_SHAFFAR = 18344
72};
73
74// 18344 - Nexus-Prince Shaffar
76{
78
79 void Reset() override
80 {
81 _Reset();
82
83 me->SummonCreature(NPC_BEACON, -191.116f, 3.82914f, 16.7834f, 3.62003f, TEMPSUMMON_MANUAL_DESPAWN);
84 me->SummonCreature(NPC_BEACON, -180.408f, 10.9629f, 16.7025f, 3.45070f, TEMPSUMMON_MANUAL_DESPAWN);
85 me->SummonCreature(NPC_BEACON, -185.980f, 14.4201f, 16.7234f, 1.31540f, TEMPSUMMON_MANUAL_DESPAWN);
86 }
87
88 void MoveInLineOfSight(Unit* who) override
89 {
90 if (!_hasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
91 {
93 _hasTaunted = true;
94 }
95 }
96
97 void JustEngagedWith(Unit* who) override
98 {
101
106 }
107
108 void JustSummoned(Creature* summoned) override
109 {
110 if (summoned->GetEntry() == NPC_BEACON)
111 {
113 summoned->AI()->AttackStart(target);
114
115 if (!me->IsInCombat())
116 summoned->GetMotionMaster()->MoveRandom(5.0f);
117 }
118
119 summons.Summon(summoned);
120 }
121
122 void OnSpellCast(SpellInfo const* spell) override
123 {
124 if (spell->Id == SPELL_ETHEREAL_BEACON)
125 if (roll_chance_i(50))
127 }
128
129 void KilledUnit(Unit* victim) override
130 {
131 if (victim->GetTypeId() == TYPEID_PLAYER)
132 Talk(SAY_SLAY);
133 }
134
135 void JustDied(Unit* /*killer*/) override
136 {
138 _JustDied();
139 }
140
141 void ExecuteEvent(uint32 eventId) override
142 {
143 switch (eventId)
144 {
145 case EVENT_BLINK:
147 events.Repeat(40s, 60s);
149 break;
150 case EVENT_BEACON:
152 events.Repeat(20s);
153 break;
154 case EVENT_MAIN_SPELL:
156
158 events.Repeat(1s, 6s);
159 else
160 events.Repeat(1s);
161 break;
162 case EVENT_FROST_NOVA:
164 events.Repeat(15s, 25s);
165 break;
166 default:
167 break;
168 }
169 }
170
171private:
173};
174
175// 18431 - Ethereal Beacon
177{
178 npc_ethereal_beacon(Creature* creature) : ScriptedAI(creature) { }
179
180 void JustAppeared() override
181 {
183 }
184
185 void Reset() override
186 {
187 _events.Reset();
188 }
189
190 void JustEngagedWith(Unit* who) override
191 {
192 if (Creature* shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100.0f))
193 if (!shaffar->IsInCombat())
194 shaffar->AI()->AttackStart(who);
195
198 }
199
200 void JustSummoned(Creature* summoned) override
201 {
202 summoned->AI()->AttackStart(me->GetVictim());
203 }
204
205 void UpdateAI(uint32 diff) override
206 {
207 if (!UpdateVictim())
208 return;
209
210 _events.Update(diff);
211
213 return;
214
215 while (uint32 eventId = _events.ExecuteEvent())
216 {
217 switch (eventId)
218 {
221 me->AttackStop();
223 me->SetImmuneToPC(true);
226 break;
229 _events.Repeat(3s, 10s);
230 break;
231 default:
232 break;
233 }
234 }
235 }
236
237private:
239};
240
249
250// 18430 - Ethereal Apprentice
252{
253 npc_ethereal_apprentice(Creature* creature) : ScriptedAI(creature) { }
254
255 void JustAppeared() override
256 {
258 }
259
260 void Reset() override
261 {
262 _events.Reset();
263 }
264
269
270 void UpdateAI(uint32 diff) override
271 {
272 if (!UpdateVictim())
273 return;
274
275 _events.Update(diff);
276
278 return;
279
280 while (uint32 eventId = _events.ExecuteEvent())
281 {
282 switch (eventId)
283 {
287 break;
291 break;
292 default:
293 break;
294 }
295 }
296 }
297
298private:
300};
301
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_MANUAL_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
@ REACT_PASSIVE
@ UNIT_FLAG_UNINTERACTIBLE
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ SPELL_ETHEREAL_APPRENTICE_FROSTBOLT
@ EVENT_ETHEREAL_APPRENTICE_FROSTBOLT
@ EVENT_ETHEREAL_APPRENTICE_FIREBOLT
@ SPELL_ETHEREAL_APPRENTICE_FIREBOLT
@ EVENT_SUMMON_APPRENTICE
void AddSC_boss_nexusprince_shaffar()
@ SPELL_ETHEREAL_APPRENTICE
@ SPELL_ETHEREAL_BEACON_VISUAL
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetImmuneToPC(bool apply) override
Definition Creature.h:129
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
void MoveRandom(float wanderDistance=0.0f)
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
void Summon(Creature const *summon)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
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
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
Definition Unit.h:769
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:844
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool AttackStop()
Definition Unit.cpp:5645
bool IsInCombat() const
Definition Unit.h:1144
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:1992
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
#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 OnSpellCast(SpellInfo const *spell) 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