TrinityCore
boss_gurtogg_bloodboil.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#include "ScriptMgr.h"
19#include "black_temple.h"
20#include "GridNotifiers.h"
21#include "ObjectAccessor.h"
22#include "PassiveAI.h"
23#include "ScriptedCreature.h"
24#include "SpellScript.h"
25
26enum Says
27{
31 SAY_ENRAGE = 3
32};
33
35{
36 //Gurtogg
40 SPELL_EJECT = 40486,
49 SPELL_CHARGE = 40602,
54 //Player
57 //Fel Geyser
59 SPELL_BIRTH = 40031
60};
61
63{
68};
69
71{
73 SOUND_ID_ENRAGE = 11437
74};
75
77{
90};
91
93{
95 {
96 Initialize();
97 }
98
99 void Reset() override
100 {
101 _Reset();
102 Initialize();
106 }
107
109 {
110 _oldThreat = 0.0f;
113 }
114
115 bool CanAIAttack(Unit const* who) const override
116 {
118 }
119
120 void AttackStart(Unit* who) override
121 {
122 if (!CanAIAttack(who))
123 return;
124
126 }
127
128 void JustEngagedWith(Unit* who) override
129 {
135 }
136
137 void EnterEvadeMode(EvadeReason /*why*/) override
138 {
140 }
141
143 {
145 {
151 }
152 else if (events.IsInPhase(PHASE_2))
153 {
158 }
159 }
160
161 void KilledUnit(Unit* victim) override
162 {
163 if (victim->GetTypeId() == TYPEID_PLAYER)
164 Talk(SAY_SLAY);
165 }
166
167 void JustDied(Unit* /*killer*/) override
168 {
169 _JustDied();
171 }
172
173 void UpdateAI(uint32 diff) override
174 {
175 if (!UpdateVictim())
176 return;
177
178 events.Update(diff);
179
181 return;
182
183 while (uint32 eventId = events.ExecuteEvent())
184 {
185 switch (eventId)
186 {
187 case EVENT_BLOODBOIL:
189 events.Repeat(Seconds(10));
190 break;
193 events.Repeat(Seconds(10));
194 break;
198 events.Repeat(Seconds(25), Seconds(30));
199 break;
200 case EVENT_EJECT:
203 break;
206 break;
208 ChangePhase();
209 break;
212 {
213 if (Unit* oldTarget = me->GetVictim())
214 {
215 _oldTargetGUID = oldTarget->GetGUID();
216 _oldThreat = GetThreat(oldTarget);
217 }
218 _targetGUID = target->GetGUID();
220 DoCast(target, SPELL_FEL_RAGE_TARGET, true);
221 DoCast(target, SPELL_FEL_RAGE_2, true);
222 DoCast(target, SPELL_FEL_RAGE_3, true);
223 DoCast(target, SPELL_FEL_GEYSER, true);
224 DoCast(target, SPELL_FEL_RAGE_TARGET_2, true);
225 target->CastSpell(target, SPELL_FEL_RAGE_P, true);
226 target->CastSpell(target, SPELL_TAUNT_GURTOGG, true);
228
230
233 }
234 else // If no other targets are found, reset phase 1
235 {
240 }
241 break;
244 DoCast(target, SPELL_CHARGE);
245 break;
246 case EVENT_EJECT_2:
248 break;
251 break;
254 events.Repeat(Seconds(13));
255 break;
256 case EVENT_BERSERK:
259 break;
260 default:
261 break;
262 }
264 return;
265 }
266 }
267
269 {
271 {
276 }
277 else if (events.IsInPhase(PHASE_2))
278 {
285
286 // Attack the stored target
287 if (Unit* oldTarget = ObjectAccessor::GetUnit(*me, _oldTargetGUID))
288 if (Unit* currentTarget = ObjectAccessor::GetUnit(*me, _targetGUID))
289 {
290 ModifyThreatByPercent(currentTarget, -100);
291 AttackStart(oldTarget);
292 AddThreat(oldTarget, _oldThreat);
293 Initialize();
294 }
295 }
296 }
297
298private:
302};
303
305{
306 npc_fel_geyser(Creature* creature) : PassiveAI(creature) { }
307
308 void Reset() override
309 {
311 DoCastSelf(SPELL_BIRTH, true);
312 }
313};
314
315// 42005 - Bloodboil
317{
318 void FilterTargets(std::list<WorldObject*>& targets)
319 {
320 if (targets.size() <= 5)
321 return;
322
323 // Sort the list of players
324 targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
325 // Resize so we only get top 5
326 targets.resize(5);
327 }
328
329 void Register() override
330 {
332 }
333};
334
335// 40618 - Insignificance
337{
338 bool Validate(SpellInfo const* /*spell*/) override
339 {
341 }
342
343 void FilterTargets(std::list<WorldObject*>& targets)
344 {
345 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FEL_RAGE_TARGET));
346 }
347
348 void Register() override
349 {
351 }
352};
353
355{
360}
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_EFFECT_ATTACK_ME
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ SPELL_AURA_MOD_TAUNT
#define SpellObjectAreaTargetSelectFn(F, I, N)
Definition: SpellScript.h:864
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_GURTOGG_BLOODBOIL
Definition: black_temple.h:35
Sounds
Definition: boss_beauty.cpp:23
@ SPELL_FEL_RAGE_2
@ SPELL_FEL_RAGE_TARGET
@ SPELL_BEWILDERING_STRIKE
@ SPELL_FEL_RAGE_P
@ SPELL_FEL_GEYSER
@ SPELL_ARCING_SMASH_2
@ SPELL_FEL_ACID_BREATH
@ SPELL_FEL_RAGE_3
@ SPELL_FEL_RAGE_TARGET_2
@ SPELL_FEL_GEYSER_2
@ SPELL_ARCING_SMASH
@ SPELL_TAUNT_GURTOGG
@ SPELL_INSIGNIFIGANCE
@ SPELL_FEL_ACID_BREATH_2
@ SPELL_FEL_RAGE_SELF
void AddSC_boss_gurtogg_bloodboil()
@ EVENT_START_PHASE_2
@ EVENT_CHANGE_PHASE
@ EVENT_FEL_ACID_BREATH_2
@ EVENT_FEL_ACID_BREATH
@ EVENT_CHARGE_PLAYER
@ EVENT_ARCING_SMASH_2
@ EVENT_ARCING_SMASH
@ EVENT_BEWILDERING_STRIKE
Says
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
bool CanAIAttack(Unit const *target) const override
EventMap events
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
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void CancelEventGroup(uint32 group)
Definition: EventMap.cpp:153
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
bool IsInPhase(uint8 phase) const
Definition: EventMap.h:217
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void RescheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:52
void Clear()
Definition: ObjectGuid.h:286
TypeID GetTypeId() const
Definition: Object.h:173
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
Definition: SpellScript.h:863
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
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 DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition: Unit.cpp:7845
float GetCombatReach() const override
Definition: Unit.h:694
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
float GetThreat(Unit const *victim, Unit const *who=nullptr)
void ModifyThreatByPercent(Unit *victim, int32 pct, Unit *who=nullptr)
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void AttackStart(Unit *who) override
== Triggered Actions Requested ==================
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *victim) override
bool CanAIAttack(Unit const *who) const override
void EnterEvadeMode(EvadeReason) override
boss_gurtogg_bloodboil(Creature *creature)
void JustDied(Unit *) override
npc_fel_geyser(Creature *creature)