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
use crate::*;
/// A character.
#[derive(Debug, Default, PartialEq, Clone)]
pub struct O {
pub(crate) strength: u8,
pub(crate) intelligence: u8,
pub(crate) wisdom: u8,
pub(crate) dexterity: u8,
pub(crate) constitution: u8,
pub(crate) charisma: u8,
pub(crate) mod_strength: i8,
pub(crate) mod_intelligence: i8,
pub(crate) mod_wisdom: i8,
pub(crate) mod_dexterity: i8,
pub(crate) mod_constitution: i8,
pub(crate) mod_charisma: i8,
pub(crate) class: Class,
pub(crate) thac0: u8,
pub(crate) thac0_melee: u8,
pub(crate) thac0_ranged: u8,
pub(crate) save_death: u8,
pub(crate) save_wands: u8,
pub(crate) save_paralysis: u8,
pub(crate) save_breath: u8,
pub(crate) save_spell: u8,
pub(crate) hp: u8,
pub(crate) alignment: Alignment,
pub(crate) starting_gold: u8,
pub(crate) equipment: Vec<(String, u8)>,
pub(crate) name: String,
pub(crate) ac: i8,
}
impl Character {
/// Returns the character's strength.
pub fn strength(&self) -> u8 {
self.strength
}
/// Returns the character's intelligence.
pub fn intelligence(&self) -> u8 {
self.intelligence
}
/// Returns the character's wisdom.
pub fn wisdom(&self) -> u8 {
self.wisdom
}
/// Returns the character's dexterity.
pub fn dexterity(&self) -> u8 {
self.dexterity
}
/// Returns the character's constitution.
pub fn constitution(&self) -> u8 {
self.constitution
}
/// Returns the character's charisma.
pub fn charisma(&self) -> u8 {
self.charisma
}
/// Returns the character's strength modifier.
pub fn mod_strength(&self) -> i8 {
self.mod_strength
}
/// Returns the character's intelligence modifier.
pub fn mod_intelligence(&self) -> i8 {
self.mod_intelligence
}
/// Returns the character's wisdom modifier.
pub fn mod_wisdom(&self) -> i8 {
self.mod_wisdom
}
/// Returns the character's dexterity modifier.
pub fn mod_dexterity(&self) -> i8 {
self.mod_dexterity
}
/// Returns the character's constitution modifier.
pub fn mod_constitution(&self) -> i8 {
self.mod_constitution
}
/// Returns the character's charisma modifier.
pub fn mod_charisma(&self) -> i8 {
self.mod_charisma
}
/// Returns the character's class.
pub fn class(&self) -> Class {
self.class
}
/// Returns the character's THAC0.
pub fn thac0(&self) -> u8 {
self.thac0
}
/// Returns the character's melee THAC0.
pub fn thac0_melee(&self) -> u8 {
self.thac0_melee
}
/// Returns the character's ranged THAC0.
pub fn thac0_ranged(&self) -> u8 {
self.thac0_ranged
}
/// Returns the character's saving throw against death.
pub fn save_death(&self) -> u8 {
self.save_death
}
/// Returns the character's saving throw against wands.
pub fn save_wands(&self) -> u8 {
self.save_wands
}
/// Returns the character's saving throw against paralysis.
pub fn save_paralysis(&self) -> u8 {
self.save_paralysis
}
/// Returns the character's saving throw against breath attacks.
pub fn save_breath(&self) -> u8 {
self.save_breath
}
/// Returns the character's saving throw against spells.
pub fn save_spell(&self) -> u8 {
self.save_spell
}
/// Returns the character's hit points.
pub fn hp(&self) -> u8 {
self.hp
}
/// Returns the character's alignment.
pub fn alignment(&self) -> Alignment {
self.alignment
}
/// Returns the character's starting gold.
pub fn starting_gold(&self) -> u8 {
self.starting_gold
}
/// Returns the character's equipment.
pub fn equipment(&self) -> Vec<(String, u8)> {
self.equipment.clone()
}
/// Returns the character's name.
pub fn name(&self) -> String {
self.name.clone()
}
/// Returns the character's armor class.
pub fn ac(&self) -> i8 {
self.ac
}
}