feat(shell): ShellState + TurnEntry HUD state model

This commit is contained in:
2026-07-11 08:46:56 -05:00
parent 400445f312
commit c4aa74da5a
6 changed files with 103 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
extends "res://addons/gut/test.gd"
func test_turn_entry_holds_fields():
var e := TurnEntry.new("DW", 12, &"ally")
assert_eq(e.initials, "DW")
assert_eq(e.initiative, 12)
assert_eq(e.side, &"ally")
assert_false(e.is_active)
assert_false(e.is_downed)
func test_seed_vitals():
var s := ShellState.seed()
assert_eq(s.vitals["hp"], 42)
assert_eq(s.vitals["hp_max"], 60)
assert_eq(s.vitals["mp"], 18)
assert_eq(s.vitals["mp_max"], 30)
assert_eq(s.vitals["gold"], 1240)
func test_seed_turn_order():
var s := ShellState.seed()
assert_eq(s.turn_order.size(), 4)
assert_eq(s.turn_order[0].initials, "EL")
assert_true(s.turn_order[0].is_active, "first combatant is the active turn")
assert_true(s.turn_order[3].is_downed, "last combatant is downed")
func test_seed_consumables():
var s := ShellState.seed()
assert_eq(s.consumables.size(), 8)
assert_eq(s.consumables[0]["label"], "Salve")
assert_eq(s.consumables[0]["hotkey"], 1)
assert_eq(s.consumables[6]["label"], "", "slot 7 is empty")
func test_toggle_dock_flips():
var s := ShellState.seed()
assert_true(s.dock_open, "seed opens with the dock out")
assert_false(s.toggle_dock())
assert_false(s.dock_open)
assert_true(s.toggle_dock())
assert_true(s.dock_open)

View File

@@ -0,0 +1 @@
uid://wkbpiulrv8rx