Added unit conditional support to pillage yield uniques

Added doc note in cached uniques so modders can know ahead of time
See #11060
This commit is contained in:
Yair Morgenstern
2024-02-01 23:02:31 +02:00
parent a8446be6ad
commit 875da6cd48
3 changed files with 24 additions and 1 deletions

View File

@ -139,7 +139,9 @@ class MapUnitCache(private val mapUnit: MapUnit) {
UniqueType.CanEnterForeignTilesButLosesReligiousStrength, UniqueType.CanEnterForeignTilesButLosesReligiousStrength,
// Special - applied in Nation and not here, wshould be moved to mapunitcache as well // Special - applied in Nation and not here, wshould be moved to mapunitcache as well
UniqueType.ForestsAndJunglesAreRoads, UniqueType.ForestsAndJunglesAreRoads,
UniqueType.IgnoreHillMovementCost UniqueType.IgnoreHillMovementCost,
// Movement algorithm avoids damage on route, meaning terrain damage requires caching
UniqueType.DamagesContainingUnits
) )
} }
} }

View File

@ -1,5 +1,6 @@
package com.unciv.app.desktop package com.unciv.app.desktop
import com.unciv.logic.map.mapunit.MapUnitCache
import com.unciv.models.ruleset.unique.UniqueParameterType import com.unciv.models.ruleset.unique.UniqueParameterType
import com.unciv.models.ruleset.unique.UniqueTarget import com.unciv.models.ruleset.unique.UniqueTarget
import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.ruleset.unique.UniqueType
@ -66,6 +67,7 @@ class UniqueDocsWriter {
if (targetType.documentationString.isNotEmpty()) if (targetType.documentationString.isNotEmpty())
lines += "!!! note \"\"\n\n ${targetType.documentationString}\n" lines += "!!! note \"\"\n\n ${targetType.documentationString}\n"
for (uniqueType in uniqueTypes) { for (uniqueType in uniqueTypes) {
if (uniqueType.getDeprecationAnnotation() != null) continue if (uniqueType.getDeprecationAnnotation() != null) continue
@ -82,6 +84,9 @@ class UniqueDocsWriter {
val paramExamples = uniqueType.parameterTypeMap.map { it.first().docExample }.toTypedArray() val paramExamples = uniqueType.parameterTypeMap.map { it.first().docExample }.toTypedArray()
lines += "\tExample: \"${uniqueText.fillPlaceholders(*paramExamples)}\"\n" lines += "\tExample: \"${uniqueText.fillPlaceholders(*paramExamples)}\"\n"
} }
if (uniqueType in MapUnitCache.UnitMovementUniques) {
lines += "Due to performance considerations, this unique is cached, thus conditionals may not work."
}
lines += "\tApplicable to: " + uniqueType.allTargets().sorted().joinToString() lines += "\tApplicable to: " + uniqueType.allTargets().sorted().joinToString()
lines += "" lines += ""
} }

View File

@ -902,11 +902,13 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
??? example "[amount] Movement point cost to disembark" ??? example "[amount] Movement point cost to disembark"
Example: "[3] Movement point cost to disembark" Example: "[3] Movement point cost to disembark"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Global, Unit Applicable to: Global, Unit
??? example "[amount] Movement point cost to embark" ??? example "[amount] Movement point cost to embark"
Example: "[3] Movement point cost to embark" Example: "[3] Movement point cost to embark"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Global, Unit Applicable to: Global, Unit
## Nation uniques ## Nation uniques
@ -924,9 +926,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Nation Applicable to: Nation
??? example "All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel." ??? example "All units move through Forest and Jungle Tiles in friendly territory as if they have roads. These tiles can be used to establish City Connections upon researching the Wheel."
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Nation Applicable to: Nation
??? example "Units ignore terrain costs when moving into any tile with Hills" ??? example "Units ignore terrain costs when moving into any tile with Hills"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Nation Applicable to: Nation
??? example "Excluded from map editor" ??? example "Excluded from map editor"
@ -1399,43 +1403,54 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
Applicable to: Unit Applicable to: Unit
??? example "Cannot move" ??? example "Cannot move"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Double movement in [terrainFilter]" ??? example "Double movement in [terrainFilter]"
Example: "Double movement in [Fresh Water]" Example: "Double movement in [Fresh Water]"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "All tiles cost 1 movement" ??? example "All tiles cost 1 movement"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "May travel on Water tiles without embarking" ??? example "May travel on Water tiles without embarking"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Can pass through impassable tiles" ??? example "Can pass through impassable tiles"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Ignores terrain cost" ??? example "Ignores terrain cost"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Ignores Zone of Control" ??? example "Ignores Zone of Control"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Rough terrain penalty" ??? example "Rough terrain penalty"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Can enter ice tiles" ??? example "Can enter ice tiles"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Cannot enter ocean tiles" ??? example "Cannot enter ocean tiles"
Applicable to: Unit Applicable to: Unit
??? example "May enter foreign tiles without open borders" ??? example "May enter foreign tiles without open borders"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "May enter foreign tiles without open borders, but loses [amount] religious strength each turn it ends there" ??? example "May enter foreign tiles without open borders, but loses [amount] religious strength each turn it ends there"
Example: "May enter foreign tiles without open borders, but loses [3] religious strength each turn it ends there" Example: "May enter foreign tiles without open borders, but loses [3] religious strength each turn it ends there"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Unit Applicable to: Unit
??? example "Never appears as a Barbarian unit" ??? example "Never appears as a Barbarian unit"
@ -1511,6 +1526,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
??? example "Units ending their turn on this terrain take [amount] damage" ??? example "Units ending their turn on this terrain take [amount] damage"
Example: "Units ending their turn on this terrain take [3] damage" Example: "Units ending their turn on this terrain take [3] damage"
Due to performance considerations, this unique is cached, thus conditionals may not work.
Applicable to: Terrain Applicable to: Terrain
??? example "Grants [promotion] ([comment]) to adjacent [mapUnitFilter] units for the rest of the game" ??? example "Grants [promotion] ([comment]) to adjacent [mapUnitFilter] units for the rest of the game"