fix(Core/WorldBoss): Azuregos rewrite (#10369)

This commit is contained in:
Nefertumm
2022-02-10 07:51:35 -03:00
committed by GitHub
parent 7eec7486e9
commit 520f0c6a50
3 changed files with 297 additions and 119 deletions

View File

@@ -15,156 +15,220 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Azuregos
SD%Complete: 90
SDComment: Teleport not included, spell reflect not effecting dots (Core problem)
SDCategory: Azshara
EndScriptData */
#include "ScriptMgr.h"
#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "TaskScheduler.h"
enum Say
{
SAY_TELEPORT = 0
SAY_TELEPORT = 0,
SAY_AGGRO,
SAY_KILL,
};
enum Spells
{
SPELL_MARKOFFROST = 23182,
SPELL_MANASTORM = 21097,
SPELL_CHILL = 21098,
SPELL_FROSTBREATH = 21099,
SPELL_REFLECT = 22067,
SPELL_CLEAVE = 8255, //Perhaps not right ID
SPELL_ENRAGE = 23537
SPELL_MARK_OF_FROST = 23182,
SPELL_MARK_OF_FROST_AURA = 23184,
SPELL_AURA_OF_FROST = 23186,
SPELL_MANA_STORM = 21097,
SPELL_CHILL = 21098,
SPELL_FROST_BREATH = 21099,
SPELL_REFLECT = 22067,
SPELL_CLEAVE = 19983,
SPELL_ARCANE_VACUUM = 21147,
SPELL_ARCANE_VACUUM_TP = 21150
};
class boss_azuregos : public CreatureScript
{
public:
boss_azuregos() : CreatureScript("boss_azuregos") { }
struct boss_azuregosAI : public ScriptedAI
{
boss_azuregosAI(Creature* creature) : ScriptedAI(creature)
{
_scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
});
}
void Reset() override
{
me->RemoveAurasDueToSpell(SPELL_MARK_OF_FROST_AURA);
_scheduler.CancelAll();
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->RestoreFaction();
me->GetMap()->DoForAllPlayers([&](Player* p)
{
if (p->GetZoneId() == me->GetZoneId())
{
p->RemoveAurasDueToSpell(SPELL_MARK_OF_FROST);
p->RemoveAurasDueToSpell(SPELL_AURA_OF_FROST);
p->RemoveAurasDueToSpell(SPELL_CHILL);
p->RemoveAurasDueToSpell(SPELL_FROST_BREATH);
}
});
}
void KilledUnit(Unit* victim) override
{
if (victim && victim->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_KILL);
victim->CastSpell(victim, SPELL_MARK_OF_FROST, true);
}
}
void EnterCombat(Unit* /*who*/) override
{
DoCastSelf(SPELL_MARK_OF_FROST_AURA);
Talk(SAY_AGGRO);
_scheduler
.Schedule(7s, [this](TaskContext context)
{
DoCastVictim(SPELL_CLEAVE);
context.Repeat(7s);
})
.Schedule(5s, 17s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_MANA_STORM);
context.Repeat(7s, 13s);
})
.Schedule(10s, 30s, [this](TaskContext context)
{
DoCastVictim(SPELL_CHILL);
context.Repeat(13s, 25s);
})
.Schedule(2s, 8s, [this](TaskContext context)
{
DoCastVictim(SPELL_FROST_BREATH);
context.Repeat(10s, 15s);
})
.Schedule(30s, [this](TaskContext context)
{
Talk(SAY_TELEPORT);
DoCastAOE(SPELL_ARCANE_VACUUM);
DoResetThreat();
context.Repeat(30s);
})
.Schedule(15s, 30s, [this](TaskContext context)
{
DoCastSelf(SPELL_REFLECT);
context.Repeat(20s, 35s);
});
}
void JustDied(Unit* /*killer*/) override
{
me->RemoveAurasDueToSpell(SPELL_MARK_OF_FROST);
me->GetMap()->DoForAllPlayers([&](Player* p)
{
if (p->GetZoneId() == me->GetZoneId())
{
p->RemoveAurasDueToSpell(SPELL_MARK_OF_FROST);
p->RemoveAurasDueToSpell(SPELL_AURA_OF_FROST);
p->RemoveAurasDueToSpell(SPELL_CHILL);
p->RemoveAurasDueToSpell(SPELL_FROST_BREATH);
}
});
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
{
return;
}
_scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
});
}
protected:
TaskScheduler _scheduler;
};
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 /*action*/) override
{
CloseGossipMenuFor(player);
creature->SetFaction(FACTION_ENEMY);
creature->AI()->AttackStart(player);
return true;
}
CreatureAI* GetAI(Creature* creature) const override
{
return new boss_azuregosAI(creature);
}
};
struct boss_azuregosAI : public ScriptedAI
// Arcane Vacuum: 21147
class spell_arcane_vacuum : public SpellScript
{
PrepareSpellScript(spell_arcane_vacuum);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
boss_azuregosAI(Creature* creature) : ScriptedAI(creature) { }
return ValidateSpellInfo({ SPELL_ARCANE_VACUUM_TP });
}
uint32 MarkOfFrostTimer;
uint32 ManaStormTimer;
uint32 ChillTimer;
uint32 BreathTimer;
uint32 TeleportTimer;
uint32 ReflectTimer;
uint32 CleaveTimer;
uint32 EnrageTimer;
bool Enraged;
void Reset() override
void HandleOnHit()
{
Unit* caster = GetCaster();
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->ToPlayer())
{
MarkOfFrostTimer = 35000;
ManaStormTimer = urand(5000, 17000);
ChillTimer = urand(10000, 30000);
BreathTimer = urand(2000, 8000);
TeleportTimer = 30000;
ReflectTimer = urand(15000, 30000);
CleaveTimer = 7000;
EnrageTimer = 0;
Enraged = false;
caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true);
}
}
void EnterCombat(Unit* /*who*/) override { }
void Register() override
{
OnHit += SpellHitFn(spell_arcane_vacuum::HandleOnHit);
}
};
void UpdateAI(uint32 diff) override
// Mark of Frost - Triggered Spell
class spell_mark_of_frost_freeze : public SpellScript
{
PrepareSpellScript(spell_mark_of_frost_freeze);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MARK_OF_FROST, SPELL_AURA_OF_FROST });
}
void HandleOnHit()
{
Unit* caster = GetCaster();
Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->HasAura(SPELL_MARK_OF_FROST) && !hitUnit->HasAura(SPELL_AURA_OF_FROST))
{
//Return since we have no target
if (!UpdateVictim())
return;
if (TeleportTimer <= diff)
{
Talk(SAY_TELEPORT);
ThreatContainer::StorageType threatlist = me->getThreatMgr().getThreatList();
for (auto i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 3, unit->GetOrientation());
}
}
DoResetThreat();
TeleportTimer = 30000;
}
else TeleportTimer -= diff;
// //MarkOfFrostTimer
// if (MarkOfFrostTimer <= diff)
// {
// DoCastVictim(SPELL_MARKOFFROST);
// MarkOfFrostTimer = 25000;
// } else MarkOfFrostTimer -= diff;
//ChillTimer
if (ChillTimer <= diff)
{
DoCastVictim(SPELL_CHILL);
ChillTimer = urand(13000, 25000);
}
else ChillTimer -= diff;
//BreathTimer
if (BreathTimer <= diff)
{
DoCastVictim(SPELL_FROSTBREATH);
BreathTimer = urand(10000, 15000);
}
else BreathTimer -= diff;
//ManaStormTimer
if (ManaStormTimer <= diff)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
DoCast(target, SPELL_MANASTORM);
ManaStormTimer = urand(7500, 12500);
}
else ManaStormTimer -= diff;
//ReflectTimer
if (ReflectTimer <= diff)
{
DoCast(me, SPELL_REFLECT);
ReflectTimer = urand(20000, 35000);
}
else ReflectTimer -= diff;
//CleaveTimer
if (CleaveTimer <= diff)
{
DoCastVictim(SPELL_CLEAVE);
CleaveTimer = 7000;
}
else CleaveTimer -= diff;
//EnrageTimer
if (HealthBelowPct(26) && !Enraged)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
}
DoMeleeAttackIfReady();
hitUnit->CastSpell(hitUnit, SPELL_AURA_OF_FROST, true);
}
};
}
void Register() override
{
OnHit += SpellHitFn(spell_mark_of_frost_freeze::HandleOnHit);
}
};
void AddSC_boss_azuregos()
{
new boss_azuregos();
RegisterSpellScript(spell_arcane_vacuum);
RegisterSpellScript(spell_mark_of_frost_freeze);
}