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,
"improvement": "Quarry",
"improvementStats": {"production": 1},
"uniques": ["+15% production towards Wonder construction"]
"uniques": ["+[15]% Production when constructing [Wonders]"]
},
{
"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)
}
fun isHolyCity(): Boolean {
return religion.religionThisIsTheHolyCityOf != null
}
fun isHolyCity(): Boolean = religion.religionThisIsTheHolyCityOf != null
fun canBeDestroyed(justCaptured: Boolean = false): Boolean {
return !isOriginalCapital && !isHolyCity() && (!isCapital() || justCaptured)

View File

@ -93,6 +93,7 @@ class CityStats(val cityInfo: CityInfo) {
return stats
}
@Deprecated("As of 3.16.16 - replaced by regular getStatPercentBonusesFromUniques()")
private fun getStatPercentBonusesFromResources(construction: IConstruction): 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.
newStatPercentBonusList["Wonders"] = getStatPercentBonusesFromUniques(currentConstruction, cityInfo.civInfo.getCivWideBuildingUniques(cityInfo))
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["National ability"] = getStatPercentBonusesFromNationUnique(currentConstruction)
newStatPercentBonusList["Puppet City"] = getStatPercentBonusesFromPuppetCity()

View File

@ -132,11 +132,10 @@ class CivilizationInfo {
*/
val temporaryUniques = ArrayList<Pair<Unique, Int>>()
// Deprecated since 3.16.15
/** Maps the name of the construction to the amount of times bought */
@Deprecated("Deprecated since 3.16.15", replaceWith = ReplaceWith("civWideConstructions.boughtItemsWithIncreasingPrice"))
val boughtConstructionsWithGloballyIncreasingPrice = HashMap<String, Int>()
//
/** Maps the name of the construction to the amount of times bought */
@Deprecated("Deprecated since 3.16.15", replaceWith = ReplaceWith("civWideConstructions.boughtItemsWithIncreasingPrice"))
val boughtConstructionsWithGloballyIncreasingPrice = HashMap<String, Int>()
// if we only use lists, and change the list each time the cities are changed,
// 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.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) {
ConsumesResources("Consumes [amount] [resource]"),
FreeUnits("[amount] units cost no maintenance"),
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),
@Deprecated("As of 3.16.16")
DecreasedUnitMaintenanceCostsGlobally("-[amount]% unit upkeep costs", UnitMaintenanceDiscount),