mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
Add "Unable to pillage tiles" unique (#10623)
This commit is contained in:
@ -393,6 +393,7 @@ enum class UniqueType(
|
|||||||
// Replace with "Withdraws before melee combat <with [amount]% chance>"?
|
// Replace with "Withdraws before melee combat <with [amount]% chance>"?
|
||||||
MayWithdraw("May withdraw before melee ([amount]%)", UniqueTarget.Unit),
|
MayWithdraw("May withdraw before melee ([amount]%)", UniqueTarget.Unit),
|
||||||
CannotCaptureCities("Unable to capture cities", UniqueTarget.Unit),
|
CannotCaptureCities("Unable to capture cities", UniqueTarget.Unit),
|
||||||
|
CannotPillage("Unable to pillage tiles", UniqueTarget.Unit),
|
||||||
|
|
||||||
// Movement
|
// Movement
|
||||||
NoMovementToPillage("No movement cost to pillage", UniqueTarget.Unit, UniqueTarget.Global),
|
NoMovementToPillage("No movement cost to pillage", UniqueTarget.Unit, UniqueTarget.Global),
|
||||||
|
@ -118,6 +118,7 @@ object UnitActionsPillage {
|
|||||||
fun canPillage(unit: MapUnit, tile: Tile): Boolean {
|
fun canPillage(unit: MapUnit, tile: Tile): Boolean {
|
||||||
if (unit.isTransported) return false
|
if (unit.isTransported) return false
|
||||||
if (!tile.canPillageTile()) return false
|
if (!tile.canPillageTile()) return false
|
||||||
|
if (unit.hasUnique(UniqueType.CannotPillage)) return false
|
||||||
val tileOwner = tile.getOwner()
|
val tileOwner = tile.getOwner()
|
||||||
// Can't pillage friendly tiles, just like you can't attack them - it's an 'act of war' thing
|
// 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)
|
return tileOwner == null || unit.civ.isAtWarWith(tileOwner)
|
||||||
|
Reference in New Issue
Block a user