mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Possibly fixed a bug where replacement buildings would not be granted (#5636)
* Possibly fixed a bug where replacement buildings would not be granted * Fixed tests
This commit is contained in:
parent
010931ca42
commit
eb24a8d364
@ -188,7 +188,7 @@ class CityConstructions {
|
||||
|
||||
// Civ-level uniques - for these only add free buildings from each city to itself to avoid weirdness on city conquest
|
||||
for (unique in cityInfo.civInfo.getMatchingUniques(UniqueType.GainFreeBuildings, stateForConditionals = StateForConditionals(cityInfo.civInfo, cityInfo))) {
|
||||
val freeBuildingName = unique.params[0]
|
||||
val freeBuildingName = cityInfo.civInfo.getEquivalentBuilding(unique.params[0]).name
|
||||
if (cityInfo.matchesFilter(unique.params[1])) {
|
||||
if (cityInfo.id !in freeBuildingsProvidedFromThisCity)
|
||||
freeBuildingsProvidedFromThisCity[cityInfo.id] = hashSetOf()
|
||||
|
@ -104,7 +104,7 @@ class CivConstructions {
|
||||
private fun addFreeBuilding(cityId: String, building: String) {
|
||||
if (!freeBuildings.containsKey(cityId))
|
||||
freeBuildings[cityId] = hashSetOf()
|
||||
freeBuildings[cityId]!!.add(building)
|
||||
freeBuildings[cityId]!!.add(civInfo.getEquivalentBuilding(building).name)
|
||||
}
|
||||
|
||||
private fun addFreeStatsBuildings() {
|
||||
@ -116,7 +116,7 @@ class CivConstructions {
|
||||
|
||||
// Deprecated since 3.16.15
|
||||
statUniquesData[Stat.Culture] = (statUniquesData[Stat.Culture] ?: 0) +
|
||||
civInfo.getMatchingUniques("Immediately creates the cheapest available cultural building in each of your first [] cities for free")
|
||||
civInfo.getMatchingUniques(UniqueType.FreeStatBuildingsDeprecated)
|
||||
.sumOf { it.params[0].toInt() }
|
||||
//
|
||||
|
||||
@ -141,7 +141,7 @@ class CivConstructions {
|
||||
private fun addFreeSpecificBuildings() {
|
||||
val buildingsUniquesData = (civInfo.getMatchingUniques(UniqueType.FreeSpecificBuildings)
|
||||
// Deprecated since 3.16.15
|
||||
+ civInfo.getMatchingUniques("Immediately creates a [] in each of your first [] cities for free")
|
||||
+ civInfo.getMatchingUniques(UniqueType.FreeSpecificBuildingsDeprecated)
|
||||
//
|
||||
).groupBy { it.params[0] }
|
||||
.mapValues { unique -> unique.value.sumOf { it.params[1].toInt() } }
|
||||
|
@ -424,6 +424,11 @@ 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"))
|
||||
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"))
|
||||
FreeSpecificBuildingsDeprecated("Immediately creates a [buildingName] in each of your first [amount] cities for free", UniqueTarget.Global),
|
||||
|
||||
///////////////////////////////////////////// META /////////////////////////////////////////////
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user