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(30))
108 break;
109 case SPELL_INFERNO:
110 if (roll_chance(30))
112 break;
114 if (roll_chance(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 }
200
201private:
203};
204
205// 17818 - Towering Infernal
207{
208 npc_towering_infernal(Creature* creature) : ScriptedAI(creature) { }
209
210 void InitializeAI() override
211 {
213 }
214
215 void JustAppeared() override
216 {
218
219 _scheduler.Schedule(1200ms, [this](TaskContext const& /*task*/)
220 {
224 });
225 }
226
227 void EnterEvadeMode(EvadeReason /*why*/) override
228 {
230 }
231
232 void DoAction(int32 action) override
233 {
234 if (action == ACTION_KILL_SELF)
236 }
237
238 void UpdateAI(uint32 diff) override
239 {
240 _scheduler.Update(diff);
241
242 UpdateVictim();
243 }
244
245private:
247};
248
249// 38196 - Vampiric Aura
251{
252 bool Validate(SpellInfo const* /*spellInfo*/) override
253 {
255 }
256
257 void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
258 {
260 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
261 if (!damageInfo || !damageInfo->GetDamage())
262 return;
263
264 Unit* actor = eventInfo.GetActor();
265 CastSpellExtraArgs args(aurEff);
266 args.AddSpellMod(SPELLVALUE_BASE_POINT0, damageInfo->GetDamage() * 3);
267 actor->CastSpell(actor, SPELL_VAMPIRIC_AURA_HEAL, args);
268 }
269
274};
275
276// 31298 - Sleep
278{
279 bool Load() override
280 {
281 return GetCaster()->IsUnit();
282 }
283
284 void FilterTargets(std::list<WorldObject*>& targets)
285 {
286 targets.remove(GetCaster()->GetVictim());
288 }
289
294};
295
First const & RAND(First const &first, Second const &second, Rest const &... rest)
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
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)
EvadeReason
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:290
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
bool IsUnit() const
Definition BaseEntity.h:171
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat()
Definition CreatureAI.h:169
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
uint32 GetDamage() const
Definition Unit.h:466
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
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
DamageInfo * GetDamageInfo() const
Definition Unit.h:524
Unit * GetActor() const
Definition Unit.h:513
uint32 const Id
Definition SpellInfo.h:328
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void Summon(Creature const *summon)
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
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 HasUnitState(const uint32 f) const
Definition Unit.h:755
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
void FilterTargets(std::list< WorldObject * > &targets)
bool Validate(SpellInfo const *) override
void HandleProc(AuraEffect const *aurEff, ProcEventInfo &eventInfo)
@ 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:67
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