aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_combine.go
diff options
context:
space:
mode:
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) {