mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-15 07:41:21 +02:00
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:
@@ -94,6 +94,8 @@ local ITEMS = {
|
||||
canToss = false },
|
||||
HM_CUT = { id = "HM_CUT", name = "HM01", pocket = "TM_HM", index = 0xf3,
|
||||
canToss = false },
|
||||
TM_HEADBUTT = { id = "TM_HEADBUTT", name = "TM02", pocket = "TM_HM",
|
||||
index = 0xea, canToss = true, teaches = "HEADBUTT" },
|
||||
}
|
||||
|
||||
local function newGame(save, items)
|
||||
@@ -291,6 +293,23 @@ do
|
||||
eq(pc.phase, "menu", "B drops back to the item PC menu")
|
||||
end
|
||||
|
||||
-- The same DepositSellPack chooser holds a TM: it must reach the quantity
|
||||
-- selector like everything tossable, never the teach party (issue #1243).
|
||||
do
|
||||
local save = newSave(1)
|
||||
local game, input = newGame(save)
|
||||
Bag.add(save, "TM_HEADBUTT", 1, game.data)
|
||||
local pc = ItemPcMenu.new(game, { save = save, items = ITEMS })
|
||||
press(pc, input, "down", "a") -- DEPOSIT ITEM
|
||||
press(pc, input, "right", "right", "right") -- ITEM -> BALL -> KEY_ITEM -> TM_HM
|
||||
press(pc, input, "a") -- choose the TM
|
||||
check(pc.qtyState ~= nil, "a TM asks how many to deposit")
|
||||
eq(#game.stack._items, 0, "with no teach screen pushed over the pack")
|
||||
press(pc, input, "a") -- deposit x1
|
||||
eq(save.pcItems.TM_HEADBUTT, 1, "the TM lands in the PC")
|
||||
eq(save.inventory.TM_HEADBUTT, nil, "and leaves the bag")
|
||||
end
|
||||
|
||||
-- .TryDepositItem's .no_toss: a KEY ITEM stays in the bag, silently.
|
||||
do
|
||||
local save = newSave(1)
|
||||
|
||||
Reference in New Issue
Block a user