aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
authorworkhorse <workhorse@localhost.localdomain>2026-06-19 03:57:06 -0400
committerworkhorse <workhorse@localhost.localdomain>2026-06-19 03:57:06 -0400
commit52a3ce6a4b4a254dc5d3067979a09e93c060fa20 (patch)
tree167c62990013733bc8669c1387078bc86ea48db5 /internal/game/game.go
parentfbd1c30d7b9777c9df6653f0c393afa7a7dfa519 (diff)
downloadthehouseoficarus-52a3ce6a4b4a254dc5d3067979a09e93c060fa20.tar.gz
feat: shops and rough assassin skill
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go30
1 files changed, 26 insertions, 4 deletions
diff --git a/internal/game/game.go b/internal/game/game.go
index 9d8a2c9..8b99731 100644
--- a/internal/game/game.go
+++ b/internal/game/game.go
@@ -52,8 +52,9 @@ type Game struct {
combatPadWidth int
freeQueue map[string][]QueuedCommand
activeQueue map[string]*QueuedCommand
- consumeQueue map[string]*QueuedCommand
+ consumeQueue map[string]*QueuedCommand
pendingDepletions []pendingDepletion
+ guardWatchTimers map[string]int
}
func New(dataDir string, colorConfig *config.ColorsConfig) *Game {
@@ -75,6 +76,7 @@ func New(dataDir string, colorConfig *config.ColorsConfig) *Game {
activeQueue: make(map[string]*QueuedCommand),
consumeQueue: make(map[string]*QueuedCommand),
pendingDepletions: nil,
+ guardWatchTimers: make(map[string]int),
}
}
@@ -121,6 +123,8 @@ func (g *Game) HandleSession(sess *net.Session, input string) {
g.handleDescriptionChange(sess, input)
case net.StateTalk:
g.handleTalkInput(sess, input)
+ case net.StateShop:
+ g.handleShopInput(sess, input)
case net.StateDropAllConfirm:
g.handleDropAllConfirm(sess, input)
case net.StateRecipeChoice:
@@ -141,8 +145,9 @@ func classifyCommand(cmd string) CommandClass {
"map", "option", "options", "alias", "unalias",
"description", "desc", "queued", "color", "colors",
"colortable", "prompt", "style", "stats",
- "tech", "t",
- "autocast", "auto", "mods", "modlist":
+ "tech", "t", "sneak",
+ "autocast", "auto", "mods", "modlist",
+ "task":
return ClassInstant
case "equip", "eq", "equipment", "wear", "wield", "remove", "unwear", "unwield":
return ClassFree
@@ -152,6 +157,7 @@ func classifyCommand(cmd string) CommandClass {
"west", "w", "up", "u", "down", "d",
"quit", "use", "burn", "stoke", "search", "walk", "cook", "smelt", "smith", "craft", "mix",
"id", "identify",
+ "steal", "thieve",
"trigger", "cast":
return ClassActive
case "eat", "fletch", "clean":
@@ -319,6 +325,8 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
}
case "sc", "score":
g.doScore(sess)
+ case "task":
+ g.doTask(sess)
case "stats":
g.doStats(sess)
case "tech", "t":
@@ -374,6 +382,9 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
return
}
case "use":
+ if g.tryFinishingBlow(sess, strings.Join(args, " ")) {
+ return
+ }
g.doUse(sess, strings.Join(args, " "))
return
case "cook":
@@ -407,6 +418,8 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
g.doAutocast(sess, strings.Join(args, " "))
case "mods", "modlist":
g.doMods(sess)
+ case "sneak":
+ g.doSneak(sess)
case "trigger", "cast":
g.doTrigger(sess, strings.Join(args, " "))
return
@@ -440,6 +453,14 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI
g.doSearch(sess, strings.Join(args, " "))
}
return
+ case "steal", "thieve":
+ g.CancelAction(p)
+ if len(args) == 0 {
+ g.doSteal(sess, "")
+ } else {
+ g.doSteal(sess, strings.Join(args, " "))
+ }
+ return
case "walk":
g.doWalk(sess, args)
return
@@ -495,7 +516,8 @@ func (g *Game) ProcessQueuedCommands() {
}
switch as.Type {
case ActionGathering, ActionCombating, ActionUsing, ActionTalking,
- ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionProducing:
+ ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionProducing,
+ ActionStealing:
default:
if as.Type != ActionMoving || p.MoveTicks <= 0 {
p.ActionState = nil