Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_anetheron.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "hyjal.h"
9#include "hyjal_trash.h"
10
20
30
32{
33public:
34 boss_anetheron() : CreatureScript("boss_anetheron") { }
35
37 {
38 return new boss_anetheronAI(creature);
39 }
40
42 {
44 {
45 instance = creature->GetInstanceScript();
46 go = false;
47 }
48
53 bool go;
54
56 {
57 damageTaken = 0;
58 SwarmTimer = 45000;
59 SleepTimer = 60000;
60 AuraTimer = 5000;
61 InfernoTimer = 45000;
62
63 if (instance && IsEvent)
65 }
66
67 void EnterCombat(Unit* /*who*/) OVERRIDE
68 {
69 if (instance && IsEvent)
72 }
73
74 void KilledUnit(Unit* /*victim*/) OVERRIDE
75 {
77 }
78
80 {
81 if (waypointId == 7 && instance)
82 {
83 Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_JAINAPROUDMOORE));
84 if (target && target->IsAlive())
85 me->AddThreat(target, 0.0f);
86 }
87 }
88
89 void JustDied(Unit* killer) OVERRIDE
90 {
92 if (instance && IsEvent)
95 }
96
98 {
99 if (IsEvent)
100 {
101 //Must update npc_escortAI
103 if (!go)
104 {
105 go = true;
106 if (instance)
107 {
108 AddWaypoint(0, 4896.08f, -1576.35f, 1333.65f);
109 AddWaypoint(1, 4898.68f, -1615.02f, 1329.48f);
110 AddWaypoint(2, 4907.12f, -1667.08f, 1321.00f);
111 AddWaypoint(3, 4963.18f, -1699.35f, 1340.51f);
112 AddWaypoint(4, 4989.16f, -1716.67f, 1335.74f);
113 AddWaypoint(5, 5026.27f, -1736.89f, 1323.02f);
114 AddWaypoint(6, 5037.77f, -1770.56f, 1324.36f);
115 AddWaypoint(7, 5067.23f, -1789.95f, 1321.17f);
116 Start(false, true);
117 SetDespawnAtEnd(false);
118 }
119 }
120 }
121
122 //Return since we have no target
123 if (!UpdateVictim())
124 return;
125
126 if (SwarmTimer <= diff)
127 {
128 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
130
131 SwarmTimer = std::rand() % 60000 + 45000;
133 } else SwarmTimer -= diff;
134
135 if (SleepTimer <= diff)
136 {
137 for (uint8 i = 0; i < 3; ++i)
138 {
139 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
140 target->CastSpell(target, SPELL_SLEEP, true);
141 }
142 SleepTimer = 60000;
144 } else SleepTimer -= diff;
145 if (AuraTimer <= diff)
146 {
148 AuraTimer = std::rand() % 20000 + 10000;
149 } else AuraTimer -= diff;
150 if (InfernoTimer <= diff)
151 {
153 InfernoTimer = 45000;
155 } else InfernoTimer -= diff;
156
158 }
159 };
160};
161
163{
164public:
165 npc_towering_infernal() : CreatureScript("npc_towering_infernal") { }
166
168 {
169 return new npc_towering_infernalAI(creature);
170 }
171
173 {
175 {
176 instance = creature->GetInstanceScript();
177 if (instance)
179 }
180
185
187 {
189 ImmolationTimer = 5000;
190 CheckTimer = 5000;
191 }
192
193 void EnterCombat(Unit* /*who*/) OVERRIDE
194 {
195 }
196
197 void KilledUnit(Unit* /*victim*/) OVERRIDE
198 {
199 }
200
201 void JustDied(Unit* /*killer*/) OVERRIDE
202 {
203 }
204
206
207 {
208 if (me->IsWithinDist(who, 50) && !me->IsInCombat() && me->IsValidAttackTarget(who))
209 AttackStart(who);
210 }
211
213 {
214 if (CheckTimer <= diff)
215 {
216 if (AnetheronGUID)
217 {
219 if (!boss || (boss && boss->isDead()))
220 {
221 me->setDeathState(DeathState::JUST_DIED);
222 me->RemoveCorpse();
223 return;
224 }
225 }
226 CheckTimer = 5000;
227 } else CheckTimer -= diff;
228
229 //Return since we have no target
230 if (!UpdateVictim())
231 return;
232
233 if (ImmolationTimer <= diff)
234 {
236 ImmolationTimer = 5000;
237 } else ImmolationTimer -= diff;
238
240 }
241 };
242};
243
245{
246 new boss_anetheron();
248}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ JUST_DIED
Definition Unit.h:504
@ SELECT_TARGET_RANDOM
Definition UnitAI.h:23
@ SPELL_IMMOLATION
@ 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()
@ SPELL_INFERNO
@ SAY_SLEEP
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Unit * SelectTarget(SelectAggroTarget targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, int32 aura=0)
Definition UnitAI.cpp:66
Definition Unit.h:1367
bool IsAlive() const
Definition Unit.h:2032
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
static Unit * GetUnit(WorldObject &object, uint64 guid)
Definition Unit.cpp:4895
bool isDead() const
Definition Unit.h:2040
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
@ DATA_ANETHERONEVENT
Definition hyjal.h:16
@ DATA_JAINAPROUDMOORE
Definition hyjal.h:21
@ DATA_ANETHERON
Definition hyjal.h:15
Creature * me
ScriptedAI(Creature *creature)
void AttackStart(Unit *) OVERRIDE
void EnterCombat(Unit *) OVERRIDE
void JustDied(Unit *killer) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void JustDied(Unit *)
uint32 damageTaken
Definition hyjal_trash.h:34
InstanceScript * instance
Definition hyjal_trash.h:25
hyjal_trashAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SetDespawnAtEnd(bool despawn)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void AddWaypoint(uint32 id, float x, float y, float z, uint32 waitTime=0)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================