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"))
|
card_item.connect("card_selected", Callable(self, "_on_bank_card_selected"))
|
||||||
_connect_hover_signals(card_item)
|
_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):
|
func _on_hand_card_selected(card_slot, card):
|
||||||
if card:
|
if card:
|
||||||
# Remove card from deck
|
# Remove card from deck
|
||||||
|
|
@ -154,24 +162,25 @@ func _on_bank_card_selected(card_item, card):
|
||||||
print("_on_bank_card_selected ", card.id)
|
print("_on_bank_card_selected ", card.id)
|
||||||
# Find first empty slot in deck
|
# Find first empty slot in deck
|
||||||
var empty_slot_index = -1
|
var empty_slot_index = -1
|
||||||
for i in range(deckGrid.get_child_count()):
|
if card and (card.rank == Card.Rank.RANK_2 || card.rank == Card.Rank.RANK_3):
|
||||||
var slot = deckGrid.get_child(i)
|
for i in range(deckGrid.get_child_count()):
|
||||||
if !slot.has_card():
|
var slot = deckGrid.get_child(i)
|
||||||
empty_slot_index = i
|
if !slot.has_card():
|
||||||
break
|
empty_slot_index = i
|
||||||
|
break
|
||||||
|
|
||||||
# print("_on_bank_card_selected ", currentHand, " ", handSize, " ", empty_slot_index, )
|
# 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))
|
# 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:
|
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("currentHand append ", card.id)
|
||||||
|
|
||||||
tokens -= Utils.TokenCosts[card.rank]
|
tokens -= Utils.TokenCosts[card.rank]
|
||||||
updateTokenLabel()
|
updateTokenLabel()
|
||||||
currentHand.append(card.id)
|
currentHand.append(card.id)
|
||||||
usedSlots.append(false)
|
usedSlots.append(false)
|
||||||
|
|
||||||
deckGrid.get_child(empty_slot_index).set_card(card)
|
deckGrid.get_child(empty_slot_index).set_card(card)
|
||||||
populateBank()
|
populateBank()
|
||||||
|
|
||||||
func _on_card_mouse_entered(node):
|
func _on_card_mouse_entered(node):
|
||||||
var card = null
|
var card = null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue