feat(currency): the command-bar purse reads in denominations

The seed placeholder was a flat 1240 gold — 12.4 million copper under the real
model, which is 1,240 plot points in the command bar. It reseeds to 347c, a
party carrying silver and no gold: '◈ 3s 47c'.

This is the only call site of Currency.format() — the display edge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYa9u7Kdxv5gX4AnwWexy8
This commit is contained in:
2026-07-12 18:39:25 -05:00
parent a9d9eedb7e
commit 6c496d3ed8
4 changed files with 14 additions and 8 deletions

View File

@@ -154,10 +154,10 @@ layout_mode = 2
theme_type_variation = &"Mono"
text = "MP 18 / 30"
[node name="Gold" type="Label" parent="Split/World/CommandBar/Vitals"]
[node name="Purse" type="Label" parent="Split/World/CommandBar/Vitals"]
layout_mode = 2
theme_type_variation = &"Mono"
text = "◈ 1240 gp"
text = "◈ 3s 47c"
[node name="Consumables" type="HBoxContainer" parent="Split/World/CommandBar"]
layout_mode = 2

View File

@@ -29,7 +29,7 @@ var _http: HTTPRequest
@onready var _tokens: HBoxContainer = $Split/World/TurnRail/Col/Tokens
@onready var _hp: Label = $Split/World/CommandBar/Vitals/HP
@onready var _mp: Label = $Split/World/CommandBar/Vitals/MP
@onready var _gold: Label = $Split/World/CommandBar/Vitals/Gold
@onready var _purse: Label = $Split/World/CommandBar/Vitals/Purse
@onready var _consumables: HBoxContainer = $Split/World/CommandBar/Consumables
@@ -93,8 +93,8 @@ func _side_color(e: TurnEntry) -> Color:
func _bind_vitals() -> void:
_hp.text = "HP %d / %d" % [_state.vitals["hp"], _state.vitals["hp_max"]]
_mp.text = "MP %d / %d" % [_state.vitals["mp"], _state.vitals["mp_max"]]
_gold.text = "%d gp" % _state.vitals["gold"]
_gold.add_theme_color_override("font_color", Palette.GOLD_BRIGHT)
_purse.text = "%s" % Currency.format(_state.vitals["purse_copper"])
_purse.add_theme_color_override("font_color", Palette.GOLD_BRIGHT)
func _bind_consumables() -> void:

View File

@@ -4,7 +4,7 @@ extends RefCounted
## 2a; later systems (combat vitals, inventory consumables) become the writers.
## No Luck/LCK value lives here — it is never surfaced (§7).
var vitals: Dictionary = {"hp": 0, "hp_max": 0, "mp": 0, "mp_max": 0, "gold": 0}
var vitals: Dictionary = {"hp": 0, "hp_max": 0, "mp": 0, "mp_max": 0, "purse_copper": 0}
var turn_order: Array[TurnEntry] = []
var consumables: Array = []
var round_label: String = ""
@@ -19,7 +19,7 @@ func toggle_dock() -> bool:
static func seed() -> ShellState:
var s := ShellState.new()
s.vitals = {"hp": 42, "hp_max": 60, "mp": 18, "mp_max": 30, "gold": 1240}
s.vitals = {"hp": 42, "hp_max": 60, "mp": 18, "mp_max": 30, "purse_copper": 347}
s.turn_order = [
TurnEntry.new("EL", 17, &"you", true, false),
TurnEntry.new("DW", 12, &"ally"),

View File

@@ -16,7 +16,13 @@ func test_seed_vitals():
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)
assert_eq(s.vitals["purse_copper"], 347)
assert_false("gold" in s.vitals, "the flat gold placeholder is gone")
func test_seed_purse_renders_as_denominations():
var s := ShellState.seed()
assert_eq(Currency.format(s.vitals["purse_copper"]), "3s 47c")
func test_seed_turn_order():