TrinityCore
Loading...
Searching...
No Matches
boss_anetheron.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/*
19 * Combat timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "Containers.h"
24#include "hyjal.h"
25#include "MotionMaster.h"
26#include "ScriptedCreature.h"
27#include "SpellInfo.h"
28#include "SpellScript.h"
29
39
41{
42 // Anetheron
44
45 SPELL_SLEEP = 31298,
49
50 // Towering Infernal
54
55 // Scripts
57};
58
66
72
73// 17808 - Anetheron
74struct boss_anetheron : public BossAI
75{
77
83
84 void Reset() override
85 {
86 _Reset();
89 }
90
100
101 void OnSpellCast(SpellInfo const* spellInfo) override
102 {
103 switch (spellInfo->Id)
104 {
105 case SPELL_SLEEP:
106 if (roll_chance_i(30))
108 break;
109 case SPELL_INFERNO:
110 if (roll_chance_i(30))
112 break;
114 if (roll_chance_i(30))
116 break;
117 default:
118 break;
119 }
120 }
121
122 void WaypointPathEnded(uint32 /*waypointId*/, uint32 pathId) override
123 {
124 switch (pathId)
125 {
130 break;
131 default:
132 break;
133 }
134 }
135
136 void JustSummoned(Creature* summon) override
137 {
138 _summons.Summon(summon);
139 }
140
141 // Do not reset SetActive, we want boss to be active all the time
142 void JustReachedHome() override { }
143
144 void KilledUnit(Unit* victim) override
145 {
146 if (victim->GetTypeId() == TYPEID_PLAYER)
147 Talk(SAY_SLAY);
148 }
149
150 void JustDied(Unit* /*killer*/) override
151 {
152 _JustDied();
154
155 std::vector<Creature*> infernals;
157 for (Creature* infernal : infernals)
158 infernal->AI()->DoAction(ACTION_KILL_SELF);
159 }
160
161 void UpdateAI(uint32 diff) override
162 {
163 if (!UpdateVictim())
164 return;
165
166 events.Update(diff);
167
169 return;
170
171 while (uint32 eventId = events.ExecuteEvent())
172 {
173 switch (eventId)
174 {
175 case EVENT_SLEEP:
177 events.Repeat(15s, 35s);
178 break;
179 case EVENT_INFERNO:
180 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 250.0f, true))
181 DoCast(target, SPELL_INFERNO);
182 events.Repeat(55s);
183 break;
185 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 60.0f))
187 events.Repeat(10s, 20s);
188 break;
189 case EVENT_BERSERK:
191 break;
192 default:
193 break;
194 }
195
197 return;
198 }
199
201 }
202
203private:
205};
206
207// 17818 - Towering Infernal
209{
210 npc_towering_infernal(Creature* creature) : ScriptedAI(creature) { }
211
212 void InitializeAI() override
213 {
215 }
216
217 void JustAppeared() override
218 {
220
221 _scheduler.Schedule(1200ms, [this](TaskContext /*task*/)
222 {
226 });
227 }
228
229 void EnterEvadeMode(EvadeReason /*why*/) override
230 {
232 }
233
234 void DoAction(int32 action) override
235 {
236 if (action == ACTION_KILL_SELF)
238 }
239
240 void UpdateAI(uint32 diff) override
241 {
242 _scheduler.Update(diff);
243
244 if (UpdateVictim())
246 }
247
248private:
250};
251
252// 38196 - Vampiric Aura
254{
256
257 bool Validate(SpellInfo const* /*spellInfo*/) override
258 {
260 }
261
262 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
263 {
265 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
266 if (!damageInfo || !damageInfo->GetDamage())
267 return;
268
269 Unit* actor = eventInfo.GetActor();
270 CastSpellExtraArgs args(aurEff);
271 args.AddSpellMod(SPELLVALUE_BASE_POINT0, damageInfo->GetDamage() * 3);
272 actor->CastSpell(actor, SPELL_VAMPIRIC_AURA_HEAL, args);
273 }
274
279};
280
281// 31298 - Sleep
283{
285
286 bool Load() override
287 {
288 return GetCaster()->IsUnit();
289 }
290
291 void FilterTargets(std::list<WorldObject*>& targets)
292 {
293 targets.remove(GetCaster()->GetVictim());
295 }
296
301};
302
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENEMY
@ SPELL_AURA_DUMMY
@ SPELLVALUE_BASE_POINT0
#define AuraEffectProcFn(F, I, N)
#define SpellObjectAreaTargetSelectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
AnetheronMisc
@ ACTION_KILL_SELF
@ NPC_TOWERING_INFERNAL
AnetheronSpells
@ SPELL_IMMOLATION
@ SPELL_VAMPIRIC_AURA_HEAL
@ SPELL_INFERNO_EFFECT
@ SPELL_SLEEP
@ SPELL_INSTAKILL_SELF
@ SPELL_CARRION_SWARM
@ SPELL_VAMPIRIC_AURA
@ SPELL_BERSERK
@ SPELL_INFERNO
AnetheronTexts
@ SAY_DEATH
@ SAY_INFERNO
@ SAY_SLEEP
@ SAY_SLAY
@ SAY_SWARM
@ SAY_INTRO
void AddSC_boss_anetheron()
AnetheronEvents
@ EVENT_INFERNO
@ EVENT_CARRION_SWARM
@ EVENT_BERSERK
@ EVENT_SLEEP
void PreventDefaultAction()
HookList< EffectProcHandler > OnEffectProc
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 GetDamage() const
Definition Unit.h:464
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
void MovePath(uint32 pathId, bool repeatable)
bool IsUnit() const
Definition Object.h:191
TypeID GetTypeId() const
Definition Object.h:93
Unit * GetActor()
Definition Unit.h:508
DamageInfo * GetDamageInfo() const
Definition Unit.h:519
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void Summon(Creature const *summon)
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
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
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_anetheron_sleep)
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
PrepareAuraScript(spell_anetheron_vampiric_aura)
@ PATH_ALLY_BASE_2
Definition hyjal.h:104
@ PATH_ALLY_INITIAL_1
Definition hyjal.h:99
@ PATH_ALLY_INITIAL_2
Definition hyjal.h:100
@ PATH_ALLY_BASE_3
Definition hyjal.h:105
@ PATH_ALLY_BASE_1
Definition hyjal.h:103
@ PATH_ALLY_INITIAL_3
Definition hyjal.h:101
@ DATA_ANETHERON
Definition hyjal.h:31
#define RegisterHyjalCreatureAI(ai_name)
Definition hyjal.h:126
void RandomResize(C &container, std::size_t requestedSize)
Definition Containers.h:66
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
void OnSpellCast(SpellInfo const *spellInfo) override
void KilledUnit(Unit *victim) override
void JustReachedHome() override
boss_anetheron(Creature *creature)
void JustDied(Unit *) override
void JustEngagedWith(Unit *who) override
void WaypointPathEnded(uint32, uint32 pathId) override
void UpdateAI(uint32 diff) override
void Reset() override
void JustAppeared() override
void JustSummoned(Creature *summon) override
void JustAppeared() override
void InitializeAI() override
npc_towering_infernal(Creature *creature)
void UpdateAI(uint32 diff) override
void EnterEvadeMode(EvadeReason) override
void DoAction(int32 action) override