mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Disabled pillaging your own tiles (#4882)
This commit is contained in:
parent
0436e67342
commit
0ce033b3a9
@ -232,7 +232,6 @@ object UnitAutomation {
|
||||
val tilesThatCanWalkToAndThenPillage = unitDistanceToTiles
|
||||
.filter { it.value.totalDistance < unit.currentMovement }.keys
|
||||
.filter { unit.movement.canMoveTo(it) && UnitActions.canPillage(unit, it) }
|
||||
.filter { it.getOwner() != unit.civInfo }
|
||||
|
||||
if (tilesThatCanWalkToAndThenPillage.isEmpty()) return false
|
||||
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it: TileInfo -> it.getDefensiveBonus() }!!
|
||||
|
@ -265,7 +265,7 @@ object UnitActions {
|
||||
|
||||
fun getPillageAction(unit: MapUnit): UnitAction? {
|
||||
val tile = unit.currentTile
|
||||
if (unit.isCivilian() || tile.improvement == null) return null
|
||||
if (unit.isCivilian() || tile.improvement == null || tile.getOwner() == unit.civInfo) return null
|
||||
|
||||
return UnitAction(UnitActionType.Pillage,
|
||||
action = {
|
||||
@ -632,7 +632,7 @@ object UnitActions {
|
||||
if (tileImprovement == null || tileImprovement.hasUnique("Unpillagable")) 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 || tileOwner == unit.civInfo || unit.civInfo.isAtWarWith(tileOwner)
|
||||
return tileOwner == null || unit.civInfo.isAtWarWith(tileOwner)
|
||||
}
|
||||
|
||||
private fun addGiftAction(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
|
||||
|
Loading…
Reference in New Issue
Block a user