AI can no longer buy wonders

This commit is contained in:
yairm210 2024-07-15 15:38:32 +03:00
parent ef38007729
commit f8c5dc5b14

View File

@ -699,13 +699,15 @@ class CityConstructions : IsPartOfGameInfoSerialization {
}
/** This tests whether the buy button should be _enabled_ */
/** This is the *one true test* of "can we butyb this construction"
* This tests whether the buy button should be _enabled_ */
fun isConstructionPurchaseAllowed(construction: INonPerpetualConstruction, stat: Stat, constructionBuyCost: Int): Boolean {
return when {
city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets).any() -> false
city.isInResistance() -> false
!construction.isPurchasable(city.cityConstructions) -> false // checks via 'rejection reason'
construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false
!construction.canBePurchasedWithStat(city, Stat.Gold) -> false
city.civ.gameInfo.gameParameters.godMode -> true
constructionBuyCost == 0 -> true
else -> city.getStatReserve(stat) >= constructionBuyCost