aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/headers/Item.hpp
blob: ce0c921d5ac8c0903284ce6c08ad841e7342231d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef ITEM_HPP
#define ITEM_HPP

#include <string>

class Actor;

/*
 * TODO description
 */
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:
    unsigned _maxAmount;
    unsigned _amount; // stackable

    const std::string _name;

    Item(Type t, const std::string &name) : type(t), _name(name) {}
};

#endif