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 * His caster mode requires rechecks
21 * Move away after succesful Frost Nova cast (seems like doesn't always triggered)
22 */
23
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "SpellInfo.h"
27#include "mana_tombs.h"
28#include "Map.h"
29
38
40{
41 // Shaffar
42 SPELL_BLINK = 34605,
47
48 // Ethereal Beacon
52};
53
66
73
74static constexpr std::array<uint32, 3> BeaconSpawnGroupsData =
75{
79};
80
81// 18344 - Nexus-Prince Shaffar
83{
85
86 void JustAppeared() override
87 {
88 for (uint32 group : BeaconSpawnGroupsData)
89 me->GetMap()->SpawnGroupSpawn(group, true);
90 }
91
93 void MoveInLineOfSight(Unit* who) override
94 {
95 if (!_hasTaunted && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 100.0f))
96 {
98 _hasTaunted = true;
99 }
100 }
101
102 void JustEngagedWith(Unit* who) override
103 {
105
107
112 }
113
114 void JustSummoned(Creature* summoned) override
115 {
117 summoned->AI()->AttackStart(target);
118
119 summons.Summon(summoned);
120 }
121
122 void OnSpellCast(SpellInfo const* spellInfo) override
123 {
124 if (spellInfo->Id == SPELL_SUMMON_ETHEREAL_BEACON)
125 if (roll_chance(50))
127 }
128
129 void JustReachedHome() override
130 {
132
133 for (uint32 group : BeaconSpawnGroupsData)
134 me->GetMap()->SpawnGroupSpawn(group, true);
135 }
136
137 void KilledUnit(Unit* /*victim*/) override
138 {
139 Talk(SAY_SLAY);
140 }
141
142 void JustDied(Unit* /*killer*/) override
143 {
144 _JustDied();
146 }
147
148 void ExecuteEvent(uint32 eventId) override
149 {
150 switch (eventId)
151 {
152 case EVENT_BLINK:
154 events.Repeat(40s, 60s);
156 break;
157 case EVENT_BEACON:
159 events.Repeat(20s);
160 break;
161 case EVENT_MAIN_SPELL:
163
165 events.Repeat(1s, 6s);
166 else
167 events.Repeat(1s);
168 break;
169 case EVENT_FROST_NOVA:
171 events.Repeat(15s, 25s);
172 break;
173 default:
174 break;
175 }
176 }
177
178private:
180};
181
182// 18431 - Ethereal Beacon
184{
186
187 void JustAppeared() override
188 {
190 }
191
192 void Reset() override
193 {
194 _events.Reset();
195 }
196
197 void JustEngagedWith(Unit* /*who*/) override
198 {
201 }
202
203 void UpdateAI(uint32 diff) override
204 {
205 if (!UpdateVictim())
206 return;
207
208 _events.Update(diff);
209
211 return;
212
213 while (uint32 eventId = _events.ExecuteEvent())
214 {
215 switch (eventId)
216 {
220 me->SetImmuneToPC(true);
221 me->SetUninteractible(true);
223 break;
226 _events.Repeat(3s, 10s);
227 break;
228 default:
229 break;
230 }
231 }
232 }
233
234private:
236};
237
246
247// 18430 - Ethereal Apprentice
249{
251
252 void JustAppeared() override
253 {
256 }
257
258 void Reset() override
259 {
260 _events.Reset();
261 }
262
267
268 void EnterEvadeMode(EvadeReason /*why*/) override
269 {
271 }
272
273 void UpdateAI(uint32 diff) override
274 {
275 if (!UpdateVictim())
276 return;
277
278 _events.Update(diff);
279
281 return;
282
283 while (uint32 eventId = _events.ExecuteEvent())
284 {
285 switch (eventId)
286 {
290 break;
294 break;
295 default:
296 break;
297 }
298 }
299 }
300
301private:
303};
304
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
EvadeReason
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:290
static constexpr std::array< uint32, 3 > BeaconSpawnGroupsData
@ 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_SUMMON_APPRENTICE
@ SPELL_SUMMON_ETHEREAL_BEACON
@ SPELL_ETHEREAL_BEACON_VISUAL
TypeID GetTypeId() const
Definition BaseEntity.h:166
void _JustReachedHome()
void JustEngagedWith(Unit *who) override
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Creature *const me
Definition CreatureAI.h:63
void SetImmuneToPC(bool apply) override
Definition Creature.h:190
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:235
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:56
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
uint32 const Id
Definition SpellInfo.h:328
void Summon(Creature const *summon)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
Definition Unit.h:647
bool IsWithinMeleeRange(Unit const *obj) const
Definition Unit.h:722
void SetUninteractible(bool apply)
Definition Unit.cpp:8583
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
Map * GetMap() const
Definition Object.h:411
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:499
#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
ScriptedAI(Creature *creature, uint32 scriptId=0) noexcept
void JustSummoned(Creature *summoned) override
boss_nexusprince_shaffar(Creature *creature)
void OnSpellCast(SpellInfo const *spellInfo) override
void ExecuteEvent(uint32 eventId) override
void MoveInLineOfSight(Unit *who) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *) override