Resolved #9242 - Hide buildings requiring multiple cities in one city challenge

This commit is contained in:
Yair Morgenstern 2023-05-04 11:22:03 +03:00
parent fab32e8c8a
commit 4b9c7171d3
2 changed files with 7 additions and 1 deletions

View File

@ -456,6 +456,11 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
} }
val rejectionReasons = getRejectionReasons(cityConstructions) val rejectionReasons = getRejectionReasons(cityConstructions)
if (rejectionReasons.any { it.type == RejectionReasonType.RequiresBuildingInSomeCities }
&& cityConstructions.city.civ.gameInfo.gameParameters.oneCityChallenge)
return false // You will never be able to get more cities, this building is effectively disabled
return rejectionReasons.none { !it.shouldShow } return rejectionReasons.none { !it.shouldShow }
|| ( || (
canBePurchasedWithAnyStat(cityConstructions.city) canBePurchasedWithAnyStat(cityConstructions.city)
@ -539,7 +544,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
val equivalentBuildingName = civ.getEquivalentBuilding(buildingName).name val equivalentBuildingName = civ.getEquivalentBuilding(buildingName).name
yield( yield(
// replace with civ-specific building for user // replace with civ-specific building for user
RejectionReasonType.RequiresBuildingInAllCities.toInstance( RejectionReasonType.RequiresBuildingInSomeCities.toInstance(
unique.text.fillPlaceholders(equivalentBuildingName, numberOfCitiesRequired.toString()) + unique.text.fillPlaceholders(equivalentBuildingName, numberOfCitiesRequired.toString()) +
" ($numberOfCitiesWithBuilding/$numberOfCitiesRequired)" " ($numberOfCitiesWithBuilding/$numberOfCitiesRequired)"
) ) ) )

View File

@ -174,6 +174,7 @@ enum class RejectionReasonType(val shouldShow: Boolean, val errorMessage: String
RequiresBuildingInThisCity(true, "Requires a specific building in this city!"), RequiresBuildingInThisCity(true, "Requires a specific building in this city!"),
RequiresBuildingInAllCities(true, "Requires a specific building in all cities!"), RequiresBuildingInAllCities(true, "Requires a specific building in all cities!"),
RequiresBuildingInSomeCities(true, "Requires a specific building in more cities!"),
RequiresBuildingInSomeCity(true, "Requires a specific building anywhere in your empire!"), RequiresBuildingInSomeCity(true, "Requires a specific building anywhere in your empire!"),
WonderAlreadyBuilt(false, "Wonder already built"), WonderAlreadyBuilt(false, "Wonder already built"),