From 01636c27f0e6eace0420f9987a73cab21e671a12 Mon Sep 17 00:00:00 2001 From: SeventhM <127357473+SeventhM@users.noreply.github.com> Date: Thu, 30 Nov 2023 09:13:24 -0800 Subject: [PATCH] Add "Unable to pillage tiles" unique (#10623) --- core/src/com/unciv/models/ruleset/unique/UniqueType.kt | 1 + .../ui/screens/worldscreen/unit/actions/UnitActionsPillage.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 1d96aefe8a..86669b96f2 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -393,6 +393,7 @@ enum class UniqueType( // Replace with "Withdraws before melee combat "? MayWithdraw("May withdraw before melee ([amount]%)", UniqueTarget.Unit), CannotCaptureCities("Unable to capture cities", UniqueTarget.Unit), + CannotPillage("Unable to pillage tiles", UniqueTarget.Unit), // Movement NoMovementToPillage("No movement cost to pillage", UniqueTarget.Unit, UniqueTarget.Global), diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsPillage.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsPillage.kt index 07e33f49b9..8905754567 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsPillage.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsPillage.kt @@ -118,6 +118,7 @@ object UnitActionsPillage { fun canPillage(unit: MapUnit, tile: Tile): Boolean { if (unit.isTransported) return false if (!tile.canPillageTile()) return false + if (unit.hasUnique(UniqueType.CannotPillage)) return false val tileOwner = tile.getOwner() // Can't pillage friendly tiles, just like you can't attack them - it's an 'act of war' thing return tileOwner == null || unit.civ.isAtWarWith(tileOwner)