TrinityCore
boss_sartura.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/* ScriptData
19SDName: Boss_Sartura
20SD%Complete: 95
21SDComment:
22SDCategory: Temple of Ahn'Qiraj
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "InstanceScript.h"
27#include "ScriptedCreature.h"
28#include "temple_of_ahnqiraj.h"
29#include "Player.h"
30
32{
36
38 SPELL_ENRAGE = 28747, //Not sure if right ID.
40
41 //Guard Spell
43 SPELL_KNOCKBACK = 26027
44};
45
47{
48public:
49 boss_sartura() : CreatureScript("boss_sartura") { }
50
51 CreatureAI* GetAI(Creature* creature) const override
52 {
53 return GetAQ40AI<boss_sarturaAI>(creature);
54 }
55
56 struct boss_sarturaAI : public BossAI
57 {
59 {
60 Initialize();
61 }
62
64 {
65 WhirlWind_Timer = 30000;
66 WhirlWindRandom_Timer = urand(3000, 7000);
67 WhirlWindEnd_Timer = 15000;
68 AggroReset_Timer = urand(45000, 55000);
70 EnrageHard_Timer = 10 * 60000;
71
72 WhirlWind = false;
73 AggroReset = false;
74 Enraged = false;
75 EnragedHard = false;
76 }
77
84
85 bool Enraged;
89
90 void Reset() override
91 {
92 Initialize();
93 _Reset();
94 }
95
96 void JustEngagedWith(Unit* who) override
97 {
100 }
101
102 void JustDied(Unit* /*killer*/) override
103 {
105 _JustDied();
106 }
107
108 void KilledUnit(Unit* /*victim*/) override
109 {
110 Talk(SAY_SLAY);
111 }
112
113 void UpdateAI(uint32 diff) override
114 {
115 //Return since we have no target
116 if (!UpdateVictim())
117 return;
118
119 if (WhirlWind)
120 {
121 if (WhirlWindRandom_Timer <= diff)
122 {
123 //Attack random Gamers
124 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
125 {
126 AddThreat(target, 1.0f);
127 AttackStart(target);
128 }
129 WhirlWindRandom_Timer = urand(3000, 7000);
130 } else WhirlWindRandom_Timer -= diff;
131
132 if (WhirlWindEnd_Timer <= diff)
133 {
134 WhirlWind = false;
135 WhirlWind_Timer = urand(25000, 40000);
136 } else WhirlWindEnd_Timer -= diff;
137 }
138
139 if (!WhirlWind)
140 {
141 if (WhirlWind_Timer <= diff)
142 {
144 WhirlWind = true;
145 WhirlWindEnd_Timer = 15000;
146 } else WhirlWind_Timer -= diff;
147
148 if (AggroReset_Timer <= diff)
149 {
150 //Attack random Gamers
151 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
152 {
153 AddThreat(target, 1.0f);
154 AttackStart(target);
155 }
156 AggroReset = true;
157 AggroReset_Timer = urand(2000, 5000);
158 } else AggroReset_Timer -= diff;
159
160 if (AggroReset)
161 {
162 if (AggroResetEnd_Timer <= diff)
163 {
164 AggroReset = false;
165 AggroResetEnd_Timer = 5000;
166 AggroReset_Timer = urand(35000, 45000);
167 } else AggroResetEnd_Timer -= diff;
168 }
169
170 //If she is 20% enrage
171 if (!Enraged)
172 {
173 if (!HealthAbovePct(20) && !me->IsNonMeleeSpellCast(false))
174 {
176 Enraged = true;
177 }
178 }
179
180 //After 10 minutes hard enrage
181 if (!EnragedHard)
182 {
183 if (EnrageHard_Timer <= diff)
184 {
186 EnragedHard = true;
187 } else EnrageHard_Timer -= diff;
188 }
189 }
190 }
191 };
192
193};
194
196{
197public:
198 npc_sartura_royal_guard() : CreatureScript("npc_sartura_royal_guard") { }
199
200 CreatureAI* GetAI(Creature* creature) const override
201 {
202 return GetAQ40AI<npc_sartura_royal_guardAI>(creature);
203 }
204
206 {
208 {
209 Initialize();
210 }
211
213 {
214 WhirlWind_Timer = 30000;
215 WhirlWindRandom_Timer = urand(3000, 7000);
216 WhirlWindEnd_Timer = 15000;
217 AggroReset_Timer = urand(45000, 55000);
218 AggroResetEnd_Timer = 5000;
219 KnockBack_Timer = 10000;
220
221 WhirlWind = false;
222 AggroReset = false;
223 }
224
231
234
235 void Reset() override
236 {
237 Initialize();
238 }
239
240 void JustEngagedWith(Unit* /*who*/) override
241 {
242 }
243
244 void UpdateAI(uint32 diff) override
245 {
246 //Return since we have no target
247 if (!UpdateVictim())
248 return;
249
250 if (!WhirlWind && WhirlWind_Timer <= diff)
251 {
253 WhirlWind = true;
254 WhirlWind_Timer = urand(25000, 40000);
255 WhirlWindEnd_Timer = 15000;
256 } else WhirlWind_Timer -= diff;
257
258 if (WhirlWind)
259 {
260 if (WhirlWindRandom_Timer <= diff)
261 {
262 //Attack random Gamers
263 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
264 {
265 AddThreat(target, 1.0f);
266 AttackStart(target);
267 }
268
269 WhirlWindRandom_Timer = urand(3000, 7000);
270 } else WhirlWindRandom_Timer -= diff;
271
272 if (WhirlWindEnd_Timer <= diff)
273 {
274 WhirlWind = false;
275 } else WhirlWindEnd_Timer -= diff;
276 }
277
278 if (!WhirlWind)
279 {
280 if (AggroReset_Timer <= diff)
281 {
282 //Attack random Gamers
283 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true))
284 {
285 AddThreat(target, 1.0f);
286 AttackStart(target);
287 }
288
289 AggroReset = true;
290 AggroReset_Timer = urand(2000, 5000);
291 } else AggroReset_Timer -= diff;
292
293 if (KnockBack_Timer <= diff)
294 {
296 KnockBack_Timer = urand(10000, 20000);
297 } else KnockBack_Timer -= diff;
298 }
299
300 if (AggroReset)
301 {
302 if (AggroResetEnd_Timer <= diff)
303 {
304 AggroReset = false;
305 AggroResetEnd_Timer = 5000;
306 AggroReset_Timer = urand(30000, 40000);
307 } else AggroResetEnd_Timer -= diff;
308 }
309 }
310 };
311
312};
313
314// 4052
316{
317public:
318 at_aq_battleguard_sartura() : AreaTriggerScript("at_aq_battleguard_sartura") { }
319
320 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
321 {
322 if (InstanceScript* instance = player->GetInstanceScript())
323 if (Creature* sartura = instance->GetCreature(DATA_SARTURA))
324 sartura->AI()->AttackStart(player);
325
326 return true;
327 }
328};
329
331{
332 new boss_sartura();
335}
uint32_t uint32
Definition: Define.h:142
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
Sartura
@ SAY_DEATH
@ SPELL_KNOCKBACK
@ SPELL_ENRAGE
@ SPELL_WHIRLWINDADD
@ SAY_AGGRO
@ SPELL_ENRAGEHARD
@ SAY_SLAY
@ SPELL_WHIRLWIND
void AddSC_boss_sartura()
void JustEngagedWith(Unit *who) override
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:79
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
bool HealthAbovePct(uint32 pct) const
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
boss_sarturaAI(Creature *creature)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void KilledUnit(Unit *) override
void JustEngagedWith(Unit *who) override
@ DATA_SARTURA