From 6035e8bb6c60cd433dccb70ed107e82807bfcbd4 Mon Sep 17 00:00:00 2001 From: 2ManyProjects Date: Sun, 16 Mar 2025 02:24:19 -0500 Subject: [PATCH] locked preloading to rank 2 and 3 --- Systems/Game/HandPreloadScreen.gd | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/Systems/Game/HandPreloadScreen.gd b/Systems/Game/HandPreloadScreen.gd index 34c4297..f90ae99 100644 --- a/Systems/Game/HandPreloadScreen.gd +++ b/Systems/Game/HandPreloadScreen.gd @@ -132,6 +132,14 @@ func populateBank(): card_item.connect("card_selected", Callable(self, "_on_bank_card_selected")) _connect_hover_signals(card_item) + +static var TokenCosts = { + Card.Rank.RANK_0: 15, # Most expensive (one-time use) + Card.Rank.RANK_1: 10, # Expensive (once per match) + Card.Rank.RANK_2: 5, # Medium (multiple uses) + Card.Rank.RANK_3: 3 # Cheapest (basic cards) +} + func _on_hand_card_selected(card_slot, card): if card: # Remove card from deck @@ -154,24 +162,25 @@ func _on_bank_card_selected(card_item, card): print("_on_bank_card_selected ", card.id) # Find first empty slot in deck var empty_slot_index = -1 - for i in range(deckGrid.get_child_count()): - var slot = deckGrid.get_child(i) - if !slot.has_card(): - empty_slot_index = i - break + if card and (card.rank == Card.Rank.RANK_2 || card.rank == Card.Rank.RANK_3): + for i in range(deckGrid.get_child_count()): + var slot = deckGrid.get_child(i) + if !slot.has_card(): + empty_slot_index = i + break - # print("_on_bank_card_selected ", currentHand, " ", handSize, " ", empty_slot_index, ) - # print("_on_bank_card_selected ", empty_slot_index >= 0, " ", currentHand.size() < handSize, " ", currentHand.find(card.id)) - if empty_slot_index >= 0 and currentHand.size() < handSize and currentHand.find(card.id) == -1 and tokens - Utils.TokenCosts[card.rank] > 0: - # print("currentHand append ", card.id) - - tokens -= Utils.TokenCosts[card.rank] - updateTokenLabel() - currentHand.append(card.id) - usedSlots.append(false) - - deckGrid.get_child(empty_slot_index).set_card(card) - populateBank() + # print("_on_bank_card_selected ", currentHand, " ", handSize, " ", empty_slot_index, ) + # print("_on_bank_card_selected ", empty_slot_index >= 0, " ", currentHand.size() < handSize, " ", currentHand.find(card.id)) + if empty_slot_index >= 0 and currentHand.size() < handSize and currentHand.find(card.id) == -1 and tokens - Utils.TokenCosts[card.rank] > 0: + # print("currentHand append ", card.id) + + tokens -= Utils.TokenCosts[card.rank] + updateTokenLabel() + currentHand.append(card.id) + usedSlots.append(false) + + deckGrid.get_child(empty_slot_index).set_card(card) + populateBank() func _on_card_mouse_entered(node): var card = null