This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpotion.h
executable file
·81 lines (71 loc) · 2.48 KB
/
potion.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef __POTION_H__
#define __POTION_H__
#include "character.h"
class Potion: public Character{
protected:
Character* component;
int pr,pc;
public:
Potion(int r, int c);
virtual ~Potion(); //make sure to not delete component if == to getInstance()
virtual void action(Character* &c) = 0;
virtual void setAbs() = 0; // set all fields to their absolute value;
virtual int getAtk(); //only used by HPpotion, virtual for decorators
virtual int getDef(); //only used by HPpotion, virtual for decorators
virtual void setCoordinates(int r, int c);; // call componet's setCoordinates()
virtual bool attack(Character &c); // call components' attack()
virtual int getRow();
virtual int getColumn();
virtual void increaseGold(int n);
virtual void increaseHP(int n); //if HP is less than 0, set to 0, if more than max, set to max
virtual int getHP();
virtual int getPotABS(); //get potion reverse
// virtual void setType(char type);
virtual int getGold();
};
//Non-decorators
class HPPotion: public Potion{
int health;
static bool posSeen;
static bool negSeen;
//call function in floor to set character to new upHP
public:
static void setPosSeen();
static void setNegSeen();
static bool getPosSeen();
static bool getNegSeen();
static void setNotPosSeen();
static void setNotNegSeen();
HPPotion(char type, int r, int c);
virtual void setAbs();
virtual void action(Character* &c);//c->increaseHP(health);
};
//Decorators
class TempPotion: public Potion{
int atkB; //B stands for boost
int defB;
static bool baSeen;
static bool waSeen;
static bool bdSeen;
static bool wdSeen;
public:
static void setBaSeen();
static void setWaSeen();
static void setBdSeen();
static void setWdSeen();
static bool getBaSeen();
static bool getWaSeen();
static bool getBdSeen();
static bool getWdSeen();
static void setNotBaSeen();
static void setNotWaSeen();
static void setNotBdSeen();
static void setNotWdSeen();
TempPotion(char type, int r, int c);
virtual void setAbs();
virtual int getAtk();
virtual int getDef();
virtual void action(Character* &c); //set component = c; c = this;
virtual bool attack(Character &c);
};
#endif