Tile resource uniques now work to provide stat bonuses

This commit is contained in:
yairm210 2021-09-17 16:05:21 +03:00
parent 103f1daf36
commit 7e05a56e37
5 changed files with 19 additions and 10 deletions

View File

@ -227,7 +227,7 @@
"gold": 2, "gold": 2,
"improvement": "Quarry", "improvement": "Quarry",
"improvementStats": {"production": 1}, "improvementStats": {"production": 1},
"uniques": ["+15% production towards Wonder construction"] "uniques": ["+[15]% Production when constructing [Wonders]"]
}, },
{ {
"name": "Whales", "name": "Whales",

View File

@ -744,9 +744,7 @@ class CityInfo {
// Note that we don't query religion here, as those only have local effects (for now at least) // Note that we don't query religion here, as those only have local effects (for now at least)
} }
fun isHolyCity(): Boolean { fun isHolyCity(): Boolean = religion.religionThisIsTheHolyCityOf != null
return religion.religionThisIsTheHolyCityOf != null
}
fun canBeDestroyed(justCaptured: Boolean = false): Boolean { fun canBeDestroyed(justCaptured: Boolean = false): Boolean {
return !isOriginalCapital && !isHolyCity() && (!isCapital() || justCaptured) return !isOriginalCapital && !isHolyCity() && (!isCapital() || justCaptured)

View File

@ -93,6 +93,7 @@ class CityStats(val cityInfo: CityInfo) {
return stats return stats
} }
@Deprecated("As of 3.16.16 - replaced by regular getStatPercentBonusesFromUniques()")
private fun getStatPercentBonusesFromResources(construction: IConstruction): Stats { private fun getStatPercentBonusesFromResources(construction: IConstruction): Stats {
val stats = Stats() val stats = Stats()
@ -473,6 +474,9 @@ class CityStats(val cityInfo: CityInfo) {
.plus(cityInfo.cityConstructions.getStatPercentBonuses()) // This function is to be deprecated but it'll take a while. .plus(cityInfo.cityConstructions.getStatPercentBonuses()) // This function is to be deprecated but it'll take a while.
newStatPercentBonusList["Wonders"] = getStatPercentBonusesFromUniques(currentConstruction, cityInfo.civInfo.getCivWideBuildingUniques(cityInfo)) newStatPercentBonusList["Wonders"] = getStatPercentBonusesFromUniques(currentConstruction, cityInfo.civInfo.getCivWideBuildingUniques(cityInfo))
newStatPercentBonusList["Railroads"] = getStatPercentBonusesFromRailroad() // Name chosen same as tech, for translation, but theoretically independent newStatPercentBonusList["Railroads"] = getStatPercentBonusesFromRailroad() // Name chosen same as tech, for translation, but theoretically independent
val resourceUniques = cityInfo.civInfo.getCivResources().asSequence().flatMap { it.resource.uniqueObjects }
newStatPercentBonusList["Resources"] = getStatPercentBonusesFromUniques(currentConstruction, resourceUniques)
// Deprecated as of 3.16.16
newStatPercentBonusList["Resources"] = getStatPercentBonusesFromResources(currentConstruction) newStatPercentBonusList["Resources"] = getStatPercentBonusesFromResources(currentConstruction)
newStatPercentBonusList["National ability"] = getStatPercentBonusesFromNationUnique(currentConstruction) newStatPercentBonusList["National ability"] = getStatPercentBonusesFromNationUnique(currentConstruction)
newStatPercentBonusList["Puppet City"] = getStatPercentBonusesFromPuppetCity() newStatPercentBonusList["Puppet City"] = getStatPercentBonusesFromPuppetCity()

View File

@ -132,11 +132,10 @@ class CivilizationInfo {
*/ */
val temporaryUniques = ArrayList<Pair<Unique, Int>>() val temporaryUniques = ArrayList<Pair<Unique, Int>>()
// Deprecated since 3.16.15 /** Maps the name of the construction to the amount of times bought */
/** Maps the name of the construction to the amount of times bought */ @Deprecated("Deprecated since 3.16.15", replaceWith = ReplaceWith("civWideConstructions.boughtItemsWithIncreasingPrice"))
@Deprecated("Deprecated since 3.16.15", replaceWith = ReplaceWith("civWideConstructions.boughtItemsWithIncreasingPrice")) val boughtConstructionsWithGloballyIncreasingPrice = HashMap<String, Int>()
val boughtConstructionsWithGloballyIncreasingPrice = HashMap<String, Int>()
//
// if we only use lists, and change the list each time the cities are changed, // if we only use lists, and change the list each time the cities are changed,
// we won't get concurrent modification exceptions. // we won't get concurrent modification exceptions.

View File

@ -3,12 +3,20 @@ package com.unciv.models.ruleset
import com.unciv.models.translations.getPlaceholderParameters import com.unciv.models.translations.getPlaceholderParameters
import com.unciv.models.translations.getPlaceholderText import com.unciv.models.translations.getPlaceholderText
enum class UniqueTarget{
/** Buildings, units, nations, policies, religions, techs etc. */
Global,
Building,
Unit,
Improvement,
}
enum class UniqueType(val text:String, val replacedBy: UniqueType? = null) { enum class UniqueType(val text:String, val replacedBy: UniqueType? = null) {
ConsumesResources("Consumes [amount] [resource]"), ConsumesResources("Consumes [amount] [resource]"),
FreeUnits("[amount] units cost no maintenance"), FreeUnits("[amount] units cost no maintenance"),
UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units"), UnitMaintenanceDiscount("[amount]% maintenance costs for [mapUnitFilter] units"),
@Deprecated("As of 3.16.16") @Deprecated("As of 3.16.16", ReplaceWith("UnitMaintenanceDiscount"))
DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs", UnitMaintenanceDiscount), DecreasedUnitMaintenanceCostsByFilter("-[amount]% [mapUnitFilter] unit maintenance costs", UnitMaintenanceDiscount),
@Deprecated("As of 3.16.16") @Deprecated("As of 3.16.16")
DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UnitMaintenanceDiscount), DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UnitMaintenanceDiscount),