forked from CIB/Cataclysm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
257 lines (218 loc) · 8.86 KB
/
player.h
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
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "item.h"
#include "monster.h"
#include "pldata.h"
#include "skill.h"
#include "bionics.h"
#include "trap.h"
#include "morale.h"
#include "inventory.h"
#include "artifact.h"
#include "mutation.h"
#include <vector>
#include <string>
class monster;
class game;
class trap;
class mission;
struct special_attack
{
std::string text;
int bash;
int cut;
int stab;
special_attack() { bash = 0; cut = 0; stab = 0; };
};
class player {
public:
player();
~player();
player& operator= (player rhs);
// newcharacter.cpp
bool create(game *g, character_type type, std::string tempname = "");
int random_good_trait();
int random_bad_trait ();
void normalize(game *g); // Starting set up of HP and inventory
// </newcharacter.cpp>
virtual bool is_npc() { return false; } // Overloaded for NPCs in npc.h
nc_color color(); // What color to draw us as
virtual void load_info(game *g, std::string data);// Load from file 'name.sav'
virtual std::string save_info(); // Save to file matching name
void disp_info(game *g); // '@' key; extended character info
void disp_morale(); // '%' key; morale info
void disp_status(WINDOW* w, game *g = NULL);// On-screen data
void reset(game *g = NULL);// Resets movement points, stats, applies effects
void update_morale(); // Ticks down morale counters and removes them
int current_speed(game *g = NULL); // Number of movement points we get a turn
int run_cost(int base_cost); // Adjust base_cost
int swim_speed(); // Our speed when swimming
bool has_trait(int flag);
bool has_mutation(int flag);
void toggle_trait(int flag);
bool has_bionic(bionic_id b);
bool has_active_bionic(bionic_id b);
void add_bionic(bionic_id b);
void charge_power(int amount);
void power_bionics(game *g);
void activate_bionic(int b, game *g);
void mutate(game *g);
void mutate_towards(game *g, pl_flag mut);
void remove_mutation(game *g, pl_flag mut);
bool has_child_flag(game *g, pl_flag mut);
void remove_child_flag(game *g, pl_flag mut);
int sight_range(int light_level);
int overmap_sight_range(int light_level);
int clairvoyance(); // Sight through walls &c
bool has_two_arms();
bool can_wear_boots();
bool is_armed(); // True if we're wielding something; true for bionics
bool unarmed_attack(); // False if we're wielding something; true for bionics
bool avoid_trap(trap *tr);
void pause(); // '.' command; pauses & reduces recoil
int hit_roll(); // Our basic hit roll, compared to our target's dodge roll
bool scored_crit(int target_dodge = 0);
int hit_mon(game *g, monster *z); // Handles hitting a monster up to its death
// hit_player returns false on a miss, and modifies bp, hitdam, and hitcut
bool hit_player(game *g, player &p, body_part &bp, int &hitdam, int &hitcut);
std::vector<special_attack> mutation_attacks(monster *z);
void stumble(game *g);
int dodge(game *g); // Returns the players's dodge, modded by clothing etc
int dodge_roll(game *g);// For comparison to hit_roll()
int throw_range(int index); // Range of throwing item; -1:ERR 0:Can't throw
int base_damage (bool real_life = true);
int base_to_hit (bool real_life = true);
int ranged_dex_mod (bool real_life = true);
int ranged_per_mod (bool real_life = true);
int throw_dex_mod (bool real_life = true);
// Mental skills and stats
int comprehension_percent(skill s, bool real_life = true);
int read_speed (bool real_life = true);
int talk_skill(); // Skill at convincing NPCs of stuff
int intimidation(); // Physical intimidation
// Converts bphurt to a hp_part (if side == 0, the left), then does/heals dam
// hit() processes damage through armor
void hit (game *g, body_part bphurt, int side, int dam, int cut);
// absorb() reduces dam and cut by your armor (and bionics, traits, etc)
void absorb(game *g, body_part bp, int &dam, int &cut);
// hurt() doesn't--effects of disease, what have you
void hurt (game *g, body_part bphurt, int side, int dam);
void heal(body_part healed, int side, int dam);
void heal(hp_part healed, int dam);
void healall(int dam);
void hurtall(int dam);
int hp_percentage(); // % of HP remaining, overall
void get_sick(game *g); // Process diseases
// infect() gives us a chance to save (mostly from armor)
void infect(dis_type type, body_part vector, int strength, int duration,
game *g);
// add_disease() does NOT give us a chance to save
void add_disease(dis_type type, int duration, game *g);
void rem_disease(dis_type type);
bool has_disease(dis_type type);
int disease_level(dis_type type);
void add_addiction(add_type type, int strength);
void rem_addiction(add_type type);
bool has_addiction(add_type type);
int addiction_level(add_type type);
void suffer(game *g);
void vomit(game *g);
int lookup_item(char let);
bool eat(game *g, int index); // Eat item; returns false on fail
virtual bool wield(game *g, int index);// Wield item; returns false on fail
bool wear(game *g, char let); // Wear item; returns false on fail
bool takeoff(game *g, char let);// Take off item; returns false on fail
void use(game *g, char let); // Use a tool
bool install_bionics(game *g, it_bionic* type); // Install bionics
void read(game *g, char let); // Read a book
void try_to_sleep(game *g); // '$' command; adds DIS_LYING_DOWN
bool can_sleep(game *g); // Checked each turn during DIS_LYING_DOWN
int warmth(body_part bp); // Warmth provided by armor &c
int encumb(body_part bp); // Encumberance from armor &c
int armor_bash(body_part bp); // Bashing resistance
int armor_cut(body_part bp); // Cutting resistance
int resist(body_part bp); // Infection &c resistance
bool wearing_something_on(body_part bp); // True if wearing something on bp
void practice(skill s, int amount); // Practice a skill
int weight_carried();
int volume_carried();
int weight_capacity(bool real_life = true);
int volume_capacity();
int morale_level(); // Modified by traits, &c
void add_morale(morale_type type, int bonus, int max_bonus = 0,
itype* item_type = NULL);
void sort_inv(); // Sort inventory by type
std::string weapname(bool charges = true);
void i_add(item it);
bool has_active_item(itype_id id);
int active_item_charges(itype_id id);
void process_active_items(game *g);
item i_rem(char let); // Remove item from inventory; returns ret_null on fail
item i_rem(itype_id type);// Remove first item w/ this type; fail is ret_null
item remove_weapon();
void remove_mission_items(int mission_id);
item i_remn(int index);// Remove item from inventory; returns ret_null on fail
item &i_at(char let); // Returns the item with inventory letter let
item &i_of_type(itype_id type); // Returns the first item with this type
std::vector<item> inv_dump(); // Inventory + weapon + worn (for death, etc)
int butcher_factor(); // Automatically picks our best butchering tool
int pick_usb(); // Pick a usb drive, interactively if it matters
bool is_wearing(itype_id it); // Are we wearing a specific itype?
bool has_artifact_with(art_effect_passive effect);
// has_amount works ONLY for quantity.
// has_charges works ONLY for charges.
void use_amount(itype_id it, int quantity, bool use_container = false);
void use_charges(itype_id it, int quantity);// Uses up charges
bool has_amount(itype_id it, int quantity);
bool has_charges(itype_id it, int quantity);
int amount_of(itype_id it);
int charges_of(itype_id it);
bool has_watertight_container();
bool has_weapon_or_armor(char let); // Has an item with invlet let
bool has_item(char let); // Has an item with invlet let
bool has_item(item *it); // Has a specific item
bool has_mission_item(int mission_id); // Has item with mission_id
std::vector<int> has_ammo(ammotype at);// Returns a list of indices of the ammo
// ---------------VALUES-----------------
int posx, posy;
player_activity activity;
// _missions vectors are of mission IDs
std::vector<int> active_missions;
std::vector<int> completed_missions;
std::vector<int> failed_missions;
int active_mission;
std::string name;
bool male;
bool my_traits[PF_MAX2];
bool my_mutations[PF_MAX2];
int mutation_category_level[NUM_MUTATION_CATEGORIES];
std::vector<bionic> my_bionics;
// Current--i.e. modified by disease, pain, etc.
int str_cur, dex_cur, int_cur, per_cur;
// Maximum--i.e. unmodified by disease
int str_max, dex_max, int_max, per_max;
int power_level, max_power_level;
int hunger, thirst, fatigue, health;
bool underwater;
bool can_dodge;
int oxygen;
unsigned int recoil;
unsigned int scent;
int stim, pain, pkill, radiation;
int cash;
int moves;
int hp_cur[num_hp_parts], hp_max[num_hp_parts];
std::vector<morale_point> morale;
int xp_pool;
int sklevel[num_skill_types];
int skexercise[num_skill_types];
bool inv_sorted;
//std::vector <item> inv;
inventory inv;
std::vector <item> worn;
item weapon;
item ret_null; // Null item, sometimes returns by weapon() etc
std::vector <disease> illness;
std::vector <addiction> addictions;
};
#endif