mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Add Friendly keyword
This commit is contained in:
parent
13d0c3c025
commit
3378f01e97
@ -1663,7 +1663,7 @@
|
|||||||
"unitType": "Civilian Water",
|
"unitType": "Civilian Water",
|
||||||
"uniques": [
|
"uniques": [
|
||||||
"[+15]% Strength bonus for [{Military} {Water}] units within [2] tiles",
|
"[+15]% Strength bonus for [{Military} {Water}] units within [2] tiles",
|
||||||
"[Every adjacent [Water] unit] heals [100] HP <by consuming this unit>",
|
"[Every adjacent [{Friendly} {Water}] unit] heals [100] HP <by consuming this unit>",
|
||||||
"Can be earned through combat",
|
"Can be earned through combat",
|
||||||
"Is part of Great Person group [Admiral]",
|
"Is part of Great Person group [Admiral]",
|
||||||
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
"Great Person - [War]", "Unbuildable", "Uncapturable"],
|
||||||
|
@ -596,7 +596,6 @@ enum class UniqueParameterType(
|
|||||||
override val staticKnownValues = setOf("Cost", "Strength")
|
override val staticKnownValues = setOf("Cost", "Strength")
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
UnitTriggerTarget("unitTriggerTarget", Constants.thisUnit, "`${Constants.thisUnit}`, `${Constants.targetUnit}`, or `Every adjacent [mapUnitFilter] unit`") {
|
UnitTriggerTarget("unitTriggerTarget", Constants.thisUnit, "`${Constants.thisUnit}`, `${Constants.targetUnit}`, or `Every adjacent [mapUnitFilter] unit`") {
|
||||||
override val staticKnownValues = setOf(Constants.thisUnit, Constants.targetUnit)
|
override val staticKnownValues = setOf(Constants.thisUnit, Constants.targetUnit)
|
||||||
|
|
||||||
@ -605,10 +604,11 @@ enum class UniqueParameterType(
|
|||||||
// Every adjacent [mapUnitFilter] unit
|
// Every adjacent [mapUnitFilter] unit
|
||||||
if (parameterText.startsWith("Every adjacent [") && parameterText.endsWith("] unit")) {
|
if (parameterText.startsWith("Every adjacent [") && parameterText.endsWith("] unit")) {
|
||||||
val params = parameterText.getPlaceholderParameters()
|
val params = parameterText.getPlaceholderParameters()
|
||||||
return MapUnitFilter.isKnownValue(params[0], ruleset)
|
return MultiFilter.multiFilter(params[0], { MapUnitFilter.isKnownValue(it, ruleset) }, true)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
override fun getErrorSeverity(parameterText: String, ruleset: Ruleset) = getErrorSeverityForFilter(parameterText, ruleset)
|
||||||
},
|
},
|
||||||
|
|
||||||
/** Mod declarative compatibility: Define Mod relations by their name. */
|
/** Mod declarative compatibility: Define Mod relations by their name. */
|
||||||
|
@ -124,14 +124,14 @@ object UniqueTriggerActivation {
|
|||||||
val ruleset = civInfo.gameInfo.ruleset
|
val ruleset = civInfo.gameInfo.ruleset
|
||||||
|
|
||||||
// Allow iterating through all unit targets, if needed.
|
// Allow iterating through all unit targets, if needed.
|
||||||
if (unique.type?.targetTypes?.contains(UniqueTarget.UnitTriggerable) == true && !unitTriggerableIteration && tile != null
|
if (unique.type?.targetTypes?.contains(UniqueTarget.UnitTriggerable) == true && !unitTriggerableIteration && tile != null &&
|
||||||
!UniqueParameterType.UnitTriggerTarget.staticKnownValues.contains(unique.params[0])) {
|
!UniqueParameterType.UnitTriggerTarget.staticKnownValues.contains(unique.params[0])) {
|
||||||
// Every adjacent [mapUnitFilter] unit
|
// Every adjacent [mapUnitFilter] unit
|
||||||
val triggerFunctions = tile.getTilesInDistance(1) // Adjacent
|
val triggerFunctions = tile.getTilesInDistance(1) // Adjacent
|
||||||
.flatMap { it.getUnits() }
|
.flatMap { it.getUnits() }
|
||||||
.filter {
|
.filter {
|
||||||
val mapUnitFilter = unique.params[0]?.getPlaceholderParameters()?.firstOrNull()
|
val mapUnitFilter = unique.params[0]?.getPlaceholderParameters()?.firstOrNull()
|
||||||
if (mapUnitFilter != null) it.matchesFilter(filterParam, gameContext) else false
|
if (mapUnitFilter != null) it.matchesFilter(mapUnitFilter, gameContext) else false
|
||||||
}
|
}
|
||||||
.mapNotNull { getTriggerFunction(unique, civInfo, city, it, it.getTile(), notification, triggerNotificationText, true) }
|
.mapNotNull { getTriggerFunction(unique, civInfo, city, it, it.getTile(), notification, triggerNotificationText, true) }
|
||||||
if (triggerFunctions.none()) return null
|
if (triggerFunctions.none()) return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user