diff options
Diffstat (limited to 'src/main/headers')
-rw-r--r-- | src/main/headers/Actor.hpp | 71 | ||||
-rw-r--r-- | src/main/headers/Bullet.hpp | 5 | ||||
-rw-r--r-- | src/main/headers/Item.hpp | 6 | ||||
-rw-r--r-- | src/main/headers/MeleeWeapon.hpp | 7 | ||||
-rw-r--r-- | src/main/headers/RangedWeapon.hpp | 2 | ||||
-rw-r--r-- | src/main/headers/Tile.hpp | 2 | ||||
-rw-r--r-- | src/main/headers/Weapon.hpp | 13 | ||||
-rw-r--r-- | src/main/headers/config.h | 2 | ||||
-rw-r--r-- | src/main/headers/config.h.in | 2 |
9 files changed, 51 insertions, 59 deletions
diff --git a/src/main/headers/Actor.hpp b/src/main/headers/Actor.hpp index 1e160f6..6366f2e 100644 --- a/src/main/headers/Actor.hpp +++ b/src/main/headers/Actor.hpp @@ -1,14 +1,34 @@ #ifndef ACTOR_HPP #define ACTOR_HPP +#include "Weapon.hpp" + #include <list> #include <string> +#include <map> + -#include "Item.hpp" +class Item; class Actor { public: + enum class Stat + { + ATTACK, + DEFENCE, + MAGICATTACK, // magia + MAGICDEFENSE, // resistenza + PRECISION, + DODGE, + REACTION + }; + + enum class Skill + { + + }; + const std::string name; const unsigned maxHp; @@ -19,35 +39,19 @@ public: void heal(int amt); void store(Item &item); - Item& drop(); + Item* drop(); + + unsigned stat(Stat stat) const; + unsigned skill(Skill skill) const; /* accessors */ bool alive() const { return _alive; } unsigned hp() const { return _hp; } - unsigned attack() const { return _attack; } - unsigned defence() const { return _defence; } - - unsigned magicAttack() const { return _magicAttack; } - unsigned magicDefence() const { return _magicDefence; } - - unsigned precisionProbabiliy() const { return _precisionProbability; } - unsigned dodgeProbabiliy() const { return _dodgeProbability; } - - unsigned reactionSpeed() const { return _reactionSpeed; } - 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; } @@ -59,31 +63,14 @@ protected: unsigned _movements; int _x, _y; - /* combat related */ - unsigned _attack; - unsigned _defence; - - unsigned _magicAttack; // nota come magia - unsigned _magicDefence; // nota come resistenza - - unsigned _precisionProbability; - unsigned _dodgeProbability; - unsigned _reactionSpeed; - - // unsigned _abilityProbability; - /* others */ + Item* _weapon; + unsigned _inventorySize; std::list<Item*> _inventory; - Item* _weapon; - - unsigned _levelAxe; - unsigned _levelLance; - unsigned _levelSword; - unsigned _levelRanged; - unsigned _levelStick; - unsigned _levelMedicine; + std::map<Stat, unsigned> _stats; + std::map<Weapon::Class, unsigned> _skills; Actor(std::string _name, unsigned _maxHp); }; diff --git a/src/main/headers/Bullet.hpp b/src/main/headers/Bullet.hpp index b12c614..db5cdff 100644 --- a/src/main/headers/Bullet.hpp +++ b/src/main/headers/Bullet.hpp @@ -2,12 +2,11 @@ #define BULLET_HPP #include "Item.hpp" -#include "RangedWeapon.hpp" -class Bullet : protected Item +class Bullet : public Item { public: - virtual bool use(RangedWeapon &weapon); + virtual bool use() { return false; } virtual bool decreaseAmount(unsigned qnt); }; diff --git a/src/main/headers/Item.hpp b/src/main/headers/Item.hpp index ce0c921..e338dbc 100644 --- a/src/main/headers/Item.hpp +++ b/src/main/headers/Item.hpp @@ -5,13 +5,11 @@ class Actor; -/* - * TODO description - */ class Item { public: - enum Type { + enum class Type + { BULLET, MELEEWEAPON, RANGEDWEAPON, STICK, HEAL, FOOD }; diff --git a/src/main/headers/MeleeWeapon.hpp b/src/main/headers/MeleeWeapon.hpp index 97a0930..e7917b8 100644 --- a/src/main/headers/MeleeWeapon.hpp +++ b/src/main/headers/MeleeWeapon.hpp @@ -10,13 +10,8 @@ class MeleeWeapon : public Weapon { public: - enum Type { - SWORD, AXE, LANCE - }; - const Type type; - - MeleeWeapon(Type t, const std::string &name, bool throwable); + MeleeWeapon(Weapon::Class weaponClass, 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 e5b0b66..38e1750 100644 --- a/src/main/headers/RangedWeapon.hpp +++ b/src/main/headers/RangedWeapon.hpp @@ -9,7 +9,7 @@ class RangedWeapon : public Weapon { public: - RangedWeapon(const std::string &name); + RangedWeapon(Weapon::Class c, const std::string &name); bool use(Actor &user, Actor &actor); bool reload(Actor &actor); diff --git a/src/main/headers/Tile.hpp b/src/main/headers/Tile.hpp index 88e7216..0fc3105 100644 --- a/src/main/headers/Tile.hpp +++ b/src/main/headers/Tile.hpp @@ -5,7 +5,7 @@ struct Tile { - enum Type + enum class Type { GRASS, WATER }; diff --git a/src/main/headers/Weapon.hpp b/src/main/headers/Weapon.hpp index 40eb7a3..f59fe4d 100644 --- a/src/main/headers/Weapon.hpp +++ b/src/main/headers/Weapon.hpp @@ -2,17 +2,26 @@ #define WEAPON_HPP #include "Item.hpp" -#include "Actor.hpp" #include <string> +class Actor; + class Weapon : public Item { +public: + enum class Class + { + SWORD, AXE, LANCE, RANGED + }; + + const Class weaponClass; + protected: unsigned _damage; unsigned _requiredLevel; - Weapon(Item::Type t, const std::string &name) : Item(t, name) {} + Weapon(Item::Type t, Class _weaponClass, const std::string &name) : Item(t, name), weaponClass(_weaponClass) {} }; #endif diff --git a/src/main/headers/config.h b/src/main/headers/config.h index e69de29..091b36d 100644 --- a/src/main/headers/config.h +++ b/src/main/headers/config.h @@ -0,0 +1,2 @@ +#define subconscious_VERSION_MAJOR 0 +#define subconscious_VERSION_MINOR 1 diff --git a/src/main/headers/config.h.in b/src/main/headers/config.h.in index e69de29..03848b5 100644 --- a/src/main/headers/config.h.in +++ b/src/main/headers/config.h.in @@ -0,0 +1,2 @@ +#define subconscious_VERSION_MAJOR @subconscious_VERSION_MAJOR@ +#define subconscious_VERSION_MINOR @subconscious_VERSION_MINOR@ |