From 3c72b5e6d01fa94308fa929d574ecfc5e8c62d47 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Sun, 16 Mar 2025 02:42:12 -0500 Subject: [PATCH] locked preloading to rank 2 and 3 --- Systems/DeckManager.gd | 15 ++++++++------- Systems/Game/ChessGame.gd | 17 +++++++++-------- Systems/Game/Menu/MenuContainer.gd | 2 ++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Systems/DeckManager.gd b/Systems/DeckManager.gd index 8ee7b59..4548cf2 100644 --- a/Systems/DeckManager.gd +++ b/Systems/DeckManager.gd @@ -58,13 +58,14 @@ func initializeStartingBank(): func shuffleDeck(): deck.shuffle() -func drawStartingHand(): - for id in preloaded_hand_cards: - var matchCard = func matchCardId(card): - return "id" in card and card.id == id - var cardIndex = deck.find_custom(matchCard.bind()) - if cardIndex != -1: - hand.append(deck.pop_at(cardIndex)) +func drawStartingHand(skip_preload: bool = false): + if !skip_preload: + for id in preloaded_hand_cards: + var matchCard = func matchCardId(card): + return "id" in card and card.id == id + var cardIndex = deck.find_custom(matchCard.bind()) + if cardIndex != -1: + hand.append(deck.pop_at(cardIndex)) for i in range(min(hand_size, deck.size())): drawCard() diff --git a/Systems/Game/ChessGame.gd b/Systems/Game/ChessGame.gd index 8b23356..ce7ea26 100644 --- a/Systems/Game/ChessGame.gd +++ b/Systems/Game/ChessGame.gd @@ -43,6 +43,7 @@ var cpuElo = 1500 var is_initialized: bool = false var currentNode = null; var has_opponent = true; +var mode: String = "vanilla" # Node references @onready var turnIndicator: ColorRect = $TurnIndicator @@ -149,7 +150,7 @@ func _on_new_game_requested(options = {}): print("ChessGame DIMENSIONS ", get_board_dimensions(currentFen)) if is_initialized: resetBoard() - initializeDeckSystem() + initializeDeckSystem(mode == "vanilla") initializeBoard() initializeTiles() if cardDisplay: @@ -158,19 +159,19 @@ func _on_new_game_requested(options = {}): stateMachine.enable() stateMachine.transitionToNextState(Constants.WHITE_TURN) else: - initialize_game_system() + initialize_game_system(mode == "vanilla") if currentFen: stockfishController.start_board(cpuElo, get_board_dimensions(currentFen)) else: stockfishController.start_board(cpuElo, "8x8") resetHighlights() -func initialize_game_system(): +func initialize_game_system(skip_preload: bool = false): print("Initializing game system") # Set up basic styles first setupStyles() # Initialize the game components - initializeGame() + initializeGame(skip_preload) initializeTiles() # Initialize Stockfish controller @@ -201,10 +202,10 @@ func _exit_tree(): stockfishController.disconnect_engine() -func initializeGame() -> void: +func initializeGame(skip_preload: bool = false) -> void: # Initialize all game components in the correct order setupStyles() - initializeDeckSystem() + initializeDeckSystem(skip_preload) initializeCardPreview() initializeBoard() setupCameraController() @@ -256,9 +257,9 @@ func initializeCardPreview() -> void: cardPreview = CardPreview.new() add_child(cardPreview) -func initializeDeckSystem() -> void: +func initializeDeckSystem(skip_preload: bool = false) -> void: deckManager.shuffleDeck() - deckManager.drawStartingHand() + deckManager.drawStartingHand(skip_preload) # Initialize the deck manager and card display if cardDisplay == null: cardDisplay = CardDisplay.new() diff --git a/Systems/Game/Menu/MenuContainer.gd b/Systems/Game/Menu/MenuContainer.gd index a5bd608..9901b7a 100644 --- a/Systems/Game/Menu/MenuContainer.gd +++ b/Systems/Game/Menu/MenuContainer.gd @@ -191,6 +191,7 @@ func _on_vanilla_selected(): print("Vanilla mode selected") if gameMenuScreen: gameMenuScreen.visible = true + game.mode = "vanilla" _on_map_open_requested({"mode": "vanilla", "hand_size": 2, }) # emit_signal("vanilla_mode_selected") @@ -198,6 +199,7 @@ func _on_deeper_selected(): print("Deeper mode selected") if gameMenuScreen: gameMenuScreen.visible = true + game.mode = "deeper" _on_map_open_requested({"mode": "deeper", "hand_size": game.player.hand_size,}) func _on_lobby_shop_open_requested(options):