TrinityCore
boss_teron_gorefiend.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 "InstanceScript.h"
21#include "MotionMaster.h"
22#include "ObjectAccessor.h"
23#include "PassiveAI.h"
24#include "Player.h"
25#include "ScriptedCreature.h"
26#include "SpellAuraEffects.h"
27#include "SpellScript.h"
28#include "TemporarySummon.h"
29
30enum Says
31{
38 SAY_DEATH = 6
39};
40
42{
43 //Teron
50
51 //Doom Blossom
54
55 //Shadow Construct
57
58 //Player
66
67 //Vengeful Spirit
72 SPELL_SPIRIT_LANCE = 40157
73};
74
75enum Npcs
76{
79 NPC_VENGEFUL_SPIRIT = 23109 //Npc controlled by player
80};
81
83{
89};
90
92{
94};
95
97{
102};
103
105{
107
108 void JustEngagedWith(Unit* who) override
109 {
117 }
118
119 void EnterEvadeMode(EvadeReason /*why*/) override
120 {
124 }
125
126 void DoAction(int32 action) override
127 {
128 if (action == ACTION_START_INTRO && me->IsAlive())
130 }
131
132 void KilledUnit(Unit* victim) override
133 {
134 if (victim->GetTypeId() == TYPEID_PLAYER)
135 Talk(SAY_SLAY);
136 }
137
138 void JustDied(Unit* /*killer*/) override
139 {
142 _JustDied();
143 }
144
145 void UpdateAI(uint32 diff) override
146 {
147 if (!UpdateVictim())
148 return;
149
150 events.Update(diff);
151
153 return;
154
155 while (uint32 eventId = events.ExecuteEvent())
156 {
157 switch (eventId)
158 {
159 case EVENT_ENRAGE:
161 break;
162 case EVENT_INCINERATE:
164 DoCast(target, SPELL_INCINERATE);
166 events.Repeat(Seconds(12), Seconds(20));
167 break;
171 events.Repeat(Seconds(30), Seconds(40));
172 break;
174 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE))
176 events.Repeat(Seconds(30), Seconds(35));
177 break;
181 events.Repeat(Seconds(18), Seconds(30));
182 break;
183 default:
184 break;
185 }
186
188 return;
189 }
190 }
191};
192
194{
195 npc_doom_blossom(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) { }
196
197 void Reset() override
198 {
199 /* Workaround - Until SMSG_SET_PLAY_HOVER_ANIM be implemented */
200 Position pos;
201 pos.Relocate(me);
202 pos.m_positionZ += 8.0f;
203 me->GetMotionMaster()->MoveTakeoff(0, pos);
204
208 _scheduler.Schedule(Seconds(12), [this](TaskContext shadowBolt)
209 {
211 DoCast(target, SPELL_SHADOWBOLT);
212
213 shadowBolt.Repeat(Seconds(2));
214 });
215 }
216
217 void UpdateAI(uint32 diff) override
218 {
220 return;
221
222 _scheduler.Update(diff);
223 }
224
225private:
228};
229
231{
232 npc_shadowy_construct(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
233
234 void Reset() override
235 {
237 {
239 return;
240 }
241
244 _scheduler.Schedule(Seconds(12), [this](TaskContext atrophy)
245 {
247 atrophy.Repeat(Seconds(10), Seconds(12));
248 });
249 _scheduler.Schedule(Milliseconds(200), [this](TaskContext checkPlayer)
250 {
251 if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
252 {
253 if (!target->IsAlive() || !me->CanCreatureAttack(target))
255 }
256 else
258
259 checkPlayer.Repeat(Seconds(1));
260 });
261
263 teron->AI()->JustSummoned(me);
264
266 }
267
268 void UpdateAI(uint32 diff) override
269 {
271 return;
272
273 _scheduler.Update(diff);
274 }
275
277 {
279 {
280 Unit* target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE);
281 // He should target Vengeful Spirits only if has no other player available
282 if (!target)
283 target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0);
284
285 if (target)
286 {
288 AttackStart(target);
289 AddThreat(target, 1000000.0f);
290 targetGUID = target->GetGUID();
291 }
292 }
293 }
294
295private:
299};
300
301// 40251 - Shadow of Death
303{
304 bool Validate(SpellInfo const* /*spellInfo*/) override
305 {
306 return ValidateSpellInfo(
307 {
315 });
316 }
317
318 void Absorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
319 {
321 }
322
323 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
324 {
325 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
326 {
327 Unit* target = GetTarget();
328 target->CastSpell(target, SPELL_SUMMON_SPIRIT, true);
329
330 for (uint8 i = 0; i < 4; ++i)
331 target->CastSpell(target, SkeletronSpells[i], true);
332
333 target->CastSpell(target, SPELL_POSSESS_SPIRIT_IMMUNE, true);
334 target->CastSpell(target, SPELL_SPIRITUAL_VENGEANCE, true);
335 }
336 }
337
338 void Register() override
339 {
342 }
343};
344
345// 40268 - Spiritual Vengeance
347{
348 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
349 {
350 GetTarget()->KillSelf();
351 }
352
353 void Register() override
354 {
356 }
357};
358
359// 41999 - Shadow of Death Remove
361{
362 bool Validate(SpellInfo const* /*spellInfo*/) override
363 {
364 return ValidateSpellInfo(
365 {
369 });
370 }
371
373 {
374 Unit* target = GetHitUnit();
375
379 }
380
381 void Register() override
382 {
384 }
385};
386
388{
389public:
390 at_teron_gorefiend_entrance() : OnlyOnceAreaTriggerScript("at_teron_gorefiend_entrance") { }
391
392 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
393 {
394 if (InstanceScript* instance = player->GetInstanceScript())
395 if (Creature* teron = instance->GetCreature(DATA_TERON_GOREFIEND))
396 teron->AI()->DoAction(ACTION_START_INTRO);
397
398 return true;
399 }
400};
401
403{
411}
Actions
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
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
@ IN_PROGRESS
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_1
Definition: SharedDefines.h:31
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_MOD_POSSESS
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
@ SPELLVALUE_MAX_TARGETS
Definition: SpellDefines.h:230
#define AuraEffectAbsorbFn(F, I)
Definition: SpellScript.h:2090
#define SpellHitFn(F)
Definition: SpellScript.h:854
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
EvadeReason
Definition: UnitAICommon.h:30
@ UNIT_STATE_CASTING
Definition: Unit.h:270
#define RegisterBlackTempleCreatureAI(ai_name)
Definition: black_temple.h:149
@ DATA_TERON_GOREFIEND
Definition: black_temple.h:34
Npcs
Definition: boss_eregos.cpp:58
Says
@ SAY_INCINERATE
@ SAY_CRUSHING
@ NPC_VENGEFUL_SPIRIT
@ NPC_SHADOWY_CONSTRUCT
@ NPC_DOOM_BLOSSOM
@ ACTION_START_INTRO
@ SPELL_SUMMON_BLOSSOM_MOVE_TARGET
@ SPELL_SUMMON_DOOM_BLOSSOM
@ SPELL_SPIRIT_CHAINS
@ SPELL_SUMMON_SKELETRON_1
@ SPELL_SUMMON_SKELETRON_3
@ SPELL_SPIRIT_SHIELD
@ SPELL_POSSESS_SPIRIT_IMMUNE
@ SPELL_SPIRIT_LANCE
@ SPELL_SHADOW_OF_DEATH
@ SPELL_SUMMON_SKELETRON_2
@ SPELL_ATROPHY
@ SPELL_SHADOW_OF_DEATH_REMOVE
@ SPELL_SPIRITUAL_VENGEANCE
@ SPELL_CRUSHING_SHADOWS
@ SPELL_SHADOWBOLT
@ SPELL_SUMMON_SPIRIT
@ SPELL_SPIRIT_STRIKE
@ SPELL_SPIRIT_VOLLEY
@ SPELL_SUMMON_SKELETRON_4
@ SPELL_BERSERK
@ SPELL_INCINERATE
uint32 const SkeletronSpells[4]
void AddSC_boss_teron_gorefiend()
@ EVENT_SUMMON_DOOM_BLOSSOM
@ EVENT_ENRAGE
@ EVENT_INCINERATE
@ EVENT_SHADOW_DEATH
@ EVENT_CRUSHING_SHADOWS
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
HookList< EffectAbsorbHandler > OnEffectAbsorb
Definition: SpellScript.h:2089
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
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 DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool CanCreatureAttack(Unit const *victim, bool force=true) const
Definition: Creature.cpp:2686
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MoveTakeoff(uint32 id, Position const &pos, Optional< int32 > tierTransitionId={}, Optional< float > velocity={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default)
void Clear()
Definition: ObjectGuid.h:286
TypeID GetTypeId() const
Definition: Object.h:173
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
HookList< HitHandler > OnHit
Definition: SpellScript.h:850
Unit * GetHitUnit() const
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
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 DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsAlive() const
Definition: Unit.h:1164
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:921
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
void Absorb(AuraEffect *, DamageInfo &, uint32 &)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
float m_positionZ
Definition: Position.h:55
constexpr void Relocate(float x, float y)
Definition: Position.h:63
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void ResetThreatList(Unit *who=nullptr)
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void UpdateAI(uint32 diff) override
void JustDied(Unit *) override
void DoAction(int32 action) override
void EnterEvadeMode(EvadeReason) override
void KilledUnit(Unit *victim) override
boss_teron_gorefiend(Creature *creature)
void JustEngagedWith(Unit *who) override
npc_doom_blossom(Creature *creature)
void UpdateAI(uint32 diff) override
InstanceScript * _instance
npc_shadowy_construct(Creature *creature)
void UpdateAI(uint32 diff) override