-
Notifications
You must be signed in to change notification settings - Fork 0
/
item.h
48 lines (40 loc) · 1.44 KB
/
item.h
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
38
39
40
41
42
43
44
45
#ifndef ITEM_H
#define ITEM_H
#include <memory>
#include "player.h"
class Item : public Stuff {
// protected:
// Type type; inherited from Stuff
public:
Item(){ this->type = Type::Itm;}
// Type getType(); inherited from Stuff
// virtual char getChar() = 0; inherited from Stuff
// virtual void effect(std::shared_ptr<Player>) {} inherited from Stuff
virtual void beAttacked(std::shared_ptr<Stuff>) {}
virtual ~Item() = default;
};
class BarrierSuit final : public Item {
// protected:
// Type type; inherited from Stuff
bool canCollect = false;
std::shared_ptr<Stuff> dragon;
public:
// Type getType(); inherited from Stuff
std::string getName() const override; // inherited from Stuff
char getChar() const override; // inherited from Stuff
void effect(std::shared_ptr<Player>) override; // inherited from Item
bool isDragonHoard() override;
virtual void setCollect() override { canCollect = true ;}
std::shared_ptr<Stuff> getDragon() override;
void setDragon(std::shared_ptr<Stuff> d) override {dragon = d; }
};
struct Compass final : public Item {
// protected:
// Type type; inherited from Stuff
// public:
// Type getType(); inherited from Stuff
char getChar() const override; // inherited from Stuff
std::string getName() const override; // inherited from Stuff
void effect(std::shared_ptr<Player>) override; // inherited from Item
};
#endif