Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_brutallus.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_Brutallus
8SD%Complete: 80
9SDComment: Find a way to start the intro, best code for the intro
10EndScriptData */
11
12#include "ScriptMgr.h"
13#include "ScriptedCreature.h"
14#include "sunwell_plateau.h"
15
36
50
51#define FELMYST 25038
52
54{
55public:
56 boss_brutallus() : CreatureScript("boss_brutallus") { }
57
59 {
60 return new boss_brutallusAI(creature);
61 }
62
64 {
65 boss_brutallusAI(Creature* creature) : ScriptedAI(creature)
66 {
67 instance = creature->GetInstanceScript();
68 Intro = true;
69 }
70
72
77
81
82 bool Intro;
83 bool IsIntro;
84 bool Enraged;
85
87 {
88 SlashTimer = 11000;
89 StompTimer = 30000;
90 BurnTimer = 60000;
91 BerserkTimer = 360000;
92
93 IntroPhase = 0;
96
97 IsIntro = false;
98 Enraged = false;
99
100 DoCast(me, SPELL_DUAL_WIELD, true);
101
102 if (instance)
104 }
105
106 void EnterCombat(Unit* /*who*/) OVERRIDE
107 {
109
110 if (instance)
112 }
113
114 void KilledUnit(Unit* /*victim*/) OVERRIDE
115 {
117 }
118
119 void JustDied(Unit* /*killer*/) OVERRIDE
120 {
122
123 if (instance)
124 {
126 float x, y, z;
127 me->GetPosition(x, y, z);
128 me->SummonCreature(FELMYST, x, y, z+30, me->GetOrientation(), TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, 0);
129 }
130 }
131
133 {
134 if (!Intro)
136 }
137
139 {
140 if (!Intro || IsIntro)
141 return;
142 Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0);
143 if (Madrigosa)
144 {
145 Madrigosa->Respawn();
146 Madrigosa->setActive(true);
147 IsIntro = true;
148 Madrigosa->SetMaxHealth(me->GetMaxHealth());
149 Madrigosa->SetHealth(me->GetMaxHealth());
151 me->Attack(Madrigosa, true);
152 Madrigosa->Attack(me, true);
153 }
154 else
155 {
156 //Madrigosa not found, end intro
157 SF_LOG_ERROR("scripts", "Madrigosa was not found");
158 EndIntro();
159 }
160 }
161
162 void EndIntro()
163 {
165 Intro = false;
166 IsIntro = false;
167 }
168
170 {
171 if (!who || Intro || IsIntro)
172 return;
174 }
175
176 void DoIntro()
177 {
178 Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0);
179 if (!Madrigosa)
180 return;
181
182 switch (IntroPhase)
183 {
184 case 0:
185 Madrigosa->AI()->Talk(YELL_MADR_ICE_BARRIER);
186 IntroPhaseTimer = 7000;
187 ++IntroPhase;
188 break;
189 case 1:
190 me->SetInFront(Madrigosa);
191 Madrigosa->SetInFront(me);
192 Madrigosa->AI()->Talk(YELL_MADR_INTRO, me);
193 IntroPhaseTimer = 9000;
194 ++IntroPhase;
195 break;
196 case 2:
197 Talk(YELL_INTRO, Madrigosa);
198 IntroPhaseTimer = 13000;
199 ++IntroPhase;
200 break;
201 case 3:
203 Madrigosa->SetDisableGravity(true);
204 me->AttackStop();
205 Madrigosa->AttackStop();
206 IntroFrostBoltTimer = 3000;
207 IntroPhaseTimer = 28000;
208 ++IntroPhase;
209 break;
210 case 4:
212 IntroPhaseTimer = 6000;
213 ++IntroPhase;
214 break;
215 case 5:
217 Madrigosa->AI()->Talk(YELL_MADR_TRAP);
219 IntroPhaseTimer = 11000;
220 ++IntroPhase;
221 break;
222 case 6:
224 IntroPhaseTimer = 5000;
225 ++IntroPhase;
226 break;
227 case 7:
228 me->Kill(Madrigosa);
229 Madrigosa->AI()->Talk(YELL_MADR_DEATH);
230 me->SetFullHealth();
231 me->AttackStop();
232 IntroPhaseTimer = 4000;
233 ++IntroPhase;
234 break;
235 case 8:
237 me->SetOrientation(0.14f);
238 me->StopMoving();
240 IntroPhaseTimer = 8000;
241 ++IntroPhase;
242 break;
243 case 9:
245 IntroPhaseTimer = 5000;
246 ++IntroPhase;
247 break;
248 case 10:
249 EndIntro();
250 break;
251 }
252 }
253
255
256 {
257 if (!me->IsValidAttackTarget(who))
258 return;
259 if (instance && Intro)
261
262 if (Intro && !IsIntro)
263 StartIntro();
264 if (!Intro)
266 }
267
269 {
270 if (IsIntro)
271 {
272 if (IntroPhaseTimer <= diff)
273 DoIntro();
274 else IntroPhaseTimer -= diff;
275
276 if (IntroPhase == 3 + 1)
277 {
278 if (IntroFrostBoltTimer <= diff)
279 {
280 if (Creature* Madrigosa = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_MADRIGOSA) : 0))
281 {
282 Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true);
283 IntroFrostBoltTimer = 2000;
284 }
285 } else IntroFrostBoltTimer -= diff;
286 }
287 if (!UpdateVictim())
288 return;
290 }
291
292 if (!UpdateVictim() || IsIntro)
293 return;
294
295 if (SlashTimer <= diff)
296 {
298 SlashTimer = 11000;
299 } else SlashTimer -= diff;
300
301 if (StompTimer <= diff)
302 {
305 StompTimer = 30000;
306 } else StompTimer -= diff;
307
308 if (BurnTimer <= diff)
309 {
310 std::list<Unit*> targets;
311 SelectTargetList(targets, 10, SELECT_TARGET_RANDOM, 100, true);
312 for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
313 if (!(*i)->HasAura(SPELL_BURN))
314 {
315 (*i)->CastSpell((*i), SPELL_BURN, true);
316 break;
317 }
318 BurnTimer = std::rand() % 180000 + 60000;
319 } else BurnTimer -= diff;
320
321 if (BerserkTimer < diff && !Enraged)
322 {
325 Enraged = true;
326 } else BerserkTimer -= diff;
327
329 }
330 };
331};
332
334{
335 new boss_brutallus();
336}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ IN_PROGRESS
@ DONE
@ SPECIAL
@ NOT_STARTED
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ TEMPSUMMON_MANUAL_DESPAWN
Definition Object.h:75
@ CORPSE
Definition Unit.h:505
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ UNIT_FIELD_FLAGS
@ YELL_AGGRO
@ YELL_INTRO
@ YELL_MADR_DEATH
@ YELL_INTRO_BREAK_ICE
@ YELL_MADR_INTRO
@ YELL_AGGRO
@ YELL_MADR_ICE_BARRIER
@ YELL_MADR_ICE_BLOCK
@ YELL_KILL
@ YELL_DEATH
@ YELL_BERSERK
@ YELL_INTRO_KILL_MADRIGOSA
@ YELL_INTRO_TAUNT
@ YELL_LOVE
@ YELL_INTRO_CHARGE
@ YELL_MADR_TRAP
@ SPELL_STOMP
@ SPELL_INTRO_FROST_BLAST
@ SPELL_INTRO_ENCAPSULATE_CHANELLING
@ SPELL_DUAL_WIELD
@ SPELL_INTRO_ENCAPSULATE
@ SPELL_INTRO_FROSTBOLT
@ SPELL_BURN
@ SPELL_BERSERK
@ SPELL_METEOR_SLASH
void AddSC_boss_brutallus()
#define FELMYST
#define SPELL_BERSERK
@ SPELL_STOMP
Definition chapter5.cpp:158
virtual void MoveInLineOfSight(Unit *)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
virtual void EnterEvadeMode()
void Respawn(bool force=false)
void setDeathState(DeathState s) OVERRIDE
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
void SelectTargetList(std::list< Unit * > &targetList, uint32 num, SelectAggroTarget targetType, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:71
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
void SetHealth(uint32 val)
Definition Unit.cpp:5162
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
bool Attack(Unit *victim, bool meleeAttack)
bool SetDisableGravity(bool disable, bool packetOnly=false)
Definition Unit.cpp:9156
void SetMaxHealth(uint32 val)
Definition Unit.cpp:5206
void SetInFront(WorldObject const *target)
Definition Unit.cpp:9108
bool AttackStop()
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
void setActive(bool isActiveObject)
Definition Object.cpp:1542
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void AttackStart(Unit *who) OVERRIDE
void MoveInLineOfSight(Unit *who) OVERRIDE
@ DATA_MADRIGOSA
@ DATA_BRUTALLUS_EVENT