TrinityCore
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
28{
33};
34
35enum Says
36{
43};
44
46{
54 SPELL_PLANAR_BLAST = 57976
55};
56
57enum Npcs
58{
59 NPC_PLANAR_ANOMALY = 30879
60};
61
63{
67};
68
70{
72};
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
143 void DoAction(int32 action) override
144 {
145 if (action != ACTION_SET_NORMAL_EVENTS)
146 return;
147
153 }
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
261 void Register() override
262 {
264 }
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 }
Actions
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_SCHOOL_IMMUNITY
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ REACT_PASSIVE
Definition: UnitDefines.h:506
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ SAY_DEATH
Definition: boss_eregos.cpp:41
@ SAY_AGGRO
Definition: boss_eregos.cpp:38
@ SAY_KILL
Definition: boss_eregos.cpp:40
@ SAY_SHIELD
Definition: boss_eregos.cpp:42
@ SAY_SPAWN
Definition: boss_eregos.cpp:37
@ SAY_ENRAGE
Definition: boss_eregos.cpp:39
Npcs
Definition: boss_eregos.cpp:58
@ NPC_PLANAR_ANOMALY
Definition: boss_eregos.cpp:59
@ ACTION_SET_NORMAL_EVENTS
Definition: boss_eregos.cpp:71
void AddSC_boss_eregos()
@ SPELL_PLANAR_ANOMALIES
Definition: boss_eregos.cpp:50
@ SPELL_ARCANE_VOLLEY
Definition: boss_eregos.cpp:48
@ SPELL_ARCANE_BARRAGE
Definition: boss_eregos.cpp:47
@ SPELL_ENRAGED_ASSAULT
Definition: boss_eregos.cpp:49
@ SPELL_SUMMON_PLANAR_ANOMALIES
Definition: boss_eregos.cpp:53
@ SPELL_SUMMON_LEY_WHELP
Definition: boss_eregos.cpp:52
@ SPELL_PLANAR_BLAST
Definition: boss_eregos.cpp:54
@ SPELL_PLANAR_SHIFT
Definition: boss_eregos.cpp:51
@ PHASE_FIRST_PLANAR
Definition: boss_eregos.cpp:65
@ PHASE_SECOND_PLANAR
Definition: boss_eregos.cpp:66
@ PHASE_NORMAL
Definition: boss_eregos.cpp:64
EregosData
Definition: boss_eregos.cpp:75
@ DATA_EMERALD_VOID
Definition: boss_eregos.cpp:77
@ DATA_AMBER_VOID
Definition: boss_eregos.cpp:78
@ DATA_RUBY_VOID
Definition: boss_eregos.cpp:76
@ EVENT_ARCANE_VOLLEY
Definition: boss_eregos.cpp:30
@ EVENT_ARCANE_BARRAGE
Definition: boss_eregos.cpp:29
@ EVENT_SUMMON_LEY_WHELP
Definition: boss_eregos.cpp:32
@ EVENT_ENRAGED_ASSAULT
Definition: boss_eregos.cpp:31
Says
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
void JustSummoned(Creature *summon) override
SummonList summons
EventMap events
void _JustDied()
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 SetReactState(ReactStates st)
Definition: Creature.h:160
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void SetPhase(uint8 phase)
Definition: EventMap.cpp:28
void Reset()
Definition: EventMap.cpp:21
void MoveRandom(float wanderDistance=0.0f, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_DEFAULT)
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
virtual uint32 GetData(uint32) const
Definition: UnitAI.h:73
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:161
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
float GetHealthPct() const
Definition: Unit.h:784
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
UnitAI * GetAI() const
Definition: Unit.h:660
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
bool OnCheck(Player *, Unit *target) override
achievement_gen_eregos_void(char const *name, uint32 data)
void Register() override
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)
Definition: boss_eregos.cpp:83
void JustDied(Unit *) override
uint32 GetData(uint32 type) const override
void Initialize()
Definition: boss_eregos.cpp:88
void DoAction(int32 action) override
void SummonedCreatureDespawn(Creature *summon) override
void Reset() override
Definition: boss_eregos.cpp:97
void UpdateAI(uint32 diff) override
void KilledUnit(Unit *who) override
void JustSummoned(Creature *summon) override
void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellInfo const *) override