fix(scripts/RuinsOfAhnQiraj): Improve Buru (#12141)

This commit is contained in:
Eddy Vega
2022-07-24 14:34:29 -06:00
committed by GitHub
parent 15fb4d3522
commit 8809ec5501
3 changed files with 78 additions and 19 deletions

View File

@@ -0,0 +1,18 @@
-- Immune to Taunt
UPDATE `creature_template` SET `flags_extra`=`flags_extra`|256 WHERE `entry`=15370;
-- Disable exp on Buru egg / Hive'zara hatchling
UPDATE `creature_template` SET `flags_extra`=`flags_extra`|64 WHERE `entry` IN (15514,15521);
-- New smartAI - despawn
UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=15521;
DELETE FROM `smart_scripts` WHERE `entryorguid`= 15521 AND `source_type`= 0 AND `id`= 0;
INSERT INTO `smart_scripts` (`entryorguid`, `event_type`, `event_flags`, `event_param1`, `event_param2`, `action_type`, `action_param1`, `target_type`, `comment`) VALUES
(15521, 1, 1, 10000, 10000, 41, 500, 1, 'Hive\'Zara Hatchling - Out of Combat - Despawn (No Repeat)');
-- Root egg properly - avoid reset
DELETE FROM `creature_template_movement` WHERE `CreatureId`=15514;
INSERT INTO `creature_template_movement` (`CreatureId`, `Ground`, `Swim`, `Flight`, `Rooted`, `Chase`, `Random`) VALUES
(15514, 1, 1, 0, 1, 0, 0);

View File

@@ -35,7 +35,7 @@ enum Spells
SPELL_BURU_TRANSFORM = 24721, SPELL_BURU_TRANSFORM = 24721,
SPELL_SUMMON_HATCHLING = 1881, SPELL_SUMMON_HATCHLING = 1881,
SPELL_EXPLODE = 19593, SPELL_EXPLODE = 19593,
SPELL_EXPLODE_2 = 5255, SPELL_EXPLODE_2 = 5255, // Server-side script
SPELL_BURU_EGG_TRIGGER = 26646 SPELL_BURU_EGG_TRIGGER = 26646
}; };
@@ -66,18 +66,19 @@ public:
struct boss_buruAI : public BossAI struct boss_buruAI : public BossAI
{ {
boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU) boss_buruAI(Creature* creature) : BossAI(creature, DATA_BURU) {}
{
}
void EnterEvadeMode(EvadeReason why) override void EnterEvadeMode(EvadeReason why) override
{ {
BossAI::EnterEvadeMode(why); BossAI::EnterEvadeMode(why);
for (ObjectGuid const& guid : Eggs) for (ObjectGuid const& guid : Eggs)
{
if (Creature* egg = me->GetMap()->GetCreature(guid)) if (Creature* egg = me->GetMap()->GetCreature(guid))
{
egg->Respawn(); egg->Respawn();
}
}
Eggs.clear(); Eggs.clear();
} }
@@ -86,25 +87,37 @@ public:
_EnterCombat(); _EnterCombat();
Talk(EMOTE_TARGET, who); Talk(EMOTE_TARGET, who);
DoCast(me, SPELL_THORNS); DoCast(me, SPELL_THORNS);
events.ScheduleEvent(EVENT_DISMEMBER, 5000); events.ScheduleEvent(EVENT_DISMEMBER, 5000);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
events.ScheduleEvent(EVENT_FULL_SPEED, 60000); events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
_phase = PHASE_EGG; _phase = PHASE_EGG;
} }
void JustDied(Unit* /*killer*/) override
{
if (InstanceScript* pInstance = me->GetInstanceScript())
{
pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_CREEPING_PLAGUE);
}
}
void DoAction(int32 action) override void DoAction(int32 action) override
{ {
if (action == ACTION_EXPLODE) if (action == ACTION_EXPLODE)
{
if (_phase == PHASE_EGG) if (_phase == PHASE_EGG)
{
Unit::DealDamage(me, me, 45000); Unit::DealDamage(me, me, 45000);
}
}
} }
void KilledUnit(Unit* victim) override void KilledUnit(Unit* victim) override
{ {
if (victim->GetTypeId() == TYPEID_PLAYER) if (victim->GetTypeId() == TYPEID_PLAYER)
{
ChaseNewVictim(); ChaseNewVictim();
}
} }
void ChaseNewVictim() void ChaseNewVictim()
@@ -116,7 +129,6 @@ public:
me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); me->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
events.ScheduleEvent(EVENT_FULL_SPEED, 60000); events.ScheduleEvent(EVENT_FULL_SPEED, 60000);
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true)) if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
{ {
DoResetThreat(); DoResetThreat();
@@ -148,15 +160,15 @@ public:
events.ScheduleEvent(EVENT_DISMEMBER, 5000); events.ScheduleEvent(EVENT_DISMEMBER, 5000);
break; break;
case EVENT_GATHERING_SPEED: case EVENT_GATHERING_SPEED:
DoCast(me, SPELL_GATHERING_SPEED); DoCastSelf(SPELL_GATHERING_SPEED);
events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000); events.ScheduleEvent(EVENT_GATHERING_SPEED, 9000);
break; break;
case EVENT_FULL_SPEED: case EVENT_FULL_SPEED:
DoCast(me, SPELL_FULL_SPEED); DoCastSelf(SPELL_FULL_SPEED);
break; break;
case EVENT_CREEPING_PLAGUE: case EVENT_CREEPING_PLAGUE:
DoCast(me, SPELL_CREEPING_PLAGUE); DoCastAOE(SPELL_CREEPING_PLAGUE);
events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 6000); events.ScheduleEvent(EVENT_CREEPING_PLAGUE, urand(6250, 6500));
break; break;
case EVENT_RESPAWN_EGG: case EVENT_RESPAWN_EGG:
if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin())) if (Creature* egg = me->GetMap()->GetCreature(*Eggs.begin()))
@@ -172,12 +184,19 @@ public:
if (me->GetHealthPct() < 20.0f && _phase == PHASE_EGG) if (me->GetHealthPct() < 20.0f && _phase == PHASE_EGG)
{ {
DoCast(me, SPELL_BURU_TRANSFORM); // Enrage DoCastSelf(SPELL_BURU_TRANSFORM);
DoCast(me, SPELL_FULL_SPEED, true); DoCastSelf(SPELL_FULL_SPEED, true);
me->RemoveAurasDueToSpell(SPELL_THORNS); me->RemoveAurasDueToSpell(SPELL_THORNS);
events.CancelEvent(EVENT_DISMEMBER);
events.ScheduleEvent(EVENT_CREEPING_PLAGUE, 2000);
_phase = PHASE_TRANSFORM; _phase = PHASE_TRANSFORM;
std::list<Creature*> RemainingEgg;
me->GetCreaturesWithEntryInRange(RemainingEgg, 100.0f, NPC_BURU_EGG);
for (std::list<Creature*>::const_iterator itr = RemainingEgg.begin(); itr != RemainingEgg.end(); ++itr)
{
Unit::Kill(me, *itr);
}
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
@@ -207,27 +226,44 @@ public:
void EnterCombat(Unit* attacker) override void EnterCombat(Unit* attacker) override
{ {
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
{
if (!buru->IsInCombat()) if (!buru->IsInCombat())
{
buru->AI()->AttackStart(attacker); buru->AI()->AttackStart(attacker);
}
}
} }
void JustSummoned(Creature* who) override void JustSummoned(Creature* who) override
{ {
if (who->GetEntry() == NPC_HATCHLING) if (who->GetEntry() == NPC_HATCHLING)
{
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
{
if (Unit* target = buru->AI()->SelectTarget(SelectTargetMethod::Random)) if (Unit* target = buru->AI()->SelectTarget(SelectTargetMethod::Random))
{
who->AI()->AttackStart(target); who->AI()->AttackStart(target);
}
}
}
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
{ {
DoCastAOE(SPELL_EXPLODE, true);
DoCastAOE(SPELL_EXPLODE_2, true); // Unknown purpose
DoCast(me, SPELL_SUMMON_HATCHLING, true);
if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU))) if (Creature* buru = me->GetMap()->GetCreature(_instance->GetGuidData(DATA_BURU)))
{
if (!buru->HasAura(SPELL_BURU_TRANSFORM))
{
DoCast(me, SPELL_EXPLODE, true);
DoCast(me, SPELL_EXPLODE_2, true);
DoCast(me, SPELL_BURU_EGG_TRIGGER, true);
}
if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI())) if (boss_buru::boss_buruAI* buruAI = dynamic_cast<boss_buru::boss_buruAI*>(buru->AI()))
{
buruAI->ManageRespawn(me->GetGUID()); buruAI->ManageRespawn(me->GetGUID());
}
}
DoCast(me, SPELL_SUMMON_HATCHLING, true);
} }
private: private:
InstanceScript* _instance; InstanceScript* _instance;
@@ -251,13 +287,17 @@ public:
void HandleAfterCast() void HandleAfterCast()
{ {
if (Creature* buru = GetCaster()->FindNearestCreature(NPC_BURU, 5.f)) if (Creature* buru = GetCaster()->FindNearestCreature(NPC_BURU, 5.f))
{
buru->AI()->DoAction(ACTION_EXPLODE); buru->AI()->DoAction(ACTION_EXPLODE);
}
} }
void HandleDummyHitTarget(SpellEffIndex /*effIndex*/) void HandleDummyHitTarget(SpellEffIndex /*effIndex*/)
{ {
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{
Unit::DealDamage(GetCaster(), target, -16 * GetCaster()->GetDistance(target) + 500); Unit::DealDamage(GetCaster(), target, -16 * GetCaster()->GetDistance(target) + 500);
}
} }
void Register() override void Register() override

View File

@@ -49,6 +49,7 @@ enum Creatures
NPC_SAND_VORTEX = 15428, NPC_SAND_VORTEX = 15428,
NPC_OSSIRIAN_TRIGGER = 15590, NPC_OSSIRIAN_TRIGGER = 15590,
NPC_HATCHLING = 15521, NPC_HATCHLING = 15521,
NPC_BURU_EGG = 15514,
NPC_LARVA = 15555, NPC_LARVA = 15555,
NPC_SWARMER = 15546, NPC_SWARMER = 15546,
NPC_HORNET = 15934 NPC_HORNET = 15934