aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/headers/Item.hpp
blob: e338dbc9436bdc3dce4adcf7fb6b5e87c804e5df (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
#ifndef ITEM_HPP
#define ITEM_HPP

#include <string>

class Actor;

class Item
{
public:
    enum class 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