aboutsummaryrefslogtreecommitdiff
path: root/internal/game/condition_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-07 16:24:27 -0400
committerhistoria <[not public]>2026-07-07 16:24:27 -0400
commitab2597b22ccdb71116992aec78080d9858358d04 (patch)
tree8beae4060c2831c4a68f92b682b5350cfa1d0afb /internal/game/condition_test.go
parent3f30fa3eec9c2e2acf9a984ccefb9529a25e688a (diff)
downloadthehouseoficarus-ab2597b22ccdb71116992aec78080d9858358d04.tar.gz
rename flags to global_flags (differentiate from player_flags)
Diffstat (limited to 'internal/game/condition_test.go')
-rw-r--r--internal/game/condition_test.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/game/condition_test.go b/internal/game/condition_test.go
index f365f2e..f7a5dc6 100644
--- a/internal/game/condition_test.go
+++ b/internal/game/condition_test.go
@@ -39,7 +39,7 @@ func TestIsTruthy(t *testing.T) {
}
func TestCheckConditionPlayerFlagTruthy(t *testing.T) {
- g := &Game{Flags: NewFlagStore()}
+ g := &Game{GlobalFlags: NewGlobalFlagStore()}
set := sessWithFlags(map[string]any{"x": true})
unset := sessWithFlags(map[string]any{})
@@ -73,7 +73,7 @@ func TestCheckConditionPlayerFlagTruthy(t *testing.T) {
}
func TestCheckConditionValueComparisonPreserved(t *testing.T) {
- g := &Game{Flags: NewFlagStore()}
+ g := &Game{GlobalFlags: NewGlobalFlagStore()}
sess := sessWithFlags(map[string]any{"n": 1})
if !g.checkCondition(sess, &behavior.Condition{PlayerFlag: "n", Value: 1}) {
@@ -87,24 +87,24 @@ func TestCheckConditionValueComparisonPreserved(t *testing.T) {
}
}
-func TestCheckConditionWorldFlag(t *testing.T) {
- g := &Game{Flags: NewFlagStore()}
- g.Flags.Set("gate_open", true)
+func TestCheckConditionGlobalFlag(t *testing.T) {
+ g := &Game{GlobalFlags: NewGlobalFlagStore()}
+ g.GlobalFlags.Set("gate_open", true)
sess := sessWithFlags(map[string]any{})
- if !g.checkCondition(sess, &behavior.Condition{Flag: "gate_open"}) {
- t.Error("world flag truthy check should pass")
+ if !g.checkCondition(sess, &behavior.Condition{GlobalFlag: "gate_open"}) {
+ t.Error("global flag truthy check should pass")
}
- if g.checkCondition(sess, &behavior.Condition{Flag: "gate_open", Not: true}) {
+ if g.checkCondition(sess, &behavior.Condition{GlobalFlag: "gate_open", Not: true}) {
t.Error("negated world flag should fail when set")
}
- if g.checkCondition(sess, &behavior.Condition{Flag: "missing"}) {
+ if g.checkCondition(sess, &behavior.Condition{GlobalFlag: "missing"}) {
t.Error("missing world flag should not pass")
}
}
func TestResolveObjDescPresence(t *testing.T) {
- g := &Game{Flags: NewFlagStore()}
+ g := &Game{GlobalFlags: NewGlobalFlagStore()}
def := &object.ObjectDef{
Description: behavior.DescList{
@@ -140,7 +140,7 @@ func TestResolveObjDescPresence(t *testing.T) {
}
func TestRoomDescriptionSelection(t *testing.T) {
- g := &Game{Flags: NewFlagStore()}
+ g := &Game{GlobalFlags: NewGlobalFlagStore()}
room := &world.Room{
Description: behavior.DescList{
{Text: "crowd", Condition: &behavior.Condition{PlayerFlag: "done", Not: true}},