Angband
player-util.h
Go to the documentation of this file.
1 
20 #ifndef PLAYER_UTIL_H
21 #define PLAYER_UTIL_H
22 
23 #include "player.h"
24 
25 /* Player regeneration constants */
26 #define PY_REGEN_NORMAL 197 /* Regen factor*2^16 when full */
27 #define PY_REGEN_WEAK 98 /* Regen factor*2^16 when weak */
28 #define PY_REGEN_FAINT 33 /* Regen factor*2^16 when fainting */
29 #define PY_REGEN_HPBASE 1442 /* Min amount hp regen*2^16 */
30 #define PY_REGEN_MNBASE 524 /* Min amount mana regen*2^16 */
31 
37 enum
38 {
42 };
43 
47 #define REST_REQUIRED_FOR_REGEN 5
48 
49 int dungeon_get_next_level(int dlev, int added);
50 void dungeon_change_level(struct player *p, int dlev);
51 void take_hit(struct player *p, int dam, const char *kb_str);
52 void death_knowledge(struct player *p);
53 s16b modify_stat_value(int value, int amount);
54 void player_regen_hp(struct player *p);
55 void player_regen_mana(struct player *p);
56 void player_update_light(struct player *p);
57 bool player_can_cast(struct player *p, bool show_msg);
58 bool player_can_study(struct player *p, bool show_msg);
59 bool player_can_read(struct player *p, bool show_msg);
60 bool player_can_fire(struct player *p, bool show_msg);
61 bool player_can_refuel(struct player *p, bool show_msg);
62 bool player_can_cast_prereq(void);
63 bool player_can_study_prereq(void);
64 bool player_can_read_prereq(void);
65 bool player_can_fire_prereq(void);
66 bool player_can_refuel_prereq(void);
68 bool player_confuse_dir(struct player *p, int *dir, bool too);
70 bool player_is_resting(struct player *p);
72 void player_resting_set_count(struct player *p, s16b count);
73 void player_resting_cancel(struct player *p, bool disturb);
75 void player_resting_step_turn(struct player *p);
78 void player_set_resting_repeat_count(struct player *p, s16b count);
79 bool player_of_has(struct player *p, int flag);
80 bool player_resists(struct player *p, int element);
81 bool player_is_immune(struct player *p, int element);
82 int coords_to_dir(struct player *p, int y, int x);
83 void player_place(struct chunk *c, struct player *p, int y, int x);
84 void disturb(struct player *p, int stop_search);
85 void search(struct player *p);
86 
87 #endif /* !PLAYER_UTIL_H */
bool player_can_fire(struct player *p, bool show_msg)
Return true if the player can fire something with a launcher.
Definition: player-util.c:526
bool player_can_refuel(struct player *p, bool show_msg)
Return true if the player can refuel their light source.
Definition: player-util.c:549
void player_regen_mana(struct player *p)
Regenerate mana points.
Definition: player-util.c:306
bool player_resting_is_special(s16b count)
Return true if the provided count is one of the conditional REST_ flags.
Definition: player-util.c:670
bool player_can_cast_prereq(void)
Prerequiste function for command.
Definition: player-util.c:565
png_infop png_uint_32 flag
Definition: libpng12/png.h:2191
bool player_of_has(struct player *p, int flag)
Check if the player state has the given OF_ flag.
Definition: player-util.c:834
bool player_can_study_prereq(void)
Prerequiste function for command.
Definition: player-util.c:573
Definition: player-util.h:39
void player_resting_step_turn(struct player *p)
Perform one turn of resting.
Definition: player-util.c:759
s16b modify_stat_value(int value, int amount)
Modify a stat value by a "modifier", return new value.
Definition: player-util.c:206
bool player_resists(struct player *p, int element)
Check if the player resists (or better) an element.
Definition: player-util.c:843
void player_update_light(struct player *p)
Update the player's light fuel.
Definition: player-util.c:360
void player_resting_complete_special(struct player *p)
Handle the conditions for conditional resting (resting with the REST_ constants). ...
Definition: player-util.c:782
Player implementation.
Definition: cave.h:142
bool player_can_read_prereq(void)
Prerequiste function for command.
Definition: player-util.c:581
bool player_is_immune(struct player *p, int element)
Check if the player resists (or better) an element.
Definition: player-util.c:851
void player_regen_hp(struct player *p)
Regenerate hit points.
Definition: player-util.c:241
void player_resting_cancel(struct player *p, bool disturb)
Cancel current rest.
Definition: player-util.c:737
int coords_to_dir(struct player *p, int y, int x)
Definition: player-util.c:860
int dungeon_get_next_level(int dlev, int added)
Increment to the next or decrement to the preceeding level accounting for the stair skip value in con...
Definition: player-util.c:48
bool player_can_refuel_prereq(void)
Prerequiste function for command.
Definition: player-util.c:597
bool player_can_read(struct player *p, bool show_msg)
Return true if the player can read scrolls or books.
Definition: player-util.c:486
bool player_can_fire_prereq(void)
Prerequiste function for command.
Definition: player-util.c:589
const char ** p[]
Definition: name.c:40
bool player_book_has_unlearned_spells(struct player *p)
Return true if the player has access to a book that has unlearned spells.
Definition: player-util.c:607
int16_t s16b
Definition: h-basic.h:170
bool player_can_study(struct player *p, bool show_msg)
Return true if the player can study a spell.
Definition: player-util.c:461
bool player_confuse_dir(struct player *p, int *dir, bool too)
Apply confusion, if needed, to a direction.
Definition: player-util.c:645
void take_hit(struct player *p, int dam, const char *kb_str)
Decreases players hit points and sets death flag if necessary.
Definition: player-util.c:98
bool player_is_resting(struct player *p)
Return true if the player is resting.
Definition: player-util.c:685
void dungeon_change_level(struct player *p, int dlev)
Change dungeon level - e.g.
Definition: player-util.c:73
void death_knowledge(struct player *p)
Win or not, know inventory, home items and history upon death, enter score.
Definition: player-util.c:158
Definition: player-util.h:40
s16b player_resting_count(struct player *p)
Return the remaining number of resting turns.
Definition: player-util.c:694
void search(struct player *p)
Search for traps or secret doors.
Definition: player-util.c:928
void player_set_resting_repeat_count(struct player *p, s16b count)
Set the number of resting turns to repeat.
Definition: player-util.c:826
Most of the "player" information goes here.
Definition: player.h:454
void player_resting_set_count(struct player *p, s16b count)
Set the number of resting turns.
Definition: player-util.c:712
int player_get_resting_repeat_count(struct player *p)
Get the number of resting turns to repeat.
Definition: player-util.c:816
bool player_resting_can_regenerate(struct player *p)
Return true if the player should get a regeneration bonus for the current rest.
Definition: player-util.c:748
png_voidp int value
Definition: libpng12/png.h:2145
bool player_can_cast(struct player *p, bool show_msg)
Return true if the player can cast a spell.
Definition: player-util.c:425
void disturb(struct player *p, int stop_search)
Definition: player-util.c:898
Definition: player-util.h:41
void player_place(struct chunk *c, struct player *p, int y, int x)
Places the player at the given coordinates in the cave.
Definition: player-util.c:868