fix(scripts/Ulduar): Kologarn - Focused Eyebeam (#3529)

This commit is contained in:
WiZZy
2020-12-25 20:10:19 +02:00
committed by GitHub
parent af22f1e9c3
commit aec0dbb747

View File

@@ -40,10 +40,11 @@ enum KologarnSpells
SPELL_STONE_SHOUT_25 = 64005, SPELL_STONE_SHOUT_25 = 64005,
// EYEBEAM // EYEBEAM
SPELL_FOCUSED_EYEBEAM_SUMMON = 63342,
SPELL_FOCUSED_EYEBEAM_10 = 63347, SPELL_FOCUSED_EYEBEAM_10 = 63347,
SPELL_FOCUSED_EYEBEAM_25 = 63977, SPELL_FOCUSED_EYEBEAM_25 = 63977,
SPELL_FOCUSED_EYEBEAM_RIGHT = 63676, // NPC -> KOLOGARN SPELL_FOCUSED_EYEBEAM_RIGHT = 63702,
SPELL_FOCUSED_EYEBEAM_LEFT = 63352, // KOLOGARN -> NPC SPELL_FOCUSED_EYEBEAM_LEFT = 63676,
// ARMS // ARMS
SPELL_ARM_DEAD_10 = 63629, SPELL_ARM_DEAD_10 = 63629,
@@ -140,6 +141,7 @@ public:
_left(0), _right(0), summons(me), breathReady(false) _left(0), _right(0), summons(me), breathReady(false)
{ {
m_pInstance = me->GetInstanceScript(); m_pInstance = me->GetInstanceScript();
eyebeamTarget = nullptr;
assert(vehicle); assert(vehicle);
me->SetStandState(UNIT_STAND_STATE_SUBMERGED); me->SetStandState(UNIT_STAND_STATE_SUBMERGED);
} }
@@ -151,6 +153,8 @@ public:
EventMap events; EventMap events;
SummonList summons; SummonList summons;
Unit* eyebeamTarget;
bool _looksAchievement, breathReady; bool _looksAchievement, breathReady;
uint8 _rubbleAchievement; uint8 _rubbleAchievement;
@@ -359,7 +363,7 @@ public:
events.ScheduleEvent(EVENT_SMASH, 8000); events.ScheduleEvent(EVENT_SMASH, 8000);
events.ScheduleEvent(EVENT_SWEEP, 17000); events.ScheduleEvent(EVENT_SWEEP, 17000);
events.ScheduleEvent(EVENT_GRIP, 15000); events.ScheduleEvent(EVENT_GRIP, 15000);
events.ScheduleEvent(EVENT_FOCUSED_EYEBEAM, 25000); events.ScheduleEvent(EVENT_FOCUSED_EYEBEAM, 10000);
events.ScheduleEvent(EVENT_PREPARE_BREATH, 3000); events.ScheduleEvent(EVENT_PREPARE_BREATH, 3000);
//events.ScheduleEvent(EVENT_ENRAGE, x); no info //events.ScheduleEvent(EVENT_ENRAGE, x); no info
@@ -429,37 +433,17 @@ public:
Talk(EMOTE_STONE_GRIP); Talk(EMOTE_STONE_GRIP);
return; return;
case EVENT_FOCUSED_EYEBEAM: case EVENT_FOCUSED_EYEBEAM:
{
events.ScheduleEvent(EVENT_FOCUSED_EYEBEAM, 20000);
if ((eyebeamTarget = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true)))
{ {
events.ScheduleEvent(EVENT_FOCUSED_EYEBEAM, 13000 + rand() % 5000); me->CastSpell(eyebeamTarget, SPELL_FOCUSED_EYEBEAM_SUMMON, false);
Unit* target = nullptr;
Map::PlayerList const& pList = me->GetMap()->GetPlayers();
for(auto itr = pList.begin(); itr != pList.end(); ++itr)
{
if (itr->GetSource()->GetPositionZ() < 420)
continue;
target = itr->GetSource();
if (urand(0, 3) == 3)
break;
}
if (!target)
break;
if (Creature* eye = me->SummonCreature(NPC_EYE_LEFT, target->GetPositionX(), target->GetPositionY() - 6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000))
{
eye->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI * 3 / 2, MOTION_SLOT_CONTROLLED);
me->CastSpell(eye, SPELL_FOCUSED_EYEBEAM_LEFT, true);
}
if (Creature* eye2 = me->SummonCreature(NPC_EYE_RIGHT, target->GetPositionX(), target->GetPositionY() + 6, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 12000))
{
eye2->GetMotionMaster()->MoveFollow(target, 0.01f, M_PI / 2, MOTION_SLOT_CONTROLLED);
eye2->CastSpell(me, SPELL_FOCUSED_EYEBEAM_RIGHT, true);
}
Talk(EMOTE_EYES);
events.DelayEvents(12000, 0);
return;
} }
Talk(EMOTE_EYES);
return;
}
case EVENT_RESTORE_ARM_LEFT: case EVENT_RESTORE_ARM_LEFT:
// shouldn't happen // shouldn't happen
AttachLeftArm(); AttachLeftArm();
@@ -605,13 +589,16 @@ public:
{ {
return new boss_kologarn_eyebeamAI (pCreature); return new boss_kologarn_eyebeamAI (pCreature);
} }
struct boss_kologarn_eyebeamAI : public ScriptedAI
struct boss_kologarn_eyebeamAI : public NullCreatureAI
{ {
boss_kologarn_eyebeamAI(Creature* c) : NullCreatureAI(c), _timer(1), _damaged(false) {} boss_kologarn_eyebeamAI(Creature* c) : ScriptedAI(c), _timer(1), _damaged(false), justSpawned(true)
{
m_pInstance = (InstanceScript*)c->GetInstanceScript();
}
InstanceScript* m_pInstance;
uint32 _timer; uint32 _timer;
bool _damaged; bool _damaged, justSpawned;
void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) override void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) override
{ {
@@ -625,6 +612,16 @@ public:
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if (justSpawned)
{
me->DespawnOrUnsummon(10000);
if (Creature* cr = ObjectAccessor::GetCreature(*me, m_pInstance->GetData64(TYPE_KOLOGARN)))
{
me->CastSpell(cr, me->GetEntry() == NPC_EYE_LEFT ? SPELL_FOCUSED_EYEBEAM_LEFT : SPELL_FOCUSED_EYEBEAM_RIGHT, true);
}
me->CastSpell(me, SPELL_FOCUSED_EYEBEAM, true);
justSpawned = false;
}
if (_timer) if (_timer)
{ {
_timer += diff; _timer += diff;