diff options
Diffstat (limited to 'src/items.cpp')
-rw-r--r-- | src/items.cpp | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/items.cpp b/src/items.cpp new file mode 100644 index 0000000..b25b482 --- /dev/null +++ b/src/items.cpp @@ -0,0 +1,117 @@ +#include <inventory.hpp> + +/************************************************************************************ +* GLOBAL * +************************************************************************************/ + +/************************************************** +* USE ITEM * +**************************************************/ + +int BaseItem::useItem() +{ + return 0; +} + +int Sword::useItem() +{ + std::cout << "Swing!" << std::endl; + return 0; +} + +int Bow::useItem() +{ + return 0; +} + +// TODO chance to hurt +int RawFood::useItem() +{ + return 0; +} + +int Food::useItem() +{ + std::cout << "Yum!" << std::endl; + return 0; +} + + +/************************************************** +* CLONE * +**************************************************/ + +BaseItem* BaseItem::clone() +{ + return new BaseItem(*this); +} + +Sword* Sword::clone() +{ + return new Sword(*this); +} + +Bow* Bow::clone() +{ + return new Bow(*this); +} + +Food* Food::clone() +{ + return new Food(*this); +} + +RawFood* RawFood::clone() +{ + return new RawFood(*this); +} + +/************************************************************************************ +* ITEM SPECIFIC * +************************************************************************************/ + +/************************************************** +* ITEM * +**************************************************/ + +Item::~Item() +{ + delete tex; +} + +GLuint Item::rtex() +{ + return tex->image[0]; +} + +GLuint Item::rtex(int n) +{ + return tex->image[n]; +} + +/************************************************** +* SWORD * +**************************************************/ + +float Sword::getDamage() +{ + return damage; +} + +/************************************************** +* BOW * +**************************************************/ + +float Bow::getDamage() +{ + return damage; +} + +/************************************************** +* FOODS * +**************************************************/ + +float RawFood::getHealth() +{ + return health; +} |