version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_living_c = | | * static char *rcsid_living_c = |
* "$Id: living.c,v 1.10 2000/08/08 06:57:57 cvs Exp $"; | | * "$Id: living.c,v 1.11 2000/08/25 06:23:28 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
} | | } |
| | |
| | /* Ensure that the permanent experience requirements in an exp object are met. */ |
| | /* GD */ |
| | void calc_perm_exp(object *op) |
| | { |
| | int p_exp_min; |
| | |
| | /* Sanity checks. */ |
| | if (op->type != EXPERIENCE) { |
| | LOG(llevError, "calc_minimum_perm_exp called on a non-experience object!"); |
| | return; |
| | } |
| | if (!(settings.use_permanent_experience)) { |
| | LOG(llevError, "calc_minimum_perm_exp called whilst permanent experience disabled!"); |
| | return; |
| | } |
| | |
| | /* The following fields are used: */ |
| | /* stats.exp: Current exp in experience object. */ |
| | /* last_heal: Permanent experience earnt. */ |
| | |
| | /* Ensure that our permanent experience minimum is met. */ |
| | p_exp_min = (int)(PERM_EXP_MINIMUM_RATIO * (float)(op->stats.exp)); |
| | /*LOG(llevError, "Experience minimum check: %d p-min %d p-curr %d curr.\n", p_exp_min, op->last_heal, op->stats.exp);*/ |
| | if (op->last_heal < p_exp_min) |
| | op->last_heal = p_exp_min; |
| | |
| | /* Cap permanent experience. */ |
| | if (op->last_heal < 0) |
| | op->last_heal = 0; |
| | else if (op->last_heal > MAX_EXP_IN_OBJ) |
| | op->last_heal = MAX_EXP_IN_OBJ; |
| | } |
| | |
/* adjust_exp() - make sure that we don't exceed max or min set on | | /* adjust_exp() - make sure that we don't exceed max or min set on |
* experience | | * experience |
*/ | | */ |
| | |
/* This code _only_ affects experience objects. */ | | /* This code _only_ affects experience objects. */ |
/* GD */ | | /* GD */ |
if (op->type == EXPERIENCE) { | | if (op->type == EXPERIENCE) { |
int p_exp_min; | | |
int p_exp_gain; | | int p_exp_gain; |
int max_loss; | | int max_loss; |
| | |
/* The following fields are used: */ | | |
/* stats.exp: Current exp in experience object. */ | | |
/* last_heal: Permanent experience earnt. */ | | |
| | |
/* Ensure that our permanent experience minimum is met. */ | | /* Ensure that our permanent experience minimum is met. */ |
p_exp_min = (int)(PERM_EXP_MINIMUM_RATIO * (float)(op->stats.exp)); | | calc_perm_exp(op); |
/*LOG(llevError, "Experience minimum check: %d p-min %d p-curr %d curr.\n", p_exp_min, op->last_heal, op->stats.exp);*/ | | |
if (op->last_heal < p_exp_min) | | |
op->last_heal = p_exp_min; | | |
| | |
/* Experience gain: We get a ratio of the gain as permanent experience. */ | | /* Experience gain: We get a ratio of the gain as permanent experience. */ |
if (exp > 0) { | | if (exp > 0) { |
p_exp_gain = (int)(PERM_EXP_GAIN_RATIO * exp); | | p_exp_gain = (int)(PERM_EXP_GAIN_RATIO * exp); |
op->last_heal += p_exp_gain; | | op->last_heal += p_exp_gain; |
/* Cap permanent experience. */ | | |
if (op->last_heal > MAX_EXP_IN_OBJ) | | /* Update our new perm exp (so we display the right amount when asked. */ |
op->last_heal = MAX_EXP_IN_OBJ; | | calc_perm_exp(op); |
| | |
/*LOG(llevError, "Gaining %d experience results in %d permanent exp (now %d).\n", exp, p_exp_gain, op->last_heal); */ | | /*LOG(llevError, "Gaining %d experience results in %d permanent exp (now %d).\n", exp, p_exp_gain, op->last_heal); */ |
} | | } |
| | |