This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2025-07-04 15:24:44 +02:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
@export var full_deck: Dictionary[int, Card]
|
2025-07-04 15:50:39 +02:00
|
|
|
|
|
|
|
|
func get_shuffled_cards(player_count: int, cards_to_pick: int) -> Dictionary: # Dictionary[String, Array[int]]
|
|
|
|
|
var dict: Dictionary = {}
|
|
|
|
|
var deck: Array[int] = full_deck.keys()
|
|
|
|
|
deck.shuffle()
|
|
|
|
|
var card_index = 0
|
|
|
|
|
for i in player_count:
|
|
|
|
|
var player_deck: Array[int] = []
|
|
|
|
|
for j in cards_to_pick:
|
|
|
|
|
player_deck.append(deck[card_index])
|
|
|
|
|
card_index += 1
|
|
|
|
|
dict[i] = player_deck
|
|
|
|
|
|
|
|
|
|
# Add trump card, if there are cards left in the deck
|
|
|
|
|
if card_index == 60:
|
|
|
|
|
dict["trump"] = -1
|
|
|
|
|
else:
|
|
|
|
|
dict["trump"] = deck[card_index]
|
|
|
|
|
|
|
|
|
|
return dict
|