From c4c7bfc06d793bcb856b3ed7415bbb1110e20067 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Thu, 6 Feb 2025 20:18:51 -0600 Subject: [PATCH] centeraalized reference to gameboard size --- Systems/Cards/Explosiveboots.gd | 2 +- Systems/Cards/Supernova.gd | 32 +------------------------------- Systems/TileManager.gd | 4 ++-- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/Systems/Cards/Explosiveboots.gd b/Systems/Cards/Explosiveboots.gd index 1be51e5..5cb716c 100644 --- a/Systems/Cards/Explosiveboots.gd +++ b/Systems/Cards/Explosiveboots.gd @@ -34,7 +34,7 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): var target_x = piece_x + dx var target_y = piece_y + dy - if target_x < 0 or target_x >= 8 or target_y < 0 or target_y >= 8: + if target_x < 0 or target_x >= game_state.boardXSize or target_y < 0 or target_y >= game_state.boardYSize: continue if dx == 0 and dy == 0: diff --git a/Systems/Cards/Supernova.gd b/Systems/Cards/Supernova.gd index 90f8d27..47344e3 100644 --- a/Systems/Cards/Supernova.gd +++ b/Systems/Cards/Supernova.gd @@ -42,7 +42,7 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null): var target_y = king_y + dy # Skip if outside board bounds - if target_x < 0 or target_x >= 8 or target_y < 0 or target_y >= 8: + if target_x < 0 or target_x >= game_state.boardXSize or target_y < 0 or target_y >= game_state.boardYSize: continue # Skip king's own position @@ -126,33 +126,3 @@ func remove_effect(): if game_state.is_connected("turn_changed", Callable(self, "on_turn_changed")): game_state.disconnect("turn_changed", Callable(self, "on_turn_changed")) super.remove_effect() - -func update_visual_effect(king, board_flow): - # Could be extended with visual feedback like particles or highlighting - var radius_tiles = [] - var king_pos = king.get_parent().name.split("-") - var king_x = int(king_pos[0]) - var king_y = int(king_pos[1]) - - for x in range(max(0, king_x - CAPTURE_RADIUS), min(8, king_x + CAPTURE_RADIUS + 1)): - for y in range(max(0, king_y - CAPTURE_RADIUS), min(8, king_y + CAPTURE_RADIUS + 1)): - if abs(x - king_x) + abs(y - king_y) <= CAPTURE_RADIUS: - var tile_name = str(x) + "-" + str(y) - radius_tiles.append(board_flow.get_node(tile_name)) - - # Highlight affected tiles briefly - for tile in radius_tiles: - var style = StyleBoxFlat.new() - style.bg_color = Color(1, 0, 0, 0.3) # Red tint - tile.add_theme_stylebox_override("normal", style) - - # Remove highlight after a short delay - var timer = Timer.new() - board_flow.add_child(timer) - timer.wait_time = 0.5 - timer.one_shot = true - timer.timeout.connect(func(): - tile.remove_theme_stylebox_override("normal") - timer.queue_free() - ) - timer.start() diff --git a/Systems/TileManager.gd b/Systems/TileManager.gd index 5973fc8..598b2e5 100644 --- a/Systems/TileManager.gd +++ b/Systems/TileManager.gd @@ -85,8 +85,8 @@ func place_random_game_tiles(num_tiles: int = 6) -> void: return var available_positions = [] - for x in range(8): - for y in range(8): + for x in range(game.boardXSize): + for y in range(game.boardYSize): if y > 1 && y < 6: # Don't place on starting rows available_positions.append(str(x) + "-" + str(y))