forked from Whales/Cataclysm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bodypart.cpp
73 lines (70 loc) · 1.44 KB
/
bodypart.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
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
#include "bodypart.h"
#include "rng.h"
std::string body_part_name (body_part bp, int side)
{
switch (bp) {
case bp_head:
return "head";
case bp_eyes:
return "eyes";
case bp_mouth:
return "mouth";
case bp_torso:
return "torso";
case bp_arms:
if (side == 0)
return "left arm";
if (side == 1)
return "right arm";
return "arms";
case bp_hands:
if (side == 0)
return "left hand";
if (side == 1)
return "right hand";
return "hands";
case bp_legs:
if (side == 0)
return "left leg";
if (side == 1)
return "right leg";
return "legs";
case bp_feet:
if (side == 0)
return "left foot";
if (side == 1)
return "right foot";
return "feet";
default:
return "appendix";
}
}
std::string encumb_text(body_part bp)
{
switch (bp) {
case bp_head: return "";
case bp_eyes: return "Ranged combat is hampered.";
case bp_mouth: return "Running is slowed.";
case bp_torso: return "Dodging and melee is hampered.";
case bp_arms: return "Melee and ranged combat is hampered.";
case bp_hands: return "Manual tasks are slowed.";
case bp_legs: return "Running and swimming are slowed.";
case bp_feet: return "Running is slowed.";
default: return "It's inflammed.";
}
}
body_part random_body_part()
{
int rn = rng(0, 30);
if (rn == 0)
return bp_eyes;
if (rn <= 2)
return bp_mouth;
if (rn <= 6)
return bp_head;
if (rn <= 12)
return bp_legs;
if (rn <= 20)
return bp_arms;
return bp_torso;
}