Fixed game lockup if no valid moves left on multimove turn
This commit is contained in:
parent
531a8c3588
commit
ff180174f0
2 changed files with 14 additions and 4 deletions
|
|
@ -8,7 +8,7 @@ func _init():
|
||||||
cardName = "Explosive Boots"
|
cardName = "Explosive Boots"
|
||||||
rank = Rank.RANK_2
|
rank = Rank.RANK_2
|
||||||
effectType = EffectType.PIECE_EFFECT
|
effectType = EffectType.PIECE_EFFECT
|
||||||
description = "All enemy units within 1 radius of the moving peice are captured"
|
description = "All enemy units within 1 radius of the moving peice at the end of the turn are captured"
|
||||||
unitWhitelist = ["Pawn", "Knight", "King"]
|
unitWhitelist = ["Pawn", "Knight", "King"]
|
||||||
remaining_turns = duration
|
remaining_turns = duration
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ func handleMovement(location: String) -> void:
|
||||||
return
|
return
|
||||||
|
|
||||||
var piece_id = piece.get_instance_id()
|
var piece_id = piece.get_instance_id()
|
||||||
print(piece_id)
|
|
||||||
var is_multi_moving = piece_id in moves_remaining and moves_remaining[piece_id] > 1
|
var is_multi_moving = piece_id in moves_remaining and moves_remaining[piece_id] > 1
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -130,12 +130,22 @@ func handleMovement(location: String) -> void:
|
||||||
multiMoving = str(piece_id)
|
multiMoving = str(piece_id)
|
||||||
|
|
||||||
# game.selectedNode = ""
|
# game.selectedNode = ""
|
||||||
game.hasMoved = false
|
|
||||||
game.currentlyMovingPiece = null
|
|
||||||
print("ANOTHER MOVE")
|
print("ANOTHER MOVE")
|
||||||
game.resetHighlights()
|
game.resetHighlights()
|
||||||
if game.selectedNode != "":
|
if game.selectedNode != "":
|
||||||
game.getMovableAreas()
|
game.getMovableAreas()
|
||||||
|
if game.areas.size() == 0 and game.specialArea.size() == 0:
|
||||||
|
print("Consuming move because no valid moves left")
|
||||||
|
# handleRegularMove(node, true)
|
||||||
|
game.resolveMoveEffects()
|
||||||
|
multiMoving = ""
|
||||||
|
game.clearSelection()
|
||||||
|
if piece_id in moves_remaining:
|
||||||
|
moves_remaining.erase(piece_id)
|
||||||
|
finished.emit(Constants.POST_MOVE)
|
||||||
|
else:
|
||||||
|
game.hasMoved = false
|
||||||
|
game.currentlyMovingPiece = null
|
||||||
# finished.emit(Constants.POST_MOVE)
|
# finished.emit(Constants.POST_MOVE)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue