Skip to content

Commit

Permalink
ExpansionBuilder will avoid nulling expansion in use by job expansion…
Browse files Browse the repository at this point in the history
… systems (#281)
  • Loading branch information
jzy-chitong56 committed Apr 20, 2024
1 parent 00397f5 commit 3a9b771
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions common.eai
Expand Up @@ -10837,6 +10837,7 @@ function ExpansionBuilder takes nothing returns nothing
local integer mines = GetMinesOwned()
local integer gold_left = GetGoldOwned()
local integer i = racial_expansion
local integer f = 0
local boolean exp_prepared = false
local boolean rebuild = false
local unit u = null
Expand All @@ -10854,7 +10855,9 @@ if current_expansion == null or CheckExpansionTaken(current_expansion) then
endif
if CheckExpansionTaken(current_expansion) then
call Trace("ExpansionBuilder: Expansion taken by someone else")
set current_expansion = null
if current_expansion != not_taken_expansion then
set current_expansion = null
endif
return
endif
set exp_prepared = false
Expand All @@ -10881,7 +10884,7 @@ if mines < 2 and ai_time - exp_time_count > exp_first_time then
endif
endif

if mines < 3 and ai_time - exp_time_count > exp_second_time or (active_expansion and ai_time - exp_time_count > exp_first_time) then
if (mines < 3 and ai_time - exp_time_count > exp_second_time) or (active_expansion and ai_time - exp_time_count > exp_first_time) then
if u != null then
set take_exp = true
call Trace("ExpansionBuilder:Need to Creep Mine 3")
Expand All @@ -10902,10 +10905,11 @@ endif
set u = null

set i = 0
set f = FoodUsed() + 10
loop
exitwhen i >= UPKEEP_NUM or upkeepboost
// If near on in an upkeep level that needs more mines then boost expansion priority
if mines < upkeep_mines_needed[i] and FoodUsed() > upkeep_border[i] - 10 then
if mines < upkeep_mines_needed[i] and f > upkeep_border[i] then
set upkeepboost = true
endif
set i = i + 1
Expand Down

0 comments on commit 3a9b771

Please sign in to comment.