From 911831269708298fd315aa3dbba0c80419af0e6c Mon Sep 17 00:00:00 2001 From: SMUnlimited Date: Sat, 23 Nov 2024 14:44:34 +0000 Subject: [PATCH] Dont build additional factories during tier up #440 --- CHANGELOG.md | 1 + common.eai | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c7b06f66..af5feaeef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/common.eai b/common.eai index acdafa8cf..5dd527c3c 100644 --- a/common.eai +++ b/common.eai @@ -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]])