Crossfire Server, Branch 1.12
R12190
|
Functions related to attributes, weight, experience, which concern only living things. More...
Go to the source code of this file.
Defines | |
#define | ADD_EXP(exptotal, exp) {exptotal += exp; if (exptotal > MAX_EXPERIENCE) exptotal = MAX_EXPERIENCE; } |
Handy little macro that adds exp and keeps it within bounds. | |
#define | DIFF_MSG(flag, subtype1, subtype2, msg1, msg2) draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_ATTRIBUTE, (flag>0)?subtype1:subtype2, (flag>0)?msg1:msg2, NULL); |
Rather than having a whole bunch of if (flag) draw. | |
#define | MAX_EXP_IN_OBJ levels[settings.max_level]/(MAX_EXP_CAT - 1) |
Because exp_obj sum to make the total score, we cannot allow that sum to exceed the maximum amount of experience a player can gain. | |
#define | MAX_EXPERIENCE levels[settings.max_level] |
Since this is nowhere defined ... | |
#define | MAX_SAVE_LEVEL 110 |
Functions | |
static void | add_player_exp (object *op, sint64 exp, const char *skill_name, int flag) |
Add experience to a player - exp should only be positive. | |
void | add_statbonus (object *op) |
Adds stat-bonuses given by the class which the player has chosen. | |
int | allowed_class (const object *op) |
Returns true if the given player is a legal class. | |
void | apply_death_exp_penalty (object *op) |
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percentage and death_penalty_levels, and by the amount of permenent experience, whichever gives the lowest loss. | |
void | calc_perm_exp (object *op) |
Ensure that the permanent experience requirements in an exp object are met. | |
int | change_abil (object *op, object *tmp) |
Permanently alters an object's stats/flags based on another object. | |
void | change_attr_value (living *stats, int attr, sint8 value) |
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat. | |
void | change_exp (object *op, sint64 exp, const char *skill_name, int flag) |
Changes experience to a player/monster. | |
void | change_luck (object *op, int value) |
Alter the object's luck. | |
sint64 | check_exp_adjust (const object *op, sint64 exp) |
Returns the maximum experience the object can gain or lose. | |
sint64 | check_exp_loss (const object *op, sint64 exp) |
This function checks to make sure that object 'op' can lose 'exp' experience. | |
void | check_stat_bounds (living *stats) |
Ensures that all stats (str/dex/con/wis/cha/int) are within the 1-30 stat limit. | |
int | did_make_save (const object *op, int level, int bonus) |
This function takes an object (monster/player, op), and determines if it makes a basic save throw by looking at the save_throw table. | |
void | dragon_level_gain (object *who) |
This function is called when a dragon-player gains an overall level. | |
void | drain_specific_stat (object *op, int deplete_stats) |
Drain a specified stat from op. | |
void | drain_stat (object *op) |
Drains a random stat from op. | |
void | fix_object (object *op) |
Updates all abilities given by applied objects in the inventory of the given object. | |
sint8 | get_attr_value (const living *stats, int attr) |
Gets the value of a stat. | |
object * | give_skill_by_name (object *op, const char *skill_name) |
Given the skill name skill_name, we find the skill archetype/object, set appropriate values, and insert it into the object (op) that is passed. | |
sint64 | level_exp (int level, double expmul) |
Returns how much experience is needed for a player to become the given level. | |
void | player_lvl_adj (object *who, object *op) |
For the new exp system. | |
void | remove_statbonus (object *op) |
Subtracts stat-bonuses given by the class which the player has chosen. | |
void | set_attr_value (living *stats, int attr, sint8 value) |
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW). | |
void | set_dragon_name (object *pl, const object *abil, const object *skin) |
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to eventually change the player's face and animation) | |
void | share_exp (object *op, sint64 exp, const char *skill, int flag) |
Gives experience to a player/monster, sharing it with party if applicable. | |
static void | subtract_player_exp (object *op, sint64 exp, const char *skill, int flag) |
Subtracts experience from player. | |
Variables | |
const char *const | attacks [NROFATTACKS] |
Attack type names. | |
const float | cha_bonus [MAX_STAT+1] |
Charisma bonus. | |
const int | cleric_chance [MAX_STAT+1] |
Probability of messing a divine spell. | |
static const int | con_bonus [MAX_STAT+1] |
Constitution bonus. | |
const int | dam_bonus [MAX_STAT+1] |
dam_bonus, thaco_bonus, max_carry, weight limit all are based on strength. | |
const int | dex_bonus [MAX_STAT+1] |
Dexterity bonus. | |
static const char *const | drain_msg [NUM_STATS] |
Message when a player is drained of a stat. | |
const int | fear_bonus [MAX_STAT+1] |
Bonus for fear resistance for players. | |
const char *const | gain_msg [NUM_STATS] |
Message when a player increases permanently a stat. | |
static const int | grace_bonus [MAX_STAT+1] |
Grace bonus. | |
const int | learn_spell [MAX_STAT+1] |
Probability to learn a spell or skill, based on intelligence or wisdom. | |
sint64 * | levels |
Number of levels for which we have experience. | |
const char *const | lose_msg [NUM_STATS] |
Message when a player decreases permanently a stat. | |
const int | max_carry [MAX_STAT+1] |
const char *const | restore_msg [NUM_STATS] |
Message when a player has a stat restored. | |
static const int | savethrow [MAX_SAVE_LEVEL+1] |
Probability to avoid something. | |
const char *const | short_stat_name [NUM_STATS] |
Short name of stats. | |
static const int | sp_bonus [MAX_STAT+1] |
Spell point bonus. | |
const float | speed_bonus [MAX_STAT+1] |
speed_bonus, which uses dex as its stat | |
const char *const | statname [NUM_STATS] |
Name of stats. | |
const int | thaco_bonus [MAX_STAT+1] |
THAC0 bonus. | |
const int | turn_bonus [MAX_STAT+1] |
Bonus for spell duration (holyword and turn undead), bonus for resistance to these spells. | |
const uint32 | weight_limit [MAX_STAT+1] |
The absolute most a character can carry - a character can't pick stuff up if it would put him above this limit. |
Functions related to attributes, weight, experience, which concern only living things.
Definition in file living.c.
#define ADD_EXP | ( | exptotal, | |
exp | |||
) | {exptotal += exp; if (exptotal > MAX_EXPERIENCE) exptotal = MAX_EXPERIENCE; } |
Handy little macro that adds exp and keeps it within bounds.
Since we are now using 64 bit values, I'm not all concerned about overflow issues with exptotal wrapping. exptotal is typically op->exp, or op->perm_exp
Definition at line 46 of file living.c.
Referenced by add_player_exp().
#define DIFF_MSG | ( | flag, | |
subtype1, | |||
subtype2, | |||
msg1, | |||
msg2 | |||
) | draw_ext_info(NDI_UNIQUE, 0, op, MSG_TYPE_ATTRIBUTE, (flag>0)?subtype1:subtype2, (flag>0)?msg1:msg2, NULL); |
Rather than having a whole bunch of if (flag) draw.
. else _draw, make this macro to clean those up. Not usuable outside change_abil function since some of the values passed to draw_ext_info are hardcoded.
Definition at line 418 of file living.c.
Referenced by change_abil().
#define MAX_EXP_IN_OBJ levels[settings.max_level]/(MAX_EXP_CAT - 1) |
Because exp_obj sum to make the total score, we cannot allow that sum to exceed the maximum amount of experience a player can gain.
Thus we define MAX_EXP_IN_OBJ. It is important to try to make the value of MAX_EXP_CAT close to the actual number of experience objects in the game, otherwise the maximum level in any experience category could be quite low. To help the situation out a little I added 10 more levels, and jacked up the last level experience value. Its out of line with progression of previous levels, so if more levels are desired, this should be fixed. -b.t.
#define MAX_EXPERIENCE levels[settings.max_level] |
Since this is nowhere defined ...
Both come in handy at least in function add_exp()
Definition at line 178 of file living.c.
Referenced by calc_perm_exp(), change_exp(), and check_exp_adjust().
#define MAX_SAVE_LEVEL 110 |
Definition at line 199 of file living.c.
Referenced by did_make_save().
static void add_player_exp | ( | object * | op, |
sint64 | exp, | ||
const char * | skill_name, | ||
int | flag | ||
) | [static] |
Add experience to a player - exp should only be positive.
Updates permanent exp for the skill we are adding to.
op | object we add exp to. |
exp | experience to gain. Can be 0, but not that useful to call in that case... |
skill_name | skill to add exp to. Can be NULL, in which case exp increases the players general total, but not any particular skill. |
flag | what to do if the player doesn't have the skill. Combination of SK_EXP_xxx flags. |
Definition at line 1837 of file living.c.
References ADD_EXP, calc_perm_exp(), give_skill_by_name(), levels, NUM_SKILLS, PERM_EXP_GAIN_RATIO, Settings::permanent_exp_ratio, player_lvl_adj(), settings, SK_EXP_ADD_SKILL, SK_EXP_NONE, and SKILL.
Referenced by change_exp().
void add_statbonus | ( | object * | op | ) |
Adds stat-bonuses given by the class which the player has chosen.
op | object which must be a player with contr not NULL. |
Definition at line 863 of file living.c.
Referenced by key_change_class(), and key_roll_stat().
int allowed_class | ( | const object * | op | ) |
Returns true if the given player is a legal class.
The function to add and remove class-bonuses to the stats doesn't check if the stat becomes negative, thus this function merely checks that all stats are 1 or more, and returns false otherwise.
op | object to check. |
Definition at line 1543 of file living.c.
Referenced by key_change_class().
void apply_death_exp_penalty | ( | object * | op | ) |
Applies a death penalty experience, the size of this is defined by the settings death_penalty_percentage and death_penalty_levels, and by the amount of permenent experience, whichever gives the lowest loss.
op | victim of the penalty. Must not be NULL. |
Definition at line 2073 of file living.c.
References check_exp_loss(), Settings::death_penalty_level, Settings::death_penalty_ratio, levels, MAX, MIN, player_lvl_adj(), settings, and SKILL.
Referenced by kill_player().
void calc_perm_exp | ( | object * | op | ) |
Ensure that the permanent experience requirements in an exp object are met.
This really just checks 'op to make sure the perm_exp value is within proper range. Note that the checking of what is passed through has been reduced. Since there is now a proper field for perm_exp, this can now work on a much larger set of objects.
op | object to check. |
Definition at line 1804 of file living.c.
References MAX_EXPERIENCE, Settings::permanent_exp_ratio, and settings.
Referenced by add_player_exp(), and command_addexp().
int change_abil | ( | object * | op, |
object * | tmp | ||
) |
Permanently alters an object's stats/flags based on another object.
Definition at line 443 of file living.c.
References add_string(), AT_CONFUSION, ATNR_PHYSICAL, BOW, change_attr_value(), change_resist_msg, check_move_on(), check_stat_bounds(), CLEAR_FLAG, DIFF_MSG, draw_ext_info(), draw_ext_info_format(), EXPERIENCE, fix_object(), FLAG_APPLIED, FLAG_BLIND, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_WIZ, FLAG_XRAYS, free_string(), gain_msg, get_attr_value(), lose_msg, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_SWIM, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_GAIN, MSG_TYPE_ATTRIBUTE_ATTACKTYPE_LOSS, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_END, MSG_TYPE_ATTRIBUTE_GOOD_EFFECT_START, MSG_TYPE_ATTRIBUTE_MOVE, MSG_TYPE_ATTRIBUTE_PROTECTION_GAIN, MSG_TYPE_ATTRIBUTE_PROTECTION_LOSS, MSG_TYPE_ATTRIBUTE_RACE, MSG_TYPE_ATTRIBUTE_STAT_GAIN, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_BLUE, NDI_UNIQUE, NROFATTACKS, NUM_STATS, PLAYER, POTION, QUERY_FLAG, set_attr_value(), SET_FLAG, and SKILL.
Referenced by apply_special(), become_follower(), blind_living(), blindness_type_process(), cast_bless(), cast_change_ability(), cast_curse(), cfapi_object_change_abil(), eat_special_food(), potion_type_apply(), remove_force(), swap_random_stats(), and unapply_special().
void change_attr_value | ( | living * | stats, |
int | attr, | ||
sint8 | value | ||
) |
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | delta (can be positive). |
Definition at line 336 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, llevError, LOG(), POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by add_abilities(), alchemy_failure_effect(), apply_changes_to_player(), change_abil(), drain_specific_stat(), fix_object(), and kill_player().
void change_exp | ( | object * | op, |
sint64 | exp, | ||
const char * | skill_name, | ||
int | flag | ||
) |
Changes experience to a player/monster.
This does bounds checking to make sure we don't overflow the max exp.
The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed. skill_name is the skill that should get the exp added. flag is what to do if player doesn't have the skill. these last two values are only used for players.
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill_name | skill to change. Can be NULL. |
flag |
|
Definition at line 2015 of file living.c.
References add_player_exp(), FABS, FLAG_ALIVE, llevDebug, llevError, LOG(), MAX_BUF, MAX_EXPERIENCE, PLAYER, QUERY_FLAG, query_name(), and subtract_player_exp().
Referenced by attempt_do_alchemy(), book_type_apply(), cfapi_object_change_exp(), cure_disease(), do_harvest(), do_hidden_move(), do_skill(), god_examines_priest(), hit_with_one_attacktype(), pay_for_item(), peacemaker_type_process(), pray_at_altar(), scroll_type_apply(), sell_item(), share_exp(), and spellbook_type_apply().
void change_luck | ( | object * | op, |
int | value | ||
) |
Alter the object's luck.
op | object to altar. |
value | delta to apply. 0 indicates timeout (moves luck towards 0), otherwise change the luck of the object via an applied bad_luck object in inventory. |
Definition at line 791 of file living.c.
References arch_to_object(), FABS, find_archetype(), FLAG_APPLIED, insert_ob_in_ob(), llevError, LOG(), present_arch_in_ob(), and SET_FLAG.
Referenced by fix_luck(), and kill_object().
sint64 check_exp_adjust | ( | const object * | op, |
sint64 | exp | ||
) |
Returns the maximum experience the object can gain or lose.
op | object which will be the victim. |
exp | experience to gain or lose. |
Definition at line 1937 of file living.c.
References check_exp_loss(), MAX_EXPERIENCE, and MIN.
Referenced by command_addexp().
sint64 check_exp_loss | ( | const object * | op, |
sint64 | exp | ||
) |
This function checks to make sure that object 'op' can lose 'exp' experience.
It basically makes adjustments based on permanent exp and the like. This function should always be used for losing experience - the 'exp' value passed should be positive - this is the amount that should get subtract from the player.
op | object to which to substract. |
exp | experience to lose. |
Definition at line 1915 of file living.c.
References PERM_EXP_MAX_LOSS_RATIO, Settings::permanent_exp_ratio, and settings.
Referenced by apply_death_exp_penalty(), check_exp_adjust(), kill_object(), and subtract_player_exp().
void check_stat_bounds | ( | living * | stats | ) |
Ensures that all stats (str/dex/con/wis/cha/int) are within the 1-30 stat limit.
stats | attributes to check. |
Definition at line 404 of file living.c.
References get_attr_value(), MAX_STAT, MIN_STAT, NUM_STATS, and set_attr_value().
Referenced by change_abil(), fix_object(), and kill_player().
int did_make_save | ( | const object * | op, |
int | level, | ||
int | bonus | ||
) |
This function takes an object (monster/player, op), and determines if it makes a basic save throw by looking at the save_throw table.
op | potential victim. |
level | the effective level to make the save at |
bonus | any plus/bonus (typically based on resistance to particular attacktype). |
Definition at line 2121 of file living.c.
References MAX_SAVE_LEVEL, PREFER_HIGH, random_roll(), and savethrow.
Referenced by flee_player(), hit_player(), hit_with_one_attacktype(), mood_change(), and polymorph_living().
void dragon_level_gain | ( | object * | who | ) |
This function is called when a dragon-player gains an overall level.
Here, the dragon might gain new abilities or change the ability-focus.
who | dragon's object. |
Definition at line 1623 of file living.c.
References atnr_is_dragon_enabled(), change_resist_msg, dragon_ability_gain(), draw_ext_info_format(), FORCE, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_RACE, NDI_BLUE, NDI_UNIQUE, and set_dragon_name().
Referenced by player_lvl_adj().
void drain_specific_stat | ( | object * | op, |
int | deplete_stats | ||
) |
Drain a specified stat from op.
op | victim to drain. |
deplete_stats | statistic to drain. |
Definition at line 760 of file living.c.
References arch_to_object(), change_attr_value(), drain_msg, draw_ext_info(), find_archetype(), fix_object(), FLAG_APPLIED, insert_ob_in_ob(), llevError, LOG(), MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_STAT_LOSS, NDI_UNIQUE, present_arch_in_ob(), and SET_FLAG.
Referenced by cfapi_object_drain(), drain_stat(), and write_scroll().
void drain_stat | ( | object * | op | ) |
Drains a random stat from op.
Stat draining by Vick 930307 (Feeling evil, I made it work as well now. -Frank 8)
op | object to drain. |
Definition at line 748 of file living.c.
References drain_specific_stat(), and NUM_STATS.
Referenced by hit_with_one_attacktype(), and potion_type_apply().
void fix_object | ( | object * | op | ) |
Updates all abilities given by applied objects in the inventory of the given object.
This functions starts from base values (archetype or player object) and then adjusts them according to what the player/monster has equipped.
Note that a player always has stats reset to their initial value.
July 95 - inserted stuff to handle new skills/exp system - b.t. spell system split, grace points now added to system --peterm
November 2006: max armor speed is always taken into account, no exception.
op | object to reset. |
Definition at line 900 of file living.c.
References add_refcount(), AMULET, ARMOUR, ARMOUR_SPEED, AT_PHYSICAL, ATNR_PHYSICAL, BOOTS, BOW, BRACERS, change_attr_value(), check_stat_bounds(), CLEAR_FLAG, CLOAK, CLOSE_CON, con_bonus, CONTAINER, dam_bonus, dex_bonus, DISEASE, esrv_update_spells(), EXPERIENCE, FLAG_APPLIED, FLAG_BLIND, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_READY_WEAPON, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STEALTH, FLAG_UNDEAD, FLAG_USE_ARMOUR, FLAG_WIZ, FLAG_XRAYS, FORCE, free_string(), get_attr_value(), GIRDLE, GLOVES, grace_bonus, HELMET, HORN, IS_COMBAT_SKILL, IS_GRACE_SKILL, IS_MANA_SKILL, llevDebug, LOG(), MAX, max_carry, Settings::max_level, MOVE_FLY_HIGH, MOVE_FLY_LOW, MOVE_WALK, NROFATTACKS, NUM_STATS, PLAYER, POTION, POTION_EFFECT, QUERY_FLAG, range_bow, range_misc, range_skill, RING, ROD, Settings::search_items, set_attr_value(), SET_FLAG, settings, SHIELD, SK_PRAYING, SKILL, SKILL_TOOL, sp_bonus, speed_bonus, Settings::spell_encumbrance, SYMPTOM, thaco_bonus, TRUE, update_ob_speed(), WAND, WEAPON, and WEAPON_SPEED.
Referenced by animate_weapon(), apply_special(), blind_living(), blindness_type_process(), cast_bless(), cast_curse(), cfapi_object_fix(), cfapi_object_set_property(), change_abil(), check_login(), command_abil(), command_brace(), command_dropall(), command_fix_me(), command_possess(), command_search_items(), do_skill(), do_symptoms(), do_turn(), dragon_eat_flesh(), drain_specific_stat(), drop_object(), eat_special_food(), fire_bow(), fix_weight(), god_intervention(), hit_with_one_attacktype(), improve_armour(), improve_weapon_stat(), insert_ob_in_ob(), key_change_class(), kill_player(), lighter_type_apply(), pay_for_amount(), pay_for_item(), pick_up_object(), player_changer_type_process(), player_lvl_adj(), poison_living(), poisoning_type_process(), potion_type_apply(), put_object_in_sack(), remove_force(), remove_ob(), remove_symptoms(), roll_stats(), save_life(), slow_living(), stop_jump(), swap_random_stats(), swap_stat(), and unapply_special().
sint8 get_attr_value | ( | const living * | stats, |
int | attr | ||
) |
Gets the value of a stat.
stats | item from which to get stat. |
attr | attribute to get. |
Definition at line 377 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by add_abilities(), apply_changes_to_player(), calc_item_power(), cast_change_ability(), change_abil(), check_good_weapon(), check_stat_bounds(), describe_item(), eat_special_food(), fix_object(), god_intervention(), is_magical(), kill_player(), perceive_self(), potion_type_apply(), ring_desc(), set_ring_bonus(), swap_random_stats(), and swap_stat().
object* give_skill_by_name | ( | object * | op, |
const char * | skill_name | ||
) |
Given the skill name skill_name, we find the skill archetype/object, set appropriate values, and insert it into the object (op) that is passed.
We return the skill - this makes it easier for calling functions that want to do something with it immediately.
op | object to which to give the skill. Must not be NULL. |
skill_name | skill to give. Must not be NULL. |
Definition at line 1689 of file living.c.
References arch_to_object(), CLEAR_FLAG, FLAG_CAN_USE_SKILL, get_archetype_by_skill_name(), insert_ob_in_ob(), llevError, LOG(), and SKILL.
Referenced by add_player_exp(), adjust_skill_tool(), become_follower(), cfapi_object_give_skill(), do_skill(), food_type_apply(), and learn_skill().
sint64 level_exp | ( | int | level, |
double | expmul | ||
) |
Returns how much experience is needed for a player to become the given level.
level should really never exceed max_level
level | level player wants to reach |
expmul | penality/bonus for experience. |
Definition at line 1788 of file living.c.
References levels, Settings::max_level, and settings.
Referenced by calculate_difficulty(), command_statistics(), place_monsters(), player_lvl_adj(), and show_skills().
void player_lvl_adj | ( | object * | who, |
object * | op | ||
) |
For the new exp system.
we are concerned with whether the player gets more hp, sp and new levels. Note this this function should only be called for players. Monsters don't really gain levels
Will tell the player about changed levels.
who | player |
op | what we are checking to gain the level (eg, skill) |
Definition at line 1731 of file living.c.
References die_roll(), dragon_level_gain(), draw_ext_info(), draw_ext_info_format(), esrv_update_spells(), fix_object(), is_dragon_pl(), level_exp(), MAX_BUF, Settings::max_level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_LEVEL_GAIN, MSG_TYPE_ATTRIBUTE_LEVEL_LOSS, NDI_RED, NDI_UNIQUE, PLAYER, player_lvl_adj(), PREFER_HIGH, settings, and snprintf().
Referenced by add_player_exp(), apply_death_exp_penalty(), command_addexp(), player_lvl_adj(), and subtract_player_exp().
void remove_statbonus | ( | object * | op | ) |
Subtracts stat-bonuses given by the class which the player has chosen.
op | object which must be a player with contr not NULL. |
Definition at line 840 of file living.c.
Referenced by key_change_class().
void set_attr_value | ( | living * | stats, |
int | attr, | ||
sint8 | value | ||
) |
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
stats | item to modify. Must not be NULL. |
attr | attribute to change. |
value | new value. |
Definition at line 296 of file living.c.
References CHA, liv::Cha, CON, liv::Con, DEX, liv::Dex, INT, liv::Int, POW, liv::Pow, STR, liv::Str, WIS, and liv::Wis.
Referenced by apply_changes_to_player(), cast_change_ability(), change_abil(), check_stat_bounds(), eat_special_food(), fix_object(), set_ring_bonus(), swap_random_stats(), and swap_stat().
void set_dragon_name | ( | object * | pl, |
const object * | abil, | ||
const object * | skin | ||
) |
Set the new dragon name after gaining levels or changing ability focus (later this can be extended to eventually change the player's face and animation)
Note that the title is written to 'own_title' in the player struct. This should be changed to 'ext_title' as soon as clients support this! Please, anyone, write support for 'ext_title'.
pl | player's object to change. |
abil | dragon's innate abilities. |
skin | dragon's skin. |
Definition at line 1566 of file living.c.
References atnr_is_dragon_enabled(), attacks, NROFATTACKS, and snprintf().
Referenced by check_login(), and dragon_level_gain().
void share_exp | ( | object * | op, |
sint64 | exp, | ||
const char * | skill, | ||
int | flag | ||
) |
Gives experience to a player/monster, sharing it with party if applicable.
This does bounds checking to make sure we don't overflow the max exp.
The exp passed is typically not modified much by this function - it is assumed the caller has modified the exp as needed.
This is merely a wrapper for change_exp().
op | victim to alter. |
exp | experience to gain (positive) or lose (negative). |
skill | skill to change. Can be NULL. |
flag |
|
Definition at line 2150 of file living.c.
References change_exp(), first_player, pl::next, pl::ob, on_same_map(), PLAYER, and SK_EXP_TOTAL.
Referenced by kill_object(), and mood_change().
static void subtract_player_exp | ( | object * | op, |
sint64 | exp, | ||
const char * | skill, | ||
int | flag | ||
) | [static] |
Subtracts experience from player.
Eg, if we figure the player is losing 10% of his total exp, what happens is he loses 10% from all his skills. Note that if permanent exp is used, player may not in fact lose as much as listed. Eg, if player has gotten reduced to the point where everything is at the minimum perm exp, he would lose nothing.
op | victim we want to substract from |
exp | value to substract. Should be positive. |
skill | skill to substract exp from. Can be NULL. |
flag | if SK_SUBTRACT_SKILL_EXP and skill is set, only subtract from the matching skill. Otherwise, this subtracts a portion from all skills the player has. |
Definition at line 1965 of file living.c.
References check_exp_loss(), player_lvl_adj(), SK_SUBTRACT_SKILL_EXP, and SKILL.
Referenced by change_exp().
const char* const attacks[NROFATTACKS] |
{ "physical", "magical", "fire", "electricity", "cold", "confusion", "acid", "drain", "weaponmagic", "ghosthit", "poison", "slow", "paralyze", "turn undead", "fear", "cancellation", "depletion", "death", "chaos","counterspell","god power","holy power","blinding", "", "life stealing" }
Attack type names.
Definition at line 220 of file living.c.
Referenced by did_make_save_item(), and set_dragon_name().
{ 10.0, 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.5, 4.0, 3.5, 3.0, 2.9, 2.8, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1, 2.0, 1.95, 1.90, 1.85, 1.80, 1.75, 1.70, 1.65, 1.60, 1.55, 1.50 }
Charisma bonus.
Definition at line 94 of file living.c.
Referenced by query_cost().
const int cleric_chance[MAX_STAT+1] |
{ 100,100,100,100,90,80,70,60,50,40,35,30,25,20,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0 }
Probability of messing a divine spell.
Based on wisdom.
Definition at line 160 of file living.c.
Referenced by cast_spell().
{ -6,-5,-4,-3,-2,-1,-1,0,0,0,0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20, 22,25,30,40,50 }
Constitution bonus.
Definition at line 51 of file living.c.
Referenced by fix_object().
{ -2,-2,-2,-1,-1,-1,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,5,5,6,6,7,8,10,15 }
dam_bonus, thaco_bonus, max_carry, weight limit all are based on strength.
Definition at line 119 of file living.c.
Referenced by do_throw(), fire_bow(), and fix_object().
{ -4,-3,-2,-2,-1,-1,-1,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,6,6,7 }
Dexterity bonus.
Definition at line 104 of file living.c.
Referenced by do_throw(), fire_bow(), and fix_object().
{ "Oh no! You are weakened!", "You're feeling clumsy!", "You feel less healthy", "You suddenly begin to lose your memory!", "Your face gets distorted!", "Watch out, your mind is going!", "Your spirit feels drained!" }
Message when a player is drained of a stat.
Definition at line 229 of file living.c.
Referenced by drain_specific_stat().
const int fear_bonus[MAX_STAT+1] |
{ 3,3,3,3,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
Bonus for fear resistance for players.
Definition at line 170 of file living.c.
Referenced by cast_cone().
{ "You feel stronger.", "You feel more agile.", "You feel healthy.", "You feel wiser.", "You seem to look better.", "You feel smarter.", "You feel more potent." }
Message when a player increases permanently a stat.
Definition at line 251 of file living.c.
Referenced by change_abil().
const int grace_bonus[MAX_STAT+1] [static] |
{ -10,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,12,15,20,25, 30,40,50,70,100 }
Grace bonus.
Definition at line 70 of file living.c.
Referenced by fix_object().
const int learn_spell[MAX_STAT+1] |
{ 0,0,0,1,2,4,8,12,16,25,36,45,55,65,70,75,80,85,90,95,100,100,100,100,100, 100,100,100,100,100,100 }
Probability to learn a spell or skill, based on intelligence or wisdom.
Definition at line 154 of file living.c.
Referenced by learn_skill(), and spellbook_type_apply().
sint64* levels |
Number of levels for which we have experience.
Definition at line 39 of file exp.c.
Referenced by add_player_exp(), apply_death_exp_penalty(), dump_experience(), free_experience(), init_experience(), level_exp(), and send_exp_table().
{ "You feel weaker!", "You feel clumsy!", "You feel less healthy!", "You lose some of your memory!", "You look ugly!", "You feel stupid!", "You feel less potent!" }
Message when a player decreases permanently a stat.
Definition at line 262 of file living.c.
Referenced by change_abil(), and kill_player().
{ 2,4,7,11,16,22,29,37,46,56,67,79,92,106,121,137,154,172,191,211,232,254,277, 301,326,352,400,450,500,600,1000 }
Definition at line 129 of file living.c.
Referenced by do_throw(), and fix_object().
const char* const restore_msg[NUM_STATS] |
{ "You feel your strength return.", "You feel your agility return.", "You feel your health return.", "You feel your wisdom return.", "You feel your charisma return.", "You feel your memory return.", "You feel your spirits return." }
Message when a player has a stat restored.
Definition at line 240 of file living.c.
Referenced by god_intervention(), and potion_type_apply().
const int savethrow[MAX_SAVE_LEVEL+1] [static] |
{ 18, 18,17,16,15,14,14,13,13,12,12,12,11,11,11,11,10,10,10,10, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
Probability to avoid something.
This no longer needs to be changed anytime the number of levels is increased - rather, did_make_save() will do the right thing and always use range within this table. for safety, savethrow should not be accessed directly anymore, and instead did_make_save() should be used instead.
Definition at line 209 of file living.c.
Referenced by did_make_save().
const char* const short_stat_name[NUM_STATS] |
{ "Str", "Dex", "Con", "Wis", "Cha", "Int","Pow" }
Short name of stats.
Definition at line 278 of file living.c.
Referenced by describe_item(), key_roll_stat(), ring_desc(), and swap_stat().
{ -10,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,12,15,20,25, 30,40,50,70,100 }
Spell point bonus.
Changed the name of this to "sp_bonus" from "int_bonus" because Pow can now be the stat that controls spellpoint advancement. -b.t.
Definition at line 62 of file living.c.
Referenced by fix_object().
const float speed_bonus[MAX_STAT+1] |
{ -0.4, -0.4, -0.3, -0.3, -0.2, -0.2, -0.2, -0.1, -0.1, -0.1, -0.05, 0, 0, 0, 0.05, 0.1, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0 }
speed_bonus, which uses dex as its stat
Definition at line 109 of file living.c.
Referenced by do_throw(), and fix_object().
{ "strength", "dexterity", "constitution", "wisdom", "charisma", "intelligence","power" }
Name of stats.
Definition at line 273 of file living.c.
Referenced by perceive_self().
const int thaco_bonus[MAX_STAT+1] |
{ -2,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,10 }
THAC0 bonus.
Definition at line 124 of file living.c.
Referenced by do_throw(), fire_bow(), and fix_object().
const int turn_bonus[MAX_STAT+1] |
{ -1,-1,-1,-1,-1,-1,-1,-1,0,0,0,1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,9,10,12,15 }
Bonus for spell duration (holyword and turn undead), bonus for resistance to these spells.
Definition at line 165 of file living.c.
Referenced by cast_cone(), and hit_with_one_attacktype().
const uint32 weight_limit[MAX_STAT+1] |
{ 200000, 250000,300000,350000,400000,500000, 600000,700000,800000,900000,1000000, 1100000,1200000,1300000,1400000,1500000, 1650000,1800000,1950000,2100000,2250000, 2400000,2550000,2700000,2850000,3000000, 3250000,3500000,3750000,4000000,4500000 }
The absolute most a character can carry - a character can't pick stuff up if it would put him above this limit.
Value is in grams, so we don't need to do conversion later
These limits are probably overly generous, but being there were no values before, you need to start someplace.
Definition at line 143 of file living.c.
Referenced by do_throw(), esrv_update_stats(), pick_up_object(), and sell_item().