aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 22:15:54 -0400
committerhistoria <[not public]>2026-07-09 22:15:54 -0400
commitecba7f726f70b37126d852c38c7e3eec7b04d730 (patch)
tree9129215c6e5015336fde1116395336d82bb952d1 /internal/game/act.go
parentb3d4c616f59ad2519f3a0b77e3b47d6571cd2486 (diff)
downloadthehouseoficarus-ecba7f726f70b37126d852c38c7e3eec7b04d730.tar.gz
feat: old standalone trigger systems completely unified into trigger->condition->action system
Diffstat (limited to 'internal/game/act.go')
-rw-r--r--internal/game/act.go47
1 files changed, 45 insertions, 2 deletions
diff --git a/internal/game/act.go b/internal/game/act.go
index 1fc2b1c..352f235 100644
--- a/internal/game/act.go
+++ b/internal/game/act.go
@@ -235,8 +235,6 @@ func (g *Game) AdvanceActions() {
g.advanceTalk(sess, p)
case behavior.TypeTriggerModule:
g.advanceTriggerModule(sess, p)
- case behavior.TypeInteractionSeq:
- g.advanceInteractionSeq(sess, p)
case behavior.TypeCombine:
g.advanceCombine(sess, p)
default:
@@ -302,6 +300,13 @@ func (g *Game) checkCondition(sess *net.Session, c *behavior.Condition) bool {
val, present := g.GlobalFlags.Get(c.GlobalFlag)
return flagMatches(present, val, c.Value, c.Not)
}
+ if c.Room != 0 {
+ has := p != nil && p.RoomID == c.Room
+ if c.Not {
+ return !has
+ }
+ return has
+ }
if c.HasItem != "" {
has := p != nil && p.HasItem(c.HasItem)
if c.Not {
@@ -319,6 +324,44 @@ func (g *Game) checkCondition(sess *net.Session, c *behavior.Condition) bool {
return true
}
+// checkConditionGlobal evaluates a condition without a player session.
+// Only global_flag predicates (plus all_of/any_of/not composition) are evaluated.
+// Room, player_flag, has_item, and min_credits are player-dependent: Room passes
+// (it is used as a reference-room selector, not a gate), and the rest fail.
+func (g *Game) checkConditionGlobal(c *behavior.Condition) bool {
+ if c.AllOf != nil {
+ for _, sub := range c.AllOf {
+ if !g.checkConditionGlobal(&sub) {
+ return false
+ }
+ }
+ return true
+ }
+ if c.AnyOf != nil {
+ for _, sub := range c.AnyOf {
+ if g.checkConditionGlobal(&sub) {
+ return true
+ }
+ }
+ return false
+ }
+
+ if c.GlobalFlag != "" {
+ val, present := g.GlobalFlags.Get(c.GlobalFlag)
+ return flagMatches(present, val, c.Value, c.Not)
+ }
+ if c.PlayerFlag != "" {
+ return c.Not
+ }
+ if c.HasItem != "" {
+ return c.Not
+ }
+ if c.MinCredits > 0 {
+ return c.Not
+ }
+ return true
+}
+
// flagMatches evaluates a global_flag/player_flag condition. The name is
// historical; it evaluates both flag types.
//