From 96f439bf22af69468fdf3d498125cede2d5b1dff Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Tue, 30 May 2023 01:06:33 +0800 Subject: [PATCH] attacker value with LOS --- src/strategy/values/AttackersValue.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/strategy/values/AttackersValue.cpp b/src/strategy/values/AttackersValue.cpp index 8c0626a8..e83dedea 100644 --- a/src/strategy/values/AttackersValue.cpp +++ b/src/strategy/values/AttackersValue.cpp @@ -85,7 +85,7 @@ void AttackersValue::RemoveNonThreating(std::set& targets) for (std::set::iterator tIter = targets.begin(); tIter != targets.end();) { Unit* unit = *tIter; - if (!IsValidTarget(unit, bot)) + if (!IsValidTarget(unit, bot) || !bot->IsWithinLOSInMap(unit)) { std::set::iterator tIter2 = tIter; ++tIter; @@ -129,8 +129,8 @@ bool AttackersValue::IsPossibleTarget(Unit* attacker, Player* bot, float range) !(attacker->GetGUID().IsPet() && enemy) && !(attacker->GetCreatureType() == CREATURE_TYPE_CRITTER && !attacker->IsInCombat()) && !(sPlayerbotAIConfig->IsInPvpProhibitedZone(attacker->GetAreaId()) && (attacker->GetGUID().IsPlayer() || attacker->GetGUID().IsPet())) && (!c || (!c->IsInEvadeMode() && ((!isMemberBotGroup && botAI->HasStrategy("attack tagged", BOT_STATE_NON_COMBAT)) || - leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) || - (botAI->GetMaster() && c->GetVictim() == botAI->GetMaster())))) || c->isTappedBy(bot)))); + leaderHasThreat || (!c->hasLootRecipient() && (!c->GetVictim() || (c->GetVictim() && ((!c->GetVictim()->IsPlayer() || bot->IsInSameGroupWith(c->GetVictim()->ToPlayer())) || + (botAI->GetMaster() && c->GetVictim() == botAI->GetMaster()))))) || c->isTappedBy(bot)))); } bool AttackersValue::IsValidTarget(Unit *attacker, Player *bot)