aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroffl <11556157+offl@users.noreply.github.com>2021-04-20 17:41:57 +0300
committerGitHub <noreply@github.com>2021-04-20 17:41:57 +0300
commit2a57b6627f7f81ffae6dbfdd933466c4bfdbc378 (patch)
treea02c2637f3d332bfeed9e9ecfff3be2f9ae6560c
parent2c1f14e0e2cbc3325140433e360143d1ea84a36b (diff)
Scripts/Oculus: Update Urom to new model (#26443)
-rw-r--r--src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp433
1 files changed, 211 insertions, 222 deletions
diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
index 96de0ce5df8..b4717b9e765 100644
--- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
+++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp
@@ -91,258 +91,247 @@ static uint32 TeleportSpells[]=
SPELL_SUMMON_MENAGERIE, SPELL_SUMMON_MENAGERIE_2, SPELL_SUMMON_MENAGERIE_3
};
-class boss_urom : public CreatureScript
+struct boss_urom : public BossAI
{
- public:
- boss_urom() : CreatureScript("boss_urom") { }
-
- struct boss_uromAI : public BossAI
- {
- boss_uromAI(Creature* creature) : BossAI(creature, DATA_UROM)
- {
- _platform = 0;
- _x = 0.0f;
- _y = 0.0f;
- _isInCenter = false;
+ boss_urom(Creature* creature) : BossAI(creature, DATA_UROM)
+ {
+ _platform = 0;
+ _x = 0.0f;
+ _y = 0.0f;
+ _isInCenter = false;
- for (uint8 i = 0; i < 3; ++i)
- _group.push_back(i);
+ for (uint8 i = 0; i < 3; ++i)
+ _group.push_back(i);
- Trinity::Containers::RandomShuffle(_group);
- }
+ Trinity::Containers::RandomShuffle(_group);
+ }
- void EnterEvadeMode(EvadeReason why) override
- {
- // We can only evade if we're in the center platform
- if (_platform > 2)
- {
- _EnterEvadeMode(why);
-
- // If we're in the center, teleport to start position
- if (_isInCenter)
- me->NearTeleportTo(1118.3101f, 1080.3800f, 508.3610f, 4.25f);
- else
- me->GetMotionMaster()->MoveTargetedHome();
-
- Reset();
- events.Reset();
- }
- }
+ void EnterEvadeMode(EvadeReason why) override
+ {
+ // We can only evade if we're in the center platform
+ if (_platform > 2)
+ {
+ _EnterEvadeMode(why);
- void Reset() override
- {
- _isInCenter = false;
- me->SetControlled(false, UNIT_STATE_ROOT);
- me->SetDisableGravity(false);
- me->SetReactState(REACT_AGGRESSIVE);
- DoCastSelf(SPELL_EVOCATE);
- _Reset();
- }
+ // If we're in the center, teleport to start position
+ if (_isInCenter)
+ me->NearTeleportTo(1118.3101f, 1080.3800f, 508.3610f, 4.25f);
+ else
+ me->GetMotionMaster()->MoveTargetedHome();
- void JustReachedHome() override
- {
- DoCastSelf(SPELL_EVOCATE);
- }
+ Reset();
+ events.Reset();
+ }
+ }
- void JustEngagedWith(Unit* who) override
- {
- BossAI::JustEngagedWith(who);
- StartAttack();
- }
+ void Reset() override
+ {
+ _isInCenter = false;
+ me->SetControlled(false, UNIT_STATE_ROOT);
+ me->SetDisableGravity(false);
+ me->SetReactState(REACT_AGGRESSIVE);
+ DoCastSelf(SPELL_EVOCATE);
+ _Reset();
+ }
- void AttackStart(Unit* who) override
- {
- if (!who)
- return;
+ void JustReachedHome() override
+ {
+ DoCastSelf(SPELL_EVOCATE);
+ }
- if (me->GetPositionZ() > 518.63f)
- DoStartNoMovement(who);
- else
- BossAI::AttackStart(who);
- }
+ void JustEngagedWith(Unit* who) override
+ {
+ BossAI::JustEngagedWith(who);
+ StartAttack();
+ }
- void SetPosition(uint8 i)
- {
- switch (i)
- {
- case 0:
- _x = me->GetPositionX() + 4;
- _y = me->GetPositionY() - 4;
- break;
- case 1:
- _x = me->GetPositionX() + 4;
- _y = me->GetPositionY() + 4;
- break;
- case 2:
- _x = me->GetPositionX() - 4;
- _y = me->GetPositionY() + 4;
- break;
- case 3:
- _x = me->GetPositionX() - 4;
- _y = me->GetPositionY() - 4;
- break;
- default:
- break;
- }
- }
+ void AttackStart(Unit* who) override
+ {
+ if (!who)
+ return;
- void StartAttack()
- {
- // We're in center - start fight normally
- if (_platform > 2)
- {
- me->CastStop(); // Stop casting of Evocation
- Talk(SAY_AGGRO);
- events.ScheduleEvent(EVENT_TELEPORT, 30s, 35s);
- events.ScheduleEvent(EVENT_FROST_BOMB, 5s, 8s);
- events.ScheduleEvent(EVENT_TIME_BOMB, 20s, 25s);
- return;
- }
+ if (me->GetPositionZ() > 518.63f)
+ DoStartNoMovement(who);
+ else
+ BossAI::AttackStart(who);
+ }
- // We're on one of the three platforms - summon guards and jump to next platform
- for (uint8 i = 0; i < 4; ++i)
- {
- SetPosition(i);
- me->SummonCreature(Group[_group[_platform]].entry[i], _x, _y, me->GetPositionZ(), me->GetOrientation());
- }
+ void SetPosition(uint8 i)
+ {
+ switch (i)
+ {
+ case 0:
+ _x = me->GetPositionX() + 4;
+ _y = me->GetPositionY() - 4;
+ break;
+ case 1:
+ _x = me->GetPositionX() + 4;
+ _y = me->GetPositionY() + 4;
+ break;
+ case 2:
+ _x = me->GetPositionX() - 4;
+ _y = me->GetPositionY() + 4;
+ break;
+ case 3:
+ _x = me->GetPositionX() - 4;
+ _y = me->GetPositionY() - 4;
+ break;
+ default:
+ break;
+ }
+ }
- Talk(_platform);
- DoCast(TeleportSpells[_platform]);
+ void StartAttack()
+ {
+ // We're in center - start fight normally
+ if (_platform > 2)
+ {
+ me->CastStop(); // Stop casting of Evocation
+ Talk(SAY_AGGRO);
+ events.ScheduleEvent(EVENT_TELEPORT, 30s, 35s);
+ events.ScheduleEvent(EVENT_FROST_BOMB, 5s, 8s);
+ events.ScheduleEvent(EVENT_TIME_BOMB, 20s, 25s);
+ return;
+ }
- ++_platform;
- }
+ // We're on one of the three platforms - summon guards and jump to next platform
+ for (uint8 i = 0; i < 4; ++i)
+ {
+ SetPosition(i);
+ me->SummonCreature(Group[_group[_platform]].entry[i], _x, _y, me->GetPositionZ(), me->GetOrientation());
+ }
- void KilledUnit(Unit* who) override
- {
- if (who->GetTypeId() == TYPEID_PLAYER)
- Talk(SAY_PLAYER_KILL);
- }
+ Talk(_platform);
+ DoCast(TeleportSpells[_platform]);
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
+ ++_platform;
+ }
- if (_platform < 3)
- return;
+ void KilledUnit(Unit* who) override
+ {
+ if (who->GetTypeId() == TYPEID_PLAYER)
+ Talk(SAY_PLAYER_KILL);
+ }
- events.Update(diff);
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
+ if (_platform < 3)
+ return;
- while (uint32 eventId = events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_TELEPORT:
- events.DelayEvents(10s);
- me->SetReactState(REACT_PASSIVE);
- me->AttackStop();
- me->StopMoving();
- me->SetDisableGravity(true);
- me->SetCanFly(true);
- me->SetControlled(true, UNIT_STATE_ROOT); // @hack: disabling gravity isn't enough to prevent falling
- DoCast(SPELL_TELEPORT);
- _isInCenter = true;
- events.ScheduleEvent(EVENT_CAST_EXPLOSION, 2s);
- break;
- case EVENT_CAST_EXPLOSION:
- Talk(EMOTE_ARCANE_EXPLOSION);
- Talk(SAY_ARCANE_EXPLOSION);
- DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
- events.ScheduleEvent(EVENT_TELEPORT_BACK, DUNGEON_MODE(10s, 8s));
- break;
- case EVENT_TELEPORT_BACK:
- me->SetReactState(REACT_AGGRESSIVE);
- me->SetDisableGravity(false);
- me->SetCanFly(false);
- me->SetControlled(false, UNIT_STATE_ROOT);
- if (Unit* victim = me->SelectVictim())
- {
- me->NearTeleportTo(victim->GetPosition());
- AttackStart(victim);
- }
- _isInCenter = false;
- events.ScheduleEvent(EVENT_TELEPORT, 30s, 35s);
- break;
- case EVENT_FROST_BOMB:
- DoCastVictim(SPELL_FROSTBOMB);
- events.ScheduleEvent(EVENT_FROST_BOMB, 5s, 8s);
- break;
- case EVENT_TIME_BOMB:
- if (Unit* unit = SelectTarget(SelectTargetMethod::Random))
- DoCast(unit, SPELL_TIME_BOMB);
- events.ScheduleEvent(EVENT_TIME_BOMB, 20s, 25s);
- break;
- }
- }
+ events.Update(diff);
- DoMeleeAttackIfReady();
- }
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- void JustDied(Unit* /*killer*/) override
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
{
- _JustDied();
- Talk(SAY_DEATH);
- DoCastSelf(SPELL_DEATH_SPELL, true);
+ case EVENT_TELEPORT:
+ events.DelayEvents(10s);
+ me->SetReactState(REACT_PASSIVE);
+ me->AttackStop();
+ me->StopMoving();
+ me->SetDisableGravity(true);
+ me->SetCanFly(true);
+ me->SetControlled(true, UNIT_STATE_ROOT); // @hack: disabling gravity isn't enough to prevent falling
+ DoCast(SPELL_TELEPORT);
+ _isInCenter = true;
+ events.ScheduleEvent(EVENT_CAST_EXPLOSION, 2s);
+ break;
+ case EVENT_CAST_EXPLOSION:
+ Talk(EMOTE_ARCANE_EXPLOSION);
+ Talk(SAY_ARCANE_EXPLOSION);
+ DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
+ events.ScheduleEvent(EVENT_TELEPORT_BACK, DUNGEON_MODE(10s, 8s));
+ break;
+ case EVENT_TELEPORT_BACK:
+ me->SetReactState(REACT_AGGRESSIVE);
+ me->SetDisableGravity(false);
+ me->SetCanFly(false);
+ me->SetControlled(false, UNIT_STATE_ROOT);
+ if (Unit* victim = me->SelectVictim())
+ {
+ me->NearTeleportTo(victim->GetPosition());
+ AttackStart(victim);
+ }
+ _isInCenter = false;
+ events.ScheduleEvent(EVENT_TELEPORT, 30s, 35s);
+ break;
+ case EVENT_FROST_BOMB:
+ DoCastVictim(SPELL_FROSTBOMB);
+ events.ScheduleEvent(EVENT_FROST_BOMB, 5s, 8s);
+ break;
+ case EVENT_TIME_BOMB:
+ if (Unit* unit = SelectTarget(SelectTargetMethod::Random))
+ DoCast(unit, SPELL_TIME_BOMB);
+ events.ScheduleEvent(EVENT_TIME_BOMB, 20s, 25s);
+ break;
}
+ }
- void LeaveCombat()
- {
- me->RemoveAllAuras();
- me->CombatStop(false);
- EngagementOver();
- }
+ DoMeleeAttackIfReady();
+ }
- void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
- {
- switch (spellInfo->Id)
- {
- case SPELL_SUMMON_MENAGERIE:
- me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f);
- LeaveCombat();
- DoCastSelf(SPELL_EVOCATE, true);
- break;
- case SPELL_SUMMON_MENAGERIE_2:
- me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f);
- LeaveCombat();
- DoCastSelf(SPELL_EVOCATE, true);
- break;
- case SPELL_SUMMON_MENAGERIE_3:
- me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f);
- LeaveCombat();
- DoCastSelf(SPELL_EVOCATE, true);
- break;
- default:
- break;
- }
- }
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ DoCastSelf(SPELL_DEATH_SPELL, true);
+ }
- void DamageTaken(Unit* /*attacker*/, uint32& damage) override
- {
- // If killed while in center, teleport to a valid ground position before dying
- if (damage >= me->GetHealth())
- {
- if (_isInCenter)
- {
- _isInCenter = false;
- me->NearTeleportTo(1124.0432f, 1078.2109f, 508.3597f, 5.4623f);
- }
- }
- }
+ void LeaveCombat()
+ {
+ me->RemoveAllAuras();
+ me->CombatStop(false);
+ EngagementOver();
+ }
- private:
- float _x, _y;
- bool _isInCenter;
- uint8 _platform;
- std::vector<uint8> _group;
- };
+ void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
+ {
+ switch (spellInfo->Id)
+ {
+ case SPELL_SUMMON_MENAGERIE:
+ me->SetHomePosition(968.66f, 1042.53f, 527.32f, 0.077f);
+ LeaveCombat();
+ DoCastSelf(SPELL_EVOCATE, true);
+ break;
+ case SPELL_SUMMON_MENAGERIE_2:
+ me->SetHomePosition(1164.02f, 1170.85f, 527.321f, 3.66f);
+ LeaveCombat();
+ DoCastSelf(SPELL_EVOCATE, true);
+ break;
+ case SPELL_SUMMON_MENAGERIE_3:
+ me->SetHomePosition(1118.31f, 1080.377f, 508.361f, 4.25f);
+ LeaveCombat();
+ DoCastSelf(SPELL_EVOCATE, true);
+ break;
+ default:
+ break;
+ }
+ }
- CreatureAI* GetAI(Creature* creature) const override
+ void DamageTaken(Unit* /*attacker*/, uint32& damage) override
+ {
+ // If killed while in center, teleport to a valid ground position before dying
+ if (damage >= me->GetHealth())
{
- return GetOculusAI<boss_uromAI>(creature);
+ if (_isInCenter)
+ {
+ _isInCenter = false;
+ me->NearTeleportTo(1124.0432f, 1078.2109f, 508.3597f, 5.4623f);
+ }
}
+ }
+
+private:
+ float _x, _y;
+ bool _isInCenter;
+ uint8 _platform;
+ std::vector<uint8> _group;
};
class spell_urom_frostbomb : public AuraScript
@@ -370,6 +359,6 @@ class spell_urom_frostbomb : public AuraScript
void AddSC_boss_urom()
{
- new boss_urom();
+ RegisterOculusCreatureAI(boss_urom);
RegisterSpellScript(spell_urom_frostbomb);
}