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 }
152
153 void JustDied(Unit* /*killer*/) override
154 {
155 _JustDied();
157 DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur
158 }
159
160private:
163};
164
166{
168 {
169 Initialize();
170 instance = creature->GetInstanceScript();
171 }
172
174 {
176 }
177
178 void Reset() override
179 {
180 Initialize();
181
182 me->SetWalk(true);
186 }
187
188 void SpellHitTarget(WorldObject* target, SpellInfo const* spellInfo) override
189 {
190 if (spellInfo->Id == SPELL_ICE_BEAM)
191 {
192 target->CastSpell(target, SPELL_SUMMON_ARCANE_BEAM, true);
194 }
195 }
196
197 void MovementInform(uint32 type, uint32 id) override
198 {
199 if (type != POINT_MOTION_TYPE ||
201 return;
202
204
205 if (Unit* target = ObjectAccessor::GetUnit(*me, targetGUID))
206 DoCast(target, SPELL_ICE_BEAM);
207 }
208
209 void DoAction(int32 action) override
210 {
211 switch (action)
212 {
215 {
216 if (Unit* victim = varos->AI()->SelectTarget(SelectTargetMethod::Random, 0))
217 {
219 me->SetWalk(false);
220 me->GetMotionMaster()->MovePoint(ACTION_CALL_DRAGON_EVENT, victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ() + 20.0f);
221 targetGUID = victim->GetGUID();
222 }
223 }
224 break;
225 }
226 }
227
228private:
231};
232
233// 50053 - Centrifuge Shield
235{
236 bool Load() override
237 {
238 Unit* caster = GetCaster();
239 return caster && caster->GetTypeId() == TYPEID_UNIT;
240 }
241
242 void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
243 {
244 if (Unit* caster = GetCaster())
245 caster->SetImmuneToAll(true, true);
246 }
247
248 void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
249 {
250 if (Unit* caster = GetCaster())
251 caster->SetImmuneToAll(false);
252 }
253
259};
260
261// 50785, 59372 - Energize Cores
263{
264 void FilterTargets(std::list<WorldObject*>& targets)
265 {
266 Creature* varos = GetCaster()->ToCreature();
267 if (!varos)
268 return;
269
270 if (varos->GetEntry() != NPC_VAROS)
271 return;
272
273 float orientation = ENSURE_AI(boss_varos, varos->AI())->GetCoreEnergizeOrientation();
274
275 for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
276 {
277 float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
278 float diff = std::fabs(orientation - angle);
279
280 if (diff > 1.0f)
281 itr = targets.erase(itr);
282 else
283 ++itr;
284 }
285 }
286
291};
292
293// 54069, 56251 - Energize Cores
294// 61407, 62136 - Energize Cores
296{
297 void FilterTargets(std::list<WorldObject*>& targets)
298 {
299 Creature* varos = GetCaster()->ToCreature();
300 if (!varos)
301 return;
302
303 if (varos->GetEntry() != NPC_VAROS)
304 return;
305
306 float orientation = ENSURE_AI(boss_varos, varos->AI())->GetCoreEnergizeOrientation();
307
308 for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();)
309 {
310 float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY());
311 float diff = std::fabs(orientation - angle);
312
313 if (diff > 1.0f)
314 itr = targets.erase(itr);
315 else
316 ++itr;
317 }
318 }
319
324};
325
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ DONE
@ POINT_MOTION_TYPE
@ TYPEID_UNIT
Definition ObjectGuid.h:43
Spells
Definition PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
@ 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:30
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ MOVEMENTFLAG_FLYING
@ UNIT_STATE_CASTING
Definition Unit.h:276
@ 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
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetReactState(ReactStates st)
Definition Creature.h:174
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:228
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 CancelEvent(uint32 eventId)
Definition EventMap.cpp:135
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={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
void Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
uint32 const Id
Definition SpellInfo.h:328
Unit * GetCaster() const
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
virtual void InitializeAI()
Definition UnitAI.cpp:43
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:1732
bool SetWalk(bool enable)
Definition Unit.cpp:13343
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
InstanceScript * GetInstanceScript() const
Definition Object.cpp:396
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
void OnRemove(AuraEffect const *, AuraEffectHandleModes)
void OnApply(AuraEffect const *, AuraEffectHandleModes)
void FilterTargets(std::list< WorldObject * > &targets)
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:207
float GetAbsoluteAngle(float x, float y) const
Definition Position.h:136
constexpr float GetOrientation() const
Definition Position.h:90
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
npc_azure_ring_captain(Creature *creature)
InstanceScript * instance
void MovementInform(uint32 type, uint32 id) override
void Reset() override