From d3a305d1d7962f82af2397760cf8008758bddd1d Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 2 Oct 2026 01:54:37 -0400 Subject: feat: better 'list' bet table, multiple bets in baccarat --- internal/item/house_edge_test.go | 29 +++++++++++++++++++++++++++++ internal/item/item.go | 4 ++++ 2 files changed, 33 insertions(+) create mode 100644 internal/item/house_edge_test.go (limited to 'internal/item') diff --git a/internal/item/house_edge_test.go b/internal/item/house_edge_test.go new file mode 100644 index 0000000..574a68f --- /dev/null +++ b/internal/item/house_edge_test.go @@ -0,0 +1,29 @@ +package item + +import "testing" + +// TestHouseEdgeItemDefinitions pins the two house-edge reference items: the +// tile shows whole percent, the computus shows hundredths. Neither stacks +// (the precision is a capability, not a quantity) and both are valuable +// enough that a player will bank them rather than drop them. +func TestHouseEdgeItemDefinitions(t *testing.T) { + store := NewItemStore("../../data") + for _, tc := range []struct { + id string + precision int + }{ + {"house_edge_tile", 0}, + {"house_edge_computus", 2}, + } { + def, err := store.Load(tc.id) + if err != nil { + t.Fatalf("load %s: %v", tc.id, err) + } + if def.HouseEdgePrecision == nil || *def.HouseEdgePrecision != tc.precision { + t.Fatalf("%s: house_edge_precision = %v, want %d", tc.id, def.HouseEdgePrecision, tc.precision) + } + if def.Stackable { + t.Fatalf("%s must not stack (its precision is a capability, not a quantity)", tc.id) + } + } +} diff --git a/internal/item/item.go b/internal/item/item.go index 809959e..c083d8e 100644 --- a/internal/item/item.go +++ b/internal/item/item.go @@ -91,6 +91,10 @@ type ItemDef struct { Tool *ToolDef `yaml:"tool,omitempty"` Requirements map[string]int `yaml:"requirements,omitempty"` + // Optional inventory-only casino reference capability. Supported precision: + // 0 (whole percent) or 2 (hundredths of a percent); nil grants nothing. + HouseEdgePrecision *int `yaml:"house_edge_precision,omitempty"` + MaxQuality int `yaml:"max_quality"` Craft CraftList `yaml:"craft,omitempty"` -- cgit v1.2.3