mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04: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
|
val tilesThatCanWalkToAndThenPillage = unitDistanceToTiles
|
||||||
.filter { it.value.totalDistance < unit.currentMovement }.keys
|
.filter { it.value.totalDistance < unit.currentMovement }.keys
|
||||||
.filter { unit.movement.canMoveTo(it) && UnitActions.canPillage(unit, it) }
|
.filter { unit.movement.canMoveTo(it) && UnitActions.canPillage(unit, it) }
|
||||||
.filter { it.getOwner() != unit.civInfo }
|
|
||||||
|
|
||||||
if (tilesThatCanWalkToAndThenPillage.isEmpty()) return false
|
if (tilesThatCanWalkToAndThenPillage.isEmpty()) return false
|
||||||
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it: TileInfo -> it.getDefensiveBonus() }!!
|
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it: TileInfo -> it.getDefensiveBonus() }!!
|
||||||
|
@ -265,7 +265,7 @@ object UnitActions {
|
|||||||
|
|
||||||
fun getPillageAction(unit: MapUnit): UnitAction? {
|
fun getPillageAction(unit: MapUnit): UnitAction? {
|
||||||
val tile = unit.currentTile
|
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,
|
return UnitAction(UnitActionType.Pillage,
|
||||||
action = {
|
action = {
|
||||||
@ -632,7 +632,7 @@ object UnitActions {
|
|||||||
if (tileImprovement == null || tileImprovement.hasUnique("Unpillagable")) return false
|
if (tileImprovement == null || tileImprovement.hasUnique("Unpillagable")) 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 || tileOwner == unit.civInfo || unit.civInfo.isAtWarWith(tileOwner)
|
return tileOwner == null || unit.civInfo.isAtWarWith(tileOwner)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addGiftAction(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
|
private fun addGiftAction(unit: MapUnit, actionList: ArrayList<UnitAction>, tile: TileInfo) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user