mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-06 08:21:36 +07:00
safer logic (#8139)
This commit is contained in:
@ -354,7 +354,7 @@ object UnitAutomation {
|
|||||||
.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)
|
||||||
&& (it.canPillageTileImprovement()
|
&& (it.canPillageTileImprovement()
|
||||||
|| (it.canPillageRoad() && it.roadOwner != "" && unit.civInfo.isAtWarWith(it.getRoadOwner()!!)))}
|
|| (it.canPillageRoad() && it.getRoadOwner() != null && unit.civInfo.isAtWarWith(it.getRoadOwner()!!)))}
|
||||||
|
|
||||||
if (tilesThatCanWalkToAndThenPillage.isEmpty()) return false
|
if (tilesThatCanWalkToAndThenPillage.isEmpty()) return false
|
||||||
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it.getDefensiveBonus() }!!
|
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it.getDefensiveBonus() }!!
|
||||||
|
Reference in New Issue
Block a user