From ce3f4f23d88e393f57e8628a784adf4b521c7783 Mon Sep 17 00:00:00 2001 From: SMUnlimited Date: Sun, 1 Dec 2024 12:27:54 +0000 Subject: [PATCH] Fix an issue where undead tried to build a high level base but isn't yet at tier to do so #453 --- CHANGELOG.md | 1 + REFORGED/Undead/BuildSequence.ai | 7 +++++-- ROC/Undead/BuildSequence.ai | 4 +++- TFT/Undead/BuildSequence.ai | 7 +++++-- common.eai | 5 +++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1488cc511..aea344095 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - This also helps protect all races from building initial base buildings at the wrong mine. - Fixed issue where harvested mines is calculated incorrectly for humans and orcs for various use cases. - Small fix so that ai does not retreat from creeps sleeping or are not fully engaged. +- Fixed an issue where undead would try and tier up due to base defense instead of tiering up through the strategy. - Multiple mine control fixes (jzy-chitong56) - Fixed 4th mine chance was evaluated incorrectly. (jzy-chitong56) - (Classic) Include missing hero harass attacks that are applicable from reforged scripts. diff --git a/REFORGED/Undead/BuildSequence.ai b/REFORGED/Undead/BuildSequence.ai index 383e1bbac..2731b1da4 100644 --- a/REFORGED/Undead/BuildSequence.ai +++ b/REFORGED/Undead/BuildSequence.ai @@ -72,11 +72,14 @@ function global_build_sequence takes nothing returns nothing call BuildUnit(1, ZIGGURAT_2, 45) call BuildUnit(1, ZIGGURAT_FROST, 40) if GetGold() > 2000 then - call DefendTownsDone(1, NECROPOLIS_1, 95) call DefendTownsDone(3, ZIGGURAT_2, 90) call DefendTownsDone(1, ZIGGURAT_FROST, 50) call DefendTownsCond(1, ZIGGURAT_FROST, 0, 8000, 0, 80) - call DefendTownsCond(1, NECROPOLIS_2, 7600, 99999, 0, 90) + if tier >= 2 then + call DefendTownsCond(1, NECROPOLIS_2, 7600, 99999, 0, 90) + elseif tier >= 1 then + call DefendTownsDone(1, NECROPOLIS_1, 95) + endif if TownCount(ZIGGURAT_2) >= 2 and TownCount(TOMB_OF_RELICS) < 2 then call DefendTownsDone(1, TOMB_OF_RELICS, 40) endif diff --git a/ROC/Undead/BuildSequence.ai b/ROC/Undead/BuildSequence.ai index 124764dac..d14169624 100644 --- a/ROC/Undead/BuildSequence.ai +++ b/ROC/Undead/BuildSequence.ai @@ -14,7 +14,9 @@ endfunction function global_build_sequence takes nothing returns nothing call DefendTownsDone(2, ZIGGURAT_2, 65) - call DefendTownsDone(1, NECROPOLIS_2, 70) + if tier >= 2 then + call DefendTownsDone(1, NECROPOLIS_2, 70) + endif call BuildUnit(3, ZIGGURAT_2, 30) diff --git a/TFT/Undead/BuildSequence.ai b/TFT/Undead/BuildSequence.ai index a3a7f7c12..ba3b5d255 100644 --- a/TFT/Undead/BuildSequence.ai +++ b/TFT/Undead/BuildSequence.ai @@ -73,11 +73,14 @@ function global_build_sequence takes nothing returns nothing call BuildUnit(1, ZIGGURAT_2, 45) call BuildUnit(1, ZIGGURAT_FROST, 40) if GetGold() > 2000 then - call DefendTownsDone(1, NECROPOLIS_1, 95) call DefendTownsDone(3, ZIGGURAT_2, 90) call DefendTownsDone(1, ZIGGURAT_FROST, 50) call DefendTownsCond(1, ZIGGURAT_FROST, 0, 8000, 0, 80) - call DefendTownsCond(1, NECROPOLIS_2, 7600, 99999, 0, 90) + if tier >= 2 then + call DefendTownsCond(1, NECROPOLIS_2, 7600, 99999, 0, 90) + elseif tier >= 1 then + call DefendTownsDone(1, NECROPOLIS_1, 95) + endif if TownCount(ZIGGURAT_2) >= 2 and TownCount(TOMB_OF_RELICS) < 2 then call DefendTownsDone(1, TOMB_OF_RELICS, 40) endif diff --git a/common.eai b/common.eai index 3d016454c..f0113b5ce 100644 --- a/common.eai +++ b/common.eai @@ -10183,10 +10183,11 @@ function DefendTownsEx takes boolean only_done, boolean at_front, integer qty, i local integer i = twm //call Trace("DefendTownsEx TownWithMine:" + Int2Str(twm)) if not at_front then - set twm = Max(twm, 1) // Home town is town 0 + set twm = Max(twm, 1) // Home town is town 0 and exclude if at_front is not set else set twm = Max(twm, 0) - endif + endif + set i = twm loop exitwhen i > twm + 2 if TownHasMine(i) and TownCountEx(racial_expansion,only_done,i) > 0 then