safer logic (#8139)

This commit is contained in:
itanasi 2022-12-14 22:53:18 -08:00 committed by GitHub
parent e1afa1e10e
commit 1fb43a805f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -354,7 +354,7 @@ object UnitAutomation {
.filter { it.value.totalDistance < unit.currentMovement }.keys
.filter { unit.movement.canMoveTo(it) && UnitActions.canPillage(unit, it)
&& (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
val tileToPillage = tilesThatCanWalkToAndThenPillage.maxByOrNull { it.getDefensiveBonus() }!!