diff options
Diffstat (limited to 'src/main/headers')
-rw-r--r-- | src/main/headers/Actor.hpp | 19 | ||||
-rw-r--r-- | src/main/headers/Bullet.hpp | 7 | ||||
-rw-r--r-- | src/main/headers/Item.hpp | 9 | ||||
-rw-r--r-- | src/main/headers/MeleeWeapon.hpp | 2 | ||||
-rw-r--r-- | src/main/headers/RangedWeapon.hpp | 2 | ||||
-rw-r--r-- | src/main/headers/Stick.hpp | 7 | ||||
-rw-r--r-- | src/main/headers/Weapon.hpp | 2 |
7 files changed, 41 insertions, 7 deletions
diff --git a/src/main/headers/Actor.hpp b/src/main/headers/Actor.hpp index 14c4fff..90535b1 100644 --- a/src/main/headers/Actor.hpp +++ b/src/main/headers/Actor.hpp @@ -38,6 +38,16 @@ public: const std::list<Item*>& inventory() const { return _inventory; } + //TODO add weaponslot + Item* weapon() const { return _weapon; } + + unsigned levelAxe() const { return _levelAxe; } + unsigned levelLance() const { return _levelLance; } + unsigned levelSword() const { return _levelSword; } + unsigned levelRanged() const { return _levelRanged; } + unsigned levelStick() const { return _levelStick; } + unsigned levelMedicine() const { return _levelMedicine; } + int x() { return _x; } int y() { return _y; } @@ -66,6 +76,15 @@ protected: unsigned _inventorySize; std::list<Item*> _inventory; + Item* _weapon; + + unsigned _levelAxe; + unsigned _levelLance; + unsigned _levelSword; + unsigned _levelRanged; + unsigned _levelStick; + unsigned _levelMedicine; + Actor(std::string _name, unsigned _maxHp); }; diff --git a/src/main/headers/Bullet.hpp b/src/main/headers/Bullet.hpp index e38c3f2..6ab5dbe 100644 --- a/src/main/headers/Bullet.hpp +++ b/src/main/headers/Bullet.hpp @@ -3,10 +3,11 @@ #include "Item.hpp" -class Bullet : public Item +class Bullet : protected Item { public: - bool use(RangedWeapon &weapon); -} + virtual bool use(RangedWeapon &weapon); + virtual bool decreaseAmount(int qnt); +}; #endif diff --git a/src/main/headers/Item.hpp b/src/main/headers/Item.hpp index caa1e6f..56f8733 100644 --- a/src/main/headers/Item.hpp +++ b/src/main/headers/Item.hpp @@ -11,11 +11,18 @@ class Actor; class Item { public: + enum Type { + BULLET, MELEEWEAPON, RANGEDWEAPON, STICK, HEAL, FOOD + }; + + const Type type; + Item() = delete; virtual ~Item() {} virtual bool use(Actor &user, Actor &actor) = 0; + int amount() { return _amount; } bool stackable() { return _maxAmount == 1; } protected: @@ -24,7 +31,7 @@ protected: const std::string _name; - Item(const std::string &name) : _name(name) {} + Item(Type t, const std::string &name) : _name(name), type(t) {} }; #endif diff --git a/src/main/headers/MeleeWeapon.hpp b/src/main/headers/MeleeWeapon.hpp index b98d027..97a0930 100644 --- a/src/main/headers/MeleeWeapon.hpp +++ b/src/main/headers/MeleeWeapon.hpp @@ -16,7 +16,7 @@ public: const Type type; - MeleeWeapon(Type t, const std::string &name); + MeleeWeapon(Type t, const std::string &name, bool throwable); bool use(Actor &user, Actor &actor); protected: diff --git a/src/main/headers/RangedWeapon.hpp b/src/main/headers/RangedWeapon.hpp index 0cc3be1..e5b0b66 100644 --- a/src/main/headers/RangedWeapon.hpp +++ b/src/main/headers/RangedWeapon.hpp @@ -11,7 +11,7 @@ class RangedWeapon : public Weapon public: RangedWeapon(const std::string &name); bool use(Actor &user, Actor &actor); - void reload(Actor &actor); + bool reload(Actor &actor); protected: bool _charged; diff --git a/src/main/headers/Stick.hpp b/src/main/headers/Stick.hpp index 4ed2b45..724e36d 100644 --- a/src/main/headers/Stick.hpp +++ b/src/main/headers/Stick.hpp @@ -5,6 +5,13 @@ class Stick : public Item { +public: + Stick(const std::string &name); + bool use(Actor &user, Actor &actor); + +protected: + const int _maxUses; + int _remainingUses; }; diff --git a/src/main/headers/Weapon.hpp b/src/main/headers/Weapon.hpp index 4c134ea..40eb7a3 100644 --- a/src/main/headers/Weapon.hpp +++ b/src/main/headers/Weapon.hpp @@ -12,7 +12,7 @@ protected: unsigned _damage; unsigned _requiredLevel; - Weapon(const std::string &name) : Item(name) {} + Weapon(Item::Type t, const std::string &name) : Item(t, name) {} }; #endif |