extends Node2D

# Core stats
var health: int = 100
var max_health: int = 100
var mana: int = 50
var max_mana: int = 50
var level: int = 1 # also acts as your damage
var experience: int = 0
var heart_pieces: int = 0

# Convenience helpers
func heal(amount: int):
	health = clamp(health + amount, 0, max_health)

func take_damage(amount: int):
	health = clamp(health - amount, 0, max_health)

func gain_xp(amount: int):
	experience += amount

func gain_heart_pieces(amount: int):
	heart_pieces += amount

func is_alive() -> bool:
	return health > 0
	
func reset_after_defeat():
	health = max_health
	mana = max_mana
	
func reset_game():
	health = 100
	max_health = 100
	mana = 50
	max_mana = 50
	level = 1 # also acts as your damage
	experience = 0
	heart_pieces = 0

# Optional: signal when stats change
# signal stats_changed()
