[Attack Target] Invalid target check

This commit is contained in:
Yunfan Li
2024-05-28 10:28:06 +08:00
parent 5d7a1aa401
commit 43c0435e78
2 changed files with 8 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -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);
}