Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI - Remove IgnoreWeakerTargetsRatio from attackforceai target logic #4461

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions lua/AI/aiattackutilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ function GetBestThreatTarget(aiBrain, platoon, bSkipPathability)
-- is less than this level, then just outright ignore it as a threat
local IgnoreThreatLessThan = 15
-- if the platoon is stronger than this threat level, then ignore weaker targets if the platoon is stronger
-- by the given ratio
local IgnoreWeakerTargetsIfStrongerThan = 20
local IgnoreWeakerTargetsRatio = 5

-- When evaluating threat, how many rings in the threat grid do we look at
local EnemyThreatRings = 1
Expand Down Expand Up @@ -237,7 +235,6 @@ function GetBestThreatTarget(aiBrain, platoon, bSkipPathability)
SecondaryTargetThreatType = SecondaryTargetThreatType or ThreatWeights.SecondaryTargetThreatType
IgnoreCommanderStrength = IgnoreCommanderStrength or ThreatWeights.IgnoreCommanderStrength
IgnoreWeakerTargetsIfStrongerThan = ThreatWeights.IgnoreWeakerTargetsIfStrongerThan or IgnoreWeakerTargetsIfStrongerThan
IgnoreWeakerTargetsRatio = ThreatWeights.IgnoreWeakerTargetsRatio or IgnoreWeakerTargetsRatio
IgnoreThreatLessThan = ThreatWeights.IgnoreThreatLessThan or IgnoreThreatLessThan
PrimaryTargetThreatType = ThreatWeights.PrimaryTargetThreatType or PrimaryTargetThreatType
SecondaryTargetThreatType = ThreatWeights.SecondaryTargetThreatType or SecondaryTargetThreatType
Expand Down Expand Up @@ -355,7 +352,6 @@ function GetBestThreatTarget(aiBrain, platoon, bSkipPathability)
if myThreat <= IgnoreStrongerTargetsIfWeakerThan
and (myThreat == 0 or enemyThreat / (myThreat + friendlyThreat) > IgnoreStrongerTargetsRatio)
and unitCapRatio < IgnoreStrongerUnitCap then
--LOG('*AI DEBUG: Skipping threat')
continue
end

Expand All @@ -364,7 +360,7 @@ function GetBestThreatTarget(aiBrain, platoon, bSkipPathability)
threat[3] = threat[3] + threatDiff * WeakAttackThreatWeight
else
-- ignore overall threats that are really low, otherwise we want to defeat the enemy wherever they are
if (baseThreat <= IgnoreThreatLessThan) or (myThreat >= IgnoreWeakerTargetsIfStrongerThan and (enemyThreat == 0 or myThreat / enemyThreat > IgnoreWeakerTargetsRatio)) then
if (baseThreat <= IgnoreThreatLessThan) then
continue
end
threat[3] = threat[3] + threatDiff * StrongAttackThreatWeight
Expand Down