mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-30 15:30:43 -04:00
Readability improvements
This commit is contained in:
parent
ad50e9d2fc
commit
194eb5299e
@ -43,13 +43,15 @@ class CityInfo {
|
|||||||
lateinit var tilesInRange: HashSet<TileInfo>
|
lateinit var tilesInRange: HashSet<TileInfo>
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
var hasJustBeenConquered = false // this is so that military units can enter the city, even before we decide what to do with it
|
var hasJustBeenConquered =
|
||||||
|
false // this is so that military units can enter the city, even before we decide what to do with it
|
||||||
|
|
||||||
var location: Vector2 = Vector2.Zero
|
var location: Vector2 = Vector2.Zero
|
||||||
var id: String = UUID.randomUUID().toString()
|
var id: String = UUID.randomUUID().toString()
|
||||||
var name: String = ""
|
var name: String = ""
|
||||||
var foundingCiv = ""
|
var foundingCiv = ""
|
||||||
var previousOwner = "" // This is so that cities in resistance that re recaptured aren't in resistance anymore
|
var previousOwner =
|
||||||
|
"" // This is so that cities in resistance that re recaptured aren't in resistance anymore
|
||||||
var turnAcquired = 0
|
var turnAcquired = 0
|
||||||
var health = 200
|
var health = 200
|
||||||
var resistanceCounter = 0
|
var resistanceCounter = 0
|
||||||
@ -58,7 +60,7 @@ class CityInfo {
|
|||||||
var population = PopulationManager()
|
var population = PopulationManager()
|
||||||
var cityConstructions = CityConstructions()
|
var cityConstructions = CityConstructions()
|
||||||
var expansion = CityExpansionManager()
|
var expansion = CityExpansionManager()
|
||||||
|
|
||||||
@Transient // CityStats has no serializable fields
|
@Transient // CityStats has no serializable fields
|
||||||
var cityStats = CityStats(this)
|
var cityStats = CityStats(this)
|
||||||
|
|
||||||
@ -105,7 +107,11 @@ class CityInfo {
|
|||||||
tryUpdateRoadStatus()
|
tryUpdateRoadStatus()
|
||||||
|
|
||||||
val tile = getCenterTile()
|
val tile = getCenterTile()
|
||||||
for (terrainFeature in tile.terrainFeatures.filter { getRuleset().tileImprovements.containsKey("Remove $it") })
|
for (terrainFeature in tile.terrainFeatures.filter {
|
||||||
|
getRuleset().tileImprovements.containsKey(
|
||||||
|
"Remove $it"
|
||||||
|
)
|
||||||
|
})
|
||||||
tile.terrainFeatures.remove(terrainFeature)
|
tile.terrainFeatures.remove(terrainFeature)
|
||||||
|
|
||||||
tile.improvement = null
|
tile.improvement = null
|
||||||
@ -113,14 +119,17 @@ class CityInfo {
|
|||||||
|
|
||||||
val ruleset = civInfo.gameInfo.ruleSet
|
val ruleset = civInfo.gameInfo.ruleSet
|
||||||
workedTiles = hashSetOf() //reassign 1st working tile
|
workedTiles = hashSetOf() //reassign 1st working tile
|
||||||
|
|
||||||
if (startingEra in ruleset.eras)
|
if (startingEra in ruleset.eras)
|
||||||
population.setPopulation(ruleset.eras[startingEra]!!.settlerPopulation)
|
population.setPopulation(ruleset.eras[startingEra]!!.settlerPopulation)
|
||||||
|
|
||||||
if (civInfo.religionManager.religionState == ReligionState.Pantheon) {
|
if (civInfo.religionManager.religionState == ReligionState.Pantheon) {
|
||||||
religion.addPressure(civInfo.religionManager.religion!!.name, 200 * population.population)
|
religion.addPressure(
|
||||||
|
civInfo.religionManager.religion!!.name,
|
||||||
|
200 * population.population
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
population.autoAssignPopulation()
|
population.autoAssignPopulation()
|
||||||
cityStats.update()
|
cityStats.update()
|
||||||
|
|
||||||
@ -178,8 +187,9 @@ class CityInfo {
|
|||||||
// names are exhausted, and choose a random one from that pool if it's not empty.
|
// names are exhausted, and choose a random one from that pool if it's not empty.
|
||||||
var newNames = civInfo.gameInfo.civilizations
|
var newNames = civInfo.gameInfo.civilizations
|
||||||
.filter { it.isMajorCiv() && it != civInfo }
|
.filter { it.isMajorCiv() && it != civInfo }
|
||||||
.mapNotNull { it.nation.cities
|
.mapNotNull {
|
||||||
.lastOrNull { city -> city !in usedCityNames }
|
it.nation.cities
|
||||||
|
.lastOrNull { city -> city !in usedCityNames }
|
||||||
}
|
}
|
||||||
if (newNames.isNotEmpty()) {
|
if (newNames.isNotEmpty()) {
|
||||||
return newNames.random()
|
return newNames.random()
|
||||||
@ -193,7 +203,7 @@ class CityInfo {
|
|||||||
.values
|
.values
|
||||||
.map {
|
.map {
|
||||||
it.cities
|
it.cities
|
||||||
.filter { city -> city !in usedCityNames }
|
.filter { city -> city !in usedCityNames }
|
||||||
}.flatten()
|
}.flatten()
|
||||||
if (newNames.isNotEmpty()) {
|
if (newNames.isNotEmpty()) {
|
||||||
return newNames.random()
|
return newNames.random()
|
||||||
@ -238,7 +248,8 @@ class CityInfo {
|
|||||||
fun isCapital(): Boolean = cityConstructions.builtBuildings.contains(capitalCityIndicator())
|
fun isCapital(): Boolean = cityConstructions.builtBuildings.contains(capitalCityIndicator())
|
||||||
fun isCoastal(): Boolean = centerTileInfo.isCoastalTile()
|
fun isCoastal(): Boolean = centerTileInfo.isCoastalTile()
|
||||||
fun capitalCityIndicator(): String {
|
fun capitalCityIndicator(): String {
|
||||||
val indicatorBuildings = getRuleset().buildings.values.asSequence().filter { it.uniques.contains("Indicates the capital city") }
|
val indicatorBuildings = getRuleset().buildings.values.asSequence()
|
||||||
|
.filter { it.uniques.contains("Indicates the capital city") }
|
||||||
val civSpecificBuilding = indicatorBuildings.firstOrNull { it.uniqueTo == civInfo.civName }
|
val civSpecificBuilding = indicatorBuildings.firstOrNull { it.uniqueTo == civInfo.civName }
|
||||||
if (civSpecificBuilding != null) return civSpecificBuilding.name
|
if (civSpecificBuilding != null) return civSpecificBuilding.name
|
||||||
else return indicatorBuildings.first().name
|
else return indicatorBuildings.first().name
|
||||||
@ -269,7 +280,11 @@ class CityInfo {
|
|||||||
for (unique in tileImprovement!!.uniqueObjects)
|
for (unique in tileImprovement!!.uniqueObjects)
|
||||||
if (unique.placeholderText == "Provides [] []") {
|
if (unique.placeholderText == "Provides [] []") {
|
||||||
val resource = getRuleset().tileResources[unique.params[1]] ?: continue
|
val resource = getRuleset().tileResources[unique.params[1]] ?: continue
|
||||||
cityResources.add(resource, unique.params[0].toInt() * civInfo.getResourceModifier(resource), "Tiles")
|
cityResources.add(
|
||||||
|
resource,
|
||||||
|
unique.params[0].toInt() * civInfo.getResourceModifier(resource),
|
||||||
|
"Tiles"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (building in cityConstructions.getBuiltBuildings()) {
|
for (building in cityConstructions.getBuiltBuildings()) {
|
||||||
@ -281,12 +296,18 @@ class CityInfo {
|
|||||||
for (unique in getLocalMatchingUniques("Provides [] []")) { // E.G "Provides [1] [Iron]"
|
for (unique in getLocalMatchingUniques("Provides [] []")) { // E.G "Provides [1] [Iron]"
|
||||||
val resource = getRuleset().tileResources[unique.params[1]]
|
val resource = getRuleset().tileResources[unique.params[1]]
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
cityResources.add(resource, unique.params[0].toInt()
|
cityResources.add(
|
||||||
* civInfo.getResourceModifier(resource), "Tiles")
|
resource, unique.params[0].toInt()
|
||||||
|
* civInfo.getResourceModifier(resource), "Tiles"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (civInfo.isCityState() && isCapital() && civInfo.cityStateResource != null) {
|
if (civInfo.isCityState() && isCapital() && civInfo.cityStateResource != null) {
|
||||||
cityResources.add(getRuleset().tileResources[civInfo.cityStateResource]!!, 1, "Mercantile City-State")
|
cityResources.add(
|
||||||
|
getRuleset().tileResources[civInfo.cityStateResource]!!,
|
||||||
|
1,
|
||||||
|
"Mercantile City-State"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return cityResources
|
return cityResources
|
||||||
@ -304,14 +325,16 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resource.improvement == tileInfo.improvement || tileInfo.isCityCenter()
|
if (resource.improvement == tileInfo.improvement || tileInfo.isCityCenter()
|
||||||
// Per https://gaming.stackexchange.com/questions/53155/do-manufactories-and-customs-houses-sacrifice-the-strategic-or-luxury-resources
|
// Per https://gaming.stackexchange.com/questions/53155/do-manufactories-and-customs-houses-sacrifice-the-strategic-or-luxury-resources
|
||||||
|| (resource.resourceType == ResourceType.Strategic && tileInfo.containsGreatImprovement())) {
|
|| resource.resourceType == ResourceType.Strategic && tileInfo.containsGreatImprovement()
|
||||||
|
) {
|
||||||
var amountToAdd = 1
|
var amountToAdd = 1
|
||||||
if (resource.resourceType == ResourceType.Strategic) {
|
if (resource.resourceType == ResourceType.Strategic) {
|
||||||
amountToAdd = 2
|
amountToAdd = 2
|
||||||
}
|
}
|
||||||
if (resource.resourceType == ResourceType.Luxury
|
if (resource.resourceType == ResourceType.Luxury
|
||||||
&& containsBuildingUnique("Provides 1 extra copy of each improved luxury resource near this City"))
|
&& containsBuildingUnique("Provides 1 extra copy of each improved luxury resource near this City")
|
||||||
|
)
|
||||||
amountToAdd *= 2
|
amountToAdd *= 2
|
||||||
|
|
||||||
return amountToAdd
|
return amountToAdd
|
||||||
@ -340,7 +363,8 @@ class CityInfo {
|
|||||||
return population.foodStored / -foodForNextTurn() + 1
|
return population.foodStored / -foodForNextTurn() + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun containsBuildingUnique(unique: String) = cityConstructions.getBuiltBuildings().any { it.uniques.contains(unique) }
|
fun containsBuildingUnique(unique: String) =
|
||||||
|
cityConstructions.getBuiltBuildings().any { it.uniques.contains(unique) }
|
||||||
|
|
||||||
fun getGreatPersonPointsForNextTurn(): HashMap<String, Counter<String>> {
|
fun getGreatPersonPointsForNextTurn(): HashMap<String, Counter<String>> {
|
||||||
val sourceToGPP = HashMap<String, Counter<String>>()
|
val sourceToGPP = HashMap<String, Counter<String>>()
|
||||||
@ -412,7 +436,8 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun getMaxHealth() = 200 + cityConstructions.getBuiltBuildings().sumBy { it.cityHealth }
|
internal fun getMaxHealth() =
|
||||||
|
200 + cityConstructions.getBuiltBuildings().sumBy { it.cityHealth }
|
||||||
|
|
||||||
override fun toString() = name // for debug
|
override fun toString() = name // for debug
|
||||||
//endregion
|
//endregion
|
||||||
@ -440,7 +465,11 @@ class CityInfo {
|
|||||||
if (isInResistance()) {
|
if (isInResistance()) {
|
||||||
resistanceCounter--
|
resistanceCounter--
|
||||||
if (!isInResistance())
|
if (!isInResistance())
|
||||||
civInfo.addNotification("The resistance in [$name] has ended!", location, "StatIcons/Resistance")
|
civInfo.addNotification(
|
||||||
|
"The resistance in [$name] has ended!",
|
||||||
|
location,
|
||||||
|
"StatIcons/Resistance"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPuppet) reassignPopulation()
|
if (isPuppet) reassignPopulation()
|
||||||
@ -467,14 +496,21 @@ class CityInfo {
|
|||||||
cityConstructions.endTurn(stats)
|
cityConstructions.endTurn(stats)
|
||||||
expansion.nextTurn(stats.culture)
|
expansion.nextTurn(stats.culture)
|
||||||
if (isBeingRazed) {
|
if (isBeingRazed) {
|
||||||
val removedPopulation = 1 + civInfo.getMatchingUniques("Cities are razed [] times as fast").sumBy { it.params[0].toInt() - 1 }
|
val removedPopulation =
|
||||||
|
1 + civInfo.getMatchingUniques("Cities are razed [] times as fast")
|
||||||
|
.sumBy { it.params[0].toInt() - 1 }
|
||||||
population.addPopulation(-1 * removedPopulation)
|
population.addPopulation(-1 * removedPopulation)
|
||||||
if (population.population <= 0) {
|
if (population.population <= 0) {
|
||||||
civInfo.addNotification("[$name] has been razed to the ground!", location, "OtherIcons/Fire")
|
civInfo.addNotification(
|
||||||
|
"[$name] has been razed to the ground!",
|
||||||
|
location,
|
||||||
|
"OtherIcons/Fire"
|
||||||
|
)
|
||||||
destroyCity()
|
destroyCity()
|
||||||
} else { //if not razed yet:
|
} else { //if not razed yet:
|
||||||
if (population.foodStored >= population.getFoodToNextPopulation()) { //if surplus in the granary...
|
if (population.foodStored >= population.getFoodToNextPopulation()) { //if surplus in the granary...
|
||||||
population.foodStored = population.getFoodToNextPopulation() - 1 //...reduce below the new growth threshold
|
population.foodStored =
|
||||||
|
population.getFoodToNextPopulation() - 1 //...reduce below the new growth threshold
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else population.nextTurn(foodForNextTurn())
|
} else population.nextTurn(foodForNextTurn())
|
||||||
@ -513,15 +549,18 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun annexCity() = CityInfoConquestFunctions(this).annexCity()
|
fun annexCity() = CityInfoConquestFunctions(this).annexCity()
|
||||||
|
|
||||||
/** This happens when we either puppet OR annex, basically whenever we conquer a city and don't liberate it */
|
/** This happens when we either puppet OR annex, basically whenever we conquer a city and don't liberate it */
|
||||||
fun puppetCity(conqueringCiv: CivilizationInfo) = CityInfoConquestFunctions(this).puppetCity(conqueringCiv)
|
fun puppetCity(conqueringCiv: CivilizationInfo) =
|
||||||
|
CityInfoConquestFunctions(this).puppetCity(conqueringCiv)
|
||||||
|
|
||||||
/* Liberating is returning a city to its founder - makes you LOSE warmongering points **/
|
/* Liberating is returning a city to its founder - makes you LOSE warmongering points **/
|
||||||
fun liberateCity(conqueringCiv: CivilizationInfo) = CityInfoConquestFunctions(this).liberateCity(conqueringCiv)
|
fun liberateCity(conqueringCiv: CivilizationInfo) =
|
||||||
|
CityInfoConquestFunctions(this).liberateCity(conqueringCiv)
|
||||||
|
|
||||||
fun moveToCiv(newCivInfo: CivilizationInfo) = CityInfoConquestFunctions(this).moveToCiv(newCivInfo)
|
fun moveToCiv(newCivInfo: CivilizationInfo) =
|
||||||
|
CityInfoConquestFunctions(this).moveToCiv(newCivInfo)
|
||||||
|
|
||||||
internal fun tryUpdateRoadStatus() {
|
internal fun tryUpdateRoadStatus() {
|
||||||
if (getCenterTile().roadStatus == RoadStatus.None) {
|
if (getCenterTile().roadStatus == RoadStatus.None) {
|
||||||
@ -535,7 +574,8 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGoldForSellingBuilding(buildingName: String) = getRuleset().buildings[buildingName]!!.cost / 10
|
fun getGoldForSellingBuilding(buildingName: String) =
|
||||||
|
getRuleset().buildings[buildingName]!!.cost / 10
|
||||||
|
|
||||||
fun sellBuilding(buildingName: String) {
|
fun sellBuilding(buildingName: String) {
|
||||||
cityConstructions.removeBuilding(buildingName)
|
cityConstructions.removeBuilding(buildingName)
|
||||||
@ -558,25 +598,23 @@ class CityInfo {
|
|||||||
There's a lot of triggering going on here.
|
There's a lot of triggering going on here.
|
||||||
*/
|
*/
|
||||||
private fun triggerCitiesSettledNearOtherCiv() {
|
private fun triggerCitiesSettledNearOtherCiv() {
|
||||||
val citiesWithin6Tiles = civInfo.gameInfo.civilizations.filter { it.isMajorCiv() && it != civInfo }
|
val citiesWithin6Tiles =
|
||||||
|
civInfo.gameInfo.civilizations.filter { it.isMajorCiv() && it != civInfo }
|
||||||
.flatMap { it.cities }
|
.flatMap { it.cities }
|
||||||
.filter { it.getCenterTile().aerialDistanceTo(getCenterTile()) <= 6 }
|
.filter { it.getCenterTile().aerialDistanceTo(getCenterTile()) <= 6 }
|
||||||
val civsWithCloseCities = citiesWithin6Tiles.map { it.civInfo }.distinct()
|
val civsWithCloseCities = citiesWithin6Tiles.map { it.civInfo }.distinct()
|
||||||
.filter { it.knows(civInfo) && it.exploredTiles.contains(location) }
|
.filter { it.knows(civInfo) && it.exploredTiles.contains(location) }
|
||||||
for (otherCiv in civsWithCloseCities)
|
for (otherCiv in civsWithCloseCities)
|
||||||
otherCiv.getDiplomacyManager(civInfo).setFlag(DiplomacyFlags.SettledCitiesNearUs, 30)
|
otherCiv.getDiplomacyManager(civInfo).setFlag(DiplomacyFlags.SettledCitiesNearUs, 30)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun canPurchase(construction: INonPerpetualConstruction): Boolean {
|
fun canPlaceNewUnit(construction: BaseUnit): Boolean {
|
||||||
if (construction is BaseUnit) {
|
val tile = getCenterTile()
|
||||||
val tile = getCenterTile()
|
return when {
|
||||||
if (construction.isCivilian())
|
construction.isCivilian() -> tile.civilianUnit == null
|
||||||
return tile.civilianUnit == null
|
construction.movesLikeAirUnits() -> tile.airUnits.filter { !it.isTransported }.size < 6
|
||||||
if (construction.movesLikeAirUnits())
|
else -> tile.militaryUnit == null
|
||||||
return tile.airUnits.filter { !it.isTransported }.size < 6
|
|
||||||
else return tile.militaryUnit == null
|
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun matchesFilter(filter: String, viewingCiv: CivilizationInfo = civInfo): Boolean {
|
fun matchesFilter(filter: String, viewingCiv: CivilizationInfo = civInfo): Boolean {
|
||||||
@ -586,18 +624,19 @@ class CityInfo {
|
|||||||
"in all coastal cities" -> isCoastal()
|
"in all coastal cities" -> isCoastal()
|
||||||
"in capital" -> isCapital()
|
"in capital" -> isCapital()
|
||||||
"in all non-occupied cities" -> !cityStats.hasExtraAnnexUnhappiness() || isPuppet
|
"in all non-occupied cities" -> !cityStats.hasExtraAnnexUnhappiness() || isPuppet
|
||||||
"in all cities with a world wonder" -> cityConstructions.getBuiltBuildings().any { it.isWonder }
|
"in all cities with a world wonder" -> cityConstructions.getBuiltBuildings()
|
||||||
|
.any { it.isWonder }
|
||||||
"in all cities connected to capital" -> isConnectedToCapital()
|
"in all cities connected to capital" -> isConnectedToCapital()
|
||||||
"in all cities with a garrison" -> getCenterTile().militaryUnit != null
|
"in all cities with a garrison" -> getCenterTile().militaryUnit != null
|
||||||
"in all cities in which the majority religion is a major religion" ->
|
"in all cities in which the majority religion is a major religion" ->
|
||||||
religion.getMajorityReligionName() != null
|
religion.getMajorityReligionName() != null
|
||||||
&& religion.getMajorityReligion()!!.isMajorReligion()
|
&& religion.getMajorityReligion()!!.isMajorReligion()
|
||||||
"in all cities in which the majority religion is an enhanced religion" ->
|
"in all cities in which the majority religion is an enhanced religion" ->
|
||||||
religion.getMajorityReligionName() != null
|
religion.getMajorityReligionName() != null
|
||||||
&& religion.getMajorityReligion()!!.isEnhancedReligion()
|
&& religion.getMajorityReligion()!!.isEnhancedReligion()
|
||||||
"in non-enemy foreign cities" ->
|
"in non-enemy foreign cities" ->
|
||||||
viewingCiv != civInfo
|
viewingCiv != civInfo
|
||||||
&& !civInfo.isAtWarWith(viewingCiv)
|
&& !civInfo.isAtWarWith(viewingCiv)
|
||||||
"in foreign cities" -> viewingCiv != civInfo
|
"in foreign cities" -> viewingCiv != civInfo
|
||||||
"in annexed cities" -> foundingCiv != civInfo.civName && !isPuppet
|
"in annexed cities" -> foundingCiv != civInfo.civName && !isPuppet
|
||||||
"in holy cities" -> religion.religionThisIsTheHolyCityOf != null
|
"in holy cities" -> religion.religionThisIsTheHolyCityOf != null
|
||||||
@ -628,7 +667,7 @@ class CityInfo {
|
|||||||
// The localUniques might not be filtered when passed as a parameter, so we filter it anyway
|
// The localUniques might not be filtered when passed as a parameter, so we filter it anyway
|
||||||
// The time loss shouldn't be that large I don't think
|
// The time loss shouldn't be that large I don't think
|
||||||
return civInfo.getMatchingUniques(placeholderText, this) +
|
return civInfo.getMatchingUniques(placeholderText, this) +
|
||||||
localUniques.filter { it.placeholderText == placeholderText }
|
localUniques.filter { it.placeholderText == placeholderText }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matching uniques provided by sources in the city itself
|
// Matching uniques provided by sources in the city itself
|
||||||
@ -680,11 +719,12 @@ class CityInfo {
|
|||||||
cityPositionList.add(tile)
|
cityPositionList.add(tile)
|
||||||
|
|
||||||
return cityPositionList.asSequence()
|
return cityPositionList.asSequence()
|
||||||
.map { it.getOwner()?.civName }.filterNotNull().toSet()
|
.map { it.getOwner()?.civName }.filterNotNull()
|
||||||
.distinct().toList()
|
.distinct().toList()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getImprovableTiles(): Sequence<TileInfo> = getTiles()
|
fun getImprovableTiles(): Sequence<TileInfo> = getTiles()
|
||||||
.filter {it.hasViewableResource(civInfo) && it.improvement == null}
|
.filter { it.hasViewableResource(civInfo) && it.improvement == null }
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
}
|
}
|
@ -492,7 +492,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
|
|||||||
!cityScreen.canChangeState -> false
|
!cityScreen.canChangeState -> 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'
|
||||||
!city.canPurchase(construction) -> false // checks room on map for units
|
construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false
|
||||||
city.civInfo.gameInfo.gameParameters.godMode -> true
|
city.civInfo.gameInfo.gameParameters.godMode -> true
|
||||||
constructionBuyCost == 0 -> true
|
constructionBuyCost == 0 -> true
|
||||||
else -> city.getStatReserve(stat) >= constructionBuyCost
|
else -> city.getStatReserve(stat) >= constructionBuyCost
|
||||||
|
Loading…
x
Reference in New Issue
Block a user