TrinityCore
Loading...
Searching...
No Matches
boss_urom.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 "oculus.h"
19#include "Containers.h"
20#include "Map.h"
21#include "MotionMaster.h"
22#include "ScriptedCreature.h"
23#include "ScriptMgr.h"
24#include "SpellInfo.h"
25#include "SpellScript.h"
26
40
49
61
76
77struct Summons
78{
80};
81
88
93
94struct boss_urom : public BossAI
95{
96 boss_urom(Creature* creature) : BossAI(creature, DATA_UROM)
97 {
98 _platform = 0;
99 _x = 0.0f;
100 _y = 0.0f;
101 _isInCenter = false;
102
103 for (uint8 i = 0; i < 3; ++i)
104 _group.push_back(i);
105
107 }
108
109 void EnterEvadeMode(EvadeReason why) override
110 {
111 // We can only evade if we're in the center platform
112 if (_platform > 2)
113 {
114 _EnterEvadeMode(why);
115
116 // If we're in the center, teleport to start position
117 if (_isInCenter)
118 me->NearTeleportTo(1118.3101f, 1080.3800f, 508.3610f, 4.25f);
119 else
121
122 Reset();
123 events.Reset();
124 }
125 }
126
127 void Reset() override
128 {
129 _isInCenter = false;
131 me->SetDisableGravity(false);
134 _Reset();
135 }
136
137 void JustReachedHome() override
138 {
140 }
141
142 void JustEngagedWith(Unit* who) override
143 {
145 StartAttack();
146 }
147
148 void AttackStart(Unit* who) override
149 {
150 if (!who)
151 return;
152
153 if (me->GetPositionZ() > 518.63f)
155 else
157 }
158
160 {
161 switch (i)
162 {
163 case 0:
164 _x = me->GetPositionX() + 4;
165 _y = me->GetPositionY() - 4;
166 break;
167 case 1:
168 _x = me->GetPositionX() + 4;
169 _y = me->GetPositionY() + 4;
170 break;
171 case 2:
172 _x = me->GetPositionX() - 4;
173 _y = me->GetPositionY() + 4;
174 break;
175 case 3:
176 _x = me->GetPositionX() - 4;
177 _y = me->GetPositionY() - 4;
178 break;
179 default:
180 break;
181 }
182 }
183
185 {
186 // We're in center - start fight normally
187 if (_platform > 2)
188 {
189 me->CastStop(); // Stop casting of Evocation
194 return;
195 }
196
197 // We're on one of the three platforms - summon guards and jump to next platform
198 for (uint8 i = 0; i < 4; ++i)
199 {
200 SetPosition(i);
202 }
203
206
207 ++_platform;
208 }
209
210 void KilledUnit(Unit* who) override
211 {
212 if (who->GetTypeId() == TYPEID_PLAYER)
214 }
215
216 void UpdateAI(uint32 diff) override
217 {
218 if (!UpdateVictim())
219 return;
220
221 if (_platform < 3)
222 return;
223
224 events.Update(diff);
225
227 return;
228
229 while (uint32 eventId = events.ExecuteEvent())
230 {
231 switch (eventId)
232 {
233 case EVENT_TELEPORT:
234 events.DelayEvents(10s);
236 me->AttackStop();
237 me->StopMoving();
238 me->SetDisableGravity(true);
239 me->SetCanFly(true);
240 me->SetControlled(true, UNIT_STATE_ROOT); // @hack: disabling gravity isn't enough to prevent falling
242 _isInCenter = true;
244 break;
250 break;
253 me->SetDisableGravity(false);
254 me->SetCanFly(false);
256 if (Unit* victim = me->SelectVictim())
257 {
258 me->NearTeleportTo(victim->GetPosition());
259 AttackStart(victim);
260 }
261 _isInCenter = false;
263 break;
264 case EVENT_FROST_BOMB:
267 break;
268 case EVENT_TIME_BOMB:
270 DoCast(unit, SPELL_TIME_BOMB);
272 break;
273 }
274 }
275
277 }
278
279 void JustDied(Unit* /*killer*/) override
280 {
281 _JustDied();
284 }
285
287 {
289 me->CombatStop(false);
291 }
292
293 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
294 {
295 switch (spellInfo->Id)
296 {
298 me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f);
299 LeaveCombat();
301 break;
303 me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f);
304 LeaveCombat();
306 break;
308 me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f);
309 LeaveCombat();
311 break;
312 default:
313 break;
314 }
315 }
316
317 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
318 {
319 // If killed while in center, teleport to a valid ground position before dying
320 if (damage >= me->GetHealth())
321 {
322 if (_isInCenter)
323 {
324 _isInCenter = false;
325 me->NearTeleportTo(1124.0432f, 1078.2109f, 508.3597f, 5.4623f);
326 }
327 }
328 }
329
330private:
331 float _x, _y;
334 std::vector<uint8> _group;
335};
336
337// 51103 - Frostbomb
339{
341
342 bool Validate(SpellInfo const* /*spell*/) override
343 {
345 }
346
347 void OnPeriodic(AuraEffect const* /*aurEff*/)
348 {
349 if (Unit* caster = GetCaster())
350 if (caster->GetMap()->IsHeroic() && caster->IsInCombat())
351 if (Unit* target = GetTarget())
352 caster->CastSpell(target, SPELL_FROST_BUFFET, true);
353 }
354
359};
360
uint8_t uint8
Definition Define.h:135
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_1
@ SPELL_AURA_PERIODIC_DAMAGE
#define AuraEffectPeriodicFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_ROOT
Definition Unit.h:230
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
Creatures
@ NPC_PHANTASMAL_WATER
Definition boss_urom.cpp:70
@ NPC_PHANTASMAL_WOLF
Definition boss_urom.cpp:66
@ NPC_PHANTASMAL_NAGAL
Definition boss_urom.cpp:73
@ NPC_PHANTASMAL_FIRE
Definition boss_urom.cpp:69
@ NPC_PHANTASMAL_OGRE
Definition boss_urom.cpp:74
@ NPC_PHANTASMAL_AIR
Definition boss_urom.cpp:68
@ NPC_PHANTASMAL_MURLOC
Definition boss_urom.cpp:72
@ NPC_PHANTASMAL_MAMMOTH
Definition boss_urom.cpp:65
@ NPC_PHANTASMAL_CLOUDSCRAPER
Definition boss_urom.cpp:64
@ SAY_DEATH
Definition boss_urom.cpp:58
@ EMOTE_ARCANE_EXPLOSION
Definition boss_urom.cpp:56
@ SAY_PLAYER_KILL
Definition boss_urom.cpp:59
@ SAY_SUMMON_3
Definition boss_urom.cpp:54
@ SAY_AGGRO
Definition boss_urom.cpp:55
@ SAY_SUMMON_1
Definition boss_urom.cpp:52
@ SAY_SUMMON_2
Definition boss_urom.cpp:53
@ SAY_ARCANE_EXPLOSION
Definition boss_urom.cpp:57
@ SPELL_FROST_BUFFET
Definition boss_urom.cpp:38
@ SPELL_ARCANE_SHIELD
Definition boss_urom.cpp:29
@ SPELL_EVOCATE
Definition boss_urom.cpp:37
@ SPELL_SUMMON_MENAGERIE
Definition boss_urom.cpp:30
@ SPELL_TELEPORT
Definition boss_urom.cpp:35
@ SPELL_SUMMON_MENAGERIE_2
Definition boss_urom.cpp:31
@ SPELL_SUMMON_MENAGERIE_3
Definition boss_urom.cpp:32
@ SPELL_EMPOWERED_ARCANE_EXPLOSION
Definition boss_urom.cpp:33
@ SPELL_FROSTBOMB
Definition boss_urom.cpp:34
@ SPELL_TIME_BOMB
Definition boss_urom.cpp:36
static uint32 TeleportSpells[]
Definition boss_urom.cpp:89
void AddSC_boss_urom()
@ EVENT_FROST_BOMB
Definition boss_urom.cpp:43
@ EVENT_TELEPORT
Definition boss_urom.cpp:46
@ EVENT_CAST_EXPLOSION
Definition boss_urom.cpp:45
@ EVENT_TELEPORT_BACK
Definition boss_urom.cpp:47
@ EVENT_TIME_BOMB
Definition boss_urom.cpp:44
Yells
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
bool _EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void EngagementOver()
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:293
void SetReactState(ReactStates st)
Definition Creature.h:119
Unit * SelectVictim()
void Update(uint32 time)
Definition EventMap.h:67
void DelayEvents(Milliseconds delay)
Definition EventMap.cpp:95
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
Definition Group.h:165
void MoveTargetedHome()
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void CastStop(uint32 except_spellid=0)
Definition Unit.cpp:988
void SetControlled(bool apply, UnitState state)
Definition Unit.cpp:11256
void StopMoving(bool force=false)
Definition Unit.cpp:10312
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
bool SetCanFly(bool enable, bool packetOnly=false)
Definition Unit.cpp:13374
uint32 GetHealth() const
Definition Unit.h:913
void NearTeleportTo(Position const &pos, bool casting=false)
Definition Unit.cpp:12832
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void RemoveAllAuras()
Definition Unit.cpp:4157
void CombatStop(bool includingCast=false, bool mutualPvP=true)
Definition Unit.cpp:5691
bool AttackStop()
Definition Unit.cpp:5645
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
bool Validate(SpellInfo const *) override
void OnPeriodic(AuraEffect const *)
void Register() override
PrepareAuraScript(spell_urom_frostbomb)
void RandomShuffle(C &container)
Reorder the elements of the container randomly.
Definition Containers.h:166
@ DATA_UROM
Definition oculus.h:33
@ SPELL_DEATH_SPELL
Definition oculus.h:83
#define RegisterOculusCreatureAI(ai_name)
Definition oculus.h:116
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void DoStartNoMovement(Unit *target)
T const & DUNGEON_MODE(T const &normal5, T const &heroic10) const
uint32 entry[4]
Definition boss_urom.cpp:79
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void AttackStart(Unit *who) override
std::vector< uint8 > _group
void KilledUnit(Unit *who) override
bool _isInCenter
boss_urom(Creature *creature)
Definition boss_urom.cpp:96
void EnterEvadeMode(EvadeReason why) override
void JustEngagedWith(Unit *who) override
void Reset() override
void UpdateAI(uint32 diff) override
void StartAttack()
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
void LeaveCombat()
void JustDied(Unit *) override
uint8 _platform
void SetPosition(uint8 i)
void JustReachedHome() override