Expand description
Generic item-effect application + bag/shop buy-sell flow (P0e).
This module owns only the control flow of using, buying, and selling items. It is 100% game-agnostic: it never decides what an item effect actually does. The engine routes; the game decides.
UsageContext/ItemUseResultare neutral engine types.ItemProvider::apply_effectis an opaque dispatch hook: the game implements what healing / status-cure / PP-restore / vitamins / battle items / catch / etc. actually do. The engine never inspects the effect.use_itemis the shared driver for field and battle use: it validates ownership and the usage context (ItemProvider::usable_in), dispatches toapply_effect, then consumes one unit from theInventoryiff the result says so. One place so field & battle share it.buy/sellperform pure money/inventory bookkeeping; prices and the sell rate come fromShopProvider(Gen-1 quirks stay game-side).
Structs§
- Shop
Receipt - Summary of a completed shop transaction.
Enums§
- Item
UseResult - Neutral result of an item-use attempt, returned by
ItemProvider::apply_effectand propagated byuse_item. - Shop
Error - Error from a shop transaction. Nothing is mutated when an error is returned.
- Usage
Context - Where / whether an item may be used. A neutral engine enum — no game
specifics. Returned by
ItemProvider::usable_inand passed intoItemProvider::apply_effect/use_itemas the active context.
Functions§
- buy
- Buy
quantityunits ofitemat the shop’sShopProvider::buy_price. - sell
- Sell
quantityunits ofitemfor the shop’sShopProvider::sell_price. - use_
item - Engine driver for using an item from the bag, shared by field and battle.