TrinityCore
Loading...
Searching...
No Matches
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
39
73
75{
78 NPC_VENGEFUL_SPIRIT = 23109 //Npc controlled by player
79};
80
89
94
102
103// 22871 - Teron Gorefiend
105{
107
118
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(12s, 20s);
167 break;
171 events.Repeat(30s, 40s);
172 break;
174 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE))
176 events.Repeat(30s, 35s);
177 break;
181 events.Repeat(18s, 30s);
182 break;
183 default:
184 break;
185 }
186
188 return;
189 }
190
192 }
193};
194
195// 23123 - Doom Blossom
197{
198 npc_doom_blossom(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) { }
199
200 void Reset() override
201 {
202 /* Workaround - Until SMSG_SET_PLAY_HOVER_ANIM be implemented */
203 Position pos;
204 pos.Relocate(me);
205 pos.m_positionZ += 8.0f;
206 me->GetMotionMaster()->MoveTakeoff(0, pos);
207
211 _scheduler.Schedule(12s, [this](TaskContext shadowBolt)
212 {
214 DoCast(target, SPELL_SHADOWBOLT);
215
216 shadowBolt.Repeat(2s);
217 });
218 }
219
220 void UpdateAI(uint32 diff) override
221 {
223 return;
224
225 _scheduler.Update(diff);
226 }
227
228private:
231};
232
233// 23111 - Shadowy Construct
235{
236 npc_shadowy_construct(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
237
238 void Reset() override
239 {
241 {
243 return;
244 }
245
248 _scheduler.Schedule(12s, [this](TaskContext atrophy)
249 {
251 atrophy.Repeat(10s, 12s);
252 });
253 _scheduler.Schedule(200ms, [this](TaskContext checkPlayer)
254 {
255 if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
256 {
257 if (!target->IsAlive() || !me->CanCreatureAttack(target))
259 }
260 else
262
263 checkPlayer.Repeat(1s);
264 });
265
267 teron->AI()->JustSummoned(me);
268
270 }
271
272 void UpdateAI(uint32 diff) override
273 {
275 return;
276
277 _scheduler.Update(diff, [this]
278 {
280 });
281 }
282
284 {
286 {
287 Unit* target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE);
288 // He should target Vengeful Spirits only if has no other player available
289 if (!target)
290 target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0);
291
292 if (target)
293 {
295 AttackStart(target);
296 AddThreat(target, 1000000.0f);
297 targetGUID = target->GetGUID();
298 }
299 }
300 }
301
302private:
306};
307
308// 40251 - Shadow of Death
310{
312
326
327 void Absorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
328 {
330 }
331
332 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
333 {
334 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
335 {
336 Unit* target = GetTarget();
337 target->CastSpell(target, SPELL_SUMMON_SPIRIT, true);
338
339 for (uint8 i = 0; i < 4; ++i)
340 target->CastSpell(target, SkeletronSpells[i], true);
341
342 target->CastSpell(target, SPELL_POSSESS_SPIRIT_IMMUNE, true);
343 target->CastSpell(target, SPELL_SPIRITUAL_VENGEANCE, true);
344 }
345 }
346
352};
353
354// 40268 - Spiritual Vengeance
369
370// 41999 - Shadow of Death Remove
399
401{
402public:
403 at_teron_gorefiend_entrance() : OnlyOnceAreaTriggerScript("at_teron_gorefiend_entrance") { }
404
405 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
406 {
407 if (InstanceScript* instance = player->GetInstanceScript())
408 if (Creature* teron = instance->GetCreature(DATA_TERON_GOREFIEND))
409 teron->AI()->DoAction(ACTION_START_INTRO);
410
411 return true;
412 }
413};
414
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_1
@ EFFECT_0
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_MOD_POSSESS
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
@ SPELLVALUE_MAX_TARGETS
#define AuraEffectAbsorbFn(F, I)
#define SpellHitFn(F)
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:235
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_TERON_GOREFIEND
@ EVENT_SUMMON_DOOM_BLOSSOM
@ EVENT_INCINERATE
@ EVENT_SHADOW_DEATH
@ EVENT_CRUSHING_SHADOWS
@ NPC_VENGEFUL_SPIRIT
@ NPC_SHADOWY_CONSTRUCT
@ NPC_DOOM_BLOSSOM
uint32 const SkeletronSpells[4]
@ 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_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_INCINERATE
void AddSC_boss_teron_gorefiend()
void PreventDefaultAction()
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
HookList< EffectAbsorbHandler > OnEffectAbsorb
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool CanCreatureAttack(Unit const *victim, bool force=true) const
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MoveTakeoff(uint32 id, Position const &pos, Optional< float > velocity={})
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
HookList< HitHandler > OnHit
Unit * GetHitUnit() const
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
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
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void KillSelf(bool durabilityLoss=true)
Definition Unit.h:1023
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool IsAlive() const
Definition Unit.h:1234
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool TryHandleOnce(Player *player, AreaTriggerEntry const *) override
PrepareSpellScript(spell_teron_gorefiend_shadow_of_death_remove)
void Absorb(AuraEffect *, DamageInfo &, uint32 &)
bool Validate(SpellInfo const *) override
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_teron_gorefiend_shadow_of_death)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_teron_gorefiend_spiritual_vengeance)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
float m_positionZ
Definition Position.h:58
void Relocate(float x, float y)
Definition Position.h:66
void AttackStart(Unit *) override
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