Fixed a bug where citadels did not damage nearby units (#5941)

* Fixed a bug where citadels did not damage nearby units

* Fixed tests
This commit is contained in:
Xander Lenstra
2022-01-10 22:32:48 +01:00
committed by GitHub
parent 0349e0a776
commit 93a109b082
3 changed files with 9 additions and 5 deletions

View File

@ -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

View File

@ -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),

View File

@ -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