I'm currently fiddling around with some RPG mechanics and I'm trying to implement a solid way to handle items that have different on use effects.
Currently, I have a base class called "Item" that consists of things that all items have such as ID, name, description, quality etc. Then I have some subtype classes that extend "Item" such as "Weapon", "Armour", "Consumable", "Material" and "Quest". "Item" also implements an interface called "Usable" that has a Use function.
These subclasses share the exact same qualities. Such as all armour has an armour value, all weapons have an attack value etc so that I don't need a different class for each item but I want the use effects to differ. An example is that I have an item of type "Consumable" which when the use function is called, restores player health, a different consumable may do this again, but heal a greater amount. Another consumable may teleport the player to a specific location. These items are being stored in a JSon file and there may be a thousand or more different items and effects.
So, firstly, What would be an effective way to implement this behaviour? Secondly, if the vast majority of items have a use effect in each category but a few don't, should it still be structured like this?
Thanks.