Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_sartura.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/* ScriptData
7SDName: Boss_Sartura
8SD%Complete: 95
9SDComment:
10SDCategory: Temple of Ahn'Qiraj
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "ScriptedCreature.h"
15
17{
21
23 SPELL_ENRAGE = 28747, //Not sure if right ID.
25
26//Guard Spell
29};
30
32{
33public:
34 boss_sartura() : CreatureScript("boss_sartura") { }
35
37 {
38 return new boss_sarturaAI(creature);
39 }
40
41 struct boss_sarturaAI : public ScriptedAI
42 {
43 boss_sarturaAI(Creature* creature) : ScriptedAI(creature) { }
44
51
52 bool Enraged;
56
58 {
59 WhirlWind_Timer = 30000;
60 WhirlWindRandom_Timer = std::rand() % 7000 + 3000;
61 WhirlWindEnd_Timer = 15000;
62 AggroReset_Timer = std::rand() % 55000 + 45000;
64 EnrageHard_Timer = 10*60000;
65
66 WhirlWind = false;
67 AggroReset = false;
68 Enraged = false;
69 EnragedHard = false;
70 }
71
72 void EnterCombat(Unit* /*who*/) OVERRIDE
73 {
75 }
76
77 void JustDied(Unit* /*killer*/) OVERRIDE
78 {
80 }
81
82 void KilledUnit(Unit* /*victim*/) OVERRIDE
83 {
85 }
86
88 {
89 //Return since we have no target
90 if (!UpdateVictim())
91 return;
92
93 if (WhirlWind)
94 {
95 if (WhirlWindRandom_Timer <= diff)
96 {
97 //Attack random Gamers
98 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
99 {
100 me->AddThreat(target, 1.0f);
101 me->TauntApply(target);
102 AttackStart(target);
103 }
104 WhirlWindRandom_Timer = std::rand() % 7000 + 3000;
105 } else WhirlWindRandom_Timer -= diff;
106
107 if (WhirlWindEnd_Timer <= diff)
108 {
109 WhirlWind = false;
110 WhirlWind_Timer = std::rand() % 40000 + 25000;
111 } else WhirlWindEnd_Timer -= diff;
112 }
113
114 if (!WhirlWind)
115 {
116 if (WhirlWind_Timer <= diff)
117 {
119 WhirlWind = true;
120 WhirlWindEnd_Timer = 15000;
121 } else WhirlWind_Timer -= diff;
122
123 if (AggroReset_Timer <= diff)
124 {
125 //Attack random Gamers
126 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
127 {
128 me->AddThreat(target, 1.0f);
129 me->TauntApply(target);
130 AttackStart(target);
131 }
132 AggroReset = true;
133 AggroReset_Timer = std::rand() % 5000 + 2000;
134 } else AggroReset_Timer -= diff;
135
136 if (AggroReset)
137 {
138 if (AggroResetEnd_Timer <= diff)
139 {
140 AggroReset = false;
141 AggroResetEnd_Timer = 5000;
142 AggroReset_Timer = std::rand() % 45000 + 35000;
143 } else AggroResetEnd_Timer -= diff;
144 }
145
146 //If she is 20% enrage
147 if (!Enraged)
148 {
149 if (!HealthAbovePct(20) && !me->IsNonMeleeSpellCasted(false))
150 {
152 Enraged = true;
153 }
154 }
155
156 //After 10 minutes hard enrage
157 if (!EnragedHard)
158 {
159 if (EnrageHard_Timer <= diff)
160 {
162 EnragedHard = true;
163 } else EnrageHard_Timer -= diff;
164 }
165
167 }
168 }
169 };
170};
171
173{
174public:
175 npc_sartura_royal_guard() : CreatureScript("npc_sartura_royal_guard") { }
176
178 {
179 return new npc_sartura_royal_guardAI(creature);
180 }
181
183 {
185
192
195
197 {
198 WhirlWind_Timer = 30000;
199 WhirlWindRandom_Timer = std::rand() % 7000 + 3000;
200 WhirlWindEnd_Timer = 15000;
201 AggroReset_Timer = std::rand() % 55000 + 45000;
202 AggroResetEnd_Timer = 5000;
203 KnockBack_Timer = 10000;
204
205 WhirlWind = false;
206 AggroReset = false;
207 }
208
209 void EnterCombat(Unit* /*who*/) OVERRIDE
210 {
211 }
212
214 {
215 //Return since we have no target
216 if (!UpdateVictim())
217 return;
218
219 if (!WhirlWind && WhirlWind_Timer <= diff)
220 {
222 WhirlWind = true;
223 WhirlWind_Timer = std::rand() % 40000 + 25000;
224 WhirlWindEnd_Timer = 15000;
225 } else WhirlWind_Timer -= diff;
226
227 if (WhirlWind)
228 {
229 if (WhirlWindRandom_Timer <= diff)
230 {
231 //Attack random Gamers
232 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
233 {
234 me->AddThreat(target, 1.0f);
235 me->TauntApply(target);
236 AttackStart(target);
237 }
238
239 WhirlWindRandom_Timer = std::rand() % 7000 + 3000;
240 } else WhirlWindRandom_Timer -= diff;
241
242 if (WhirlWindEnd_Timer <= diff)
243 {
244 WhirlWind = false;
245 } else WhirlWindEnd_Timer -= diff;
246 }
247
248 if (!WhirlWind)
249 {
250 if (AggroReset_Timer <= diff)
251 {
252 //Attack random Gamers
253 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
254 {
255 me->AddThreat(target, 1.0f);
256 me->TauntApply(target);
257 AttackStart(target);
258 }
259
260 AggroReset = true;
261 AggroReset_Timer = std::rand() % 5000 + 2000;
262 } else AggroReset_Timer -= diff;
263
264 if (KnockBack_Timer <= diff)
265 {
267 KnockBack_Timer = std::rand() % 20000 + 10000;
268 } else KnockBack_Timer -= diff;
269 }
270
271 if (AggroReset)
272 {
273 if (AggroResetEnd_Timer <= diff)
274 {
275 AggroReset = false;
276 AggroResetEnd_Timer = 5000;
277 AggroReset_Timer = std::rand() % 40000 + 30000;
278 } else AggroResetEnd_Timer -= diff;
279 }
280
282 }
283 };
284};
285
287{
288 new boss_sartura();
290}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_ENRAGE
@ SPELL_WHIRLWIND
@ SAY_SLAY
#define SAY_DEATH
#define SAY_AGGRO
Sartura
@ SAY_DEATH
@ SPELL_ENRAGE
@ SPELL_WHIRLWINDADD
@ SAY_AGGRO
@ SPELL_ENRAGEHARD
@ SAY_SLAY
@ SPELL_WHIRLWIND
void AddSC_boss_sartura()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
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
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthAbovePct(uint32 pct) const
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
boss_sarturaAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void KilledUnit(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void JustDied(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================