From ff180174f08c1bddf04fc8e9e27d4ce5b6f1cd8e Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Thu, 6 Feb 2025 22:05:45 -0600 Subject: [PATCH] Fixed game lockup if no valid moves left on multimove turn --- Systems/Cards/Explosiveboots.gd | 2 +- Systems/StateMachine/GameStates/Movement.gd | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Systems/Cards/Explosiveboots.gd b/Systems/Cards/Explosiveboots.gd index 35001c7..30059c0 100644 --- a/Systems/Cards/Explosiveboots.gd +++ b/Systems/Cards/Explosiveboots.gd @@ -8,7 +8,7 @@ func _init(): cardName = "Explosive Boots" rank = Rank.RANK_2 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"] remaining_turns = duration diff --git a/Systems/StateMachine/GameStates/Movement.gd b/Systems/StateMachine/GameStates/Movement.gd index 981b3c1..30c5560 100644 --- a/Systems/StateMachine/GameStates/Movement.gd +++ b/Systems/StateMachine/GameStates/Movement.gd @@ -60,7 +60,7 @@ func handleMovement(location: String) -> void: return 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 @@ -130,12 +130,22 @@ func handleMovement(location: String) -> void: multiMoving = str(piece_id) # game.selectedNode = "" - game.hasMoved = false - game.currentlyMovingPiece = null print("ANOTHER MOVE") game.resetHighlights() if game.selectedNode != "": 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)