locked preloading to rank 2 and 3
This commit is contained in:
parent
6035e8bb6c
commit
3c72b5e6d0
3 changed files with 19 additions and 15 deletions
|
|
@ -58,13 +58,14 @@ func initializeStartingBank():
|
||||||
func shuffleDeck():
|
func shuffleDeck():
|
||||||
deck.shuffle()
|
deck.shuffle()
|
||||||
|
|
||||||
func drawStartingHand():
|
func drawStartingHand(skip_preload: bool = false):
|
||||||
for id in preloaded_hand_cards:
|
if !skip_preload:
|
||||||
var matchCard = func matchCardId(card):
|
for id in preloaded_hand_cards:
|
||||||
return "id" in card and card.id == id
|
var matchCard = func matchCardId(card):
|
||||||
var cardIndex = deck.find_custom(matchCard.bind())
|
return "id" in card and card.id == id
|
||||||
if cardIndex != -1:
|
var cardIndex = deck.find_custom(matchCard.bind())
|
||||||
hand.append(deck.pop_at(cardIndex))
|
if cardIndex != -1:
|
||||||
|
hand.append(deck.pop_at(cardIndex))
|
||||||
|
|
||||||
for i in range(min(hand_size, deck.size())):
|
for i in range(min(hand_size, deck.size())):
|
||||||
drawCard()
|
drawCard()
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ var cpuElo = 1500
|
||||||
var is_initialized: bool = false
|
var is_initialized: bool = false
|
||||||
var currentNode = null;
|
var currentNode = null;
|
||||||
var has_opponent = true;
|
var has_opponent = true;
|
||||||
|
var mode: String = "vanilla"
|
||||||
|
|
||||||
# Node references
|
# Node references
|
||||||
@onready var turnIndicator: ColorRect = $TurnIndicator
|
@onready var turnIndicator: ColorRect = $TurnIndicator
|
||||||
|
|
@ -149,7 +150,7 @@ func _on_new_game_requested(options = {}):
|
||||||
print("ChessGame DIMENSIONS ", get_board_dimensions(currentFen))
|
print("ChessGame DIMENSIONS ", get_board_dimensions(currentFen))
|
||||||
if is_initialized:
|
if is_initialized:
|
||||||
resetBoard()
|
resetBoard()
|
||||||
initializeDeckSystem()
|
initializeDeckSystem(mode == "vanilla")
|
||||||
initializeBoard()
|
initializeBoard()
|
||||||
initializeTiles()
|
initializeTiles()
|
||||||
if cardDisplay:
|
if cardDisplay:
|
||||||
|
|
@ -158,19 +159,19 @@ func _on_new_game_requested(options = {}):
|
||||||
stateMachine.enable()
|
stateMachine.enable()
|
||||||
stateMachine.transitionToNextState(Constants.WHITE_TURN)
|
stateMachine.transitionToNextState(Constants.WHITE_TURN)
|
||||||
else:
|
else:
|
||||||
initialize_game_system()
|
initialize_game_system(mode == "vanilla")
|
||||||
if currentFen:
|
if currentFen:
|
||||||
stockfishController.start_board(cpuElo, get_board_dimensions(currentFen))
|
stockfishController.start_board(cpuElo, get_board_dimensions(currentFen))
|
||||||
else:
|
else:
|
||||||
stockfishController.start_board(cpuElo, "8x8")
|
stockfishController.start_board(cpuElo, "8x8")
|
||||||
resetHighlights()
|
resetHighlights()
|
||||||
func initialize_game_system():
|
func initialize_game_system(skip_preload: bool = false):
|
||||||
print("Initializing game system")
|
print("Initializing game system")
|
||||||
# Set up basic styles first
|
# Set up basic styles first
|
||||||
setupStyles()
|
setupStyles()
|
||||||
|
|
||||||
# Initialize the game components
|
# Initialize the game components
|
||||||
initializeGame()
|
initializeGame(skip_preload)
|
||||||
initializeTiles()
|
initializeTiles()
|
||||||
|
|
||||||
# Initialize Stockfish controller
|
# Initialize Stockfish controller
|
||||||
|
|
@ -201,10 +202,10 @@ func _exit_tree():
|
||||||
stockfishController.disconnect_engine()
|
stockfishController.disconnect_engine()
|
||||||
|
|
||||||
|
|
||||||
func initializeGame() -> void:
|
func initializeGame(skip_preload: bool = false) -> void:
|
||||||
# Initialize all game components in the correct order
|
# Initialize all game components in the correct order
|
||||||
setupStyles()
|
setupStyles()
|
||||||
initializeDeckSystem()
|
initializeDeckSystem(skip_preload)
|
||||||
initializeCardPreview()
|
initializeCardPreview()
|
||||||
initializeBoard()
|
initializeBoard()
|
||||||
setupCameraController()
|
setupCameraController()
|
||||||
|
|
@ -256,9 +257,9 @@ func initializeCardPreview() -> void:
|
||||||
cardPreview = CardPreview.new()
|
cardPreview = CardPreview.new()
|
||||||
add_child(cardPreview)
|
add_child(cardPreview)
|
||||||
|
|
||||||
func initializeDeckSystem() -> void:
|
func initializeDeckSystem(skip_preload: bool = false) -> void:
|
||||||
deckManager.shuffleDeck()
|
deckManager.shuffleDeck()
|
||||||
deckManager.drawStartingHand()
|
deckManager.drawStartingHand(skip_preload)
|
||||||
# Initialize the deck manager and card display
|
# Initialize the deck manager and card display
|
||||||
if cardDisplay == null:
|
if cardDisplay == null:
|
||||||
cardDisplay = CardDisplay.new()
|
cardDisplay = CardDisplay.new()
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,7 @@ func _on_vanilla_selected():
|
||||||
print("Vanilla mode selected")
|
print("Vanilla mode selected")
|
||||||
if gameMenuScreen:
|
if gameMenuScreen:
|
||||||
gameMenuScreen.visible = true
|
gameMenuScreen.visible = true
|
||||||
|
game.mode = "vanilla"
|
||||||
_on_map_open_requested({"mode": "vanilla", "hand_size": 2, })
|
_on_map_open_requested({"mode": "vanilla", "hand_size": 2, })
|
||||||
# emit_signal("vanilla_mode_selected")
|
# emit_signal("vanilla_mode_selected")
|
||||||
|
|
||||||
|
|
@ -198,6 +199,7 @@ func _on_deeper_selected():
|
||||||
print("Deeper mode selected")
|
print("Deeper mode selected")
|
||||||
if gameMenuScreen:
|
if gameMenuScreen:
|
||||||
gameMenuScreen.visible = true
|
gameMenuScreen.visible = true
|
||||||
|
game.mode = "deeper"
|
||||||
_on_map_open_requested({"mode": "deeper", "hand_size": game.player.hand_size,})
|
_on_map_open_requested({"mode": "deeper", "hand_size": game.player.hand_size,})
|
||||||
|
|
||||||
func _on_lobby_shop_open_requested(options):
|
func _on_lobby_shop_open_requested(options):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue