Added building trigger with city filter

This commit is contained in:
Yair Morgenstern 2023-01-16 23:02:48 +02:00
parent 239a6e238f
commit d07c77fa2b
2 changed files with 11 additions and 2 deletions

View File

@ -442,10 +442,17 @@ class CityConstructions : IsPartOfGameInfoSerialization {
}
}
if (construction is Building)
if (construction is Building){
for (unique in cityInfo.civInfo.getTriggeredUniques(UniqueType.TriggerUponConstructingBuilding, StateForConditionals(cityInfo.civInfo, cityInfo)))
if (unique.conditionals.any {it.type == UniqueType.TriggerUponConstructingBuilding && construction.matchesFilter(it.params[0])})
UniqueTriggerActivation.triggerCivwideUnique(unique, cityInfo.civInfo, cityInfo)
for (unique in cityInfo.civInfo.getTriggeredUniques(UniqueType.TriggerUponConstructingBuildingCityFilter, StateForConditionals(cityInfo.civInfo, cityInfo)))
if (unique.conditionals.any {it.type == UniqueType.TriggerUponConstructingBuildingCityFilter
&& construction.matchesFilter(it.params[0])
&& cityInfo.matchesFilter(it.params[1])})
UniqueTriggerActivation.triggerCivwideUnique(unique, cityInfo.civInfo, cityInfo)
}
}
fun addBuilding(buildingName: String) {

View File

@ -706,10 +706,12 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
TriggerUponEnteringGoldenAge("upon entering a Golden Age", UniqueTarget.TriggerCondition),
TriggerUponConqueringCity("upon conquering a city", UniqueTarget.TriggerCondition),
TriggerUponConstructingBuilding("upon constructing [buildingFilter]", UniqueTarget.TriggerCondition),
// Not auto cityfiltered, since 'in all cities' can be read 'only if it's in all cities'
TriggerUponConstructingBuildingCityFilter("upon constructing [buildingFilter] [cityFilter]", UniqueTarget.TriggerCondition),
TriggerUponFoundingPantheon("upon founding a Pantheon", UniqueTarget.TriggerCondition),
TriggerUponFoundingReligion("upon founding a Religion", UniqueTarget.TriggerCondition),
TriggerUponEnhancingReligion("upon enahncing a Religion", UniqueTarget.TriggerCondition),
TriggerUponEnhancingReligion("upon enhancing a Religion", UniqueTarget.TriggerCondition),
//endregion