mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-18 11:49:19 +07:00
Okay that was dumb
This commit is contained in:
@ -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 buty this construction"
|
||||||
|
* This tests whether the buy button should be _enabled_ */
|
||||||
fun isConstructionPurchaseAllowed(construction: INonPerpetualConstruction, stat: Stat, constructionBuyCost: Int): Boolean {
|
fun isConstructionPurchaseAllowed(construction: INonPerpetualConstruction, stat: Stat, constructionBuyCost: Int): Boolean {
|
||||||
return when {
|
return when {
|
||||||
city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets).any() -> false
|
city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets).any() -> false
|
||||||
city.isInResistance() -> false
|
city.isInResistance() -> false
|
||||||
!construction.isPurchasable(city.cityConstructions) -> false // checks via 'rejection reason'
|
!construction.isPurchasable(city.cityConstructions) -> false // checks via 'rejection reason'
|
||||||
construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false
|
construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false
|
||||||
|
!construction.canBePurchasedWithStat(city, stat) -> false
|
||||||
city.civ.gameInfo.gameParameters.godMode -> true
|
city.civ.gameInfo.gameParameters.godMode -> true
|
||||||
constructionBuyCost == 0 -> true
|
constructionBuyCost == 0 -> true
|
||||||
else -> city.getStatReserve(stat) >= constructionBuyCost
|
else -> city.getStatReserve(stat) >= constructionBuyCost
|
||||||
|
Reference in New Issue
Block a user