diff --git a/src/strategy/triggers/GenericTriggers.cpp b/src/strategy/triggers/GenericTriggers.cpp index 7f55be58..6d2a9d0a 100644 --- a/src/strategy/triggers/GenericTriggers.cpp +++ b/src/strategy/triggers/GenericTriggers.cpp @@ -469,14 +469,16 @@ bool PossibleAddsTrigger::IsActive() bool NotDpsTargetActiveTrigger::IsActive() { - Unit* dps = AI_VALUE(Unit*, "dps target"); Unit* target = AI_VALUE(Unit*, "current target"); - Unit* enemy = AI_VALUE(Unit*, "enemy player target"); - // do not switch if enemy target - if (target && target == enemy && target->IsAlive()) - return false; + if (target && target->IsAlive()) { + Unit* enemy = AI_VALUE(Unit*, "enemy player target"); + if (target == enemy) + return false; + } + + Unit* dps = AI_VALUE(Unit*, "dps target"); return dps && target != dps; } diff --git a/src/strategy/values/InvalidTargetValue.cpp b/src/strategy/values/InvalidTargetValue.cpp index fe2ab023..d2499c52 100644 --- a/src/strategy/values/InvalidTargetValue.cpp +++ b/src/strategy/values/InvalidTargetValue.cpp @@ -27,6 +27,7 @@ bool InvalidTargetValue::Calculate() target->isFeared() || target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsFriendlyTo(bot) || + !AttackersValue::IsValidTarget(target, bot) || // !bot->IsWithinDistInMap(target, sPlayerbotAIConfig->sightDistance) || !bot->IsWithinLOSInMap(target); }