Definition in file player.c.
#include "crogue.h"
#include "export.h"
Go to the source code of this file.
Functions | |
| void | distribute_attributes (void) |
| Roll up stats for a new character. | |
| sint | mod_from_attribute (uint attr, sint mindistance, sint divisor) |
| Determine how much something should be modified based on a stat. | |
| void | follow_connection (void) |
| Follow a staircase which the player is standing on. | |
| void | plr_walk (sshort x, sshort y) |
| Try to walk in the given direction. | |
| void | plr_run (sshort x, sshort y) |
| Try to run in the given direction. | |
| void | plr_moveto (ushort x, ushort y, sshort displace_monst) |
| Move to the given location. | |
| void | plr_attack (int monstid) |
| Attack the monster with given index. | |
| void | char_info (void) |
| Display player stats. | |
| void | plr_search (void) |
| Search for traps and secret doors. | |
| void | manip_door (int open) |
| Open or close a door. | |
| int | plr_attack_monster_roll (int monstid, int modifier) |
| Make an attack-roll. | |
| void | playerclassname (int n, char *buf) |
| Callback for class name. | |
| void | init_player (uint is_tutorial) |
| Initialize the player's class and stats. | |
| void | apply_stat_mod_desc (sint *target, const stat_mod_desc *s, schar plus) |
| void | update_player (void) |
| Recalculate player's extrinsic stats. | |
| void | enter_map (void) |
| A new map has been entered. | |
| void | plr_move (void) |
| Read and act on a keypress. | |
| void | place_player_randomly (void) |
| Teleport to a random spot. | |
| void | plr_takedamage (sint amt, const char *cause_of_death) |
| Take amt of damage. If fatal, die with #cause_of_death shown. | |
| void | plr_mod_stat (sint which, sint amt) |
| Drain or boost stat which by given amt. | |
| short | plr_restore_stat (short which, short amt) |
| Restore stat which by amt if it has been drained. | |
| void | awardXP (uint amt) |
| Give the player experience. | |
Variables | |
| const char * | statmsg [3][5] |
| Messages shown when a stat is drained, boosted, or restored. | |
|
||||||||||||||||
|
Definition at line 187 of file player.c. References stat_mod_desc::amount, player::extrinsic, world::plr, stat_mod_desc::stat, STATMOD_ADD, STATMOD_ADDPLUS, STATMOD_OR, STATMOD_SET, stat_mod_desc::type, and w. Referenced by apply_timers(), cb_apply_item_stat(), cb_apply_item_stat_all(), cb_apply_item_stat_to_temp(), potion_numbness_effect(), spell_adrenaline_high_effect(), and spell_adrenaline_low_effect(). |
|
|
Give the player experience. The amount of XP needed to gain a level, when the current level is L, is 25*L*(L+2). Extra experience points past what is needed to gain a level are not counted towards the next level; you can only gain one level at a time. Each point of XP gained is worth one point of score. Definition at line 921 of file player.c. References player::level, message(), world::plr, player::score, ulong, update_player(), w, and player::xp. Referenced by monst_takedamage(), and plr_search(). |
|
|
Display player stats.
Definition at line 942 of file player.c. References player::class, deref_file_ptr(), draw_string(), player::extrinsic, full_redraw(), Graph_ClrScr(), player::intrinsic, player::level, OPTION_FONT_SMALL, player_screen_tabs, world::playerclasses, world::plr, print_skills(), read_char(), SCREEN_HEIGHT, SCREEN_WIDTH, setTabStops(), STAT_DAMAGE_MAX, STAT_DAMAGE_MIN, STAT_DEXTERITY, STAT_DV, STAT_MANA, STAT_PV, STAT_SPEED, STAT_STRENGTH, STAT_TOUGHNESS, STAT_WILLPOWER, and w. Referenced by plr_move(). |
|
|
Roll up stats for a new character. A character has, depending on class, a set of base stats, maximum values for each stat, and a number of 'free points' which are randomly added onto the base stats. Rather than distribute points one at a time (which would mean that characters would all average out to be about the same), free points are lumped into chunks of 3 (when possible) and assigned that way, OR given out individually.
Definition at line 160 of file player.c. References classdesc::base_stat, player::class, classdesc::free_points, player::intrinsic, classdesc::max_stat, player::maximum, NUM_BASE_STATS, world::playerclasses, world::plr, RANGE, and w. Referenced by init_player(). |
|
|
A new map has been entered.
Definition at line 277 of file player.c. References calc_light(), call_genericfunc(), full_redraw(), world::interrupt, MAPDESC_CURRENT, world::plr, UI_TF_PlaceCamera(), w, player::x, and player::y. Referenced by follow_connection(), and initialize(). |
|
|
Follow a staircase which the player is standing on.
Definition at line 288 of file player.c. References world::current_map, world::current_map_link, deref_file_ptr(), spec_descriptor_ext_level::destcoord, spec_descriptor_ext_level::destmap, end_game(), enter_map(), spec_descriptor::ext, tile::flags, mapdesc::flags, gather_wandering_monsters(), gen_map(), world::level, load_level(), spec_descriptor_ext::lvl, MAPFLAG_NOMONST, MAPFLAG_OUTSIDE, mapdesc::mapindex, MAPSPEC, max(), world::maxlevel, message(), place_wandering_monsters(), world::plr, prompt(), save_level(), tile::special, world::t, TFLAG_OCCUPIED, TILEDESC, timepass(), w, player::x, and player::y. Referenced by auto_follow_connection(), force_follow_connection(), and plr_move(). |
|
|
Initialize the player's class and stats.
Definition at line 93 of file player.c. References player::class, class_menu_rect, player::debt, world::desc, display_title_screen(), distribute_attributes(), player::extrinsic, player::facing, player::facing_forced, player::hps, player::hps_max, player::hps_max_mod, init_inventory(), init_skills(), init_timers(), player::intrinsic, player::level, NUM_STATS, world_descriptor::numplayerclasses, player::partialhps, player::partialpps, world::playerclasses, playerclassname(), world::plr, player::pps, player::pps_max, player::pps_max_mod, player::satiation, player::score, STAT_DIGESTION, STAT_LIGHTRADIUS, STAT_MANA, STAT_SPEED, STAT_TOUGHNESS, STAT_WILLPOWER, world_descriptor::tutorialclass, UI_Menu_Pick(), update_player(), player::velocity, w, and player::xp. Referenced by main_menu(). |
|
|
Open or close a door.
Definition at line 836 of file player.c. References calc_light(), count_items(), draw_tile(), message(), monstbytile(), world::plr, prompt_dir(), world::t, timepass(), tile::type, w, direction::x, player::x, direction::y, and player::y. Referenced by plr_move(). |
|
||||||||||||||||
|
Determine how much something should be modified based on a stat. A stat is modified by attr by an amount depending on how good or bad it is. If attr is average (10), then there is no change. mindistance, then, is how far from average a stat must be before there is any noticeable effect, and divisor is how many points beyond that it takes to make a difference of 1 in the result. attr must be one of the Player Stats.
Definition at line 67 of file player.c. References player::extrinsic, world::plr, sint, and w. Referenced by update_player(). |
|
|
Teleport to a random spot.
Definition at line 560 of file player.c. References tile::flags, MAPSIZE_X, MAPSIZE_Y, tiledesc::passable, plr_moveto(), RANGE, world::t, TFLAG_OCCUPIED, world::tiledescs, tile::type, and w. Referenced by place_player_on_map(). |
|
||||||||||||
|
Callback for class name. Copies the name of class n into buf.
Definition at line 52 of file player.c. References deref_file_ptr(), classdesc::name, world::playerclasses, and w. Referenced by init_player(). |
|
|
Attack the monster with given index.
Definition at line 688 of file player.c. References award_mark(), player::extrinsic, monster::hps, player::level, world::m, MDESC, message(), monst_anger(), monst_attack_type(), monst_takedamage(), monstname(), MTRIGGER_PREEMPT, nrandom(), world::plr, plr_attack_monster_roll(), sint, STAT_DAMAGE_MAX, STAT_DAMAGE_MIN, STAT_TOHIT, and w. Referenced by plr_walk(). |
|
||||||||||||
|
Make an attack-roll.
Definition at line 41 of file player.c. References calculate_hit(), player::level, MDESC, world::plr, and w. Referenced by plr_attack(), and throw_item(). |
|
||||||||||||
|
Drain or boost stat which by given amt.
Definition at line 762 of file player.c. References player::intrinsic, player::maximum, message(), world::plr, statmsg, update_player(), and w. |
|
|
||||||||||||||||
|
Move to the given location. The player is moved to the given location, possibly teleporting. This function handles entering/leaving shops, auto-pickup, and traps. Definition at line 799 of file player.c. References calc_light(), call_stepfunc(), count_items(), deref_file_ptr(), draw_tile(), tile::flags, item_step(), world::m, message(), world::plr, world::shopdescs, tile::special, world::t, TFLAG_EXPLORED, TFLAG_LIT, TFLAG_OCCUPIED, TILEDESC, tile::type, UI_TF_MoveCamera(), w, monster::x, player::x, monster::y, and player::y. Referenced by place_player_randomly(), and plr_walk(). |
|
||||||||||||
|
Restore stat which by amt if it has been drained.
Definition at line 782 of file player.c. References player::intrinsic, player::maximum, message(), world::plr, statmsg, update_player(), and w. |
|
||||||||||||
|
Try to run in the given direction. This function causes the player to keep moving in the given direction until w->interrupt is set, or a wall is reached.
Definition at line 663 of file player.c. References player::extrinsic, world::interrupt, message(), world::plr, plr_walk(), STAT_FLAG_ENTANGLED, STAT_FLAGS, timepass(), and w. Referenced by plr_move(). |
|
|
Search for traps and secret doors.
Definition at line 888 of file player.c. References awardXP(), draw_tile(), tile::flags, message(), world::plr, RANGE, world::t, TFLAG_HIDETRAP, timepass(), tile::type, w, player::x, and player::y. Referenced by plr_move(). |
|
||||||||||||
|
Take amt of damage. If fatal, die with #cause_of_death shown.
Definition at line 717 of file player.c. References die(), player::extrinsic, player::hps, world::interrupt, max(), world::plr, STAT_FLAG_NUMB, STAT_FLAGS, STAT_PV, and w. Referenced by attack_tile(), spell_confusion(), and timepass(). |
|
||||||||||||
|
Try to walk in the given direction.
Definition at line 576 of file player.c. References calc_light(), call_stepfunc(), delta_facing(), dir, draw_tile(), player::extrinsic, player::facing, facing(), tile::flags, world::interrupt, isNull, message(), monst_is_peaceful(), monst_is_pet(), monstbytile(), monstname(), player_facing(), world::plr, plr_attack(), plr_moveto(), prompt(), RANGE, retprintf(), STAT_DEXTERITY, STAT_FLAG_CONFUSED, STAT_FLAG_ENTANGLED, STAT_FLAG_SLIPPERY, STAT_FLAGS, world::t, TFLAG_OCCUPIED, TILEDESC, timepass(), tile::type, player::velocity, w, player::x, and player::y. Referenced by plr_move(), and plr_run(). |
|
|
Recalculate player's extrinsic stats.
Definition at line 212 of file player.c. References apply_all_item_properties(), apply_timers(), calc_light(), player::extrinsic, item::flags, player::hps_max, player::hps_max_mod, player::intrinsic, INVENTORY, ITEMFLAG_EQUIPPED, player::level, max(), mod_from_attribute(), NUM_STATS, world::plr, PLRINVSIZE, player::pps_max, player::pps_max_mod, PROPERTY_CARRIED_EFFECT, PROPERTY_WORN_STAT_EFFECT, STAT_DAMAGE_MAX, STAT_DAMAGE_MIN, STAT_DEXTERITY, STAT_DV, STAT_LIGHTRADIUS, STAT_MANA, STAT_MISSILE_TOHIT, STAT_MISSILEDAM_MAX, STAT_PV, STAT_SPEED, STAT_STRENGTH, STAT_TOHIT, STAT_TOUGHNESS, STAT_WILLPOWER, item::type, w, weapon_skill_attack(), and weapon_skill_damage(). Referenced by add_timer(), award_mark(), awardXP(), do_drop_item(), do_takeoff_item(), do_wear_item(), enchant_item(), init_player(), pickup(), plr_mod_stat(), plr_restore_stat(), potion_numbness_expire(), throw_item(), and timepass(). |
|
|
Initial value: {
{
gettext("You feel weaker."),
gettext("You feel clumsy."),
gettext("You feel sickly."),
gettext("You feel tired."),
gettext("You feel naive."),
},
{
gettext("You feel stronger."),
gettext("Your coordination improves."),
gettext("You feel tougher."),
gettext("You feel powerful."),
gettext("You feel skeptical."),
},
{
gettext("You feel your strength returning."),
gettext("You feel less clumsy."),
gettext("You feel restored to health."),
gettext("You feel restored."),
gettext("You feel less naive."),
}
}
Definition at line 736 of file player.c. Referenced by plr_mod_stat(), and plr_restore_stat(). |
1.3.6