TrinityCore
Loading...
Searching...
No Matches
boss_eregos.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 "MotionMaster.h"
20#include "oculus.h"
21#include "ScriptedCreature.h"
22#include "SpellScript.h"
23
24// Types of drake mounts: Ruby (Tank), Amber (DPS), Emerald (Healer)
25// Two Repeating phases
26
34
44
56
57enum Npcs
58{
59 NPC_PLANAR_ANOMALY = 30879
60};
61
68
73
75{
76 DATA_RUBY_VOID = 0, // http://www.wowhead.com/achievement=2044
77 DATA_EMERALD_VOID = 1, // http://www.wowhead.com/achievement=2045
78 DATA_AMBER_VOID = 2 // http://www.wowhead.com/achievement=2046
79};
80
81struct boss_eregos : public BossAI
82{
83 boss_eregos(Creature* creature) : BossAI(creature, DATA_EREGOS)
84 {
85 Initialize();
86 }
87
89 {
91
92 _rubyVoid = true;
93 _emeraldVoid = true;
94 _amberVoid = true;
95 }
96
97 void Reset() override
98 {
99 _Reset();
100 Initialize();
101
103 }
104
105 void KilledUnit(Unit* who) override
106 {
107 if (who->GetTypeId() == TYPEID_PLAYER)
108 Talk(SAY_KILL);
109 }
110
111 void JustEngagedWith(Unit* who) override
112 {
114
116 /* Checks for present drakes vehicles from each type and deactivate achievement that corresponds to each found
117 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/
118 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. */
120 _rubyVoid = false;
122 _emeraldVoid = false;
124 _amberVoid = false;
125 }
126
127 uint32 GetData(uint32 type) const override
128 {
129 switch (type)
130 {
131 case DATA_RUBY_VOID:
132 return _rubyVoid;
134 return _emeraldVoid;
135 case DATA_AMBER_VOID:
136 return _amberVoid;
137 default:
138 break;
139 }
140 return 0;
141 }
142
154
155 void JustSummoned(Creature* summon) override
156 {
157 BossAI::JustSummoned(summon);
158
159 if (summon->GetEntry() != NPC_PLANAR_ANOMALY)
160 return;
161
162 summon->CombatStop(true);
164 summon->GetMotionMaster()->MoveRandom(100.0f);
165 }
166
167 void SummonedCreatureDespawn(Creature* summon) override
168 {
169 if (summon->GetEntry() != NPC_PLANAR_ANOMALY)
170 return;
171
173 summon->CastSpell(summon, SPELL_PLANAR_BLAST, true);
174 }
175
176 void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
177 {
178 if (!IsHeroic())
179 return;
180
181 if ( (me->GetHealthPct() < 60.0f && me->GetHealthPct() > 20.0f && _phase < PHASE_FIRST_PLANAR)
182 || (me->GetHealthPct() < 20.0f && _phase < PHASE_SECOND_PLANAR) )
183 {
184 events.Reset();
186
189
190 // not sure about the amount, and if we should despawn previous spawns (dragon trashs)
192 for (uint8 i = 0; i < 6; i++)
194 }
195 }
196
197 void UpdateAI(uint32 diff) override
198 {
199 if (!UpdateVictim())
200 return;
201
202 events.Update(diff);
203
205 return;
206
207 while (uint32 eventId = events.ExecuteEvent())
208 {
209 switch (eventId)
210 {
214 break;
218 break;
223 break;
225 for (uint8 i = 0; i < 3; i++)
228 break;
229 default:
230 break;
231 }
232
234 return;
235 }
236
238 }
239
240 void JustDied(Unit* /*killer*/) override
241 {
243
244 _JustDied();
245 }
246
247private:
252};
253
254// 51162 - Planar Shift
256{
258
259 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
260 {
261 if (Creature* creature = GetTarget()->ToCreature())
262 creature->AI()->DoAction(ACTION_SET_NORMAL_EVENTS);
263 }
264
269};
270
272{
273 public:
274 achievement_gen_eregos_void(char const* name, uint32 data) : AchievementCriteriaScript(name), _data(data) { }
275
276 bool OnCheck(Player* /*player*/, Unit* target) override
277 {
278 return target && target->GetAI()->GetData(_data);
279 }
280
281 private:
283};
284
286 {
289 new achievement_gen_eregos_void("achievement_ruby_void", DATA_RUBY_VOID);
290 new achievement_gen_eregos_void("achievement_emerald_void", DATA_EMERALD_VOID);
291 new achievement_gen_eregos_void("achievement_amber_void", DATA_AMBER_VOID);
292 }
Actions
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_SCHOOL_IMMUNITY
#define AuraEffectRemoveFn(F, I, N, M)
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_SHIELD
@ SAY_SPAWN
@ SAY_ENRAGE
@ 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
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void SetPhase(PhaseIndex phase)
Definition EventMap.cpp:28
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
void MoveRandom(float wanderDistance=0.0f)
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
virtual uint32 GetData(uint32) const
Definition UnitAI.h:155
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
float GetHealthPct() const
Definition Unit.h:921
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
UnitAI * GetAI() const
Definition Unit.h:800
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5691
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
bool OnCheck(Player *, Unit *target) override
achievement_gen_eregos_void(char const *name, uint32 data)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_eregos_planar_shift)
@ DATA_EREGOS
Definition oculus.h:34
@ NPC_AMBER_DRAKE_VEHICLE
Definition oculus.h:50
@ NPC_EMERALD_DRAKE_VEHICLE
Definition oculus.h:49
@ NPC_RUBY_DRAKE_VEHICLE
Definition oculus.h:48
#define RegisterOculusCreatureAI(ai_name)
Definition oculus.h:116
bool IsHeroic() const
void JustEngagedWith(Unit *who) override
boss_eregos(Creature *creature)
void JustDied(Unit *) override
uint32 GetData(uint32 type) const override
void Initialize()
void DoAction(int32 action) override
void SummonedCreatureDespawn(Creature *summon) override
void Reset() override
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *who) override
void JustSummoned(Creature *summon) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override
Npcs
Definition zulaman.cpp:47