Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
boss_eregos.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 "SpellScript.h"
9#include "SpellAuraEffects.h"
10#include "oculus.h"
11
12//Types of drake mounts: Ruby(Tank), Amber(DPS), Emerald(Healer)
13//Two Repeating phases
14
22
32
44
45enum Npcs
46{
48};
49
56
61
63{
64 DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
65 DATA_EMERALD_VOID = 1, // http://www.wowhead.com/achievement=2045
66 DATA_AMBER_VOID = 2 // http://www.wowhead.com/achievement=2046
67};
68
70{
71public:
72 boss_eregos() : CreatureScript("boss_eregos") { }
73
75 {
76 return new boss_eregosAI(creature);
77 }
78
79 struct boss_eregosAI : public BossAI
80 {
81 boss_eregosAI(Creature* creature) : BossAI(creature, DATA_EREGOS_EVENT) { }
82
84 {
85 _Reset();
87
88 _rubyVoid = true;
89 _emeraldVoid = true;
90 _amberVoid = true;
91
93 }
94
95 void KilledUnit(Unit* /*victim*/) OVERRIDE
96 {
98 }
99
100 void EnterCombat(Unit* /*who*/) OVERRIDE
101 {
102 _EnterCombat();
103
105 /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found
106 The checks are so big in case some party try weird things like pulling boss down or hiding out of check range, the only thing player need is to get the boss kill credit after the check /even if he or his drake die/
107 Drakes mechanic would despawn all after unmount and also drakes should be auto mounted after item use, item use after Eregos is engaged leads to his despawn - based on retail data. */
108 if (me->FindNearestCreature(NPC_RUBY_DRAKE_VEHICLE, 500.0f, true))
109 _rubyVoid = false;
110 if (me->FindNearestCreature(NPC_EMERALD_DRAKE_VEHICLE, 500.0f, true))
111 _emeraldVoid = false;
112 if (me->FindNearestCreature(NPC_AMBER_DRAKE_VEHICLE, 500.0f, true))
113 _amberVoid = false;
114 }
115
117 {
118 switch (type)
119 {
120 case DATA_RUBY_VOID:
121 return _rubyVoid;
123 return _emeraldVoid;
124 case DATA_AMBER_VOID:
125 return _amberVoid;
126 default:
127 break;
128 }
129 return 0;
130 }
131
133 {
134 if (action != ACTION_SET_NORMAL_EVENTS)
135 return;
136
137 events.ScheduleEvent(EVENT_ARCANE_BARRAGE, std::rand() % (10 * IN_MILLISECONDS) + (3 * IN_MILLISECONDS), 0, PHASE_NORMAL);
138 events.ScheduleEvent(EVENT_ARCANE_VOLLEY, std::rand() % (25 * IN_MILLISECONDS) + (10 * IN_MILLISECONDS), 0, PHASE_NORMAL);
139 events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, std::rand() % (50 * IN_MILLISECONDS) + (35 * IN_MILLISECONDS), 0, PHASE_NORMAL);
140 events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, std::rand() % (30* IN_MILLISECONDS) + (15 * IN_MILLISECONDS), 0, PHASE_NORMAL);
141 }
142
144 {
145 BossAI::JustSummoned(summon);
146
147 if (summon->GetEntry() != NPC_PLANAR_ANOMALY)
148 return;
149
150 summon->CombatStop(true);
151 summon->SetReactState(REACT_PASSIVE);
152 summon->GetMotionMaster()->MoveRandom(100.0f);
153 }
154
156 {
157 if (summon->GetEntry() != NPC_PLANAR_ANOMALY)
158 return;
159
160 // TO-DO: See why the spell is not casted
161 summon->CastSpell(summon, SPELL_PLANAR_BLAST, true);
162 }
163
164 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) OVERRIDE
165 {
166 if (!me->GetMap()->IsHeroic())
167 return;
168
169 if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR)
170 || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) )
171 {
172 events.Reset();
173 _phase = (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f) ? PHASE_FIRST_PLANAR : PHASE_SECOND_PLANAR;
174
177
178 // not sure about the amount, and if we should despawn previous spawns (dragon trashs)
179 summons.DespawnAll();
180 for (uint8 i = 0; i < 6; i++)
182 }
183 }
184
186 {
187 //Return since we have no target
188 if (!UpdateVictim())
189 return;
190
191 events.Update(diff);
192
193 if (me->HasUnitState(UNIT_STATE_CASTING))
194 return;
195
196 while (uint32 eventId = events.ExecuteEvent())
197 {
198 switch (eventId)
199 {
202 events.ScheduleEvent(EVENT_ARCANE_BARRAGE, std::rand() % (10 * IN_MILLISECONDS) + (3 * IN_MILLISECONDS), 0, PHASE_NORMAL);
203 break;
206 events.ScheduleEvent(EVENT_ARCANE_VOLLEY, std::rand() % (25 * IN_MILLISECONDS) + (10 * IN_MILLISECONDS), 0, PHASE_NORMAL);
207 break;
211 events.ScheduleEvent(EVENT_ENRAGED_ASSAULT, std::rand() % (50 * IN_MILLISECONDS) + (35 * IN_MILLISECONDS), 0, PHASE_NORMAL);
212 break;
214 for (uint8 i = 0; i < 3; i++)
216 events.ScheduleEvent(EVENT_SUMMON_LEY_WHELP, std::rand() % (30 * IN_MILLISECONDS) + (15 * IN_MILLISECONDS), 0, PHASE_NORMAL);
217 break;
218 }
219 }
220
222 }
223
224 void JustDied(Unit* /*killer*/) OVERRIDE
225 {
227
228 _JustDied();
229 }
230
231 private:
236 };
237};
238
240{
241 public:
242 spell_eregos_planar_shift() : SpellScriptLoader("spell_eregos_planar_shift") { }
243
260
265};
266
268{
269 public:
270 achievement_gen_eregos_void(char const* name, uint32 data) : AchievementCriteriaScript(name), _data(data) { }
271
272 bool OnCheck(Player* /*player*/, Unit* target) OVERRIDE
273 {
274 return target && target->GetAI()->GetData(_data);
275 }
276
277 private:
279};
280
282 {
283 new boss_eregos();
285 new achievement_gen_eregos_void("achievement_ruby_void", DATA_RUBY_VOID);
286 new achievement_gen_eregos_void("achievement_emerald_void", DATA_EMERALD_VOID);
287 new achievement_gen_eregos_void("achievement_amber_void", DATA_AMBER_VOID);
288 }
Actions
@ IN_MILLISECONDS
Definition Common.h:125
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ EFFECT_0
@ SPELL_AURA_SCHOOL_IMMUNITY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:527
@ REACT_PASSIVE
Definition Unit.h:1156
#define SAY_DEATH
#define SAY_AGGRO
#define SAY_KILL
@ SAY_ENRAGE
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_SHIELD
@ SAY_ENRAGE
Npcs
@ NPC_PLANAR_ANOMALY
@ ACTION_SET_NORMAL_EVENTS
void AddSC_boss_eregos()
@ SPELL_PLANAR_ANOMALIES
@ SPELL_ARCANE_VOLLEY
@ SPELL_ARCANE_BARRAGE
@ SPELL_ENRAGED_ASSAULT
@ SPELL_SUMMON_PLANAR_ANOMALIES
@ SPELL_SUMMON_LEY_WHELP
@ SPELL_PLANAR_BLAST
@ SPELL_PLANAR_SHIFT
@ PHASE_FIRST_PLANAR
@ PHASE_SECOND_PLANAR
@ PHASE_NORMAL
EregosData
@ DATA_EMERALD_VOID
@ DATA_AMBER_VOID
@ DATA_RUBY_VOID
@ EVENT_ARCANE_VOLLEY
@ EVENT_ARCANE_BARRAGE
@ EVENT_SUMMON_LEY_WHELP
@ EVENT_ENRAGED_ASSAULT
@ SPELL_ARCANE_BARRAGE
@ PHASE_NORMAL
AchievementCriteriaScript(const char *name)
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
void JustSummoned(Creature *summon) OVERRIDE
SummonList summons
EventMap events
BossAI(Creature *creature, uint32 bossId)
void _EnterCombat()
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
Creature * ToCreature()
Definition Object.h:207
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
void DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:176
Definition Unit.h:1367
bool OnCheck(Player *, Unit *target) OVERRIDE
achievement_gen_eregos_void(char const *name, uint32 data)
CreatureAI * GetAI(Creature *creature) const OVERRIDE
PrepareAuraScript(spell_eregos_planar_shift_AuraScript)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
AuraScript * GetAuraScript() const OVERRIDE
@ NPC_AMBER_DRAKE_VEHICLE
Definition oculus.h:37
@ NPC_EMERALD_DRAKE_VEHICLE
Definition oculus.h:36
@ NPC_RUBY_DRAKE_VEHICLE
Definition oculus.h:35
@ DATA_EREGOS_EVENT
Definition oculus.h:14
Creature * me
void EnterCombat(Unit *) OVERRIDE
void DoAction(int32 action) OVERRIDE
uint32 GetData(uint32 type) const OVERRIDE
void SummonedCreatureDespawn(Creature *summon) OVERRIDE
void KilledUnit(Unit *) OVERRIDE
boss_eregosAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustDied(Unit *) OVERRIDE
void JustSummoned(Creature *summon) OVERRIDE
void DamageTaken(Unit *, uint32 &) OVERRIDE