Party stuff

This commit is contained in:
2026-01-10 17:23:29 -06:00
parent db15eeb672
commit 6f036aac77
12 changed files with 106 additions and 3 deletions

49
battle/BattleStats.gd Normal file
View File

@@ -0,0 +1,49 @@
class_name BattleStats
# enum Type {
# NEUTRAL,
# FIRE,
# ICE,
# }
enum Status {
NORMAL,
DEAD,
}
var health:int = 100
var maxHealth:int = 100
var mp:int = 50
var maxMp:int = 50
# var type:Type = Type.NEUTRAL
var status:Status = Status.NORMAL
func damage(amount:int) -> void:
assert(amount > 0)
if status == Status.DEAD:
return
health = max(health - amount, 0)
if health == 0:
status = Status.DEAD
func heal(amount:int) -> void:
assert(amount > 0)
if status == Status.DEAD:
return
health = min(health + amount, maxHealth)
func revive(health:int) -> void:
assert(health > 0)
if status != Status.DEAD:
return
health = min(health, maxHealth)
status = Status.NORMAL
self.health = health
func mpConsume(amount:int) -> void:
assert(amount > 0)
mp = max(mp - amount, 0)
func mpRestore(amount:int) -> void:
assert(amount > 0)
mp = min(mp + amount, maxMp)