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 }
237
238 void JustDied(Unit* /*killer*/) override
239 {
241
242 _JustDied();
243 }
244
245private:
250};
251
252// 51162 - Planar Shift
254{
255 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
256 {
257 if (Creature* creature = GetTarget()->ToCreature())
258 creature->AI()->DoAction(ACTION_SET_NORMAL_EVENTS);
259 }
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 {
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 }
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ EFFECT_0
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_SCHOOL_IMMUNITY
#define AuraEffectRemoveFn(F, I, N, M)
@ REACT_PASSIVE
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_KILL
@ SAY_SHIELD
@ SAY_SPAWN
@ 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
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetTarget() const
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
SummonList summons
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void SetPhase(uint8 phase)
Definition EventMap.cpp:32
void Reset()
Definition EventMap.cpp:25
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::ForceWalk, MovementSlot slot=MOTION_SLOT_DEFAULT, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
uint32 GetEntry() const
Definition Object.h:89
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:162
virtual uint32 GetData(uint32 id) const
Definition UnitAI.h:74
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
float GetHealthPct() const
Definition Unit.h:796
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6012
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
UnitAI * GetAI() const
Definition Unit.h:668
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
bool OnCheck(Player *, Unit *target) override
achievement_gen_eregos_void(char const *name, uint32 data)
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
@ 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