From 8e23e34a66f6acffd90c45ffa962a3d67071c50d Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Fri, 7 Mar 2025 22:15:46 -0600 Subject: [PATCH] fixed card reset --- Systems/Card.gd | 3 ++- Systems/CardDisplay.gd | 2 +- Systems/Cards/Explosiveboots.gd | 4 ++++ Systems/Cards/Supernova.gd | 4 ++++ Systems/DeckManager.gd | 2 +- Systems/StateMachine/GameStates/AttachCards.gd | 4 ++-- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Systems/Card.gd b/Systems/Card.gd index d019287..4e5aba4 100644 --- a/Systems/Card.gd +++ b/Systems/Card.gd @@ -25,7 +25,8 @@ var stored_game_state = null func _init(): remaining_turns = duration # print(id) - +func reset(): + remaining_turns = duration func can_attach_to_piece(piece: Pawn) -> bool: # print(unitWhitelist, " | ", piece.name , " | ", unitWhitelist.has(piece.name)) if unitWhitelist.is_empty(): diff --git a/Systems/CardDisplay.gd b/Systems/CardDisplay.gd index 73bc47c..80c6681 100644 --- a/Systems/CardDisplay.gd +++ b/Systems/CardDisplay.gd @@ -105,7 +105,7 @@ func _on_card_clicked(event: InputEvent, card: Card): func _on_card_mouse_entered(card: Card): # Show card preview when hovering - print("_on_card_mouse_entered") + # print("_on_card_mouse_entered") currently_hovered_card = card hoveredPreview.preview_card(card) hoveredPreview.visible = true diff --git a/Systems/Cards/Explosiveboots.gd b/Systems/Cards/Explosiveboots.gd index 90eb762..a32b684 100644 --- a/Systems/Cards/Explosiveboots.gd +++ b/Systems/Cards/Explosiveboots.gd @@ -12,6 +12,10 @@ func _init(): unitWhitelist = ["Pawn", "Knight", "King"] remaining_turns = duration +func reset(): + remaining_turns = duration + valid = false + func apply_effect(target_piece = null, board_flow = null, game_state = null): attached_piece = target_piece stored_board_flow = board_flow diff --git a/Systems/Cards/Supernova.gd b/Systems/Cards/Supernova.gd index eb938ca..7270ce6 100644 --- a/Systems/Cards/Supernova.gd +++ b/Systems/Cards/Supernova.gd @@ -13,6 +13,10 @@ func _init(): unitWhitelist = ["King"] remaining_turns = duration +func reset(): + remaining_turns = duration + valid = false + func apply_effect(target_piece = null, board_flow = null, game_state = null): attached_piece = target_piece stored_board_flow = board_flow diff --git a/Systems/DeckManager.gd b/Systems/DeckManager.gd index 3aad4e7..410d7f5 100644 --- a/Systems/DeckManager.gd +++ b/Systems/DeckManager.gd @@ -171,7 +171,7 @@ func updateCardDurations(): if card.remaining_turns <= 0: expired_cards.append(piece_id) - + card.reset() match card.rank: Card.Rank.RANK_0: print("Rank 3 Burned permanently") diff --git a/Systems/StateMachine/GameStates/AttachCards.gd b/Systems/StateMachine/GameStates/AttachCards.gd index 040a2fc..8ddbb0a 100644 --- a/Systems/StateMachine/GameStates/AttachCards.gd +++ b/Systems/StateMachine/GameStates/AttachCards.gd @@ -1,6 +1,6 @@ extends "res://Systems/StateMachine/ChessGameState.gd" -const ATTACHMENT_PHASE_DURATION = 5 # Duration in seconds +const ATTACHMENT_PHASE_DURATION = 15 # Duration in seconds var timer: Timer var tile_pressed_connection: Signal @@ -56,7 +56,7 @@ func handleTilePressed(location: String) -> void: if isCorrectColor and selectedCard.can_attach_to_piece(piece) and \ !game.deckManager.attached_cards.has(piece.get_instance_id()): if game.deckManager.playCard(selectedCard, piece, game.boardContainer, game): - # print("Successfully attached card ", selectedCard.cardName, " to ", piece.name, " at ", location) + print("Successfully attached card ", selectedCard.cardName, " to ", piece.name, " at ", location) piece.on_card_effect_changed() if game.deckManager.hand.is_empty(): complete_attachment_phase()