TrinityCore
boss_brutallus.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_Brutallus
20SD%Complete: 80
21SDComment: Find a way to start the intro, best code for the intro
22EndScriptData */
23
24#include "ScriptMgr.h"
25#include "InstanceScript.h"
26#include "Log.h"
27#include "ScriptedCreature.h"
28#include "SpellAuraEffects.h"
29#include "SpellScript.h"
30#include "sunwell_plateau.h"
31
33{
39
45
51};
52
54{
56 SPELL_BURN = 46394,
57 SPELL_STOMP = 45185,
60
65};
66
67struct boss_brutallus : public BossAI
68{
70 {
71 Initialize();
72 Intro = true;
73 }
74
76 {
77 SlashTimer = 11000;
78 StompTimer = 30000;
79 BurnTimer = 60000;
80 BerserkTimer = 360000;
81
82 IntroPhase = 0;
85
86 IsIntro = false;
87 Enraged = false;
88 }
89
94
98
99 bool Intro;
102
103 void Reset() override
104 {
105 Initialize();
106
107 DoCast(me, SPELL_DUAL_WIELD, true);
108
110 }
111
112 void JustEngagedWith(Unit* who) override
113 {
115
117 }
118
119 void KilledUnit(Unit* /*victim*/) override
120 {
122 }
123
124 void JustDied(Unit* killer) override
125 {
127
129 BossAI::JustDied(killer);
130 }
131
132 void EnterEvadeMode(EvadeReason why) override
133 {
134 if (!Intro)
136 }
137
139 {
140 if (!Intro || IsIntro)
141 return;
142
143 if (Creature* Madrigosa = instance->GetCreature(DATA_MADRIGOSA))
144 {
145 Madrigosa->Respawn();
146 Madrigosa->setActive(true);
147 Madrigosa->SetFarVisible(true);
148 IsIntro = true;
149 Madrigosa->SetMaxHealth(me->GetMaxHealth());
150 Madrigosa->SetHealth(me->GetMaxHealth());
152 me->Attack(Madrigosa, true);
153 Madrigosa->Attack(me, true);
154 }
155 else
156 {
157 // Madrigosa not found, end intro
158 TC_LOG_ERROR("scripts", "Madrigosa was not found");
159 EndIntro();
160 }
161 }
162
163 void EndIntro()
164 {
166 Intro = false;
167 IsIntro = false;
168 }
169
170 void AttackStart(Unit* who) override
171 {
172 if (!who || Intro || IsIntro)
173 return;
175 }
176
177 void DoIntro()
178 {
180 if (!Madrigosa)
181 return;
182
183 switch (IntroPhase)
184 {
185 case 0:
186 Madrigosa->AI()->Talk(YELL_MADR_ICE_BARRIER);
187 IntroPhaseTimer = 7000;
188 ++IntroPhase;
189 break;
190 case 1:
191 me->SetFacingToObject(Madrigosa);
192 Madrigosa->SetFacingToObject(me);
193 Madrigosa->AI()->Talk(YELL_MADR_INTRO, me);
194 IntroPhaseTimer = 9000;
195 ++IntroPhase;
196 break;
197 case 2:
198 Talk(YELL_INTRO, Madrigosa);
199 IntroPhaseTimer = 13000;
200 ++IntroPhase;
201 break;
202 case 3:
204 Madrigosa->SetDisableGravity(true);
205 me->AttackStop();
206 Madrigosa->AttackStop();
207 IntroFrostBoltTimer = 3000;
208 IntroPhaseTimer = 28000;
209 ++IntroPhase;
210 break;
211 case 4:
213 IntroPhaseTimer = 6000;
214 ++IntroPhase;
215 break;
216 case 5:
218 Madrigosa->AI()->Talk(YELL_MADR_TRAP);
220 IntroPhaseTimer = 11000;
221 ++IntroPhase;
222 break;
223 case 6:
225 IntroPhaseTimer = 5000;
226 ++IntroPhase;
227 break;
228 case 7:
229 Unit::Kill(me, Madrigosa);
230 Madrigosa->AI()->Talk(YELL_MADR_DEATH);
231 me->SetFullHealth();
232 me->AttackStop();
233 IntroPhaseTimer = 4000;
234 ++IntroPhase;
235 break;
236 case 8:
238 me->SetOrientation(0.14f);
239 me->StopMoving();
240 Madrigosa->setDeathState(CORPSE);
241 IntroPhaseTimer = 8000;
242 ++IntroPhase;
243 break;
244 case 9:
246 IntroPhaseTimer = 5000;
247 ++IntroPhase;
248 break;
249 case 10:
250 EndIntro();
251 break;
252 }
253 }
254
255 void MoveInLineOfSight(Unit* who) override
256 {
257 if (!me->IsValidAttackTarget(who))
258 return;
259
260 if (Intro)
262
263 if (Intro && !IsIntro)
264 StartIntro();
265
266 if (!Intro)
268 }
269
270 void UpdateAI(uint32 diff) override
271 {
272 if (IsIntro)
273 {
274 if (IntroPhaseTimer <= diff)
275 DoIntro();
276 else IntroPhaseTimer -= diff;
277
278 if (IntroPhase == 3 + 1)
279 {
280 if (IntroFrostBoltTimer <= diff)
281 {
282 if (Creature* Madrigosa = instance->GetCreature(DATA_MADRIGOSA))
283 {
284 Madrigosa->CastSpell(me, SPELL_INTRO_FROSTBOLT, true);
285 IntroFrostBoltTimer = 2000;
286 }
287 }
288 else
289 IntroFrostBoltTimer -= diff;
290 }
291
292 if (!UpdateVictim())
293 return;
294 }
295
296 if (!UpdateVictim() || IsIntro)
297 return;
298
299 if (SlashTimer <= diff)
300 {
302 SlashTimer = 11000;
303 } else SlashTimer -= diff;
304
305 if (StompTimer <= diff)
306 {
309 StompTimer = 30000;
310 } else StompTimer -= diff;
311
312 if (BurnTimer <= diff)
313 {
314 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_BURN))
315 target->CastSpell(target, SPELL_BURN, true);
316 BurnTimer = urand(60000, 180000);
317 } else BurnTimer -= diff;
318
319 if (BerserkTimer < diff && !Enraged)
320 {
323 Enraged = true;
324 } else BerserkTimer -= diff;
325 }
326};
327
328// 46394 - Burn
330{
332 {
333 if (aurEff->GetTickNumber() % 11 == 0)
334 aurEff->SetAmount(aurEff->GetAmount() * 2);
335 }
336
337 void Register() override
338 {
340 }
341};
342
343// 45185 - Stomp
345{
346 bool Validate(SpellInfo const* /*spellInfo*/) override
347 {
348 return ValidateSpellInfo({ SPELL_BURN });
349 }
350
351 void HandleScript(SpellEffIndex /*effIndex*/)
352 {
354 }
355
356 void Register() override
357 {
359 }
360};
361
363{
367}
uint32_t uint32
Definition: Define.h:142
@ SPECIAL
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_EFFECT_SCRIPT_EFFECT
@ SPELL_AURA_PERIODIC_DAMAGE
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectUpdatePeriodicFn(F, I, N)
Definition: SpellScript.h:2052
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:145
@ CORPSE
Definition: Unit.h:248
Quotes
@ 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()
uint32 GetTickNumber() const
void SetAmount(int32 amount)
int32 GetAmount() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
Definition: SpellScript.h:2051
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void Reset() override
virtual void MoveInLineOfSight(Unit *)
Definition: CreatureAI.cpp:122
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
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
void setDeathState(DeathState s) override
Definition: Creature.cpp:2197
CreatureAI * AI() const
Definition: Creature.h:214
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:840
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
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
void SetFullHealth()
Definition: Unit.h:790
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
void StopMoving()
Definition: Unit.cpp:10049
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
uint64 GetMaxHealth() const
Definition: Unit.h:777
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:833
bool AttackStop()
Definition: Unit.cpp:5781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10591
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2991
void HandleEffectPeriodicUpdate(AuraEffect *aurEff)
void Register() override
void HandleScript(SpellEffIndex)
void Register() override
bool Validate(SpellInfo const *) override
constexpr void SetOrientation(float orientation)
Definition: Position.h:71
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void JustEngagedWith(Unit *who) override
void AttackStart(Unit *who) override
== Triggered Actions Requested ==================
uint32 IntroFrostBoltTimer
void EnterEvadeMode(EvadeReason why) override
void Reset() override
void JustDied(Unit *killer) override
boss_brutallus(Creature *creature)
void MoveInLineOfSight(Unit *who) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *) override
#define RegisterSunwellPlateauCreatureAI(ai_name)
@ DATA_BRUTALLUS
@ DATA_FELMYST
@ DATA_MADRIGOSA