Fixed hopscotch capture

This commit is contained in:
2ManyProjects 2025-03-01 00:27:48 -06:00
parent e055b75a49
commit b0888668bf
4 changed files with 18 additions and 9 deletions

View file

@ -23,12 +23,12 @@ func initializeStartingDeck():
deck.clear(); deck.clear();
# for i in range(2): # for i in range(2):
# deck.append(DoubleTimeCard.new()) # deck.append(DoubleTimeCard.new())
deck.append(HopscotchCard.new())
deck.append(FieryCapeCard.new()) deck.append(FieryCapeCard.new())
deck.append(FieryTrailCard.new()) deck.append(FieryTrailCard.new())
deck.append(ExplosiveBootsCard.new()) deck.append(ExplosiveBootsCard.new())
deck.append(DoubleTimeCard.new()) deck.append(DoubleTimeCard.new())
deck.append(DrunkDrivingCard.new()) deck.append(DrunkDrivingCard.new())
deck.append(HopscotchCard.new())
deck.append(SupernovaCard.new()) deck.append(SupernovaCard.new())
shuffleDeck() shuffleDeck()
drawStartingHand() drawStartingHand()

View file

@ -43,7 +43,7 @@ var stockfishPath = "res://Assets/ChessEngines/stockfish/stockfish.exe"
@export var tileYSize: int = 50 @export var tileYSize: int = 50
@export var windowXSize: int = 1280 @export var windowXSize: int = 1280
@export var windowYSize: int = 720 @export var windowYSize: int = 720
@export var FEN: String = "rnbqkbnr/pppppppp/4U3/2u5/1****u*1/4U3/PPPPPPPP/RNBQKBNR w KQkq - 0 1" @export var FEN: String = "2rnbqkbnr2/2pppppppp2/6u5/12/2********U1/12/2u9/12/7U4/12/2PPPPPPPP2/2RNBQKBNR2 w KQkq - 0 1"
# "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" # "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
# "2rnbqkbnr2/2pppppppp2/12/12/2********2/12/12/12/12/12/2PPPPPPPP2/2RNBQKBNR2 w KQkq - 0 1" # "2rnbqkbnr2/2pppppppp2/12/12/2********2/12/12/12/12/12/2PPPPPPPP2/2RNBQKBNR2 w KQkq - 0 1"

View file

@ -77,6 +77,7 @@ func handleMovement(location: String, generated: bool = false) -> void:
# Only try to get piece if we have a selected node # Only try to get piece if we have a selected node
if game.selectedNode == "": if game.selectedNode == "":
# print("No Node")
# If no node is selected, we might want to select this one if it has a piece # If no node is selected, we might want to select this one if it has a piece
var piece = node.get_piece() var piece = node.get_piece()
if piece != null && piece.Item_Color == game.Turn: if piece != null && piece.Item_Color == game.Turn:
@ -93,6 +94,7 @@ func handleMovement(location: String, generated: bool = false) -> void:
var sourceContainer = game.get_node("Flow/" + game.selectedNode) as PieceContainer var sourceContainer = game.get_node("Flow/" + game.selectedNode) as PieceContainer
var piece = sourceContainer.get_piece() var piece = sourceContainer.get_piece()
if piece == null: if piece == null:
# print("No Piece")
return return
# print("SColor ", sourcePiece.Item_Color, " tColor ", piece.Item_Color) # print("SColor ", sourcePiece.Item_Color, " tColor ", piece.Item_Color)
@ -105,14 +107,15 @@ func handleMovement(location: String, generated: bool = false) -> void:
if node.get_piece() != null and is_instance_valid(node.get_piece()): if node.get_piece() != null and is_instance_valid(node.get_piece()):
var attempting_piece = node.get_piece() var attempting_piece = node.get_piece()
print("Checking Str comp ", str(attempting_piece.get_instance_id()), " ", multiMoving) # print("Checking Str comp ", str(attempting_piece.get_instance_id()), " ", multiMoving)
# Only block if it's a different piece of the same color # Only block if it's a different piece of the same color
if str(attempting_piece.get_instance_id()) != multiMoving and attempting_piece.Item_Color == game.Turn: if str(attempting_piece.get_instance_id()) != multiMoving and attempting_piece.Item_Color == game.Turn:
print("early return - can't select different piece of same color during multi-move") print("early return - can't select different piece of same color during multi-move")
return return
if game.selectedNode == "": if game.selectedNode == "":
# print("No Node 2")
if node.get_piece() != null && node.get_piece().Item_Color == game.Turn: if node.get_piece() != null && node.get_piece().Item_Color == game.Turn:
print("SELECTED NODE ", location) # print("SELECTED NODE ", location)
game.selectedNode = location game.selectedNode = location
game.getMovableAreas() game.getMovableAreas()
return return
@ -133,13 +136,16 @@ func handleMovement(location: String, generated: bool = false) -> void:
if !is_multi_moving and multiMoving == "": if !is_multi_moving and multiMoving == "":
print("CLEAR SELECTION*************") print("CLEAR SELECTION*************")
game.clearSelection() game.clearSelection()
return
return
elif moves != null and !moves.regular_moves.has(game.selectedNode) and !moves.special_moves.has(game.selectedNode): elif moves != null and !moves.regular_moves.has(game.selectedNode) and !moves.special_moves.has(game.selectedNode):
# print(moves, sourcePiece.Item_Color, piece.Item_Color)
if sourcePiece and sourcePiece.Item_Color == piece.Item_Color: if sourcePiece and sourcePiece.Item_Color == piece.Item_Color:
# print("Set Location*************")
game.selectedNode = location game.selectedNode = location
game.getMovableAreas() game.getMovableAreas()
return return
return if isCastlingMove(node, location):
elif isCastlingMove(node, location):
handleCastling(node, generated) handleCastling(node, generated)
finished.emit(Constants.POST_MOVE) finished.emit(Constants.POST_MOVE)
# En Passant # En Passant
@ -177,8 +183,10 @@ func handleMovement(location: String, generated: bool = false) -> void:
print("ANOTHER MOVE") print("ANOTHER MOVE")
game.resetHighlights() game.resetHighlights()
if game.selectedNode != "": if game.selectedNode != "":
game.tileManager.apply_tile_effect(game.selectedNode)
game.getMovableAreas() if game.isPlayerTurn():
game.tileManager.apply_tile_effect(game.selectedNode)
game.getMovableAreas()
if game.areas.size() == 0 and game.specialArea.size() == 0: if game.areas.size() == 0 and game.specialArea.size() == 0:
print("Consuming move because no valid moves left") print("Consuming move because no valid moves left")
game.resolveMoveEffects() game.resolveMoveEffects()

View file

@ -40,7 +40,8 @@ func apply_effect(piece: Pawn = null) -> void:
animate_portal_teleport(piece, current_container, target_container) animate_portal_teleport(piece, current_container, target_container)
print("*****************SETTING SELECTED*(*************)") print("*****************SETTING SELECTED*(*************)")
print(target_container.location) print(target_container.location)
game.selectedNode = target_container.location if game.isPlayerTurn():
game.selectedNode = target_container.location
# target_container.animate_movement(current_container, piece); # target_container.animate_movement(current_container, piece);
func animate_portal_teleport(piece: Pawn, origin_container: PieceContainer, destination_container: PieceContainer) -> void: func animate_portal_teleport(piece: Pawn, origin_container: PieceContainer, destination_container: PieceContainer) -> void: