Do not wake up a general or a worker if they are protected (#2383)

This commit is contained in:
Jack Rainy 2020-04-11 21:37:40 +03:00 committed by GitHub
parent 84f41341f6
commit 4cc10aa38f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -450,8 +450,9 @@ class MapUnit {
attacksThisTurn = 0
due = true
// Wake sleeping units if there's an enemy nearby
if (isSleeping() && currentTile.getTilesInDistance(2).any {
// Wake sleeping units if there's an enemy nearby and civilian is not protected
if (isSleeping() && (!type.isCivilian() || currentTile.militaryUnit == null) &&
currentTile.getTilesInDistance(2).any {
it.militaryUnit != null && it.militaryUnit!!.civInfo.isAtWarWith(civInfo)
})
action = null