-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.cpp
45 lines (38 loc) · 869 Bytes
/
Item.cpp
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
#include "Item.h"
void Item::setid(int _id)
{
id = _id;
}
void Item::setName(std::string _name)
{
name = _name;
}
void Item::setDesc(std::string _desc)
{
desc = _desc;
}
void Item::setValue(int _value)
{
value = _value;
}
std::string Item::stringRep()
{
std::string rep = name + ": " + desc + "\n";
rep += "Value: " + std::to_string(value);
return rep;
}
std::string Weapon::stringRep()
{
std::string rep = name_() + ": " + desc_() + "\n";
rep += "Damage: " + damageDie.stringRep() + "+" + std::to_string(bonus) + "\n";
rep += "Value: " + std::to_string(value_());
return rep;
}
std::string Armor::stringRep()
{
std::string rep = name_() + ": " + desc_() + "\n";
rep += "AC Bonus: " + std::to_string(acBonus_()) + "\n";
rep += "Value: " + std::to_string(value_());
return rep;
return std::string();
}