Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_xevozz.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "violet_hold.h"
9#include "Player.h"
10
21
22enum NPCs
23{
25 //NPC_ETHEREAL_SPHERE2 = 32582, // heroic only?
26};
27
35
46
48{
49public:
50 boss_xevozz() : CreatureScript("boss_xevozz") { }
51
53 {
54 return new boss_xevozzAI(creature);
55 }
56
57 struct boss_xevozzAI : public ScriptedAI
58 {
59 boss_xevozzAI(Creature* creature) : ScriptedAI(creature)
60 {
61 instance = creature->GetInstanceScript();
62 }
63
65
69
71 {
72 if (instance)
73 {
74 if (instance->GetData(DATA_WAVE_COUNT) == 6)
76 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
78 }
79
80 uiSummonEtherealSphere_Timer = std::rand() % 12000 + 10000;
81 uiArcaneBarrageVolley_Timer = std::rand() % 22000 + 20000;
82 uiArcaneBuffet_Timer = uiSummonEtherealSphere_Timer + std::rand() % 6000 + 5000;
84 }
85
87 {
88 std::list<Creature*> assistList;
90
91 if (assistList.empty())
92 return;
93
94 for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
95 {
96 if (Creature* pSphere = *iter)
97 pSphere->Kill(pSphere, false);
98 }
99 }
100
102 {
103 summoned->SetSpeed(MOVE_RUN, 0.5f);
104 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
105 {
106 summoned->AddThreat(target, 0.00f);
107 summoned->AI()->AttackStart(target);
108 }
109 }
110
112 {
114 return;
115
116 if (me->Attack(who, true))
117 {
118 me->AddThreat(who, 0.0f);
119 me->SetInCombatWith(who);
120 who->SetInCombatWith(me);
121 DoStartMovement(who);
122 }
123 }
124
125 void EnterCombat(Unit* /*who*/) OVERRIDE
126 {
128 if (instance)
129 {
130 if (GameObject* pDoor = instance->instance->GetGameObject(instance->GetData64(DATA_XEVOZZ_CELL)))
131 if (pDoor->GetGoState() == GOState::GO_STATE_READY)
132 {
134 return;
135 }
136 if (instance->GetData(DATA_WAVE_COUNT) == 6)
138 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
140 }
141 }
142
143 void MoveInLineOfSight(Unit* /*who*/) OVERRIDE { }
144
145
147 {
148 //Return since we have no target
149 if (!UpdateVictim())
150 return;
151
152 if (uiArcaneBarrageVolley_Timer < uiDiff)
153 {
155 uiArcaneBarrageVolley_Timer = std::rand() % 22000 + 20000;
156 }
157 else uiArcaneBarrageVolley_Timer -= uiDiff;
158
160 {
161 if (uiArcaneBuffet_Timer < uiDiff)
162 {
165 }
166 else uiArcaneBuffet_Timer -= uiDiff;
167 }
168
169 if (uiSummonEtherealSphere_Timer < uiDiff)
170 {
173 if (IsHeroic()) // extra one for heroic
174 me->SummonCreature(NPC_ETHEREAL_SPHERE, me->GetPositionX()-5+rand()%10, me->GetPositionY()-5+rand()%10, me->GetPositionZ(), 0, TempSummonType::TEMPSUMMON_TIMED_DESPAWN, 40000);
175
176 uiSummonEtherealSphere_Timer = std::rand() % 47000 + 45000;
177 uiArcaneBuffet_Timer = std::rand() % 6000 + 5000;
178 }
179 else uiSummonEtherealSphere_Timer -= uiDiff;
180
182 }
183
184 void JustDied(Unit* /*killer*/) OVERRIDE
185 {
187
189
190 if (instance)
191 {
192 if (instance->GetData(DATA_WAVE_COUNT) == 6)
193 {
195 instance->SetData(DATA_WAVE_COUNT, 7);
196 }
197 else if (instance->GetData(DATA_WAVE_COUNT) == 12)
198 {
200 instance->SetData(DATA_WAVE_COUNT, 13);
201 }
202 }
203 }
205 {
206 if (victim->GetTypeId() != TypeID::TYPEID_PLAYER)
207 return;
208
209 Talk(SAY_SLAY);
210 }
211 };
212};
213
215{
216public:
217 npc_ethereal_sphere() : CreatureScript("npc_ethereal_sphere") { }
218
220 {
221 return new npc_ethereal_sphereAI(creature);
222 }
223
225 {
227 {
228 instance = creature->GetInstanceScript();
229 }
230
232
235
237 {
238 uiSummonPlayers_Timer = std::rand() % 35000 + 33000;
239 uiRangeCheck_Timer = 1000;
240 }
241
243 {
244 //Return since we have no target
245 if (!UpdateVictim())
246 return;
247
248 if (!me->HasAura(SPELL_POWER_BALL_VISUAL))
250
251 if (uiRangeCheck_Timer < uiDiff)
252 {
253 if (instance)
254 {
255 if (Creature* pXevozz = Unit::GetCreature(*me, instance->GetData64(DATA_XEVOZZ)))
256 {
257 float fDistance = me->GetDistance2d(pXevozz);
258 if (fDistance <= 3)
259 DoCast(pXevozz, SPELL_ARCANE_POWER);
260 else
261 DoCast(me, 35845); //Is it blizzlike?
262 }
263 }
264 uiRangeCheck_Timer = 1000;
265 }
266 else uiRangeCheck_Timer -= uiDiff;
267
268 if (uiSummonPlayers_Timer < uiDiff)
269 {
270 DoCast(me, SPELL_SUMMON_PLAYERS); // not working right
271
272 Map* map = me->GetMap();
273 if (map && map->IsDungeon())
274 {
275 Map::PlayerList const &PlayerList = map->GetPlayers();
276
277 if (!PlayerList.isEmpty())
278 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
279 if (i->GetSource()->IsAlive())
280 DoTeleportPlayer(i->GetSource(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), i->GetSource()->GetOrientation());
281 }
282
283 uiSummonPlayers_Timer = std::rand() % 35000 + 33000;
284 }
285 else uiSummonPlayers_Timer -= uiDiff;
286 }
287 };
288};
289
291{
292 new boss_xevozz();
294}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GO_STATE_READY
Definition GameObject.h:577
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
void GetCreatureListWithEntryInGrid(std::list< Creature * > &list, WorldObject *source, uint32 entry, float maxSearchRange)
@ MOVE_RUN
Definition Unit.h:556
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
@ SPELL_ARCANE_BUFFET
void AddSC_boss_xevozz()
@ SAY_DEATH
@ SAY_REPEAT_SUMMON
@ SAY_AGGRO
@ SAY_SUMMON_ENERGY
@ SAY_SLAY
@ SAY_SPAWN
@ SAY_CHARGED
CreatureSpells
@ SPELL_POWER_BALL_VISUAL
@ SPELL_ARCANE_POWER
@ H_SPELL_ARCANE_POWER
@ SPELL_SUMMON_PLAYERS
@ SPELL_ARCANE_BARRAGE_VOLLEY
@ SPELL_ARCANE_BUFFET
@ SPELL_ARCANE_BARRAGE_VOLLEY_H
@ SPELL_SUMMON_ETHEREAL_SPHERE_1
@ SPELL_SUMMON_ETHEREAL_SPHERE_2
@ SPELL_ARCANE_BUFFET_H
@ SPELL_SUMMON_ETHEREAL_SPHERE_3
@ NPC_ETHEREAL_SPHERE
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
CreatureScript(const char *name)
bool isEmpty() const
Definition LinkedList.h:86
Definition Map.h:238
bool IsDungeon() const
Definition Map.h:369
MapRefManager PlayerList
Definition Map.h:406
PlayerList const & GetPlayers() const
Definition Map.h:407
iterator end()
iterator begin()
LinkedListHead::Iterator< MapReference const > const_iterator
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_WAVE_COUNT
bool IsHeroic() const
Creature * me
void DoTeleportPlayer(Unit *unit, float x, float y, float z, float o)
ScriptedAI(Creature *creature)
void DoStartMovement(Unit *target, float distance=0.0f, float angle=0.0f)
void JustDied(Unit *) OVERRIDE
void MoveInLineOfSight(Unit *) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
InstanceScript * instance
void AttackStart(Unit *who) OVERRIDE
boss_xevozzAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
void KilledUnit(Unit *victim) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_XEVOZZ
Definition violet_hold.h:37
@ DATA_XEVOZZ_CELL
Definition violet_hold.h:46
@ DATA_1ST_BOSS_EVENT
Definition violet_hold.h:11
@ DATA_2ND_BOSS_EVENT
Definition violet_hold.h:12