Items are discrete, i.e. each item has its unique id. But items may have properties that are continuous or have too many states, or "modifiers"...
Player has inventory, a collection of items.
an Item object is a prototype of an in game item that can have modifiers applied to it outside. an Item has: name, description, data (for equipment).
There's a large lookup map (indexed array) that associates an ID with a Item object.
An Inventory is a map of many items. Format is <id, quantity, modifiers>.
e.g. let blue claw be item id 4, let you have 10 of them, it's stored as (4,10, null) in your inventory. And in the lookup map, there will be an entry something like Item{name: "Blue claw", desc: "a shiny blue claw from idk", null} at index 4.
Weapons and equipment are just items with the data field specifying the type. like if its a weapon. what kind of weapon is the "class". Usually only can be 1 in a slot, but for things like throwing knives it can have multiple.
e.g., let id 3 be a wood sword,.. so a wood sword with the "sharp" modifier is stored in inventory as (3,1, {mods: "sharp"}) for now. And in the lookup map, there'll be an entry like: Item{name:"Wood sword", desc:"weak lulw", data: Weapon{class: "sword", "damage":3, "delay":30} } at index 3.
Zelda BOTW inventory is actually multiple inventories of categories- have something like this. Weapons, Potions, armor, materials, key items, and some fancy screens that lists some key things. So like in player, can have, weapon_inventory, potion_inventory, armor_inventory, etc.
For combat... how to choose which weapon's active? Assuming only one weapon can be used at a time (no dual wielding any two), then have a single pointer that points to the item that's active. Dont use "equipped" flags on items (because that implies very many items can be equipped at once).
For other items in combat like potions or throwing knives, have some hotkeys that uses them or switches between them, dont make it like minecraft where they can be put anywhere in some hotbar that's too sandbox-y.
Later should have some actors on the battlefield have similar inventories for combat? Usually like being able to switch weapons or use potions. Their inventories should be similar anyway, just a few slots with main weapons and consumables.
What items they drop on death will be determined through other means, some other service will map what an enemy type drops, etc...
Clean.
Items are discrete, i.e. each item has its unique id. But items may have properties that are continuous or have too many states, or "modifiers"...
Player has inventory, a collection of items.
Weapons and equipment are just items with the data field specifying the type. like if its a weapon. what kind of weapon is the "class". Usually only can be 1 in a slot, but for things like throwing knives it can have multiple.
Zelda BOTW inventory is actually multiple inventories of categories- have something like this. Weapons, Potions, armor, materials, key items, and some fancy screens that lists some key things. So like in player, can have, weapon_inventory, potion_inventory, armor_inventory, etc.
For combat... how to choose which weapon's active? Assuming only one weapon can be used at a time (no dual wielding any two), then have a single pointer that points to the item that's active. Dont use "equipped" flags on items (because that implies very many items can be equipped at once).
Later should have some actors on the battlefield have similar inventories for combat? Usually like being able to switch weapons or use potions. Their inventories should be similar anyway, just a few slots with main weapons and consumables.