forked from Whales/Cataclysm2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrait.cpp
More file actions
316 lines (233 loc) · 7.46 KB
/
trait.cpp
File metadata and controls
316 lines (233 loc) · 7.46 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
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#include "trait.h"
#include "stringfunc.h"
#include <string>
Trait_id lookup_trait_id(std::string name)
{
name = no_caps( trim( name ) );
for (int i = 0; i < TRAIT_MAX; i++) {
Trait_id ret = Trait_id(i);
if (name == no_caps( trait_id_name(ret) ) ) {
return ret;
}
}
return TRAIT_NULL;
}
std::string trait_name(Trait_id trait)
{
return trait_id_name(trait);
}
std::string trait_id_name(Trait_id trait)
{
switch (trait) {
case TRAIT_NULL:
return "NULL";
case TRAIT_FLEET:
return "Fleet-Footed";
case TRAIT_QUICK:
return "Quick";
case TRAIT_LIGHT_EATER:
return "Light Eater";
case TRAIT_CAMEL:
return "Camel";
case TRAIT_NIGHT_VISION:
return "Night Vision";
case TRAIT_DURABLE:
return "Durable";
case TRAIT_STURDY_CONSTITUTION:
return "Sturdy Constitution";
case TRAIT_PACKMULE:
return "Packmule";
case TRAIT_ROBUST_GENETICS:
return "Robust Genetics";
case TRAIT_PAIN_RESISTANT:
return "Pain Resistant";
case TRAIT_INSIGHTFUL:
return "Insightful";
case TRAIT_AUTODIDACT:
return "Autodidact";
case TRAIT_MAX_GOOD:
return "BUG - TRAIT_MAX_GOOD";
case TRAIT_LIGHTWEIGHT:
return "Lightweight";
case TRAIT_CHEMICAL_IMBALANCE:
return "Chemical Imbalance";
case TRAIT_MAX_NEUTRAL:
return "BUG - TRAIT_MAX_NEUTRAL";
case TRAIT_MYOPIC:
return "Myopic";
case TRAIT_BAD_BACK:
return "Bad Back";
case TRAIT_BAD_HEARING:
return "Bad Hearing";
case TRAIT_SMELLY:
return "Smelly";
case TRAIT_ILLITERATE:
return "Illiterate";
case TRAIT_MAX_BAD:
return "BUG - TRAIT_MAX_BAD";
case TRAIT_MAX:
return "BUG - TRAIT_MAX";
default:
return "BUG - Unnamed Trait_id";
}
return "BUG - Escaped Trait_id_name() switch!";
}
std::string trait_description(Trait_id trait)
{
switch (trait) {
case TRAIT_NULL:
return "NULL Trait. If you're reading this, it's a bug!";
case TRAIT_FLEET:
return "\
You are especially fast on your feet. When moving over flat terrain, like \
dirt, grass, or pavement, you only use 95 action points, instead of 100.";
case TRAIT_QUICK:
return "\
You are quick at everything you do! You receive an extra 5 percent action \
points each turn. Under normal conditions, this means 5 AP; if your speed has \
been reduced to 60, you'll only receive 3 AP, and so on.";
case TRAIT_LIGHT_EATER:
return "\
You're able to get by with less food than most people. Your hunger increases \
once every 8 turns, instead of once every 6.";
case TRAIT_CAMEL:
return "\
You're able to get by with less water than most people. Your thirst increases \
once every 8 turns, instead of once every 6.";
case TRAIT_NIGHT_VISION:
return "\
You have a natural ability to see in the dark, more than the average person. \
Under reduced light, your sight radius is double what it would normally be!";
case TRAIT_DURABLE:
return "\
You're particularly durable. Your maximum HP is 115, instead of the normal \
100.";
case TRAIT_STURDY_CONSTITUTION:
return "\
You're very resistance to disease. You're less likely to get sick, and even \
if you do, diseases, poisons, and other ailments of that nature have a reduced \
effect on you.";
case TRAIT_PACKMULE:
return "\
You're good at making do with limited storage space. Your volume limit is \
increased by 20 percent.";
case TRAIT_ROBUST_GENETICS:
return "\
Your genes are fit in a very particular way. If you happen to mutate, you're \
as likely to get a good mutation as a bad one (others are much more likely to \
wind up with a bad mutation).";
case TRAIT_PAIN_RESISTANT:
return "\
You have a high pain threshold. The amount of pain needed to reach each level \
(e.g. \"Minor Pain,\" \"Moderate Pain\" etc) is 20 percent higher.";
case TRAIT_INSIGHTFUL:
return "\
You have an ability to understand advanced concepts, even without knowing the \
fundamentals first. You ignore any skill level requirements when reading \
books.";
case TRAIT_AUTODIDACT:
return "\
You learn things intuitively, even without a teacher or reference material. \
Skill caps don't prevent you from improving a skill entirely, but they do make \
it cost twice as much experience.";
case TRAIT_MAX_GOOD:
return "TRAIT_MAX_GOOD - If you're seeing this, it's a bug!";
case TRAIT_LIGHTWEIGHT:
return "\
Drugs of all kind have an increased effect on you. This can be desirable - it \
means you have to take less to get the same effect - but on the other hand, \
sometimes you don't want things to go to your head so much!";
case TRAIT_CHEMICAL_IMBALANCE:
return "\
A slight chemical imbalance results in occasional minor status effects. These \
are as likely to be good as they are to be bad, but are never too severe.";
case TRAIT_MAX_NEUTRAL:
return "TRAIT_MAX_NEUTRAL - If you're seeing this, it's a bug!";
case TRAIT_MYOPIC:
return "\
You have poor long-distance vision. Your sight range is capped at 6 tiles, \
unless you're wearing your glasses. Taking this trait means you get to start \
with a pair of glasses, but they break easily and a replacement pair may be \
hard to acquire!";
case TRAIT_BAD_BACK:
return "\
You have a weak back. While your strength is just as good for all other \
purposes, your carrying capacity is reduced by 20 percent.";
case TRAIT_BAD_HEARING:
return "\
Your hearing is bad, and you won't hear sounds unless they're twice as loud as \
they'd need to be for a normal person. This effect is amplified - and \
particularly dangerous - while you're asleep!";
case TRAIT_SMELLY:
return "\
You have a strong body odor. Animals and monsters that track using scent will \
find you easier to detect, and many NPCs will have a slight negative reaction.";
case TRAIT_ILLITERATE:
return "\
You never learned to read, and it's far too late to start now. You cannot \
read books at all!";
case TRAIT_MAX_BAD:
return "TRAIT_MAX_BAD - If you're seeing this, it's a bug!";
case TRAIT_MAX:
return "TRAIT_MAX - If you're seeing this, it's a bug!";
default:
return "Undefined trait description! Someone forgot to write this.";
}
return "Escaped trait_description() switch?!";
}
int trait_cost(Trait_id trait)
{
switch (trait) {
case TRAIT_NULL:
return 0;
case TRAIT_FLEET:
return 3;
case TRAIT_QUICK:
return 3;
case TRAIT_LIGHT_EATER:
return 2;
case TRAIT_CAMEL:
return 2;
case TRAIT_NIGHT_VISION:
return 2;
case TRAIT_DURABLE:
return 3;
case TRAIT_STURDY_CONSTITUTION:
return 2;
case TRAIT_PACKMULE:
return 2;
case TRAIT_ROBUST_GENETICS:
return 2;
case TRAIT_PAIN_RESISTANT:
return 3;
case TRAIT_INSIGHTFUL:
return 2;
case TRAIT_AUTODIDACT:
return 3;
case TRAIT_MAX_GOOD:
return 0;
case TRAIT_LIGHTWEIGHT:
return 0;
case TRAIT_CHEMICAL_IMBALANCE:
return 0;
case TRAIT_MAX_NEUTRAL:
return 0;
case TRAIT_MYOPIC:
return -2;
case TRAIT_BAD_BACK:
return -2;
case TRAIT_BAD_HEARING:
return -2;
case TRAIT_SMELLY:
return -2;
case TRAIT_ILLITERATE:
return -4;
case TRAIT_MAX_BAD:
return 0;
case TRAIT_MAX:
return 0;
default:
return 0;
}
return 0;
}