From 51d842a8bdf4fc5e9d606c1749e992c1a1b8d097 Mon Sep 17 00:00:00 2001 From: ccrs Date: Tue, 10 Aug 2021 13:17:47 +0200 Subject: Scripts/Ahnkahet: corrections to npc_amanitar_mushrooms script (cherry picked from commit 9c7f2544c872d820fbf649c2d5d509f04f38a899) --- .../AzjolNerub/Ahnkahet/boss_amanitar.cpp | 47 +++++++++++++--------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp index 91452e736f2..8aa18cb80a0 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp @@ -192,8 +192,8 @@ struct boss_amanitar : public BossAI DoMeleeAttackIfReady(); } - private: - std::deque _mushroomsDeque; +private: + std::deque _mushroomsDeque; }; struct npc_amanitar_mushrooms : public ScriptedAI @@ -209,33 +209,38 @@ 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(Milliseconds(800), [this](TaskContext /*context*/) - { - DoCastSelf(SPELL_GROW, true); - }); - } + _scheduler.Schedule(1s, [this](TaskContext checkRangeContext) + { + std::vector playersNearby; + GetPlayerListInGrid(playersNearby, me, 2.0f); + if (!playersNearby.empty()) + { + _active = true; - void MoveInLineOfSight(Unit* target) override - { - if (_active || target->GetTypeId() != TYPEID_PLAYER || me->GetDistance2d(target) > 2.0f) - return; + for (Player* foundPlayer : playersNearby) + foundPlayer->RemoveAurasDueToSpell(SPELL_POTENT_FUNGUS); - _active = true; + DoCastAOE(SPELL_POISONOUS_MUSHROOM_POISON_CLOUD); - 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)); + }); + } + else + checkRangeContext.Repeat(1s); + }); + } - _scheduler.Schedule(Seconds(1), [this](TaskContext /*context*/) + _scheduler.Schedule(Milliseconds(800), [this](TaskContext /*context*/) { - me->SetObjectScale(0.1f); - me->DespawnOrUnsummon(Seconds(4)); + DoCastSelf(SPELL_GROW, true); }); } @@ -243,6 +248,8 @@ struct npc_amanitar_mushrooms : public ScriptedAI { 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 -- cgit v1.2.3