diff --git a/Systems/Cards/Drunkdriving.gd b/Systems/Cards/Drunkdriving.gd index 1a55a35..ea71bdf 100644 --- a/Systems/Cards/Drunkdriving.gd +++ b/Systems/Cards/Drunkdriving.gd @@ -32,8 +32,22 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): tiles_to_check.append(str(current_x) + "-" + str(y)) y += y_direction + # Find final position (stop before any impassable tile) + var final_y = target_y + for tile_name in tiles_to_check: + var tile = game_state.tileManager.get_tile(tile_name) + if tile && !tile.passable: + # Stop at the tile before this one + var tile_y = int(tile_name.split("-")[1]) + final_y = tile_y - y_direction + break # Process pieces in path for tile_name in tiles_to_check: + var tile_y = int(tile_name.split("-")[1]) + # Only process tiles up to where we're stopping + if (y_direction > 0 && tile_y > final_y) || (y_direction < 0 && tile_y < final_y): + break + var container = board_flow.get_node(tile_name) as PieceContainer if container.has_piece(): var piece_to_capture = container.get_piece() @@ -41,7 +55,8 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): container.remove_piece() # Move piece to final position - var final_container = board_flow.get_node(str(current_x) + "-" + str(target_y)) as PieceContainer + var final_container = board_flow.get_node(str(current_x) + "-" + str(final_y)) as PieceContainer + # Important: Need to remove the piece from its current container first # AND keep a reference to it