Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_toravon.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 "vault_of_archavon.h"
9
11{
12 // Toravon
13 SPELL_FREEZING_GROUND = 72090, // don't know cd... using 20 secs.
15 SPELL_WHITEOUT = 72034, // Every 38 sec. cast. (after SPELL_FROZEN_ORB)
17
18 // Frost Warder
19 SPELL_FROST_BLAST = 72123, // don't know cd... using 20 secs.
21
22 // Frozen Orb
23 SPELL_FROZEN_ORB_DMG = 72081, // priodic dmg aura
24 SPELL_FROZEN_ORB_AURA = 72067, // make visible
25
26 // Frozen Orb Stalker
27 SPELL_FROZEN_ORB_SUMMON = 72093, // summon orb
28};
29
38
40{
41 NPC_FROZEN_ORB = 38456 // 1 in 10 mode and 3 in 25 mode
42};
43
45{
46 public:
47 boss_toravon() : CreatureScript("boss_toravon") { }
48
49 struct boss_toravonAI : public BossAI
50 {
52 {
53 }
54
55 void EnterCombat(Unit* /*who*/) OVERRIDE
56 {
58
59 events.ScheduleEvent(EVENT_FROZEN_ORB, 11000);
60 events.ScheduleEvent(EVENT_WHITEOUT, 13000);
61 events.ScheduleEvent(EVENT_FREEZING_GROUND, 15000);
62
64 }
65
67 {
68 if (!UpdateVictim())
69 return;
70
71 events.Update(diff);
72
73 if (me->HasUnitState(UNIT_STATE_CASTING))
74 return;
75
76 while (uint32 eventId = events.ExecuteEvent())
77 {
78 switch (eventId)
79 {
81 me->CastCustomSpell(SPELL_FROZEN_ORB, SPELLVALUE_MAX_TARGETS, 1, me);
82 events.ScheduleEvent(EVENT_FROZEN_ORB, 38000);
83 break;
84 case EVENT_WHITEOUT:
86 events.ScheduleEvent(EVENT_WHITEOUT, 38000);
87 break;
89 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
91 events.ScheduleEvent(EVENT_FREEZING_GROUND, 20000);
92 break;
93 default:
94 break;
95 }
96 }
97
99 }
100 };
101
103 {
104 return new boss_toravonAI(creature);
105 }
106};
107
108/*######
109## Mob Frost Warder
110######*/
112{
113 public:
114 npc_frost_warder() : CreatureScript("npc_frost_warder") { }
115
117 {
118 npc_frost_warderAI(Creature* creature) : ScriptedAI(creature) { }
119
121 {
122 events.Reset();
123 }
124
125 void EnterCombat(Unit* /*who*/) OVERRIDE
126 {
128
130
131 events.ScheduleEvent(EVENT_FROST_BLAST, 5000);
132 }
133
135 {
136 if (!UpdateVictim())
137 return;
138
139 events.Update(diff);
140
141 if (me->HasUnitState(UNIT_STATE_CASTING))
142 return;
143
144 if (events.ExecuteEvent() == EVENT_FROST_BLAST)
145 {
147 events.ScheduleEvent(EVENT_FROST_BLAST, 20000);
148 }
149
151 }
152
153 private:
155 };
156
158 {
159 return new npc_frost_warderAI(creature);
160 }
161};
162
163/*######
164## Mob Frozen Orb
165######*/
167{
168public:
169 npc_frozen_orb() : CreatureScript("npc_frozen_orb") { }
170
172 {
173 npc_frozen_orbAI(Creature* creature) : ScriptedAI(creature)
174 {
175 }
176
178 {
179 done = false;
180 killTimer = 60000; // if after this time there is no victim -> destroy!
181 }
182
183 void EnterCombat(Unit* /*who*/) OVERRIDE
184 {
186 }
187
189 {
190 if (!done)
191 {
194 done = true;
195 }
196
197 if (killTimer <= diff)
198 {
199 if (!UpdateVictim())
200 me->DespawnOrUnsummon();
201 killTimer = 10000;
202 }
203 else
204 killTimer -= diff;
205 }
206
207 private:
209 bool done;
210 };
211
213 {
214 return new npc_frozen_orbAI(creature);
215 }
216};
217
218/*######
219## Mob Frozen Orb Stalker
220######*/
222{
223 public:
224 npc_frozen_orb_stalker() : CreatureScript("npc_frozen_orb_stalker") { }
225
227 {
229 {
230 creature->SetVisible(false);
232 creature->SetReactState(REACT_PASSIVE);
233
234 instance = creature->GetInstanceScript();
235 spawned = false;
236
237 SetCombatMovement(false);
238 }
239
240 void UpdateAI(uint32 /*diff*/) OVERRIDE
241 {
242 if (spawned)
243 return;
244
245 spawned = true;
246 Unit* toravon = me->GetCreature(*me, instance ? instance->GetData64(DATA_TORAVON) : 0);
247 if (!toravon)
248 return;
249
250 uint8 num_orbs = RAID_MODE(1, 3);
251 for (uint8 i = 0; i < num_orbs; ++i)
252 {
253 Position pos;
254 me->GetNearPoint(toravon, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 10.0f, 0.0f);
255 me->SetPosition(pos);
257 }
258 }
259
260 private:
263 };
264
266 {
267 return new npc_frozen_orb_stalkerAI(creature);
268 }
269};
270
272{
273 new boss_toravon();
274 new npc_frost_warder();
275 new npc_frozen_orb();
277}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ SPELLVALUE_MAX_TARGETS
Definition Unit.h:118
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ REACT_PASSIVE
Definition Unit.h:1156
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FLAG_DISABLE_MOVE
Definition Unit.h:627
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
Creatures
@ SPELL_FROST_BLAST
@ NPC_FROZEN_ORB
@ SPELL_FROZEN_MALLET_2
@ SPELL_FROZEN_MALLET
@ SPELL_WHITEOUT
@ SPELL_FROZEN_ORB
@ SPELL_FROZEN_ORB_DMG
@ SPELL_FREEZING_GROUND
@ SPELL_FROST_BLAST
@ SPELL_FROZEN_ORB_SUMMON
@ SPELL_FROZEN_ORB_AURA
@ EVENT_FROST_BLAST
@ EVENT_FROZEN_ORB
@ EVENT_WHITEOUT
@ EVENT_FREEZING_GROUND
void AddSC_boss_toravon()
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void DoZoneInCombat(Creature *creature=NULL, float maxRangeToNearestTarget=50.0f)
bool UpdateVictim()
void SetReactState(ReactStates st)
Definition Creature.h:460
CreatureScript(const char *name)
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
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
void SetVisible(bool x)
Definition Unit.cpp:4163
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
float m_positionZ
Definition Object.h:289
float m_positionX
Definition Object.h:287
float m_positionY
Definition Object.h:288
void SetCombatMovement(bool allowMovement)
Creature * me
const T & RAID_MODE(const T &normal10, const T &normal25) const
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
boss_toravonAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void EnterCombat(Unit *) OVERRIDE
npc_frozen_orbAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
@ DATA_TORAVON