From 9666676766bf21364f4fc4d0d1d336e72f2a91b4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 6 Oct 2026 12:57:23 -0400 Subject: refactor: split casino.go, dedup helpers, remove audit docs --- internal/game/act_combine.go | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'internal/game/act_combine.go') diff --git a/internal/game/act_combine.go b/internal/game/act_combine.go index d7aed04..a50d310 100644 --- a/internal/game/act_combine.go +++ b/internal/game/act_combine.go @@ -18,6 +18,21 @@ func (g *Game) startCombine(sess *net.Session, p *player.Player, item *item.Item return } + // See startProduction: combine recipes can start outside the crafting + // menus, so the station/tool gate must live at the execution site. + if len(craft.Station) > 0 { + if stID, _ := g.findStation(p.RoomID, craft.Station); stID == "" { + sess.WriteLine("You are not near the required station.") + g.reprompt(sess) + return + } + } + if craft.Tool != "" && !g.hasToolType(p, craft.Tool) { + sess.WriteLine("You do not have the required tool.") + g.reprompt(sess) + return + } + outDef, _ := g.ItemStore.Load(item.ID) outputName := item.ID if outDef != nil { @@ -47,13 +62,12 @@ func (g *Game) startCombine(sess *net.Session, p *player.Player, item *item.Item g.broadcastAction(sess, "%s starts combining.", p.Name) } -// combineSkill resolves the skill a combine recipe trains. Combine recipes -// declare type "combine", which is an action, not a skill: player.SkillName -// of it is the literal "combine", so p.Level would read a map miss as level 1 -// when rolling success and awardSkillXP would persist a phantom "combine" -// skill entry. A recipe that declares a real skill name is honored; anything -// else trains Crafting, the skill combine work belongs to. -func combineSkill(craft *item.CraftDef) player.SkillName { +// recipeSkill resolves the skill a recipe trains and rolls against. A recipe +// type is an action name, not necessarily a skill: player.SkillName of e.g. +// "combine" or "cleaning" is a literal action, so p.Level would read a map +// miss as level 1 and AddSkillXP would persist a phantom skill key. A recipe +// that declares a real skill name is honored; anything else trains Crafting. +func recipeSkill(craft *item.CraftDef) player.SkillName { skill := player.SkillName(craft.EffectiveSkill()) if player.ValidSkill(skill) { return skill @@ -61,6 +75,13 @@ func combineSkill(craft *item.CraftDef) player.SkillName { return player.Crafting } +// combineSkill resolves the skill a combine recipe trains. Combine recipes +// declare type "combine", which is an action, not a skill: the shared +// recipeSkill fallback keeps success rolls and XP on Crafting. +func combineSkill(craft *item.CraftDef) player.SkillName { + return recipeSkill(craft) +} + func (g *Game) advanceCombine(sess *net.Session, p *player.Player) { d, ok := p.Action.Data.(*behavior.CombineData) if !ok { -- cgit v1.2.3