TrinityCore
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#include "ScriptMgr.h"
19#include "hyjal.h"
20#include "hyjal_trash.h"
21#include "InstanceScript.h"
22#include "ObjectAccessor.h"
23#include "SpellScript.h"
24
26{
28 SPELL_SLEEP = 31298,
34};
35
37{
44};
45
46static constexpr uint32 PATH_ESCORT_ANETHERON = 142466;
47
49{
50public:
51 boss_anetheron() : CreatureScript("boss_anetheron") { }
52
53 CreatureAI* GetAI(Creature* creature) const override
54 {
55 return GetHyjalAI<boss_anetheronAI>(creature);
56 }
57
59 {
61 {
62 Initialize();
63 instance = creature->GetInstanceScript();
64 go = false;
65 }
66
68 {
69 SwarmTimer = 45000;
70 SleepTimer = 60000;
71 AuraTimer = 5000;
72 InfernoTimer = 45000;
73 damageTaken = 0;
74 }
75
80 bool go;
81
82 void Reset() override
83 {
84 Initialize();
85
86 if (IsEvent)
88 }
89
90 void JustEngagedWith(Unit* /*who*/) override
91 {
92 if (IsEvent)
94
96 }
97
98 void KilledUnit(Unit* who) override
99 {
100 if (who->GetTypeId() == TYPEID_PLAYER)
102 }
103
104 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
105 {
106 if (waypointId == 7)
107 {
109 if (target && target->IsAlive())
110 AddThreat(target, 0.0f);
111 }
112 }
113
114 void JustDied(Unit* killer) override
115 {
117 if (IsEvent)
120 }
121
122 void UpdateAI(uint32 diff) override
123 {
124 if (IsEvent)
125 {
126 //Must update EscortAI
127 EscortAI::UpdateAI(diff);
128 if (!go)
129 {
130 go = true;
132 Start(false);
133 SetDespawnAtEnd(false);
134 }
135 }
136
137 //Return since we have no target
138 if (!UpdateVictim())
139 return;
140
141 if (SwarmTimer <= diff)
142 {
143 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
145
146 SwarmTimer = urand(45000, 60000);
148 } else SwarmTimer -= diff;
149
150 if (SleepTimer <= diff)
151 {
152 for (uint8 i = 0; i < 3; ++i)
153 {
154 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
155 target->CastSpell(target, SPELL_SLEEP, true);
156 }
157 SleepTimer = 60000;
159 } else SleepTimer -= diff;
160 if (AuraTimer <= diff)
161 {
163 AuraTimer = urand(10000, 20000);
164 } else AuraTimer -= diff;
165 if (InfernoTimer <= diff)
166 {
168 InfernoTimer = 45000;
170 } else InfernoTimer -= diff;
171 }
172 };
173};
174
176{
177public:
178 npc_towering_infernal() : CreatureScript("npc_towering_infernal") { }
179
180 CreatureAI* GetAI(Creature* creature) const override
181 {
182 return GetHyjalAI<npc_towering_infernalAI>(creature);
183 }
184
186 {
188 {
189 ImmolationTimer = 5000;
190 CheckTimer = 5000;
191 instance = creature->GetInstanceScript();
192 }
193
197
198 void Reset() override
199 {
201 ImmolationTimer = 5000;
202 CheckTimer = 5000;
203 }
204
205 void JustEngagedWith(Unit* /*who*/) override
206 {
207 }
208
209 void KilledUnit(Unit* /*victim*/) override
210 {
211 }
212
213 void JustDied(Unit* /*killer*/) override
214 {
215 }
216
217 void MoveInLineOfSight(Unit* who) override
218
219 {
220 if (me->IsWithinDist(who, 50) && !me->IsInCombat() && me->IsValidAttackTarget(who))
221 AttackStart(who);
222 }
223
224 void UpdateAI(uint32 diff) override
225 {
226 if (CheckTimer <= diff)
227 {
229 if (!boss || boss->isDead())
230 {
232 return;
233 }
234 CheckTimer = 5000;
235 } else CheckTimer -= diff;
236
237 //Return since we have no target
238 if (!UpdateVictim())
239 return;
240
241 if (ImmolationTimer <= diff)
242 {
244 ImmolationTimer = 5000;
245 } else ImmolationTimer -= diff;
246 }
247 };
248};
249
250// 38196 - Vampiric Aura
252{
253 public:
254 spell_anetheron_vampiric_aura() : SpellScriptLoader("spell_anetheron_vampiric_aura") { }
255
257 {
258 bool Validate(SpellInfo const* /*spellInfo*/) override
259 {
261 }
262
263 void HandleProc(AuraEffect* aurEff, ProcEventInfo& eventInfo)
264 {
266 DamageInfo* damageInfo = eventInfo.GetDamageInfo();
267 if (!damageInfo || !damageInfo->GetDamage())
268 return;
269
270 Unit* actor = eventInfo.GetActor();
271 CastSpellExtraArgs args(aurEff);
272 args.AddSpellMod(SPELLVALUE_BASE_POINT0, damageInfo->GetDamage() * 3);
273 actor->CastSpell(actor, SPELL_VAMPIRIC_AURA_HEAL, args);
274 }
275
276 void Register() override
277 {
279 }
280 };
281
282 AuraScript* GetAuraScript() const override
283 {
285 }
286};
287
289{
290 new boss_anetheron();
293}
Texts
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_AURA_DUMMY
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
#define AuraEffectProcFn(F, I, N)
Definition: SpellScript.h:2160
@ SPELL_IMMOLATION
@ SPELL_VAMPIRIC_AURA_HEAL
@ SPELL_INFERNO_EFFECT
@ SPELL_SLEEP
@ SPELL_CARRION_SWARM
@ SPELL_VAMPIRIC_AURA
@ SPELL_INFERNO
@ SAY_INFERNO
@ SAY_ONAGGRO
@ SAY_SLEEP
@ SAY_SWARM
@ SAY_ONSLAY
@ SAY_ONDEATH
void AddSC_boss_anetheron()
static constexpr uint32 PATH_ESCORT_ANETHERON
void PreventDefaultAction()
HookList< EffectProcHandler > OnEffectProc
Definition: SpellScript.h:2155
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
uint32 GetDamage() const
Definition: Unit.h:446
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
virtual ObjectGuid GetGuidData(uint32 type) const override
TypeID GetTypeId() const
Definition: Object.h:173
DamageInfo * GetDamageInfo() const
Definition: Unit.h:505
Unit * GetActor() const
Definition: Unit.h:493
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
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:627
bool IsAlive() const
Definition: Unit.h:1164
bool IsInCombat() const
Definition: Unit.h:1043
bool isDead() const
Definition: Unit.h:1166
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition: Object.cpp:2991
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition: Object.cpp:1142
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
void HandleProc(AuraEffect *aurEff, ProcEventInfo &eventInfo)
AuraScript * GetAuraScript() const override
@ DATA_JAINAPROUDMOORE
Definition: hyjal.h:36
@ DATA_ANETHERON
Definition: hyjal.h:31
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void SetDespawnAtEnd(bool despawn)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void AddThreat(Unit *victim, float amount, Unit *who=nullptr)
void UpdateAI(uint32 diff) override
void JustDied(Unit *killer) override
void JustEngagedWith(Unit *) override
boss_anetheronAI(Creature *creature)
void KilledUnit(Unit *who) override
void WaypointReached(uint32 waypointId, uint32) override
void JustDied(Unit *) override
uint32 damageTaken
Definition: hyjal_trash.h:43
InstanceScript * instance
Definition: hyjal_trash.h:34