TrinityCore
Loading...
Searching...
No Matches
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
33
61
69
71{
73 SOUND_ID_ENRAGE = 11437
74};
75
91
92// 22948 - Gurtogg Bloodboil
94{
99
108
110 {
111 _oldThreat = 0.0f;
114 }
115
116 bool CanAIAttack(Unit const* who) const override
117 {
119 }
120
121 void AttackStart(Unit* who) override
122 {
123 if (!CanAIAttack(who))
124 return;
125
127 }
128
137
138 void EnterEvadeMode(EvadeReason /*why*/) override
139 {
141 }
142
161
162 void KilledUnit(Unit* victim) override
163 {
164 if (victim->GetTypeId() == TYPEID_PLAYER)
165 Talk(SAY_SLAY);
166 }
167
168 void JustDied(Unit* /*killer*/) override
169 {
170 _JustDied();
172 }
173
174 void UpdateAI(uint32 diff) override
175 {
176 if (!UpdateVictim())
177 return;
178
179 events.Update(diff);
180
182 return;
183
184 while (uint32 eventId = events.ExecuteEvent())
185 {
186 switch (eventId)
187 {
188 case EVENT_BLOODBOIL:
190 events.Repeat(10s);
191 break;
194 events.Repeat(10s);
195 break;
199 events.Repeat(25s, 30s);
200 break;
201 case EVENT_EJECT:
204 break;
207 break;
209 ChangePhase();
210 break;
213 {
214 if (Unit* oldTarget = me->GetVictim())
215 {
216 _oldTargetGUID = oldTarget->GetGUID();
217 _oldThreat = GetThreat(oldTarget);
218 }
219 _targetGUID = target->GetGUID();
221 DoCast(target, SPELL_FEL_RAGE_TARGET, true);
222 DoCast(target, SPELL_FEL_RAGE_2, true);
223 DoCast(target, SPELL_FEL_RAGE_3, true);
224 DoCast(target, SPELL_FEL_GEYSER, true);
225 DoCast(target, SPELL_FEL_RAGE_TARGET_2, true);
226 target->CastSpell(target, SPELL_FEL_RAGE_P, true);
227 target->CastSpell(target, SPELL_TAUNT_GURTOGG, true);
229
231
234 }
235 else // If no other targets are found, reset phase 1
236 {
241 }
242 break;
245 DoCast(target, SPELL_CHARGE);
246 break;
247 case EVENT_EJECT_2:
249 break;
252 break;
255 events.Repeat(13s);
256 break;
257 case EVENT_BERSERK:
260 break;
261 default:
262 break;
263 }
265 return;
266 }
267
269 }
270
272 {
274 {
279 }
280 else if (events.IsInPhase(PHASE_2))
281 {
288
289 // Attack the stored target
290 if (Unit* oldTarget = ObjectAccessor::GetUnit(*me, _oldTargetGUID))
291 if (Unit* currentTarget = ObjectAccessor::GetUnit(*me, _targetGUID))
292 {
293 ModifyThreatByPercent(currentTarget, -100);
294 AttackStart(oldTarget);
295 AddThreat(oldTarget, _oldThreat);
296 Initialize();
297 }
298 }
299 }
300
301private:
305};
306
307// 23254 - Fel Geyser
309{
310 npc_fel_geyser(Creature* creature) : PassiveAI(creature) { }
311
312 void Reset() override
313 {
315 DoCastSelf(SPELL_BIRTH, true);
316 }
317};
318
319// 42005 - Bloodboil
321{
323
324 void FilterTargets(std::list<WorldObject*>& targets)
325 {
326 if (targets.size() <= 5)
327 return;
328
329 // Sort the list of players
330 targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
331 // Resize so we only get top 5
332 targets.resize(5);
333 }
334
339};
340
341// 40618 - Insignificance
361
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ SPELL_EFFECT_ATTACK_ME
@ TARGET_UNIT_SRC_AREA_ENEMY
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ SPELL_AURA_MOD_TAUNT
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_GURTOGG_BLOODBOIL
@ EVENT_START_PHASE_2
@ EVENT_FEL_ACID_BREATH_2
@ EVENT_FEL_ACID_BREATH
@ EVENT_CHARGE_PLAYER
@ EVENT_ARCING_SMASH_2
@ EVENT_BEWILDERING_STRIKE
@ SPELL_FEL_RAGE_TARGET
@ SPELL_BEWILDERING_STRIKE
@ SPELL_ARCING_SMASH_2
@ SPELL_FEL_ACID_BREATH
@ SPELL_FEL_RAGE_TARGET_2
@ SPELL_TAUNT_GURTOGG
@ SPELL_INSIGNIFIGANCE
@ SPELL_FEL_ACID_BREATH_2
@ SPELL_FEL_RAGE_SELF
void AddSC_boss_gurtogg_bloodboil()
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
bool CanAIAttack(Unit const *target) const override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:236
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:52
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void CancelEventGroup(GroupIndex group)
Definition EventMap.cpp:165
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
float GetCombatReach() const override
Definition Unit.h:839
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition Unit.cpp:8142
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_gurtogg_bloodboil_bloodboil)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_gurtogg_bloodboil_insignificance)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
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
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)
npc_fel_geyser(Creature *creature)