Use unit state for trigger conditionals for gaining new units (#12660)

This commit is contained in:
SeventhM 2024-12-16 00:54:23 -08:00 committed by GitHub
parent e7b73c05cd
commit 7918123a79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,14 +102,14 @@ class UnitManager(val civInfo: Civilization) {
if (!unique.hasTriggerConditional() && unique.conditionalsApply(unit.cache.state)) if (!unique.hasTriggerConditional() && unique.conditionalsApply(unit.cache.state))
UniqueTriggerActivation.triggerUnique(unique, unit, triggerNotificationText = triggerNotificationText) UniqueTriggerActivation.triggerUnique(unique, unit, triggerNotificationText = triggerNotificationText)
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponGainingUnit) for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponGainingUnit, unit.cache.state)
{ unit.matchesFilter(it.params[0]) }) { unit.matchesFilter(it.params[0]) })
UniqueTriggerActivation.triggerUnique(unique, unit, triggerNotificationText = triggerNotificationText) UniqueTriggerActivation.triggerUnique(unique, unit, triggerNotificationText = triggerNotificationText)
if (unit.getResourceRequirementsPerTurn().isNotEmpty()) if (unit.getResourceRequirementsPerTurn().isNotEmpty())
civInfo.cache.updateCivResources() civInfo.cache.updateCivResources()
for (unique in civInfo.getMatchingUniques(UniqueType.LandUnitsCrossTerrainAfterUnitGained)) { for (unique in civInfo.getMatchingUniques(UniqueType.LandUnitsCrossTerrainAfterUnitGained, unit.cache.state)) {
if (unit.matchesFilter(unique.params[1])) { if (unit.matchesFilter(unique.params[1])) {
civInfo.passThroughImpassableUnlocked = true // Update the cached Boolean civInfo.passThroughImpassableUnlocked = true // Update the cached Boolean
civInfo.passableImpassables.add(unique.params[0]) // Add to list of passable impassables civInfo.passableImpassables.add(unique.params[0]) // Add to list of passable impassables