refactor(Scripts/ZulGurub): Modernize Gahzranka script (#20603)
This commit is contained in:
@@ -20,12 +20,6 @@
|
|||||||
#include "SpellScript.h"
|
#include "SpellScript.h"
|
||||||
#include "SpellScriptLoader.h"
|
#include "SpellScriptLoader.h"
|
||||||
#include "zulgurub.h"
|
#include "zulgurub.h"
|
||||||
/* ScriptData
|
|
||||||
SDName: Boss_Gahz'ranka
|
|
||||||
SD%Complete: 85
|
|
||||||
SDComment: Massive Geyser with knockback not working. Spell buggy.
|
|
||||||
SDCategory: Zul'Gurub
|
|
||||||
EndScriptData */
|
|
||||||
|
|
||||||
enum Spells
|
enum Spells
|
||||||
{
|
{
|
||||||
@@ -36,89 +30,39 @@ enum Spells
|
|||||||
SPELL_SPLASH = 24593
|
SPELL_SPLASH = 24593
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Events
|
|
||||||
{
|
|
||||||
EVENT_FROSTBREATH = 1,
|
|
||||||
EVENT_MASSIVEGEYSER = 2,
|
|
||||||
EVENT_SLAM = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Misc
|
enum Misc
|
||||||
{
|
{
|
||||||
GAMEOBJECT_MUDSKUNK_LURE = 180346
|
GAMEOBJECT_MUDSKUNK_LURE = 180346
|
||||||
};
|
};
|
||||||
|
|
||||||
class boss_gahzranka : public CreatureScript
|
struct boss_gahzranka : public BossAI
|
||||||
{
|
{
|
||||||
public:
|
boss_gahzranka(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) {}
|
||||||
boss_gahzranka() : CreatureScript("boss_gahzranka") { }
|
|
||||||
|
|
||||||
struct boss_gahzrankaAI : public BossAI
|
void IsSummonedBy(WorldObject* /*summoner*/) override
|
||||||
{
|
{
|
||||||
boss_gahzrankaAI(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) { }
|
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
|
||||||
|
}
|
||||||
|
|
||||||
void IsSummonedBy(WorldObject* /*summoner*/) override
|
void JustEngagedWith(Unit* /*who*/) override
|
||||||
{
|
|
||||||
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset() override
|
|
||||||
{
|
|
||||||
_Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/) override
|
|
||||||
{
|
|
||||||
_JustDied();
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustEngagedWith(Unit* /*who*/) override
|
|
||||||
{
|
|
||||||
_JustEngagedWith();
|
|
||||||
me->AddAura(SPELL_THRASH, me);
|
|
||||||
events.ScheduleEvent(EVENT_FROSTBREATH, 8s);
|
|
||||||
events.ScheduleEvent(EVENT_MASSIVEGEYSER, 25s);
|
|
||||||
events.ScheduleEvent(EVENT_SLAM, 15s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (!UpdateVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
events.Update(diff);
|
|
||||||
|
|
||||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
|
||||||
return;
|
|
||||||
|
|
||||||
while (uint32 eventId = events.ExecuteEvent())
|
|
||||||
{
|
|
||||||
switch (eventId)
|
|
||||||
{
|
|
||||||
case EVENT_FROSTBREATH:
|
|
||||||
DoCastVictim(SPELL_FROSTBREATH);
|
|
||||||
events.ScheduleEvent(EVENT_FROSTBREATH, 8s, 20s);
|
|
||||||
break;
|
|
||||||
case EVENT_MASSIVEGEYSER:
|
|
||||||
DoCastVictim(SPELL_MASSIVEGEYSER);
|
|
||||||
events.ScheduleEvent(EVENT_MASSIVEGEYSER, 22s, 32s);
|
|
||||||
break;
|
|
||||||
case EVENT_SLAM:
|
|
||||||
DoCastVictim(SPELL_SLAM, true);
|
|
||||||
events.ScheduleEvent(EVENT_SLAM, 12s, 20s);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* creature) const override
|
|
||||||
{
|
{
|
||||||
return GetZulGurubAI<boss_gahzrankaAI>(creature);
|
_JustEngagedWith();
|
||||||
|
me->AddAura(SPELL_THRASH, me);
|
||||||
|
|
||||||
|
ScheduleTimedEvent(8s, [&]
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_FROSTBREATH);
|
||||||
|
}, 8s, 20s);
|
||||||
|
|
||||||
|
ScheduleTimedEvent(25s, [&]
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_MASSIVEGEYSER);
|
||||||
|
}, 22s, 32s);
|
||||||
|
|
||||||
|
ScheduleTimedEvent(15s, [&]
|
||||||
|
{
|
||||||
|
DoCastVictim(SPELL_SLAM, true);
|
||||||
|
}, 12s, 20s);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,23 +73,15 @@ class spell_gahzranka_slam : public SpellScript
|
|||||||
void FilterTargets(std::list<WorldObject*>& targets)
|
void FilterTargets(std::list<WorldObject*>& targets)
|
||||||
{
|
{
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* caster = GetCaster())
|
||||||
{
|
|
||||||
_wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();
|
_wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleWipeThreat(SpellEffIndex /*effIndex*/)
|
void HandleWipeThreat(SpellEffIndex /*effIndex*/)
|
||||||
{
|
{
|
||||||
if (_wipeThreat)
|
if (_wipeThreat)
|
||||||
{
|
|
||||||
if (Unit* caster = GetCaster())
|
if (Unit* caster = GetCaster())
|
||||||
{
|
|
||||||
if (Unit* target = GetHitUnit())
|
if (Unit* target = GetHitUnit())
|
||||||
{
|
|
||||||
caster->GetThreatMgr().ModifyThreatByPercent(target, -100);
|
caster->GetThreatMgr().ModifyThreatByPercent(target, -100);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
@@ -198,7 +134,7 @@ class spell_pagles_point_cast : public SpellScript
|
|||||||
|
|
||||||
void AddSC_boss_gahzranka()
|
void AddSC_boss_gahzranka()
|
||||||
{
|
{
|
||||||
new boss_gahzranka();
|
RegisterZulGurubCreatureAI(boss_gahzranka);
|
||||||
RegisterSpellScript(spell_gahzranka_slam);
|
RegisterSpellScript(spell_gahzranka_slam);
|
||||||
RegisterSpellScript(spell_pagles_point_cast);
|
RegisterSpellScript(spell_pagles_point_cast);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user