Sleeping units wake if there's an enemy in 3-tile radius

This commit is contained in:
Yair Morgenstern 2023-01-09 09:08:40 +02:00
parent 6964c66d73
commit cba5ab0b91

View File

@ -878,8 +878,7 @@ class MapUnit : IsPartOfGameInfoSerialization {
// For every double-stacked tile, check if our cohabitant can boost our speed // For every double-stacked tile, check if our cohabitant can boost our speed
for (unit in getTile().getUnits()) for (unit in getTile().getUnits())
{ {
if (unit == this) if (unit == this) continue
continue
if (unit.getMatchingUniques(UniqueType.TransferMovement) if (unit.getMatchingUniques(UniqueType.TransferMovement)
.any { matchesFilter(it.params[0]) } ) .any { matchesFilter(it.params[0]) } )
@ -890,8 +889,8 @@ class MapUnit : IsPartOfGameInfoSerialization {
// Wake sleeping units if there's an enemy in vision range: // Wake sleeping units if there's an enemy in vision range:
// Military units always but civilians only if not protected. // Military units always but civilians only if not protected.
if (isSleeping() && (isMilitary() || (currentTile.militaryUnit == null && !currentTile.isCityCenter())) && if (isSleeping() && (isMilitary() || (currentTile.militaryUnit == null && !currentTile.isCityCenter())) &&
this.viewableTiles.any { this.currentTile.getTilesInDistance(3).any {
it.militaryUnit != null && it.militaryUnit!!.civInfo.isAtWarWith(civInfo) it.militaryUnit != null && it in civInfo.viewableTiles && it.militaryUnit!!.civInfo.isAtWarWith(civInfo)
} }
) )
action = null action = null