Scripts/Ahnkahet: corrections to npc_amanitar_mushrooms script

(cherry picked from commit 9c7f2544c872d820fbf649c2d5d509f04f38a899)
This commit is contained in:
ccrs
2022-03-12 14:48:45 +01:00
committed by Shauren
parent 5b6bcbff1a
commit 51d842a8bd
@@ -192,8 +192,8 @@ struct boss_amanitar : public BossAI
DoMeleeAttackIfReady();
}
private:
std::deque<Position> _mushroomsDeque;
private:
std::deque<Position> _mushroomsDeque;
};
struct npc_amanitar_mushrooms : public ScriptedAI
@@ -209,40 +209,47 @@ struct npc_amanitar_mushrooms : public ScriptedAI
DoCastSelf(SPELL_GROW, true);
if (me->GetEntry() == NPC_HEALTHY_MUSHROOM)
{
DoCastSelf(SPELL_POWER_MUSHROOM_VISUAL_AURA);
_active = true;
}
else
{
DoCastSelf(SPELL_POISONOUS_MUSHROOM_VISUAL_AURA);
_scheduler.Schedule(1s, [this](TaskContext checkRangeContext)
{
std::vector<Player*> playersNearby;
GetPlayerListInGrid(playersNearby, me, 2.0f);
if (!playersNearby.empty())
{
_active = true;
for (Player* foundPlayer : playersNearby)
foundPlayer->RemoveAurasDueToSpell(SPELL_POTENT_FUNGUS);
DoCastAOE(SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
_scheduler.Schedule(Seconds(1), [this](TaskContext /*context*/)
{
me->SetObjectScale(0.1f);
me->DespawnOrUnsummon(Seconds(4));
});
}
else
checkRangeContext.Repeat(1s);
});
}
_scheduler.Schedule(Milliseconds(800), [this](TaskContext /*context*/)
{
DoCastSelf(SPELL_GROW, true);
});
}
void MoveInLineOfSight(Unit* target) override
{
if (_active || target->GetTypeId() != TYPEID_PLAYER || me->GetDistance2d(target) > 2.0f)
return;
_active = true;
target->RemoveAurasDueToSpell(SPELL_POTENT_FUNGUS);
DoCastAOE(SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
_scheduler.Schedule(Seconds(1), [this](TaskContext /*context*/)
{
me->SetObjectScale(0.1f);
me->DespawnOrUnsummon(Seconds(4));
});
}
void JustDied(Unit* /*killer*/) override
{
if (me->GetEntry() == NPC_HEALTHY_MUSHROOM)
DoCastAOE(SPELL_POTENT_FUNGUS, true);
else if (!_active)
DoCastAOE(SPELL_POISONOUS_MUSHROOM_POISON_CLOUD);
}
void UpdateAI(uint32 diff) override