Skip to content

Commit

Permalink
Dont build additional factories during tier up #440
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Nov 23, 2024
1 parent 06c03c4 commit 9118312
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Changed
- Further improvements for team attacks where AI should ignore its teammates attacks e.g for the ancient barracks rush above.
- When we enhanced the build code to build other things if it can't build the current priorities it caused strategies to tier up much earlier than designed, so now tier ups can only happen once most higher priority unit production is done honoring the strategy and and they are not currently expanding.
- Building additional factory buildings should not be done while actively tiering up as the buildings needed for tier 2/3 may be different.

### Fixed

Expand Down
12 changes: 11 additions & 1 deletion common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -9350,9 +9350,19 @@ function IsOneOnlyBuilding takes integer unitid returns boolean
return false
endfunction

function isTieringUp takes nothing returns boolean
local integer i = tiernum
loop
exitwhen i <= 1
return GetUnitCountDone(racial_hall[i]) < GetUnitCount(racial_hall[i])
set i = i - 1
endloop
return false
endfunction

//============================================================================
function Get_f_qty takes integer qty, integer unitid, integer town returns integer
if buy_type[unitid] != BT_UNIT or unitid == racial_peon or IsOneOnlyBuilding(needed1[unitid]) then
if buy_type[unitid] != BT_UNIT or unitid == racial_peon or IsOneOnlyBuilding(needed1[unitid]) or isTieringUp() then
return 1
endif
return GetFactoryQty(qty - TownCountTown(unitid, town), GetUnitBuildTime(old_id[unitid]), GetUnitGoldCost2(unitid), GetUnitWoodCost2(unitid), needed1[unitid], income_percentage[needed1[unitid]])
Expand Down

0 comments on commit 9118312

Please sign in to comment.