fixed card reset
This commit is contained in:
parent
3060273c1d
commit
8e23e34a66
6 changed files with 14 additions and 5 deletions
|
|
@ -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():
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue