locked preloading to rank 2 and 3
This commit is contained in:
parent
9c5b0e011b
commit
6035e8bb6c
1 changed files with 26 additions and 17 deletions
|
|
@ -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)
|
||||
# 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)
|
||||
tokens -= Utils.TokenCosts[card.rank]
|
||||
updateTokenLabel()
|
||||
currentHand.append(card.id)
|
||||
usedSlots.append(false)
|
||||
|
||||
deckGrid.get_child(empty_slot_index).set_card(card)
|
||||
populateBank()
|
||||
deckGrid.get_child(empty_slot_index).set_card(card)
|
||||
populateBank()
|
||||
|
||||
func _on_card_mouse_entered(node):
|
||||
var card = null
|
||||
|
|
|
|||
Loading…
Reference in a new issue