extends Node @export var full_deck: Dictionary[int, Card] @export var card_fallback_texture: Texture enum CardStyle { STICKMAN, } func get_shuffled_cards(client_ids: Array[String], 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 client_id in client_ids: var player_deck: Array[int] = [] for j in cards_to_pick: player_deck.append(deck[card_index]) card_index += 1 dict[client_id] = 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 func get_card_texture(card_id: int, style: CardStyle = CardStyle.STICKMAN) -> Texture: var style_name: String = "" match style: CardStyle.STICKMAN: style_name = "stickman" return load("res://cards/textures/" + style_name + "/" + _get_card_name(card_id) + ".webp") func _get_card_name(card_id: int) -> String: var color: String var suffix: String print("looking up card with id " + str(card_id)) if card_id < 13: color = "blue" elif card_id < 26: color = "green" elif card_id < 39: color = "violet" else: color = "orange" match card_id: 0, 13, 26, 39: suffix = "1" 1, 14, 27, 40: suffix = "2" 2, 15, 28, 41: suffix = "3" 3, 16, 29, 42: suffix = "4" 4, 17, 30, 43: suffix = "5" 5, 18, 31, 44: suffix = "6" 6, 19, 32, 45: suffix = "7" 7, 20, 33, 46: suffix = "8" 8, 21, 34, 47: suffix = "9" 9, 22, 35, 48: suffix = "10" 10, 23, 36, 49: suffix = "11" 11, 24, 37, 50: suffix = "12" 12, 25, 38, 51: suffix = "13" 52, 53, 54, 55: suffix = "joker" 56, 57, 58, 59: suffix = "magician" return color + "_" + suffix