fixed supernova checkmate
This commit is contained in:
parent
19e75c60f9
commit
27c4db3622
5 changed files with 11 additions and 27 deletions
|
|
@ -11,11 +11,9 @@ func _init():
|
|||
|
||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||
if !super.apply_effect(target_piece, board_flow, game_state):
|
||||
print("FAILED DEFAULT FN")
|
||||
return false
|
||||
|
||||
if !target_piece or !board_flow or !game_state:
|
||||
print("FAILED DEFAULT FN 2")
|
||||
return false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,18 +13,15 @@ func _init():
|
|||
remaining_turns = duration
|
||||
|
||||
func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
||||
print(cardName, " APPLY EFFECT ")
|
||||
attached_piece = target_piece
|
||||
if !target_piece or !board_flow or !game_state:
|
||||
print(cardName, " missing input param ")
|
||||
return false
|
||||
|
||||
# Get king's position
|
||||
var king_pos = target_piece.get_parent().name.split("-")
|
||||
var king_x = int(king_pos[0])
|
||||
var king_y = int(king_pos[1])
|
||||
|
||||
# Calculate tiles as before...
|
||||
var tiles_to_check = []
|
||||
for dx in range(-CAPTURE_RADIUS, CAPTURE_RADIUS + 1):
|
||||
for dy in range(-CAPTURE_RADIUS, CAPTURE_RADIUS + 1):
|
||||
|
|
@ -60,9 +57,8 @@ func apply_effect(target_piece = null, board_flow = null, game_state = null):
|
|||
tile.add_child(overlay)
|
||||
overlay.show()
|
||||
|
||||
# Handle piece capture
|
||||
if tile.get_child_count() > 1: # > 1 because we just added the overlay
|
||||
var piece = tile.get_child(0) # Piece should still be first child
|
||||
var piece = tile.get_child(0)
|
||||
if piece.Item_Color != target_piece.Item_Color:
|
||||
game_state.updatePoints(piece)
|
||||
piece.queue_free()
|
||||
|
|
@ -108,7 +104,7 @@ func on_turn_changed():
|
|||
# print("TURN CHANGED ==================", attached_piece, " | ", remaining_turns, )
|
||||
|
||||
if attached_piece.get_parent().get_parent().owner.isPlayerTurn() and attached_piece and remaining_turns > 0:
|
||||
print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
||||
# print(attached_piece.get_parent().get_parent(), attached_piece.get_parent().get_parent().owner)
|
||||
var piece = attached_piece
|
||||
var flow = attached_piece.get_parent().get_parent()
|
||||
var state = attached_piece.get_parent().get_parent().owner
|
||||
|
|
|
|||
|
|
@ -42,15 +42,6 @@ func drawStartingHand():
|
|||
|
||||
func drawCard():
|
||||
if deck.is_empty() && !discard.is_empty():
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
print("********ADDING DISCARD TO DECK*")
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
print("*******************************")
|
||||
deck = discard.duplicate()
|
||||
discard.clear()
|
||||
shuffleDeck()
|
||||
|
|
@ -88,27 +79,25 @@ func updateCardDurations():
|
|||
for piece_id in attached_cards:
|
||||
var card = attached_cards[piece_id]
|
||||
card.update_duration()
|
||||
print("Card: ", card.id, " | ", card.cardName, " | ", card.remaining_turns)
|
||||
# print("Card: ", card.id, " | ", card.cardName, " | ", card.remaining_turns)
|
||||
if card.remaining_turns <= 0:
|
||||
expired_cards.append(piece_id)
|
||||
|
||||
|
||||
match card.rank:
|
||||
Card.Rank.RANK_0:
|
||||
# Burned permanently
|
||||
print("Rank 3 Burned permanently")
|
||||
pass
|
||||
Card.Rank.RANK_1:
|
||||
# Burned until next match
|
||||
print("Rank 3 Burned until next match")
|
||||
pass
|
||||
Card.Rank.RANK_2:
|
||||
print("Rank 2 add to Discard")
|
||||
discard.append(card)
|
||||
# continue
|
||||
pass
|
||||
Card.Rank.RANK_3:
|
||||
deck.append(card)
|
||||
# continue
|
||||
print("Rank 1 add to Deck")
|
||||
print("Rank 3 add to Deck")
|
||||
pass
|
||||
else:
|
||||
var piece_node = instance_from_id(piece_id)
|
||||
|
|
|
|||
|
|
@ -151,6 +151,10 @@ func updatePoints(capturedPiece: Node) -> void:
|
|||
p2Points += capturedPiece.Points
|
||||
p2String.text = str(p2Points)
|
||||
|
||||
if capturedPiece.name == "King":
|
||||
print("Game Over!")
|
||||
gamecheckMate = true
|
||||
|
||||
func parseLocation(location: String) -> void:
|
||||
var number = 0
|
||||
locationX = ""
|
||||
|
|
|
|||
|
|
@ -165,16 +165,13 @@ func handleCapture(node: Node) -> void:
|
|||
var piece = game.get_node("Flow/" + game.selectedNode).get_child(0)
|
||||
var capturedPiece = node.get_child(0)
|
||||
|
||||
game.updatePoints(capturedPiece)
|
||||
|
||||
piece.reparent(node)
|
||||
piece.position = Vector2(25, 25)
|
||||
piece.position = Vector2(25, 25)
|
||||
game.currentlyMovingPiece = piece
|
||||
game.resolveMoveEffects()
|
||||
if capturedPiece.name == "King":
|
||||
print("Game Over!")
|
||||
game.gamecheckMate = true
|
||||
game.updatePoints(capturedPiece)
|
||||
capturedPiece.free()
|
||||
|
||||
func handleRegularMove(node: Node, consume: bool) -> void:
|
||||
|
|
|
|||
Loading…
Reference in a new issue