fix(Scripts/ZulGurub): Improvements to Hazzarah encounter (#11964)

Corrected timers of events.
Added missing/Removed invalid spells.
Fixes #11612
This commit is contained in:
UltraNix
2022-06-14 02:03:56 +02:00
committed by GitHub
parent 450b8f9157
commit 21705d76ad
2 changed files with 81 additions and 31 deletions
@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `spell_id`=24684;
INSERT INTO `spell_script_names` VALUES
(24684,'spell_chain_burn');
@@ -24,19 +24,25 @@ EndScriptData */
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "SpellScript.h"
#include "zulgurub.h" #include "zulgurub.h"
enum Spells enum Spells
{ {
SPELL_MANABURN = 26046, SPELL_SLEEP = 24664,
SPELL_SLEEP = 24664 SPELL_EARTH_SHOCK = 24685,
SPELL_CHAIN_BURN = 24684,
SPELL_SUMMON_NIGHTMARE_ILLUSION_LEFT = 24681,
SPELL_SUMMON_NIGHTMARE_ILLUSION_BACK = 24728,
SPELL_SUMMON_NIGHTMARE_ILLUSION_RIGHT = 24729
}; };
enum Events enum Events
{ {
EVENT_MANABURN = 1, EVENT_SLEEP = 1,
EVENT_SLEEP = 2, EVENT_EARTH_SHOCK = 2,
EVENT_ILLUSIONS = 3 EVENT_CHAIN_BURN = 3,
EVENT_ILLUSIONS = 4
}; };
class boss_hazzarah : public CreatureScript class boss_hazzarah : public CreatureScript
@@ -48,22 +54,42 @@ public:
{ {
boss_hazzarahAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) { } boss_hazzarahAI(Creature* creature) : BossAI(creature, DATA_EDGE_OF_MADNESS) { }
void Reset() override void JustSummoned(Creature* summon) override
{ {
_Reset(); summons.Summon(summon);
}
void JustDied(Unit* /*killer*/) override summon->SetCorpseDelay(10);
{ summon->SetReactState(REACT_PASSIVE);
_JustDied(); summon->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);
summon->SetVisible(false);
summon->m_Events.AddEventAtOffset([summon]()
{
summon->SetVisible(true);
}, 2s);
summon->m_Events.AddEventAtOffset([summon]()
{
summon->RemoveUnitFlag(UNIT_FLAG_DISABLE_MOVE);
summon->SetReactState(REACT_AGGRESSIVE);
summon->SetInCombatWithZone();
}, 3500ms);
} }
void EnterCombat(Unit* /*who*/) override void EnterCombat(Unit* /*who*/) override
{ {
_EnterCombat(); _EnterCombat();
events.ScheduleEvent(EVENT_MANABURN, urand(4000, 10000)); events.ScheduleEvent(EVENT_SLEEP, 12s, 15s);
events.ScheduleEvent(EVENT_SLEEP, urand(10000, 18000)); events.ScheduleEvent(EVENT_EARTH_SHOCK, 8s, 18s);
events.ScheduleEvent(EVENT_ILLUSIONS, urand(10000, 18000)); events.ScheduleEvent(EVENT_CHAIN_BURN, 12s, 28s);
events.ScheduleEvent(EVENT_ILLUSIONS, 16s, 24s);
}
bool CanAIAttack(Unit const* target) const override
{
if (me->GetThreatMgr().getThreatList().size() > 1 && me->GetThreatMgr().getOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_SLEEP);
return true;
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -80,27 +106,26 @@ public:
{ {
switch (eventId) switch (eventId)
{ {
case EVENT_MANABURN:
DoCastVictim(SPELL_MANABURN, true);
events.ScheduleEvent(EVENT_MANABURN, urand(8000, 16000));
break;
case EVENT_SLEEP: case EVENT_SLEEP:
DoCastVictim(SPELL_SLEEP, true); DoCastVictim(SPELL_SLEEP, true);
events.ScheduleEvent(EVENT_SLEEP, urand(12000, 20000)); events.ScheduleEvent(EVENT_SLEEP, 24s, 32s);
return;
case EVENT_EARTH_SHOCK:
DoCastVictim(SPELL_EARTH_SHOCK);
events.ScheduleEvent(EVENT_EARTH_SHOCK, 8s, 18s);
break;
case EVENT_CHAIN_BURN:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) { return u && !u->IsPet() && u->getPowerType() == POWER_MANA; }))
{
DoCast(target, SPELL_CHAIN_BURN, false);
}
events.ScheduleEvent(EVENT_CHAIN_BURN, 12s, 28s);
break; break;
case EVENT_ILLUSIONS: case EVENT_ILLUSIONS:
// We will summon 3 illusions that will spawn on a random gamer and attack this gamer DoCastSelf(SPELL_SUMMON_NIGHTMARE_ILLUSION_LEFT, true);
// We will just use one model for the beginning DoCastSelf(SPELL_SUMMON_NIGHTMARE_ILLUSION_BACK, true);
for (uint8 i = 0; i < 3; ++i) DoCastSelf(SPELL_SUMMON_NIGHTMARE_ILLUSION_RIGHT, true);
{ events.ScheduleEvent(EVENT_ILLUSIONS, 16s, 24s);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
Creature* Illusion = me->SummonCreature(NPC_NIGHTMARE_ILLUSION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);
if (Illusion)
Illusion->AI()->AttackStart(target);
}
}
events.ScheduleEvent(EVENT_ILLUSIONS, urand(15000, 25000));
break; break;
default: default:
break; break;
@@ -117,7 +142,28 @@ public:
} }
}; };
class spell_chain_burn : public SpellScript
{
PrepareSpellScript(spell_chain_burn);
void FilterTargets(std::list<WorldObject*>& targets)
{
Unit* caster = GetCaster();
targets.remove_if([caster](WorldObject* target) -> bool
{
Unit* unit = target->ToUnit();
return !unit || unit->getPowerType() != POWER_MANA || caster->GetVictim() == unit;
});
}
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_chain_burn::FilterTargets, EFFECT_0, TARGET_UNIT_TARGET_ENEMY);
}
};
void AddSC_boss_hazzarah() void AddSC_boss_hazzarah()
{ {
new boss_hazzarah(); new boss_hazzarah();
RegisterSpellScript(spell_chain_burn);
} }