mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 15:01:09 -04:00
Resource.building, Building.resourceBonusStats deprecated in favor of '[stats] from [resource] tiles in this city' unique
This commit is contained in:
parent
21aa371cc3
commit
e8bbd4bc70
@ -279,8 +279,6 @@ class ConstructionAutomation(val cityConstructions: CityConstructions){
|
||||
}
|
||||
|
||||
private fun addProductionBuildingChoice() {
|
||||
val hasWaterResource = cityInfo.tilesInRange
|
||||
.any { it.isWater && it.resource!=null && it.position in cityInfo.tiles }
|
||||
val productionBuilding = buildableNotWonders.asSequence()
|
||||
.filter { it.isStatRelated(Stat.Production) }
|
||||
.minByOrNull { it.cost }
|
||||
|
@ -253,16 +253,8 @@ open class TileInfo {
|
||||
stats.add(wonder)
|
||||
}
|
||||
}
|
||||
|
||||
if (hasViewableResource(observingCiv)) {
|
||||
val resource = getTileResource()
|
||||
stats.add(getTileResource()) // resource base
|
||||
if (resource.building != null && city != null && city.cityConstructions.isBuilt(resource.building!!)) {
|
||||
val resourceBuilding = tileMap.gameInfo.ruleSet.buildings[resource.building!!]
|
||||
if (resourceBuilding?.resourceBonusStats != null)
|
||||
stats.add(resourceBuilding.resourceBonusStats!!) // resource-specific building (eg forge, stable) bonus
|
||||
}
|
||||
}
|
||||
// resource base
|
||||
if (hasViewableResource(observingCiv)) stats.add(getTileResource())
|
||||
|
||||
val improvement = getTileImprovement()
|
||||
if (improvement != null)
|
||||
|
@ -64,12 +64,6 @@ class Building : NamedStats(), IConstruction {
|
||||
var replacementTextForUniques = ""
|
||||
val uniqueObjects: List<Unique> by lazy { uniques.map { Unique(it) } }
|
||||
|
||||
/**
|
||||
* The bonus stats that a resource gets when this building is built
|
||||
*/
|
||||
@Deprecated("Since 3.13.3 - replaced with '[stats] from [resource] tiles in this city'")
|
||||
var resourceBonusStats: Stats? = null
|
||||
|
||||
fun getShortDescription(ruleset: Ruleset): String { // should fit in one line
|
||||
val infoList = mutableListOf<String>()
|
||||
val str = getStats(null).toString()
|
||||
@ -77,11 +71,6 @@ class Building : NamedStats(), IConstruction {
|
||||
for (stat in getStatPercentageBonuses(null).toHashMap())
|
||||
if (stat.value != 0f) infoList += "+${stat.value.toInt()}% ${stat.key.name.tr()}"
|
||||
|
||||
val improvedResources = ruleset.tileResources.values.asSequence().filter { it.building == name }.map { it.name.tr() }
|
||||
if (improvedResources.any()) {
|
||||
// buildings that improve resources
|
||||
infoList += improvedResources.joinToString() + " {provide} " + resourceBonusStats.toString()
|
||||
}
|
||||
if (requiredNearbyImprovedResources != null)
|
||||
infoList += "Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city"
|
||||
if (uniques.isNotEmpty()) {
|
||||
@ -152,11 +141,6 @@ class Building : NamedStats(), IConstruction {
|
||||
for ((specialistName, amount) in newSpecialists())
|
||||
stringBuilder.appendLine("+$amount " + "[$specialistName] slots".tr())
|
||||
|
||||
if (resourceBonusStats != null) {
|
||||
val resources = ruleset.tileResources.values.filter { name == it.building }.joinToString { it.name.tr() }
|
||||
stringBuilder.appendLine("$resources {provide} $resourceBonusStats".tr())
|
||||
}
|
||||
|
||||
if (requiredNearbyImprovedResources != null)
|
||||
stringBuilder.appendLine(("Requires worked [" + requiredNearbyImprovedResources!!.joinToString("/") { it.tr() } + "] near city").tr())
|
||||
|
||||
@ -457,7 +441,6 @@ class Building : NamedStats(), IConstruction {
|
||||
fun isStatRelated(stat: Stat): Boolean {
|
||||
if (get(stat) > 0) return true
|
||||
if (getStatPercentageBonuses(null).get(stat) > 0) return true
|
||||
if (resourceBonusStats != null && resourceBonusStats!!.get(stat) > 0) return true
|
||||
if (uniqueObjects.any { it.placeholderText == "[] Per [] Population in this city" && it.stats.get(stat) > 0 }) return true
|
||||
return false
|
||||
}
|
||||
|
@ -12,13 +12,6 @@ class TileResource : NamedStats() {
|
||||
var terrainsCanBeFoundOn: List<String> = listOf()
|
||||
var improvement: String? = null
|
||||
var improvementStats: Stats? = null
|
||||
|
||||
/**
|
||||
* The building that improves this resource, if any. E.G.: Granary for wheat, Stable for cattle.
|
||||
*
|
||||
*/
|
||||
@Deprecated("Since 3.13.3 - replaced with '[stats] from [resource] tiles in this city' unique in the building")
|
||||
var building: String? = null
|
||||
var revealedBy: String? = null
|
||||
var unique: String? = null
|
||||
|
||||
|
@ -46,13 +46,11 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
if (attacker is MapUnitCombatant && attacker.unit.hasUnique("Nuclear weapon")) {
|
||||
val selectedTile = worldScreen.mapHolder.selectedTile
|
||||
if (selectedTile == null) { hide(); return } // no selected tile
|
||||
simulateNuke(attacker as MapUnitCombatant, selectedTile)
|
||||
simulateNuke(attacker, selectedTile)
|
||||
}
|
||||
else {
|
||||
val defender = tryGetDefender()
|
||||
if (defender == null) {
|
||||
hide(); return
|
||||
}
|
||||
if (defender == null) { hide(); return }
|
||||
|
||||
simulateBattle(attacker, defender)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user