Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(Scripts/ZulGurub): Modernize Gahzranka script #20603

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 19 additions & 83 deletions src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
#include "SpellScript.h"
#include "SpellScriptLoader.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
{
Expand All @@ -36,89 +30,39 @@ enum Spells
SPELL_SPLASH = 24593
};

enum Events
{
EVENT_FROSTBREATH = 1,
EVENT_MASSIVEGEYSER = 2,
EVENT_SLAM = 3
};

enum Misc
{
GAMEOBJECT_MUDSKUNK_LURE = 180346
};

class boss_gahzranka : public CreatureScript
struct boss_gahzranka : public BossAI
{
public:
boss_gahzranka() : CreatureScript("boss_gahzranka") { }
boss_gahzranka(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) {}

struct boss_gahzrankaAI : public BossAI
void IsSummonedBy(WorldObject* /*summoner*/) override
{
boss_gahzrankaAI(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) { }

void IsSummonedBy(WorldObject* /*summoner*/) override
{
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
}
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
}

void Reset() override
{
_Reset();
}
void JustEngagedWith(Unit* /*who*/) override
{
_JustEngagedWith();
me->AddAura(SPELL_THRASH, me);

void JustDied(Unit* /*killer*/) override
ScheduleTimedEvent(8s, [&]
{
_JustDied();
}
DoCastVictim(SPELL_FROSTBREATH);
}, 8s, 20s);

void JustEngagedWith(Unit* /*who*/) override
ScheduleTimedEvent(25s, [&]
{
_JustEngagedWith();
me->AddAura(SPELL_THRASH, me);
events.ScheduleEvent(EVENT_FROSTBREATH, 8s);
events.ScheduleEvent(EVENT_MASSIVEGEYSER, 25s);
events.ScheduleEvent(EVENT_SLAM, 15s);
}
DoCastVictim(SPELL_MASSIVEGEYSER);
}, 22s, 32s);

void UpdateAI(uint32 diff) override
ScheduleTimedEvent(15s, [&]
{
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);
DoCastVictim(SPELL_SLAM, true);
}, 12s, 20s);
}
};

Expand All @@ -129,23 +73,15 @@ class spell_gahzranka_slam : public SpellScript
void FilterTargets(std::list<WorldObject*>& targets)
{
if (Unit* caster = GetCaster())
{
_wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();
}
}

void HandleWipeThreat(SpellEffIndex /*effIndex*/)
{
if (_wipeThreat)
{
if (Unit* caster = GetCaster())
{
if (Unit* target = GetHitUnit())
{
caster->GetThreatMgr().ModifyThreatByPercent(target, -100);
}
}
}
}

void Register() override
Expand Down Expand Up @@ -198,7 +134,7 @@ class spell_pagles_point_cast : public SpellScript

void AddSC_boss_gahzranka()
{
new boss_gahzranka();
RegisterZulGurubCreatureAI(boss_gahzranka);
RegisterSpellScript(spell_gahzranka_slam);
RegisterSpellScript(spell_pagles_point_cast);
}