-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmor.cpp
More file actions
52 lines (39 loc) · 1.05 KB
/
Armor.cpp
File metadata and controls
52 lines (39 loc) · 1.05 KB
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
#include "Armor.h"
#include<assert.h>
#include<sstream>
#define ceil 1
#define floor 0.65
Armor::Armor()
{
}
Armor::Armor(double armor, Point2d* loc):Item(loc,"Armor"){
this->_armor = armor;
}
BodyArmor::BodyArmor(double armor, Point2d* loc):Armor(armor,loc) {
assert(armor >= floor && armor <= ceil);
}
double BodyArmor::getArmor(){
return this->_armor;
}
void BodyArmor::setArmor(double num){
this->_armor = num;
}
string BodyArmor::toString(){
std::ostringstream oss;
oss << "BodyArmor - Power :"<<this->_armor<<" , Point : "<<this->_loc->toString();
return oss.str();
}
ShieldArmor::ShieldArmor(double armor, Point2d* loc) :Armor(armor, loc) {
assert(armor >= floor && armor <= ceil);
}
void ShieldArmor::setArmor(double num){
this->_armor = num;
}
double ShieldArmor::getArmor(){
return this->_armor;
}
string ShieldArmor::toString(){
std::ostringstream oss;
oss << "ShieldArmor - Power :"<<this->_armor<<" , Point : "<<this->_loc->toString();
return oss.str();
}