Stacked with unit conditional unique (#13406)

* Added Stacked With Unit unique

* Deprecated the old unique

* Fixed a typo in Deprecated annotation

* Added the exception of relevant unit

* Replaced the old unique in ruleset

* Added the missing + sign

* Update android/assets/jsons/Civ V - Gods & Kings/UnitPromotions.json

* Update core/src/com/unciv/models/ruleset/unique/UniqueType.kt

* Swapped the conditions order

---------

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
PLynx 2025-06-15 10:23:16 +02:00 committed by GitHub
parent f39f81d704
commit 686180fe4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 1 deletions

View File

@ -756,7 +756,7 @@
},
{
"name": "[Hakkapeliitta] ability",
"uniques": ["Transfer Movement to [Great General]", "[+15]% Strength when stacked with [Great General]"]
"uniques": ["Transfer Movement to [Great General]", "[+15]% Strength <when stacked with a [Great General] unit>"]
},
{
"name": "[Zero] ability",

View File

@ -246,6 +246,8 @@ object Conditionals {
UniqueType.ConditionalHasNotUsedOtherActions ->
state.unit == null || // So we get the action as a valid action in BaseUnit.hasUnique()
state.unit.abilityToTimesUsed.isEmpty()
UniqueType.ConditionalStackedWithUnit -> state.relevantUnit != null &&
state.relevantUnit!!.getTile().getUnits().any { it != state.relevantUnit && it.matchesFilter(conditional.params[0]) }
UniqueType.ConditionalInTiles ->
state.relevantTile?.matchesFilter(conditional.params[0], state.relevantCiv) == true

View File

@ -395,6 +395,7 @@ enum class UniqueType(
StrengthNearCapital("[relativeAmount]% Strength decreasing with distance from the capital", UniqueTarget.Unit, UniqueTarget.Global),
FlankAttackBonus("[relativeAmount]% to Flank Attack bonuses", UniqueTarget.Unit, UniqueTarget.Global),
StrengthForAdjacentEnemies("[relativeAmount]% Strength for enemy [mapUnitFilter] units in adjacent [tileFilter] tiles", UniqueTarget.Unit),
@Deprecated("As of 4.16.14", ReplaceWith("[relativeAmount]% Strength <when stacked with a [mapUnitFilter] unit>"), DeprecationLevel.WARNING)
StrengthWhenStacked("[relativeAmount]% Strength when stacked with [mapUnitFilter]", UniqueTarget.Unit), // candidate for conditional!
StrengthBonusInRadius("[relativeAmount]% Strength bonus for [mapUnitFilter] units within [amount] tiles", UniqueTarget.Unit),
@ -787,6 +788,7 @@ enum class UniqueType(
ConditionalAboveHP("when above [positiveAmount] HP", UniqueTarget.Conditional),
ConditionalBelowHP("when below [positiveAmount] HP", UniqueTarget.Conditional),
ConditionalHasNotUsedOtherActions("if it hasn't used other actions yet", UniqueTarget.Conditional),
ConditionalStackedWithUnit("when stacked with a [mapUnitFilter] unit", UniqueTarget.Conditional),
/////// tile conditionals
ConditionalNeighborTiles("with [nonNegativeAmount] to [nonNegativeAmount] neighboring [tileFilter] tiles", UniqueTarget.Conditional),

View File

@ -3205,6 +3205,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
??? example "&lt;if it hasn't used other actions yet&gt;"
Applicable to: Conditional
??? example "&lt;when stacked with a [mapUnitFilter] unit&gt;"
Example: "&lt;when stacked with a [Wounded] unit&gt;"
Applicable to: Conditional
??? example "&lt;with [nonNegativeAmount] to [nonNegativeAmount] neighboring [tileFilter] tiles&gt;"
Example: "&lt;with [3] to [3] neighboring [Farm] tiles&gt;"