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 }
268
270 {
272 {
277 }
278 else if (events.IsInPhase(PHASE_2))
279 {
286
287 // Attack the stored target
288 if (Unit* oldTarget = ObjectAccessor::GetUnit(*me, _oldTargetGUID))
289 if (Unit* currentTarget = ObjectAccessor::GetUnit(*me, _targetGUID))
290 {
291 ModifyThreatByPercent(currentTarget, -100);
292 AttackStart(oldTarget);
293 AddThreat(oldTarget, _oldThreat);
294 Initialize();
295 }
296 }
297 }
298
299private:
303};
304
305// 23254 - Fel Geyser
307{
308 npc_fel_geyser(Creature* creature) : PassiveAI(creature) { }
309
310 void Reset() override
311 {
313 DoCastSelf(SPELL_BIRTH, true);
314 }
315};
316
317// 42005 - Bloodboil
319{
320 void FilterTargets(std::list<WorldObject*>& targets)
321 {
322 if (targets.size() <= 5)
323 return;
324
325 // Sort the list of players
326 targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster(), false));
327 // Resize so we only get top 5
328 targets.resize(5);
329 }
330
335};
336
337// 40618 - Insignificance
339{
340 bool Validate(SpellInfo const* /*spell*/) override
341 {
343 }
344
345 void FilterTargets(std::list<WorldObject*>& targets)
346 {
347 targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_FEL_RAGE_TARGET));
348 }
349
354};
355
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
@ SPELL_EFFECT_ATTACK_ME
@ TARGET_UNIT_SRC_AREA_ENEMY
@ IMMUNITY_STATE
@ IMMUNITY_EFFECT
@ SPELL_AURA_MOD_TAUNT
#define SpellObjectAreaTargetSelectFn(F, I, N)
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:290
#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()
TypeID GetTypeId() const
Definition BaseEntity.h:166
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
bool IsInPhase(PhaseIndex phase) const
Definition EventMap.h:246
void RescheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:56
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:32
void CancelEventGroup(GroupIndex group)
Definition EventMap.cpp:178
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Clear()
Definition ObjectGuid.h:329
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
virtual void AttackStart(Unit *victim)
Definition UnitAI.cpp:29
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
void ApplySpellImmune(uint32 spellId, SpellImmunity op, uint32 type, bool apply)
Definition Unit.cpp:8261
float GetCombatReach() const override
Definition Unit.h:717
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
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)
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)