Units can promote only if they have movement left and have not attacked

This commit is contained in:
yairm210 2021-11-03 10:23:59 +02:00
parent 05b741b3e5
commit cafbf0d155
2 changed files with 3 additions and 3 deletions

View File

@ -412,7 +412,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
unit.action = null
unit.removeFromTile()
unit.putInTile(destination)
unit.currentMovement -= 1f
unit.useMovementPoints(1f)
unit.attacksThisTurn += 1
// Check if unit maintenance changed
// Is also done for other units, but because we skip everything else, we have to manually check it
@ -466,7 +466,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
// We can assume we can pass through this tile, as we would have broken earlier
if (unit.movement.canMoveTo(tile, assumeCanPassThrough = true)) {
lastReachedEnterableTile = tile
unit.currentMovement -= passingMovementSpent
unit.useMovementPoints(passingMovementSpent)
passingMovementSpent = 0f
}

View File

@ -226,7 +226,7 @@ object UnitActions {
actionList += UnitAction(UnitActionType.Promote,
action = {
UncivGame.Current.setScreen(PromotionPickerScreen(unit))
})
}.takeIf { unit.currentMovement > 0 && unit.attacksThisTurn == 0 })
}
private fun addSetupAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {