-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArmour.h
195 lines (162 loc) · 4.47 KB
/
Armour.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#ifndef ARMOUR_H_INCLUDED
#define ARMOUR_H_INCLUDED
#include "Item.h"
/**
* This class represents one piece of armour--as found in most video games.
* This includes boots and helmets.
*
* Armour may not be stacked. All Constructors must initialize Item::stackable
* to false.
*/
class Armour : public Item {
private:
protected:
double durability; ///< decreases each time the armour is used
double defense; ///< damage that is blocked
std::string material; ///< material out of which the armour is composed
std::string modifier; ///< one of protection, feather_falling, or unbreaking
int modifierLevel; ///< modifier level in the range 1 to 3
std::string element; ///< associated element--e.g., ice, fire, and lightning.
public:
/**
* Default to a armour with an empty name
*/
Armour();
// Big-3
Armour(const Armour& src) = default;
~Armour() = default;
Armour& operator=(const Armour& rhs) = default;
/**
* Retrieve armour durability
*/
double getDurability() const;
/**
* Set armour durability
*/
void setDurability(double durability);
/**
* Retrieve armour defense
*/
double getDefense() const;
/**
* Set armour defense
*/
void setDefense(double defense);
/**
* Retrieve armour Material
*/
std::string getMaterial() const;
/**
* Set armour Material
*/
void setMaterial(std::string m);
/**
* Retrieve armour Modifier
*/
std::string getModifier() const;
/**
* Set armour Modifier
*/
void setModifier(std::string m);
/**
* Retrieve armour Modifier Level
*/
double getModifierLevel() const;
/**
* Set armour Modifier Level
*/
void setModifierLevel(double level);
/**
* Retrieve armour Element
*/
std::string getElement() const;
/**
* Set armour Element
*/
void setElement(std::string e);
/**
* Print one Armour
*/
virtual void display(std::ostream& outs) const;
/**
* Read Armour attributes from an input stream
*/
virtual void read(std::istream& ins);
/**
* Clone--i.e., copy--this Armour
*/
virtual Item* clone() const;
};
//------------------------------------------------------------------------------
inline
double Armour::getDurability() const
{
return this->durability;
}
//------------------------------------------------------------------------------
inline
void Armour::setDurability(double durability)
{
this->durability = durability;
}
//------------------------------------------------------------------------------
inline
double Armour::getDefense() const
{
return this->defense;
}
//------------------------------------------------------------------------------
inline
void Armour::setDefense(double defense)
{
this->defense = defense;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getMaterial() const
{
return this->material;
}
//------------------------------------------------------------------------------
inline
void Armour::setMaterial(std::string m)
{
this->material = m;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getModifier() const
{
return this->modifier;
}
//------------------------------------------------------------------------------
inline
void Armour::setModifier(std::string m)
{
this->modifier = m;
}
//------------------------------------------------------------------------------
inline
double Armour::getModifierLevel() const
{
return this->modifierLevel;
}
//------------------------------------------------------------------------------
inline
void Armour::setModifierLevel(double level)
{
this->modifierLevel = level;
}
//------------------------------------------------------------------------------
inline
std::string Armour::getElement() const
{
return this->element;
}
//------------------------------------------------------------------------------
inline
void Armour::setElement(std::string e)
{
this->element = e;
}
#endif