mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Add "Unable to pillage tiles" unique (#10623)
This commit is contained in:
parent
4be14d77f4
commit
01636c27f0
@ -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),
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user