mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Units can promote only if they have movement left and have not attacked
This commit is contained in:
parent
05b741b3e5
commit
cafbf0d155
@ -412,7 +412,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
unit.action = null
|
unit.action = null
|
||||||
unit.removeFromTile()
|
unit.removeFromTile()
|
||||||
unit.putInTile(destination)
|
unit.putInTile(destination)
|
||||||
unit.currentMovement -= 1f
|
unit.useMovementPoints(1f)
|
||||||
unit.attacksThisTurn += 1
|
unit.attacksThisTurn += 1
|
||||||
// Check if unit maintenance changed
|
// Check if unit maintenance changed
|
||||||
// Is also done for other units, but because we skip everything else, we have to manually check it
|
// 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
|
// We can assume we can pass through this tile, as we would have broken earlier
|
||||||
if (unit.movement.canMoveTo(tile, assumeCanPassThrough = true)) {
|
if (unit.movement.canMoveTo(tile, assumeCanPassThrough = true)) {
|
||||||
lastReachedEnterableTile = tile
|
lastReachedEnterableTile = tile
|
||||||
unit.currentMovement -= passingMovementSpent
|
unit.useMovementPoints(passingMovementSpent)
|
||||||
passingMovementSpent = 0f
|
passingMovementSpent = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ object UnitActions {
|
|||||||
actionList += UnitAction(UnitActionType.Promote,
|
actionList += UnitAction(UnitActionType.Promote,
|
||||||
action = {
|
action = {
|
||||||
UncivGame.Current.setScreen(PromotionPickerScreen(unit))
|
UncivGame.Current.setScreen(PromotionPickerScreen(unit))
|
||||||
})
|
}.takeIf { unit.currentMovement > 0 && unit.attacksThisTurn == 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addSetupAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {
|
private fun addSetupAction(unit: MapUnit, actionList: ArrayList<UnitAction>) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user