mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-25 02:16:06 +07:00
Added trigger conditional for constructing building
This commit is contained in:
parent
7c52e25a1d
commit
1c64844c1e
@ -563,7 +563,7 @@ object Battle {
|
||||
for (unique in attackerCiv.getTriggeredUniques(UniqueType.TriggerUponConqueringCity,
|
||||
StateForConditionals(attackerCiv, city, attacker.unit, attackedTile = city.getCenterTile() )
|
||||
))
|
||||
UniqueTriggerActivation.triggerCivwideUnique(unique, attackerCiv)
|
||||
UniqueTriggerActivation.triggerCivwideUnique(unique, attackerCiv, city)
|
||||
}
|
||||
|
||||
fun getMapCombatantOfTile(tile: TileInfo): ICombatant? {
|
||||
|
@ -16,6 +16,7 @@ import com.unciv.models.ruleset.Ruleset
|
||||
import com.unciv.models.ruleset.unique.LocalUniqueCache
|
||||
import com.unciv.models.ruleset.unique.StateForConditionals
|
||||
import com.unciv.models.ruleset.unique.UniqueMap
|
||||
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.stats.Stat
|
||||
@ -440,6 +441,11 @@ class CityConstructions : IsPartOfGameInfoSerialization {
|
||||
NotificationCategory.General, NotificationIcon.Construction, buildingIcon)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fun addBuilding(buildingName: String) {
|
||||
|
@ -705,6 +705,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
TriggerUponDeclaringWar("upon declaring war", UniqueTarget.TriggerCondition),
|
||||
TriggerUponEnteringGoldenAge("upon entering a Golden Age", UniqueTarget.TriggerCondition),
|
||||
TriggerUponConqueringCity("upon conquering a city", UniqueTarget.TriggerCondition),
|
||||
TriggerUponConstructingBuilding("upon constructing [buildingFilter]", UniqueTarget.TriggerCondition),
|
||||
|
||||
//endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user