mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
refactor(Scripts/RuinsOfAhnQiraj): Clean up Ayamiss script (#19742)
This commit is contained in:
@@ -45,9 +45,9 @@ enum Spells
|
|||||||
SPELL_HIVEZARA_SWARMER_TELEPORT_5 = 25828,
|
SPELL_HIVEZARA_SWARMER_TELEPORT_5 = 25828,
|
||||||
SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER = 25830,
|
SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER = 25830,
|
||||||
SPELL_HIVEZARA_SWARMER_START_LOOP = 25711,
|
SPELL_HIVEZARA_SWARMER_START_LOOP = 25711,
|
||||||
SPELL_HIVEZARA_SWARMER_LOOP_1 = 25833,
|
SPELL_HZ_SWARMER_LOOP_1 = 25833,
|
||||||
SPELL_HIVEZARA_SWARMER_LOOP_2 = 25834,
|
SPELL_HZ_SWARMER_LOOP_2 = 25834,
|
||||||
SPELL_HIVEZARA_SWARMER_LOOP_3 = 25835,
|
SPELL_HZ_SWARMER_LOOP_3 = 25835,
|
||||||
SPELL_HIVEZARA_SWARMER_SWARM = 25844
|
SPELL_HIVEZARA_SWARMER_SWARM = 25844
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,16 +105,13 @@ struct boss_ayamiss : public BossAI
|
|||||||
|
|
||||||
void JustSummoned(Creature* who) override
|
void JustSummoned(Creature* who) override
|
||||||
{
|
{
|
||||||
switch (who->GetEntry())
|
if (who->GetEntry() == NPC_HIVEZARA_SWARMER)
|
||||||
{
|
{
|
||||||
case NPC_HIVEZARA_SWARMER:
|
|
||||||
who->CastSpell(who, SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER, true);
|
who->CastSpell(who, SPELL_HIVEZARA_SWARMER_TELEPORT_TRIGGER, true);
|
||||||
_swarmers.push_back(who->GetGUID());
|
_swarmers.push_back(who->GetGUID());
|
||||||
break;
|
|
||||||
case NPC_HIVEZARA_LARVA:
|
|
||||||
who->GetMotionMaster()->MovePoint(POINT_PARALYZE, AltarPos);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else if (who->GetEntry() == NPC_HIVEZARA_LARVA)
|
||||||
|
who->GetMotionMaster()->MovePoint(POINT_PARALYZE, AltarPos);
|
||||||
|
|
||||||
summons.Summon(who);
|
summons.Summon(who);
|
||||||
}
|
}
|
||||||
@@ -122,9 +119,7 @@ struct boss_ayamiss : public BossAI
|
|||||||
void MovementInform(uint32 type, uint32 id) override
|
void MovementInform(uint32 type, uint32 id) override
|
||||||
{
|
{
|
||||||
if (type == POINT_MOTION_TYPE && id == POINT_AIR)
|
if (type == POINT_MOTION_TYPE && id == POINT_AIR)
|
||||||
{
|
|
||||||
me->AddUnitState(UNIT_STATE_ROOT);
|
me->AddUnitState(UNIT_STATE_ROOT);
|
||||||
}
|
|
||||||
else if (type == WAYPOINT_MOTION_TYPE && id == POINT_GROUND)
|
else if (type == WAYPOINT_MOTION_TYPE && id == POINT_GROUND)
|
||||||
{
|
{
|
||||||
me->SetCombatMovement(true);
|
me->SetCombatMovement(true);
|
||||||
@@ -133,10 +128,7 @@ struct boss_ayamiss : public BossAI
|
|||||||
me->m_Events.AddEventAtOffset([this]()
|
me->m_Events.AddEventAtOffset([this]()
|
||||||
{
|
{
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
if (me->GetVictim())
|
me->ResumeChasingVictim();
|
||||||
{
|
|
||||||
me->GetMotionMaster()->MoveChase(me->GetVictim());
|
|
||||||
}
|
|
||||||
|
|
||||||
}, 1s);
|
}, 1s);
|
||||||
|
|
||||||
@@ -164,9 +156,7 @@ struct boss_ayamiss : public BossAI
|
|||||||
DoCastAOE(SPELL_SUMMON_HIVEZARA_SWARMER, true);
|
DoCastAOE(SPELL_SUMMON_HIVEZARA_SWARMER, true);
|
||||||
|
|
||||||
if (_swarmers.size() >= MAX_SWARMER_COUNT)
|
if (_swarmers.size() >= MAX_SWARMER_COUNT)
|
||||||
{
|
|
||||||
DoCastAOE(SPELL_HIVEZARA_SWARMER_SWARM, true);
|
DoCastAOE(SPELL_HIVEZARA_SWARMER_SWARM, true);
|
||||||
}
|
|
||||||
|
|
||||||
context.Repeat(RAND(2400ms, 3600ms));
|
context.Repeat(RAND(2400ms, 3600ms));
|
||||||
}).Schedule(15s, 28s, [this](TaskContext context) {
|
}).Schedule(15s, 28s, [this](TaskContext context) {
|
||||||
@@ -185,15 +175,9 @@ struct boss_ayamiss : public BossAI
|
|||||||
if (action == ACTION_SWARMER_SWARM)
|
if (action == ACTION_SWARMER_SWARM)
|
||||||
{
|
{
|
||||||
for (ObjectGuid const& guid : _swarmers)
|
for (ObjectGuid const& guid : _swarmers)
|
||||||
{
|
|
||||||
if (Creature* swarmer = me->GetMap()->GetCreature(guid))
|
if (Creature* swarmer = me->GetMap()->GetCreature(guid))
|
||||||
{
|
|
||||||
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
if (Unit* target = SelectTarget(SelectTargetMethod::Random))
|
||||||
{
|
|
||||||
swarmer->AI()->AttackStart(target);
|
swarmer->AI()->AttackStart(target);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_swarmers.clear();
|
_swarmers.clear();
|
||||||
}
|
}
|
||||||
@@ -231,18 +215,15 @@ struct npc_hive_zara_larva : public ScriptedAI
|
|||||||
npc_hive_zara_larva(Creature* creature) : ScriptedAI(creature)
|
npc_hive_zara_larva(Creature* creature) : ScriptedAI(creature)
|
||||||
{
|
{
|
||||||
_instance = me->GetInstanceScript();
|
_instance = me->GetInstanceScript();
|
||||||
|
me->SetReactState(REACT_PASSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovementInform(uint32 type, uint32 id) override
|
void MovementInform(uint32 type, uint32 id) override
|
||||||
{
|
{
|
||||||
if (type == POINT_MOTION_TYPE && id == POINT_PARALYZE)
|
if (type == POINT_MOTION_TYPE && id == POINT_PARALYZE)
|
||||||
{
|
|
||||||
if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED)))
|
if (Player* target = ObjectAccessor::GetPlayer(*me, _instance->GetGuidData(DATA_PARALYZED)))
|
||||||
{
|
|
||||||
DoCast(target, SPELL_FEED);
|
DoCast(target, SPELL_FEED);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void JustSummoned(Creature* summon) override
|
void JustSummoned(Creature* summon) override
|
||||||
{
|
{
|
||||||
@@ -253,29 +234,6 @@ struct npc_hive_zara_larva : public ScriptedAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit* who) override
|
|
||||||
{
|
|
||||||
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ScriptedAI::MoveInLineOfSight(who);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AttackStart(Unit* victim) override
|
|
||||||
{
|
|
||||||
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ScriptedAI::AttackStart(victim);
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(uint32 diff) override
|
|
||||||
{
|
|
||||||
if (_instance->GetBossState(DATA_AYAMISS) == IN_PROGRESS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ScriptedAI::UpdateAI(diff);
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
InstanceScript* _instance;
|
InstanceScript* _instance;
|
||||||
};
|
};
|
||||||
@@ -369,7 +327,7 @@ class spell_ayamiss_swarmer_start_loop : public SpellScript
|
|||||||
|
|
||||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||||
{
|
{
|
||||||
return ValidateSpellInfo({ SPELL_HIVEZARA_SWARMER_LOOP_1, SPELL_HIVEZARA_SWARMER_LOOP_2, SPELL_HIVEZARA_SWARMER_LOOP_3 });
|
return ValidateSpellInfo({ SPELL_HZ_SWARMER_LOOP_1, SPELL_HZ_SWARMER_LOOP_2, SPELL_HZ_SWARMER_LOOP_3 });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Load() override
|
bool Load() override
|
||||||
@@ -379,8 +337,7 @@ class spell_ayamiss_swarmer_start_loop : public SpellScript
|
|||||||
|
|
||||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||||
{
|
{
|
||||||
uint32 loopSpells[3] = { SPELL_HIVEZARA_SWARMER_LOOP_1, SPELL_HIVEZARA_SWARMER_LOOP_2, SPELL_HIVEZARA_SWARMER_LOOP_3 };
|
GetCaster()->GetAI()->DoCastAOE(RAND(SPELL_HZ_SWARMER_LOOP_1, SPELL_HZ_SWARMER_LOOP_2, SPELL_HZ_SWARMER_LOOP_3));
|
||||||
GetCaster()->CastSpell((Unit*)nullptr, Acore::Containers::SelectRandomContainerElement(loopSpells));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Register() override
|
void Register() override
|
||||||
|
|||||||
Reference in New Issue
Block a user