ChessBuilder/Systems/Game/Player/Player.gd
2025-03-14 00:51:53 -05:00

58 lines
1.1 KiB
GDScript

extends Node
class_name Player
var attached_cards: Dictionary = {}
var attached_effects: Dictionary = {}
var hand_size: int = 2
var gold: int = 70
var tokens: int = 0
var game: ChessGame
var run_count: int = 0
const MAX_HAND_SIZE = 5
func _init(g: int, size: int, tok: int, gm: ChessGame):
print("INIT PLAYER CHARACTER")
gold = g
tokens = tok
game = gm
hand_size = size
update_deck_hand_size(size)
func update_deck_hand_size(size: int):
if "deckManager" in game:
game.deckManager.set_hand_size(hand_size)
func set_hand_size(size: int):
hand_size = size
func get_tokens() -> int:
return tokens
func set_tokens(amount: int) -> void:
tokens = amount
func remove_tokens(amount: int) -> void:
tokens = max(0, tokens - amount)
func add_tokens(t: int) -> void :
tokens += t
func increment_runs() -> void :
run_count += 1
func get_run_count() -> int :
return run_count
func get_gold() -> int :
return gold
func add_gold(g: int) -> void :
gold += g
func remove_gold(g: int) -> void :
gold -= g
func set_gold(g: int) -> void :
gold = g