TrinityCore
Loading...
Searching...
No Matches
boss_varos.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 "InstanceScript.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "oculus.h"
23#include "ScriptedCreature.h"
24#include "SpellInfo.h"
25#include "SpellScript.h"
26
34
36{
38 SPELL_ENERGIZE_CORES = 50785, //Damage 5938 to 6562, effec2 Triggers 54069, effect3 Triggers 56251
39 SPELL_CALL_AZURE_RING_CAPTAIN = 51002, //Effect Send Event (12229)
40 /*SPELL_CALL_AZURE_RING_CAPTAIN_2 = 51006, //Effect Send Event (10665)
41 SPELL_CALL_AZURE_RING_CAPTAIN_3 = 51007, //Effect Send Event (18454)
42 SPELL_CALL_AZURE_RING_CAPTAIN_4 = 51008, //Effect Send Event (18455)*/
44
48};
49
57
58struct boss_varos : public BossAI
59{
60 boss_varos(Creature* creature) : BossAI(creature, DATA_VAROS)
61 {
62 Initialize();
63 }
64
66 {
67 firstCoreEnergize = false;
69 }
70
77
78 void Reset() override
79 {
80 _Reset();
81
84 // not sure if this is handled by a timer or hp percentage
86
87 Initialize();
88 }
89
90 void JustEngagedWith(Unit* who) override
91 {
93
95 }
96
101
102 void UpdateAI(uint32 diff) override
103 {
104 if (!UpdateVictim())
105 return;
106
107 events.Update(diff);
108
110 return;
111
112 while (uint32 eventId = events.ExecuteEvent())
113 {
114 switch (eventId)
115 {
119 break;
122 {
124 firstCoreEnergize = true;
125 }
126 else
128
132 break;
133 case EVENT_CALL_AZURE:
134 // not sure how blizz handles this, i cant see any pattern between the differnt spells
139 break;
143 break;
144 default:
145 break;
146 }
147
149 return;
150 }
151
153 }
154
155 void JustDied(Unit* /*killer*/) override
156 {
157 _JustDied();
159 DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur
160 }
161
162private:
165};
166
168{
170 {
171 Initialize();
172 instance = creature->GetInstanceScript();
173 }
174
176 {
178 }
179
180 void Reset() override
181 {
182 Initialize();
183
184 me->SetWalk(true);
188 }
189
190 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
191 {
192 if (spellInfo->Id == SPELL_ICE_BEAM)
193 {
194 target->CastSpell(target, SPELL_SUMMON_ARCANE_BEAM, true);
196 }
197 }
198
199 void UpdateAI(uint32 /*diff*/) override
200 {
201 if (!UpdateVictim())
202 return;
203
205 }
206
207 void MovementInform(uint32 type, uint32 id) override
208 {
209 if (type != POINT_MOTION_TYPE ||
211 return;
212
214
215 if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
216 DoCast(target, SPELL_ICE_BEAM);
217 }
218
219 void DoAction(int32 action) override
220 {
221 switch (action)
222 {
225 {
226 if (Unit* victim = varos->AI()->SelectTarget(SelectTargetMethod::Random, 0))
227 {
229 me->SetWalk(false);
230 me->GetMotionMaster()->MovePoint(ACTION_CALL_DRAGON_EVENT, victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ() + 20.0f);
231 targetGUID = victim->GetGUID();
232 }
233 }
234 break;
235 }
236 }
237
238private:
241};
242
243// 50053 - Centrifuge Shield
245{
247
248 bool Load() override
249 {
250 Unit* caster = GetCaster();
251 return caster && caster->GetTypeId() == TYPEID_UNIT;
252 }
253
254 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
255 {
256 if (Unit* caster = GetCaster())
257 caster->SetImmuneToAll(true, true);
258 }
259
260 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
261 {
262 if (Unit* caster = GetCaster())
263 caster->SetImmuneToAll(false);
264 }
265
271};
272
273// 50785, 59372 - Energize Cores
275{
277
278 void FilterTargets(std::list<WorldObject*>& targets)
279 {
280 Creature* varos = GetCaster()->ToCreature();
281 if (!varos)
282 return;
283
284 if (varos->GetEntry() != NPC_VAROS)
285 return;
286
287 float orientation = ENSURE_AI(boss_varos, varos->AI())->GetCoreEnergizeOrientation();
288
289 for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
290 {
291 float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
292 float diff = std::fabs(orientation - angle);
293
294 if (diff > 1.0f)
295 itr = targets.erase(itr);
296 else
297 ++itr;
298 }
299 }
300
305};
306
307// 54069, 56251 - Energize Cores
308// 61407, 62136 - Energize Cores
310{
312
313 void FilterTargets(std::list<WorldObject*>& targets)
314 {
315 Creature* varos = GetCaster()->ToCreature();
316 if (!varos)
317 return;
318
319 if (varos->GetEntry() != NPC_VAROS)
320 return;
321
322 float orientation = ENSURE_AI(boss_varos, varos->AI())->GetCoreEnergizeOrientation();
323
324 for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
325 {
326 float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
327 float diff = std::fabs(orientation - angle);
328
329 if (diff > 1.0f)
330 itr = targets.erase(itr);
331 else
332 ++itr;
333 }
334 }
335
340};
341
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ DONE
@ POINT_MOTION_TYPE
@ TYPEID_UNIT
Definition ObjectGuid.h:38
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
@ EFFECT_0
@ TARGET_UNIT_SRC_AREA_ENTRY
@ TARGET_UNIT_SRC_AREA_ENEMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define SpellObjectAreaTargetSelectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
#define AuraEffectRemoveFn(F, I, N, M)
#define ENSURE_AI(a, b)
Definition UnitAI.h:28
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ MOVEMENTFLAG_FLYING
@ UNIT_STATE_CASTING
Definition Unit.h:235
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_AZURE
@ SAY_AZURE_EMOTE
void AddSC_boss_varos()
@ SPELL_ENERGIZE_CORES
@ SPELL_CALL_AZURE_RING_CAPTAIN
@ SPELL_ICE_BEAM
@ SPELL_CALL_AMPLIFY_MAGIC
@ SPELL_ARCANE_BEAM_PERIODIC
@ SPELL_SUMMON_ARCANE_BEAM
@ SPELL_ENERGIZE_CORES_VISUAL
@ EVENT_CALL_AZURE
@ EVENT_ENERGIZE_CORES_VISUAL
@ EVENT_ENERGIZE_CORES
@ EVENT_AMPLIFY_MAGIC
Unit * GetCaster() const
HookList< EffectApplyHandler > OnEffectRemove
HookList< EffectApplyHandler > OnEffectApply
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void CancelEvent(EventId eventId)
Definition EventMap.cpp:151
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
EncounterState GetBossState(uint32 id) const
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void Clear()
Definition ObjectGuid.h:150
static Creature * ToCreature(Object *o)
Definition Object.h:186
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
virtual void InitializeAI()
Definition UnitAI.cpp:36
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:1676
bool SetWalk(bool enable)
Definition Unit.cpp:13268
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_varos_centrifuge_shield)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void FilterTargets(std::list< WorldObject * > &targets)
PrepareSpellScript(spell_varos_energize_core_area_enemy)
PrepareSpellScript(spell_varos_energize_core_area_entry)
void FilterTargets(std::list< WorldObject * > &targets)
void Register() override
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ DATA_VAROS
Definition oculus.h:32
@ DATA_DRAKOS
Definition oculus.h:31
@ NPC_VAROS
Definition oculus.h:42
@ ACTION_CALL_DRAGON_EVENT
Definition oculus.h:71
@ SPELL_DEATH_SPELL
Definition oculus.h:83
@ SPELL_CENTRIFUGE_SHIELD
Definition oculus.h:82
#define RegisterOculusCreatureAI(ai_name)
Definition oculus.h:116
static float NormalizeOrientation(float o)
Definition Position.cpp:156
float GetOrientation() const
Definition Position.h:82
float GetAbsoluteAngle(float x, float y) const
Definition Position.h:128
void InitializeAI() override
boss_varos(Creature *creature)
void Reset() override
bool firstCoreEnergize
float coreEnergizeOrientation
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
float GetCoreEnergizeOrientation()
void Initialize()
void JustDied(Unit *) override
void SpellHitTarget(WorldObject *target, SpellInfo const *spellInfo) override
void DoAction(int32 action) override
void UpdateAI(uint32) override
npc_azure_ring_captain(Creature *creature)
InstanceScript * instance
void MovementInform(uint32 type, uint32 id) override
void Reset() override