fix(gen2): sell TMs at Poké Marts instead of opening the teach party

Selecting a TM in the mart's SELL pack (and the item PC's DEPOSIT pack) opened the teach-party screen: PackMenu:useSelected taught any item carrying `teaches`, even when the pack was built as a chooser (DepositSellPack, world = {}). On the cart that chooser's jumptable is four ScrollingMenus and never reaches tmhm.asm, so the row must hand back to the caller instead.

Gate the teach and field-NOUSE branches behind world.useFieldItem so only the real field PACK teaches; choosers now hand TMs to onChoose. Selling then prices a TM at half its ItemAttributes price -- exactly half of what the Goldenrod/Celadon TM shelves charge, and half of the hidden price for the rest, the way SelectQuantityToSell -> GetItemPrice -> Sell_HalvePrice does on the cart.

Closes #1243
This commit is contained in:
ShaneMcGovernIE
2026-08-13 23:55:31 +01:00
parent 26e9e1d597
commit 1586aec9f6
5 changed files with 94 additions and 12 deletions
+21
View File
@@ -549,6 +549,27 @@ do
dudePack:useSelected()
eq(thrown, "POKE_BALL", "the tutorial pack still throws")
eq(dudePack.message, nil, "with no Oak line in the way")
-- DepositSellPack passes the same empty world (the mart's SELL and the
-- item PC's DEPOSIT both do): a TM row must hand its id back rather than
-- open the teach party, which is issue #1243's "Teach which PKMN?" in
-- the middle of a sale.
local sellGame = { input = newInput(), save = {
player = { name = "GOLD" },
inventory = { TM01 = 1 },
options = {},
}, data = DATA, stack = newStack() }
local sold
local sellPack = PackMenu.new(sellGame, {
save = sellGame.save, items = DATA.items, world = {},
onChoose = function(id) sold = id end,
})
sellPack.pocketIndex = 4 -- TM_HM
sellPack:rebuild()
sellPack:useSelected()
eq(sold, "TM01", "a chooser pack hands a TM to its caller")
eq(sellPack.message, nil, "with no teach refusal in the way")
eq(#sellGame.stack._items, 0, "and nothing pushed over the pack")
end
-- ------------------------------------------------ say(): the teardown rule