From 93a109b082b7f15665d2aead96ea52a31d291430 Mon Sep 17 00:00:00 2001 From: Xander Lenstra <71121390+xlenstra@users.noreply.github.com> Date: Mon, 10 Jan 2022 22:32:48 +0100 Subject: [PATCH] Fixed a bug where citadels did not damage nearby units (#5941) * Fixed a bug where citadels did not damage nearby units * Fixed tests --- core/src/com/unciv/logic/map/MapUnit.kt | 6 ++++-- core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 4 +++- docs/uniques.md | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/logic/map/MapUnit.kt b/core/src/com/unciv/logic/map/MapUnit.kt index ec217302f1..d431b990d1 100644 --- a/core/src/com/unciv/logic/map/MapUnit.kt +++ b/core/src/com/unciv/logic/map/MapUnit.kt @@ -1054,8 +1054,10 @@ class MapUnit { && it.improvement != null && civInfo.isAtWarWith(it.getOwner()!!) }.map { tile -> - tile to tile.getTileImprovement()!! - .getMatchingUniques(UniqueType.DamagesAdjacentEnemyUnits) + tile to ( + tile.getTileImprovement()!!.getMatchingUniques(UniqueType.DamagesAdjacentEnemyUnits) + + tile.getTileImprovement()!!.getMatchingUniques(UniqueType.DamagesAdjacentEnemyUnitsOld) + ) .sumOf { it.params[0].toInt() } }.maxByOrNull { it.second } ?: return diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index ec8296a849..5be5261bbe 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -386,7 +386,9 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags: DefensiveBonus("Gives a defensive bonus of [amount]%", UniqueTarget.Improvement), ImprovementMaintenance("Costs [amount] gold per turn when in your territory", UniqueTarget.Improvement), // Unused - DamagesAdjacentEnemyUnits("Deal [amount] damage to adjacent enemy units", UniqueTarget.Improvement), + DamagesAdjacentEnemyUnits("Adjacent enemy units ending their turn take [amount] damage", UniqueTarget.Improvement), + @Deprecated("As of 3.18.17", ReplaceWith("Adjacent enemy units ending their turn take [30] damage"), DeprecationLevel.WARNING) + DamagesAdjacentEnemyUnitsOld("Deal [amount] damage to adjacent enemy units", UniqueTarget.Improvement), @Deprecated("As of 3.17.10", ReplaceWith("Adjacent enemy units ending their turn take [30] damage"), DeprecationLevel.WARNING) DamagesAdjacentEnemyUnitsForExactlyThirtyDamage("Deal 30 damage to adjacent enemy units", UniqueTarget.Improvement), diff --git a/docs/uniques.md b/docs/uniques.md index c7414dbd25..c7c7aa0225 100644 --- a/docs/uniques.md +++ b/docs/uniques.md @@ -805,8 +805,8 @@ Example: "Costs [20] gold per turn when in your territory" Applicable to: Improvement -#### Deal [amount] damage to adjacent enemy units -Example: "Deal [20] damage to adjacent enemy units" +#### Adjacent enemy units ending their turn take [30] damage +Example: "Adjacent enemy units ending their turn take [30] damage" Applicable to: Improvement