Data Structures | Macros | Enumerations | Functions | Variables
player-timed.h File Reference

Timed effects handling. More...

#include "player.h"
#include "list-player-timed.h"

Go to the source code of this file.

Data Structures

struct  timed_grade
struct  timed_effect_data
 Data struct. More...


#define PY_FOOD_MAX   17000 /* Food value (Bloated) */
 Player food values. More...
#define PY_FOOD_FULL   10000 /* Food value (Normal) */
#define PY_FOOD_ALERT   2000 /* Food value (Hungry) */
#define PY_FOOD_WEAK   1000 /* Food value (Weak) */
#define PY_FOOD_FAINT   500 /* Food value (Fainting) */
#define PY_FOOD_STARVE   100 /* Food value (Starving) */
#define TMD_CUT_NONE   0
 Player cut timer values. More...
#define TMD_CUT_GRAZE   10
#define TMD_CUT_LIGHT   25
#define TMD_CUT_BAD   50
#define TMD_CUT_NASTY   100
#define TMD_CUT_SEVERE   200
#define TMD_CUT_DEEP   1000
#define TMD(a, b, c)   TMD_##a,


enum  { TMD_MAX }
 Timed effects. More...
 Effect failure flag types. More...


int timed_name_to_idx (const char *name)
bool player_set_timed (struct player *p, int idx, int v, bool notify)

Setting, increasing, decreasing and clearing timed effects

bool player_inc_check (struct player *p, int idx, bool lore)
 Check whether a timed effect will affect the player. More...
bool player_inc_timed (struct player *p, int idx, int v, bool notify, bool check)
 Increase the timed effect idx by v. More...
bool player_dec_timed (struct player *p, int idx, int v, bool notify)
 Decrease the timed effect idx by v. More...
bool player_clear_timed (struct player *p, int idx, bool notify)
 Clear the timed effect idx. More...
bool player_set_food (struct player *p, int v)
 Set "player->food", notice observable changes. More...


struct file_parser player_timed_parser
struct timed_effect_data timed_effects [TMD_MAX]

Detailed Description

Timed effects handling.

Copyright (c) 1997 Ben Harrison Copyright (c) 2007 A Sidwell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Macro Definition Documentation


#define PY_FOOD_ALERT   2000 /* Food value (Hungry) */

Referenced by player_set_food().


#define PY_FOOD_FAINT   500 /* Food value (Fainting) */


#define PY_FOOD_FULL   10000 /* Food value (Normal) */


#define PY_FOOD_MAX   17000 /* Food value (Bloated) */

Player food values.

Referenced by do_cmd_wiz_cure_all(), player_set_food(), and wiz_cheat_death().


#define PY_FOOD_STARVE   100 /* Food value (Starving) */


#define PY_FOOD_WEAK   1000 /* Food value (Weak) */

Referenced by player_regen_hp(), and player_set_food().


#define TMD (   a,
)    TMD_##a,


#define TMD_CUT_BAD   50


#define TMD_CUT_DEEP   1000

Referenced by decrease_timeouts().


#define TMD_CUT_GRAZE   10


#define TMD_CUT_LIGHT   25


#define TMD_CUT_NASTY   100

Referenced by process_world().


#define TMD_CUT_NONE   0

Player cut timer values.


#define TMD_CUT_SEVERE   200

Referenced by process_world().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Timed effects.


◆ anonymous enum

anonymous enum

Effect failure flag types.


Function Documentation

◆ player_clear_timed()

bool player_clear_timed ( struct player p,
int  idx,
bool  notify 

◆ player_dec_timed()

bool player_dec_timed ( struct player p,
int  idx,
int  v,
bool  notify 

Decrease the timed effect idx by v.

Mention this if notify is true.

References player_set_timed(), player::timed, and TMD_MAX.

Referenced by decrease_timeouts(), and effect_handler_TIMED_DEC().

◆ player_inc_check()

bool player_inc_check ( struct player p,
int  idx,
bool  lore 

◆ player_inc_timed()

bool player_inc_timed ( struct player p,
int  idx,
int  v,
bool  notify,
bool  check 

◆ player_set_food()

bool player_set_food ( struct player p,
int  v 

Set "player->food", notice observable changes.

The "player->food" variable can get as large as 20000, allowing the addition of the most "filling" item, Elvish Waybread, which adds 7500 food units, without overflowing the 32767 maximum limit.

Perhaps we should disturb the player with various messages, especially messages about hunger status changes. XXX XXX XXX

Digestion of food is handled in "dungeon.c", in which, normally, the player digests about 20 food units per 100 game turns, more when "fast", more when "regenerating", less with "slow digestion".

References disturb(), player::food, handle_stuff(), MAX, MIN, msg, msgt(), PR_STATUS, PU_BONUS, PY_FOOD_ALERT, PY_FOOD_FAINT, PY_FOOD_FULL, PY_FOOD_MAX, PY_FOOD_WEAK, player_upkeep::redraw, player_upkeep::update, and player::upkeep.

Referenced by do_cmd_wiz_cure_all(), effect_handler_JUMP_AND_BITE(), effect_handler_NOURISH(), effect_handler_SET_NOURISH(), process_world(), and wiz_cheat_death().

◆ player_set_timed()

bool player_set_timed ( struct player p,
int  idx,
int  v,
bool  notify 

◆ timed_name_to_idx()

int timed_name_to_idx ( const char *  name)

References i, my_stricmp(), and N_ELEMENTS.

Referenced by effect_subtype().

Variable Documentation

◆ player_timed_parser

struct file_parser player_timed_parser

◆ timed_effects

struct timed_effect_data timed_effects[TMD_MAX]