Before I start, I’ve done a lot of research and I know what I want and don’t want from this system.
So let me demonstrate the problem. You have 6 Items. A sword, a bow, a health potion, a mana potion, bread, and a key.
All items have a Name, a Gold Value, and an ID. A sword inherits from Item but also has Damage and can be Equipped. A Bow also inherits from Item but has Damage, a Projectile, and can be Equipped. [I know we could have a Weapon class inherit from Item first]. Health Potion and Mana Potion will also inherit from Item. Health Potion will restore health while the Mana Potion restores mana. Bread inherits from Item and also restores health. Other Produce like bread can restore Health, Mana, or both. A key really is just an Item with no functionality; it stays in the inventory until removed by a Quest.
Ok, so yes, I see that I can create a Potion class to treat all potions the same. I see that I can probably set up a variable for the attribute and the amount so when I call the Use method, it affects that specific attribute. Some Potions will be able to affect multiple attributes though or may remove all status effects. The functionality is endless as it goes on. I could break it down further to an AttributePotion that accepts an array of attributes and a value. That could work, but then there may just be more types of Potions. Not to mention, Produce has the same affect as Potions. It could just be a Consumable class, but sorting in the GUI would come down to me telling the item that it is a potion or not (so food).
I can clearly see that there may or may not be a correct answer to this. I see that there can be several different ways to implement this. I’m looking for suggestions. Best practices. I don’t know much about LUA, but I’ve heard that I could have a string of code in LUA be parsed to give me any customizable effects I want (“Health += 80; Mana += 20;”). If that’s true, it would probably save a lot of the structuring issues I’m running into.
Any advice?