What's in the item class then? |
ItemBase class includes general data that is common to all items. For example the name of the item, the player stats that can be altered, etc...:
1 2 3 4 5 6 7 8 9 10 11 12
|
unsigned int itemID;
string itemName;
string itemDescription;
double baseItemPrice;
// stats
short int itemStrength;
short int itemIntellect;
short int itemStamina;
short int itemAgility;
short int itemSpirit;
short int itemDurability;
short int itemDurabilityMax;
|
As far as the methods available. There should be a member function that modifies the players stats based on the item equipped, unequipped or use. For example lets say the item had +4 strength. When it's equipped the function will add 4 to the players base strength. I won't post my class interface, it is now propriertary info :)
As far as attacks, unless the attack is directly dependant on a specific item, you should break attacks, spells, or whatever into their own class. The weapon class shouldn't really contain any sort of input handling. Choosing a weapon, equipping, using, etc... should be handled by your key bind/input handling interface. For example I have a KeyBinding class that associates each key with specific actions dependant on the game state. Every frame I grab an event and pass it along to handle input if its appropriate, for example equipping items, using items, opening menus, etc... its complicated as hell... Handle input processes the input correclty based on the KeyBindings that are set (which can be changed by the player), the object type, game state, etc... This is probably a bit overboard for what your trying to do, but hopefully you get my point.