Fixed hopscotch capture
This commit is contained in:
parent
e055b75a49
commit
b0888668bf
4 changed files with 18 additions and 9 deletions
|
|
@ -23,12 +23,12 @@ func initializeStartingDeck():
|
|||
deck.clear();
|
||||
# for i in range(2):
|
||||
# deck.append(DoubleTimeCard.new())
|
||||
deck.append(HopscotchCard.new())
|
||||
deck.append(FieryCapeCard.new())
|
||||
deck.append(FieryTrailCard.new())
|
||||
deck.append(ExplosiveBootsCard.new())
|
||||
deck.append(DoubleTimeCard.new())
|
||||
deck.append(DrunkDrivingCard.new())
|
||||
deck.append(HopscotchCard.new())
|
||||
deck.append(SupernovaCard.new())
|
||||
shuffleDeck()
|
||||
drawStartingHand()
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ var stockfishPath = "res://Assets/ChessEngines/stockfish/stockfish.exe"
|
|||
@export var tileYSize: int = 50
|
||||
@export var windowXSize: int = 1280
|
||||
@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"
|
||||
# "2rnbqkbnr2/2pppppppp2/12/12/2********2/12/12/12/12/12/2PPPPPPPP2/2RNBQKBNR2 w KQkq - 0 1"
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ func handleMovement(location: String, generated: bool = false) -> void:
|
|||
|
||||
# Only try to get piece if we have a selected node
|
||||
if game.selectedNode == "":
|
||||
# print("No Node")
|
||||
# If no node is selected, we might want to select this one if it has a piece
|
||||
var piece = node.get_piece()
|
||||
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 piece = sourceContainer.get_piece()
|
||||
if piece == null:
|
||||
# print("No Piece")
|
||||
return
|
||||
# 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()):
|
||||
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
|
||||
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")
|
||||
return
|
||||
if game.selectedNode == "":
|
||||
# print("No Node 2")
|
||||
if node.get_piece() != null && node.get_piece().Item_Color == game.Turn:
|
||||
print("SELECTED NODE ", location)
|
||||
# print("SELECTED NODE ", location)
|
||||
game.selectedNode = location
|
||||
game.getMovableAreas()
|
||||
return
|
||||
|
|
@ -133,13 +136,16 @@ func handleMovement(location: String, generated: bool = false) -> void:
|
|||
if !is_multi_moving and multiMoving == "":
|
||||
print("CLEAR SELECTION*************")
|
||||
game.clearSelection()
|
||||
return
|
||||
return
|
||||
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:
|
||||
# print("Set Location*************")
|
||||
game.selectedNode = location
|
||||
game.getMovableAreas()
|
||||
return
|
||||
return
|
||||
elif isCastlingMove(node, location):
|
||||
if isCastlingMove(node, location):
|
||||
handleCastling(node, generated)
|
||||
finished.emit(Constants.POST_MOVE)
|
||||
# En Passant
|
||||
|
|
@ -177,8 +183,10 @@ func handleMovement(location: String, generated: bool = false) -> void:
|
|||
print("ANOTHER MOVE")
|
||||
game.resetHighlights()
|
||||
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:
|
||||
print("Consuming move because no valid moves left")
|
||||
game.resolveMoveEffects()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ func apply_effect(piece: Pawn = null) -> void:
|
|||
animate_portal_teleport(piece, current_container, target_container)
|
||||
print("*****************SETTING SELECTED*(*************)")
|
||||
print(target_container.location)
|
||||
game.selectedNode = target_container.location
|
||||
if game.isPlayerTurn():
|
||||
game.selectedNode = target_container.location
|
||||
# target_container.animate_movement(current_container, piece);
|
||||
|
||||
func animate_portal_teleport(piece: Pawn, origin_container: PieceContainer, destination_container: PieceContainer) -> void:
|
||||
|
|
|
|||
Loading…
Reference in a new issue