locked preloading to rank 2 and 3

This commit is contained in:
2ManyProjects 2025-03-16 02:42:12 -05:00
parent 6035e8bb6c
commit 3c72b5e6d0
3 changed files with 19 additions and 15 deletions

View file

@ -58,7 +58,8 @@ func initializeStartingBank():
func shuffleDeck():
deck.shuffle()
func drawStartingHand():
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

View file

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

View file

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