Fixed game lockup if no valid moves left on multimove turn

This commit is contained in:
2ManyProjects 2025-02-06 22:05:45 -06:00
parent 531a8c3588
commit ff180174f0
2 changed files with 14 additions and 4 deletions

View file

@ -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

View file

@ -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)