Skip to content

Commit

Permalink
Just extra protection for double expansion check
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Jan 25, 2024
1 parent 788ff2a commit 18b383f
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions Jobs/DETECT_DOUBLE_EXP.eai
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,26 @@ function CheckDoubleExpansionsClaimedInArea takes real tx, real ty returns boole
if GetOwningPlayer(u) != ai_player and GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
set claimedMines = claimedMines + 1
endif
if IsPlayerAlly(ai_player, GetOwningPlayer(u)) then
set double_expansion_ally_present = true
else
set double_expansion_target = u
if GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
if IsPlayerAlly(ai_player, GetOwningPlayer(u)) then
set double_expansion_ally_present = true
else
set double_expansion_target = u
endif
endif
set minecount = minecount + 1
endif
if IsUnitType(u, UNIT_TYPE_TOWNHALL) then
if GetOwningPlayer(u) != ai_player and GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
set claimedMines = claimedMines + 1
endif
if IsPlayerAlly(ai_player, GetOwningPlayer(u)) then
set double_expansion_ally_present = true
else
set double_expansion_target = u
set double_expansion_enemy_present = true
if GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
if IsPlayerAlly(ai_player, GetOwningPlayer(u)) then
set double_expansion_ally_present = true
else
set double_expansion_target = u
set double_expansion_enemy_present = true
endif
endif
endif
call GroupRemoveUnit(g,u)
Expand Down

1 comment on commit 18b383f

@jzy-chitong56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if GetOwningPlayer(u) != Player(PLAYER_NEUTRAL_PASSIVE) then
if IsPlayerAlly(ai_player, GetOwningPlayer(u)) then // input unit is town and is ai_player -- then double_expansion_ally_present will true , so Always cancel
set double_expansion_ally_present = true
else
set double_expansion_target = u
set double_expansion_enemy_present = true
endif

Please sign in to comment.