diff --git a/Systems/Game/ChessGame.gd b/Systems/Game/ChessGame.gd index 4e5fedd..5a7eee4 100644 --- a/Systems/Game/ChessGame.gd +++ b/Systems/Game/ChessGame.gd @@ -37,8 +37,8 @@ var stockfishPath = "res://Assets/ChessEngines/stockfish/stockfish.exe" @onready var cardDisplay: CardDisplay @onready var cardPreview: CardPreview -@export var boardXSize = 8 -@export var boardYSize = 8 +@export var boardXSize = 12 +@export var boardYSize = 12 @export var tileXSize: int = 50 @export var tileYSize: int = 50 @export var windowXSize: int = 1280 diff --git a/Systems/StateMachine/GameStates/Movement.gd b/Systems/StateMachine/GameStates/Movement.gd index b77a4a1..36bcf4f 100644 --- a/Systems/StateMachine/GameStates/Movement.gd +++ b/Systems/StateMachine/GameStates/Movement.gd @@ -83,12 +83,18 @@ func handleMovement(location: String, generated: bool = false) -> void: game.selectedNode = location game.getMovableAreas() return - + + var sourcePiece = node.get_piece() + var moves = null; + if sourcePiece: + moves = sourcePiece.getValidMoves(game.boardContainer, location) + # Now we know we have a selected node, get its piece var sourceContainer = game.get_node("Flow/" + game.selectedNode) as PieceContainer var piece = sourceContainer.get_piece() if piece == null: return + # print("SColor ", sourcePiece.Item_Color, " tColor ", piece.Item_Color) var piece_id = piece.get_instance_id() @@ -121,10 +127,18 @@ func handleMovement(location: String, generated: bool = false) -> void: if piece_id in moves_remaining: moves_remaining.erase(piece_id) # finished.emit(Constants.POST_MOVE) + + if game.selectedNode == location: if !is_multi_moving and multiMoving == "": print("CLEAR SELECTION*************") game.clearSelection() + elif moves != null and !moves.regular_moves.has(game.selectedNode) and !moves.special_moves.has(game.selectedNode): + if sourcePiece and sourcePiece.Item_Color == piece.Item_Color: + game.selectedNode = location + game.getMovableAreas() + return + return elif isCastlingMove(node, location): handleCastling(node, generated) finished.emit(Constants.POST_MOVE) diff --git a/Systems/Tiles/Portal.gd b/Systems/Tiles/Portal.gd index f5ad0a1..a0f2347 100644 --- a/Systems/Tiles/Portal.gd +++ b/Systems/Tiles/Portal.gd @@ -23,9 +23,10 @@ func apply_effect(piece: Pawn = null) -> void: return if last_piece and last_piece.id == piece.id: return - # Check if partner portal tile has a piece on it var partner_container = other_portal.base_button as PieceContainer + if partner_container.has_piece(): + return if partner_container && partner_container.has_piece(): return