forked from JohnAnthony/TROG
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathequippable.cpp
More file actions
138 lines (130 loc) · 3.89 KB
/
Copy pathequippable.cpp
File metadata and controls
138 lines (130 loc) · 3.89 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
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
#include "equippable.hpp"
#include "gui.hpp"
#include "geometry.hpp"
#include <sstream>
static char const * const EquippableNames[Equippable::LAST_CATEGORY] = {
"Dagger",
"Short Sword",
"Longsword",
"Mace",
"Flail",
"Staff",
"Two-Handed Sword",
"Two-Handed Axe",
"Light Shield",
"Heavy Shield",
"Robes",
"Leather Armour",
"Chainmail",
"Platemail",
"Holy Symbol"
};
Equippable::Equippable(Equippable::Category inCat, int pot) {
this->potency = pot;
this->category = inCat;
this->modHP = 0;
this->modMP = 0;
this->modSTR = 0;
this->modTOU = 0;
this->modATT = 0;
this->modDEF = 0;
this->modMAG = 0;
this->modWIL = 0;
switch (inCat) {
case Equippable::DAGGER:
this->modSTR = (5 + DICEROLL(pot, 10)) / 4;
this->modATT = 5 + DICEROLL(pot, 10);
this->location = WEAPON;
break;
case Equippable::SHORT_SWORD:
this->modSTR = (5 + DICEROLL(pot, 10)) / 2;
this->modATT = 5 + DICEROLL(pot, 10);
this->location = WEAPON;
break;
case Equippable::LONGSWORD:
this->modSTR = 5 + DICEROLL(pot, 10);
this->modATT = (5 + DICEROLL(pot, 10)) / 2;
this->location = WEAPON;
break;
case Equippable::MACE:
case Equippable::FLAIL:
this->modSTR = (5 + DICEROLL(pot, 10)) / 2;
this->modATT = (5 + DICEROLL(pot, 10)) / 2;
this->location = WEAPON;
break;
case Equippable::STAFF:
this->modSTR = (5 + DICEROLL(pot, 10)) / 4;
this->modATT = (5 + DICEROLL(pot, 10)) / 4;
this->modMAG = 5 + DICEROLL(pot, 10);
this->location = WEAPON;
break;
case Equippable::TWO_HANDED_SWORD:
case Equippable::TWO_HANDED_AXE:
this->modSTR = (5 + DICEROLL(pot, 10)) * 1.5;
this->modATT = 5 + DICEROLL(pot, 10);
this->location = WEAPON;
break;
case Equippable::LIGHT_SHIELD:
this->modDEF = 5 + DICEROLL(pot, 10);
this->location = SHIELD;
break;
case Equippable::HEAVY_SHIELD:
this->modDEF = 5 + DICEROLL(pot, 10) / 2;
this->modTOU = 5 + DICEROLL(pot, 10) / 2;
this->location = SHIELD;
break;
case Equippable::ROBES:
this->modMAG = 5 + DICEROLL(pot, 10) / 2;
this->modWIL = 5 + DICEROLL(pot, 10) / 2;
this->location = BODY;
break;
case Equippable::LEATHER_ARMOUR:
this->modTOU = 5 + DICEROLL(pot, 10) / 2;
this->location = BODY;
this->location = BODY;
break;
case Equippable::CHAINMAIL:
this->modTOU = 5 + DICEROLL(pot, 10);
this->location = BODY;
break;
case Equippable::PLATEMAIL:
this->modTOU = 5 + DICEROLL(pot, 10) * 1.5;
this->modDEF = 5 + DICEROLL(pot, 10) * (-0.5);
this->location = BODY;
break;
case Equippable::HOLY_SYMBOL:
this->modWIL = 5 + DICEROLL(pot, 10);
this->location = NECK;
break;
case Equippable::LAST_CATEGORY:
GUI::Alert("Error generating item!");
break;
}
}
std::string
Equippable::getName(void) {
std::stringstream ss;
ss << EquippableNames[this->category];
return ss.str();
}
std::string
Equippable::getNameWithQuality(void) {
std::stringstream ss;
ss << this->getName();
ss << " (q:" << this->getQuality() << ")";
return ss.str();
}
int
Equippable::getQuality(void) {
int ret;
ret = 0;
ret += this->modHP;
ret += this->modMP;
ret += this->modSTR;
ret += this->modTOU;
ret += this->modATT;
ret += this->modDEF;
ret += this->modMAG;
ret += this->modWIL;
return ret;
}