More Unique types, with some deprecations

This commit is contained in:
yairm210
2021-11-21 21:08:15 +02:00
parent 59c5d2b10c
commit b23ba40cd0
4 changed files with 7 additions and 16 deletions

View File

@ -77,13 +77,6 @@ class CivConstructions {
.mapValues { unique -> unique.value.sumOf { it.params[1].toInt() } }
.toMutableMap()
// Deprecated since 3.16.15
statUniquesData[Stat.Culture] = (statUniquesData[Stat.Culture] ?: 0) +
civInfo.getMatchingUniques(UniqueType.FreeStatBuildingsDeprecated)
.sumOf { it.params[0].toInt() }
//
for ((stat, amount) in statUniquesData) {
addFreeStatBuildings(stat, amount)
}
@ -102,11 +95,8 @@ class CivConstructions {
}
private fun addFreeSpecificBuildings() {
val buildingsUniquesData = (civInfo.getMatchingUniques(UniqueType.FreeSpecificBuildings)
// Deprecated since 3.16.15
+ civInfo.getMatchingUniques(UniqueType.FreeSpecificBuildingsDeprecated)
//
).groupBy { it.params[0] }
val buildingsUniquesData = civInfo.getMatchingUniques(UniqueType.FreeSpecificBuildings)
.groupBy { it.params[0] }
.mapValues { unique -> unique.value.sumOf { it.params[1].toInt() } }
for ((building, amount) in buildingsUniquesData) {

View File

@ -346,7 +346,8 @@ class MapUnit {
return 1
}
visibilityRange += getMatchingUniques(UniqueType.Sight, checkCivInfoUniques = true).sumOf { it.params[0].toInt() }
visibilityRange += getMatchingUniques(UniqueType.Sight, checkCivInfoUniques = true)
.sumOf { it.params[0].toInt() }
// Deprecated since 3.17.5
for (unique in getMatchingUniques(UniqueType.SightUnits))

View File

@ -364,7 +364,7 @@ open class TileInfo {
return terrain.getMatchingUniques(UniqueType.OverrideFertility).first().params[0].toInt()
else
fertility += terrain.getMatchingUniques(UniqueType.AddFertility)
.sumBy { it.params[0].toInt() }
.sumOf { it.params[0].toInt() }
}
if (isAdjacentToRiver()) fertility += 1
if (isAdjacentToFreshwater) fertility += 1 // meaning total +2 for river

View File

@ -466,9 +466,9 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
FreeStatBuildings("Provides the cheapest [stat] building in your first [amount] cities for free", UniqueTarget.Global), // used in Policy
FreeSpecificBuildings("Provides a [buildingName] in your first [amount] cities for free", UniqueTarget.Global), // used in Policy
@Deprecated("As of 3.16.15", ReplaceWith("Provides the cheapest [stat] building in your first [amount] cities for free"))
@Deprecated("As of 3.16.15 - removed 3.18.4", ReplaceWith("Provides the cheapest [stat] building in your first [amount] cities for free"), DeprecationLevel.ERROR)
FreeStatBuildingsDeprecated("Immediately creates the cheapest available cultural building in each of your first [amount] cities for free", UniqueTarget.Global),
@Deprecated("As of 3.16.15", ReplaceWith("Provides a [buildingName] in your first [amount] cities for free"))
@Deprecated("As of 3.16.15 - removed 3.18.4", ReplaceWith("Provides a [buildingName] in your first [amount] cities for free"), DeprecationLevel.ERROR)
FreeSpecificBuildingsDeprecated("Immediately creates a [buildingName] in each of your first [amount] cities for free", UniqueTarget.Global),
///////////////////////////////////////////// META /////////////////////////////////////////////