aboutsummaryrefslogtreecommitdiff
path: root/internal/game/act_steal.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/act_steal.go')
-rw-r--r--internal/game/act_steal.go19
1 files changed, 4 insertions, 15 deletions
diff --git a/internal/game/act_steal.go b/internal/game/act_steal.go
index 32889ce..5a7f93e 100644
--- a/internal/game/act_steal.go
+++ b/internal/game/act_steal.go
@@ -42,7 +42,7 @@ var stallGuardTalk = &behavior.TalkConfig{
},
"jail": {
Messages: []string{"Off to the detention cell with you!"},
- Action: &behavior.Step{Teleport: 162},
+ Action: &behavior.Step{Teleport: 99999162},
Options: []behavior.TalkOption{{Text: "(You are dragged away)"}},
},
"fight": {
@@ -254,11 +254,6 @@ func (g *Game) startSteal(sess *net.Session, p *player.Player, targetType string
}
}
- if p.FirstFreeSlot() == -1 {
- sess.WriteLine("Your inventory is too full!")
- return
- }
-
sess.WriteLine(fmt.Sprintf("You attempt to steal from the %s...", targetName))
g.broadcastAction(sess, "%s glances around the room.", p.Name)
@@ -379,12 +374,6 @@ func (g *Game) advanceSteal(sess *net.Session, p *player.Player) {
g.saveCharacter(p)
- if p.FirstFreeSlot() == -1 {
- sess.WriteLine("Your inventory is full.")
- g.cancelAction(p)
- return
- }
-
p.Action.WaitLeft = engine.ToTicks(stealSpeed)
} else {
if targetType == "mob" {
@@ -429,14 +418,14 @@ func (g *Game) giveStealLoot(sess *net.Session, p *player.Player, drop *behavior
name = lootDef.Name
}
- freeSlot := p.FirstFreeSlot()
- if freeSlot == -1 {
+ // Stack-aware placement: a stackable steal merges into an existing stack,
+ // so a full inventory with a matching stack is not a failure.
+ if !placeCraftOutput(p, drop.ItemID, lootDef, qty) {
g.World.AddGroundItem(p.RoomID, drop.ItemID, qty)
sess.WriteLine(fmt.Sprintf("You steal %s but your inventory is full. It falls to the ground.", g.itemColorize(sess, lootDef, name)))
return
}
- p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: drop.ItemID, Quantity: qty})
sess.WriteLine(fmt.Sprintf("You steal %s.", g.itemColorize(sess, lootDef, name)))
}