Resolved #1230 - sleeping units wake up if there's an enemy nearby

This commit is contained in:
Yair Morgenstern
2019-10-26 21:18:17 +03:00
parent 8151476806
commit ba33e2266d

View File

@ -384,6 +384,13 @@ class MapUnit {
currentMovement = getMaxMovement().toFloat()
attacksThisTurn=0
due = true
// Wake sleeping units if there's an enemy nearby
if(action==Constants.unitActionSleep && currentTile.getTilesInDistance(2).any {
it.militaryUnit!=null && it.militaryUnit!!.civInfo.isAtWarWith(civInfo)
})
action=null
val tileOwner = getTile().getOwner()
if(tileOwner!=null && !civInfo.canEnterTiles(tileOwner) && !tileOwner.isCityState()) // if an enemy city expanded onto this tile while I was in it
movement.teleportToClosestMoveableTile()