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
75enum Npcs
76{
79 NPC_VENGEFUL_SPIRIT = 23109 //Npc controlled by player
80};
81
90
95
103
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(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{
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
343};
344
345// 40268 - Spiritual Vengeance
358
359// 41999 - Shadow of Death Remove
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
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
@ IN_PROGRESS
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#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:276
#define RegisterBlackTempleCreatureAI(ai_name)
@ DATA_TERON_GOREFIEND
Npcs
@ 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_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
uint32 const SkeletronSpells[4]
void AddSC_boss_teron_gorefiend()
@ EVENT_SUMMON_DOOM_BLOSSOM
@ EVENT_INCINERATE
@ EVENT_SHADOW_DEATH
@ EVENT_CRUSHING_SHADOWS
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
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
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: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:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
bool IsAlive() const
Definition Unit.h:1185
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:936
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3974
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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