aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_combine.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-05 17:49:48 -0400
committerhistoria <[not public]>2026-10-05 17:49:48 -0400
commit7a15a5d70004b28bf2a710fa0f536af2446e5b17 (patch)
tree920705853f79bb13a65fcb2f89cee38e6f2efab8 /internal/game/act_combine.go
parentec703a39738fefb60817f5659f76f8e683f8d301 (diff)
downloadthehouseoficarus-7a15a5d70004b28bf2a710fa0f536af2446e5b17.tar.gz
fix: production multi-step recipes, drop-weight validation, journal versioning
Diffstat (limited to 'internal/game/act_combine.go')
-rw-r--r--internal/game/act_combine.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/game/act_combine.go b/internal/game/act_combine.go
index 701aaec..d7aed04 100644
--- a/internal/game/act_combine.go
+++ b/internal/game/act_combine.go
@@ -8,7 +8,7 @@ import (
"thehouseoficarus/internal/player"
)
-func (g *Game) startCombine(sess *net.Session, p *player.Player, item *item.ItemDef, craft *item.CraftDef, count int) {
+func (g *Game) startCombine(sess *net.Session, p *player.Player, item *item.ItemDef, craft *item.CraftDef, count int, craftIndex int) {
g.cancelAction(p)
g.cancelBgAction(p)
@@ -33,6 +33,7 @@ func (g *Game) startCombine(sess *net.Session, p *player.Player, item *item.Item
TargetName: outputName,
Data: &behavior.CombineData{
ItemID: item.ID,
+ CraftIndex: craftIndex,
Phase: 0,
StepIndex: 0,
Remaining: count,
@@ -72,7 +73,11 @@ func (g *Game) advanceCombine(sess *net.Session, p *player.Player) {
g.cancelAction(p)
return
}
- craft := item.FirstCraft()
+ idx := d.CraftIndex
+ if idx < 0 || idx >= len(item.Craft) {
+ idx = 0
+ }
+ craft := &item.Craft[idx]
switch d.Phase {
case 0:
@@ -127,7 +132,7 @@ func (g *Game) advanceCombine(sess *net.Session, p *player.Player) {
// Byproducts must be collected BEFORE consumption: the resolver maps
// each ingredient entry to the alternative actually being consumed
// (bucket vs jug of water), which requires the items still present.
- byproducts := g.collectByproducts(p, item)
+ byproducts := g.collectByproducts(p, craft)
hasItem := craftConsumedHasItem(craft, p.CountItem, p.HasItem)
if !consumeIngredients(craft, p.CountItem, p.RemoveItem) {