Add "Unable to pillage tiles" unique (#10623)

This commit is contained in:
SeventhM 2023-11-30 09:13:24 -08:00 committed by GitHub
parent 4be14d77f4
commit 01636c27f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -393,6 +393,7 @@ enum class UniqueType(
// Replace with "Withdraws before melee combat <with [amount]% chance>"?
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),

View File

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