Add the SellBuilding Unique (#10514)

* Restored the SellBuilding Unique

* Rephrased SellBuilding unique
This commit is contained in:
PLynx 2023-11-20 21:47:47 +01:00 committed by GitHub
parent 1744d1271f
commit e67fd6a28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View File

@ -687,6 +687,26 @@ object UniqueTriggerActivation {
return true
}
UniqueType.SellBuilding -> {
val applicableCities = civInfo.cities.asSequence().filter {
it.matchesFilter(unique.params[1])
}
for (applicableCity in applicableCities) {
val buildingsToSell = applicableCity.cityConstructions.getBuiltBuildings().filter {
it.matchesFilter(unique.params[0]) && it.isSellable()
}
for (building in buildingsToSell) {
applicableCity.sellBuilding(building)
}
}
return true
}
else -> {}
}
return false

View File

@ -133,6 +133,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
GainFreeBuildings("Gain a free [buildingName] [cityFilter]", UniqueTarget.Global, UniqueTarget.Triggerable),
BuildingMaintenance("[relativeAmount]% maintenance cost for buildings [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),
RemoveBuilding("Remove [buildingFilter] [cityFilter]", UniqueTarget.Global, UniqueTarget.Triggerable),
SellBuilding("Sell [buildingFilter] buildings [cityFilter]", UniqueTarget.Global, UniqueTarget.Triggerable),
/// Border growth
BorderGrowthPercentage("[relativeAmount]% Culture cost of natural border growth [cityFilter]", UniqueTarget.Global, UniqueTarget.FollowerBelief),

View File

@ -18,6 +18,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Triggerable, Global
??? example "Sell [buildingFilter] [cityFilter]"
Example: "Sell [Culture] [in all cities]"
Applicable to: Triggerable, Global
??? example "Free [unit] appears"
Example: "Free [Musketman] appears"