From 6f3d21d6e7f01155ce0c461857a053b43d329392 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 27 Jun 2026 02:29:55 -0400 Subject: feat: recall/home cmd, line break option --- internal/game/act_trigger_module.go | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 internal/game/act_trigger_module.go (limited to 'internal/game/act_trigger_module.go') diff --git a/internal/game/act_trigger_module.go b/internal/game/act_trigger_module.go new file mode 100644 index 0000000..467cb83 --- /dev/null +++ b/internal/game/act_trigger_module.go @@ -0,0 +1,61 @@ +package game + +import ( + "fmt" + + "thehouseoficarus/internal/behavior" + "thehouseoficarus/internal/net" + "thehouseoficarus/internal/player" +) + +func (g *Game) startTriggerModule(sess *net.Session, p *player.Player, mod *ModDef) { + if p.Action != nil { + g.cancelAction(p) + } + p.Action = &behavior.Action{ + Type: behavior.TypeTriggerModule, + TargetID: mod.ID, + TargetName: mod.Name, + WaitLeft: 0, + Data: &behavior.TriggerModuleData{ + ModID: mod.ID, + Steps: mod.Sequence, + StepIndex: 0, + }, + } + g.writePrompt(sess) +} + +func (g *Game) advanceTriggerModule(sess *net.Session, p *player.Player) { + data := p.Action.Data.(*behavior.TriggerModuleData) + + mod := GetMod(data.ModID) + if mod == nil { + g.cancelAction(p) + sess.WriteLine("The module has vanished.") + return + } + + if data.StepIndex < len(data.Steps) { + step := data.Steps[data.StepIndex] + sess.WriteLine(step.Message) + data.StepIndex++ + p.Action.WaitLeft = step.Delay + } else { + g.triggerModReward(sess, p, mod, 1.0) + if g.Combat.Get(p.Name) != nil { + g.Combat.Leave(p.Name) + } + switch mod.Category { + case ModTransport: + g.executeTransportEffect(sess, p, mod) + if mod.ID == "transport_home" { + p.HomeTransportCooldown = 3000 + } + default: + sess.WriteLine(fmt.Sprintf("%s completes.", mod.Name)) + } + g.cancelAction(p) + g.writePrompt(sess) + } +} -- cgit v1.2.3