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#include "TemporarySummon.h"
29
40
74
76{
79 NPC_VENGEFUL_SPIRIT = 23109 //Npc controlled by player
80};
81
90
95
103
104// 22871 - Teron Gorefiend
106{
108
119
126
127 void DoAction(int32 action) override
128 {
129 if (action == ACTION_START_INTRO && me->IsAlive())
131 }
132
133 void KilledUnit(Unit* victim) override
134 {
135 if (victim->GetTypeId() == TYPEID_PLAYER)
136 Talk(SAY_SLAY);
137 }
138
139 void JustDied(Unit* /*killer*/) override
140 {
143 _JustDied();
144 }
145
146 void UpdateAI(uint32 diff) override
147 {
148 if (!UpdateVictim())
149 return;
150
151 events.Update(diff);
152
154 return;
155
156 while (uint32 eventId = events.ExecuteEvent())
157 {
158 switch (eventId)
159 {
160 case EVENT_ENRAGE:
162 break;
163 case EVENT_INCINERATE:
165 DoCast(target, SPELL_INCINERATE);
167 events.Repeat(12s, 20s);
168 break;
172 events.Repeat(30s, 40s);
173 break;
175 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE))
177 events.Repeat(30s, 35s);
178 break;
182 events.Repeat(18s, 30s);
183 break;
184 default:
185 break;
186 }
187
189 return;
190 }
191 }
192};
193
194// 23123 - Doom Blossom
196{
197 npc_doom_blossom(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) { }
198
199 void Reset() override
200 {
201 /* Workaround - Until SMSG_SET_PLAY_HOVER_ANIM be implemented */
202 Position pos;
203 pos.Relocate(me);
204 pos.m_positionZ += 8.0f;
205 me->GetMotionMaster()->MoveTakeoff(0, pos);
206
210 _scheduler.Schedule(12s, [this](TaskContext& shadowBolt)
211 {
213 DoCast(target, SPELL_SHADOWBOLT);
214
215 shadowBolt.Repeat(2s);
216 });
217 }
218
219 void UpdateAI(uint32 diff) override
220 {
222 return;
223
224 _scheduler.Update(diff);
225 }
226
227private:
230};
231
232// 23111 - Shadowy Construct
234{
235 npc_shadowy_construct(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
236
237 void Reset() override
238 {
240 {
242 return;
243 }
244
247 _scheduler.Schedule(12s, [this](TaskContext& atrophy)
248 {
250 atrophy.Repeat(10s, 12s);
251 });
252 _scheduler.Schedule(200ms, [this](TaskContext& checkPlayer)
253 {
254 if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
255 {
256 if (!target->IsAlive() || !me->CanCreatureAttack(target))
258 }
259 else
261
262 checkPlayer.Repeat(1s);
263 });
264
266 teron->AI()->JustSummoned(me);
267
269 }
270
271 void UpdateAI(uint32 diff) override
272 {
274 return;
275
276 _scheduler.Update(diff);
277 }
278
280 {
282 {
283 Unit* target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true, true, -SPELL_SPIRITUAL_VENGEANCE);
284 // He should target Vengeful Spirits only if has no other player available
285 if (!target)
286 target = teron->AI()->SelectTarget(SelectTargetMethod::Random, 0);
287
288 if (target)
289 {
291 AttackStart(target);
292 AddThreat(target, 1000000.0f);
293 targetGUID = target->GetGUID();
294 }
295 }
296 }
297
298private:
302};
303
304// 40251 - Shadow of Death
306{
320
321 void Absorb(AuraEffect* /*aurEff*/, DamageInfo& /*dmgInfo*/, uint32& /*absorbAmount*/)
322 {
324 }
325
326 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
327 {
328 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
329 {
330 Unit* target = GetTarget();
331 target->CastSpell(target, SPELL_SUMMON_SPIRIT, true);
332
333 for (uint8 i = 0; i < 4; ++i)
334 target->CastSpell(target, SkeletronSpells[i], true);
335
336 target->CastSpell(target, SPELL_POSSESS_SPIRIT_IMMUNE, true);
337 target->CastSpell(target, SPELL_SPIRITUAL_VENGEANCE, true);
338 }
339 }
340
346};
347
348// 40268 - Spiritual Vengeance
361
362// 41999 - Shadow of Death Remove
389
391{
392public:
393 at_teron_gorefiend_entrance() : OnlyOnceAreaTriggerScript("at_teron_gorefiend_entrance") { }
394
395 bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
396 {
397 if (InstanceScript* instance = player->GetInstanceScript())
398 if (Creature* teron = instance->GetCreature(DATA_TERON_GOREFIEND))
399 teron->AI()->DoAction(ACTION_START_INTRO);
400
401 return true;
402 }
403};
404
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_1
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ 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)
EvadeReason
@ UNIT_STATE_CASTING
Definition Unit.h:290
#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
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void _DespawnAtEvade(Seconds delayToRespawn=30s, Creature *who=nullptr)
SummonList summons
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool CanCreatureAttack(Unit const *victim, bool force=true) const
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
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, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void Clear()
Definition ObjectGuid.h:329
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< HitHandler > OnHit
Unit * GetHitUnit() const
TaskContext & Repeat(TaskScheduler::duration_t duration)
TaskScheduler & CancelAll()
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
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 DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool IsAlive() const
Definition Unit.h:1205
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:951
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
InstanceScript * GetInstanceScript() const
Definition Object.cpp:394
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
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:66
constexpr void Relocate(float x, float y)
Definition Position.h:74
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