refactor(Scripts/ZulAman): Move Hexlord adds to SAI (#20185)

This commit is contained in:
Andrew
2024-10-13 07:47:05 -03:00
committed by GitHub
parent 84c35c8214
commit 96082065f6
2 changed files with 55 additions and 368 deletions

View File

@@ -509,63 +509,6 @@ public:
}
};
class boss_thurg : public CreatureScript
{
public:
boss_thurg()
: CreatureScript("boss_thurg")
{
}
struct boss_thurgAI : public boss_hexlord_addAI
{
boss_thurgAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 bloodlust_timer;
uint32 cleave_timer;
void Reset() override
{
bloodlust_timer = 15000;
cleave_timer = 10000;
boss_hexlord_addAI::Reset();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (bloodlust_timer <= diff)
{
std::list<Creature*> templist = DoFindFriendlyMissingBuff(50, SPELL_BLOODLUST);
if (!templist.empty())
{
if (Unit* target = *(templist.begin()))
DoCast(target, SPELL_BLOODLUST, false);
}
bloodlust_timer = 12000;
}
else bloodlust_timer -= diff;
if (cleave_timer <= diff)
{
DoCastVictim(SPELL_CLEAVE, false);
cleave_timer = 12000; //3 sec cast
}
else cleave_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_thurgAI>(creature);
}
};
class boss_alyson_antille : public CreatureScript
{
public:
@@ -668,331 +611,30 @@ public:
}
};
struct boss_gazakrothAI : public boss_hexlord_addAI
class spell_hexlord_unstable_affliction : public AuraScript
{
boss_gazakrothAI(Creature* creature) : boss_hexlord_addAI(creature) { }
PrepareAuraScript(spell_hexlord_unstable_affliction);
uint32 firebolt_timer;
void Reset() override
bool Validate(SpellInfo const* /*spell*/) override
{
firebolt_timer = 2000;
boss_hexlord_addAI::Reset();
return ValidateSpellInfo({ SPELL_WL_UNSTABLE_AFFL_DISPEL });
}
void AttackStart(Unit* who) override
void HandleDispel(DispelInfo* dispelInfo)
{
if (!who)
return;
if (who->isTargetableForAttack())
{
if (me->Attack(who, false))
{
me->GetMotionMaster()->MoveChase(who, 20);
me->AddThreat(who, 0.0f);
}
}
if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void UpdateAI(uint32 diff) override
void Register() override
{
if (!UpdateVictim())
return;
if (firebolt_timer <= diff)
{
DoCastVictim(SPELL_FIREBOLT, false);
firebolt_timer = 700;
}
else firebolt_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
class boss_lord_raadan : public CreatureScript
{
public:
boss_lord_raadan()
: CreatureScript("boss_lord_raadan")
{
}
struct boss_lord_raadanAI : public boss_hexlord_addAI
{
boss_lord_raadanAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 flamebreath_timer;
uint32 thunderclap_timer;
void Reset() override
{
flamebreath_timer = 8000;
thunderclap_timer = 13000;
boss_hexlord_addAI::Reset();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (thunderclap_timer <= diff)
{
DoCastVictim(SPELL_THUNDERCLAP, false);
thunderclap_timer = 12000;
}
else thunderclap_timer -= diff;
if (flamebreath_timer <= diff)
{
DoCastVictim(SPELL_FLAME_BREATH, false);
flamebreath_timer = 12000;
}
else flamebreath_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_lord_raadanAI>(creature);
}
};
class boss_darkheart : public CreatureScript
{
public:
boss_darkheart()
: CreatureScript("boss_darkheart")
{
}
struct boss_darkheartAI : public boss_hexlord_addAI
{
boss_darkheartAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 psychicwail_timer;
void Reset() override
{
psychicwail_timer = 8000;
boss_hexlord_addAI::Reset();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (psychicwail_timer <= diff)
{
DoCastVictim(SPELL_PSYCHIC_WAIL, false);
psychicwail_timer = 12000;
}
else psychicwail_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_darkheartAI>(creature);
}
};
class boss_slither : public CreatureScript
{
public:
boss_slither()
: CreatureScript("boss_slither")
{
}
struct boss_slitherAI : public boss_hexlord_addAI
{
boss_slitherAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 venomspit_timer;
void Reset() override
{
venomspit_timer = 5000;
boss_hexlord_addAI::Reset();
}
void AttackStart(Unit* who) override
{
if (!who)
return;
if (who->isTargetableForAttack())
{
if (me->Attack(who, false))
{
me->GetMotionMaster()->MoveChase(who, 20);
me->AddThreat(who, 0.0f);
}
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (venomspit_timer <= diff)
{
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(victim, SPELL_VENOM_SPIT, false);
venomspit_timer = 2500;
}
else venomspit_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_slitherAI>(creature);
}
};
class boss_fenstalker : public CreatureScript
{
public:
boss_fenstalker()
: CreatureScript("boss_fenstalker")
{
}
struct boss_fenstalkerAI : public boss_hexlord_addAI
{
boss_fenstalkerAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 volatileinf_timer;
void Reset() override
{
volatileinf_timer = 15000;
boss_hexlord_addAI::Reset();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (volatileinf_timer <= diff)
{
// core bug
me->GetVictim()->CastSpell(me->GetVictim(), SPELL_VOLATILE_INFECTION, false);
volatileinf_timer = 12000;
}
else volatileinf_timer -= diff;
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_fenstalkerAI>(creature);
}
};
class boss_koragg : public CreatureScript
{
public:
boss_koragg()
: CreatureScript("boss_koragg")
{
}
struct boss_koraggAI : public boss_hexlord_addAI
{
boss_koraggAI(Creature* creature) : boss_hexlord_addAI(creature) { }
uint32 coldstare_timer;
uint32 mightyblow_timer;
void Reset() override
{
coldstare_timer = 15000;
mightyblow_timer = 10000;
boss_hexlord_addAI::Reset();
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (mightyblow_timer <= diff)
{
DoCastVictim(SPELL_MIGHTY_BLOW, false);
mightyblow_timer = 12000;
}
if (coldstare_timer <= diff)
{
if (Unit* victim = SelectTarget(SelectTargetMethod::Random, 0, 100, true))
DoCast(victim, SPELL_COLD_STARE, false);
coldstare_timer = 12000;
}
boss_hexlord_addAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<boss_koraggAI>(creature);
}
};
class spell_hexlord_unstable_affliction : public SpellScriptLoader
{
public:
spell_hexlord_unstable_affliction() : SpellScriptLoader("spell_hexlord_unstable_affliction") { }
class spell_hexlord_unstable_affliction_AuraScript : public AuraScript
{
PrepareAuraScript(spell_hexlord_unstable_affliction_AuraScript);
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_WL_UNSTABLE_AFFL_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)
{
if (Unit* caster = GetCaster())
caster->CastSpell(dispelInfo->GetDispeller(), SPELL_WL_UNSTABLE_AFFL_DISPEL, true, nullptr, GetEffect(EFFECT_0));
}
void Register() override
{
AfterDispel += AuraDispelFn(spell_hexlord_unstable_affliction_AuraScript::HandleDispel);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_hexlord_unstable_affliction_AuraScript();
AfterDispel += AuraDispelFn(spell_hexlord_unstable_affliction::HandleDispel);
}
};
void AddSC_boss_hex_lord_malacrass()
{
new boss_hexlord_malacrass();
new boss_thurg();
// new boss_gazakroth();
new boss_lord_raadan();
new boss_darkheart();
new boss_slither();
new boss_fenstalker();
new boss_koragg();
new boss_alyson_antille();
new spell_hexlord_unstable_affliction();
RegisterSpellScript(spell_hexlord_unstable_affliction);
}