version 1.16 | | version 1.17 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.16 2000/08/02 06:04:50 cvs Exp $"; | | * "$Id: player.c,v 1.17 2000/10/16 19:19:31 peterm Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
return dir; | | return dir; |
} | | } |
| | |
void give_initial_items(object *pl) { | | void give_initial_items(object *pl,treasurelist *items) { |
object *op,*next=NULL; | | object *op,*next=NULL; |
static uint8 start_spells[] = {0, 1, 4, 5, 7,17,168}; | | static uint8 start_spells[] = {0, 1, 4, 5, 7,17,168}; |
static uint8 start_prayers[] = {19, 31, 32, 129}; | | static uint8 start_prayers[] = {19, 31, 32, 129}; |
if(pl->randomitems!=NULL) | | if(pl->randomitems!=NULL) |
create_treasure(pl->randomitems,pl,GT_INVENTORY,1,0); | | create_treasure(items,pl,GT_INVENTORY,1,0); |
| | |
for (op=pl->inv; op; op=next) { | | for (op=pl->inv; op; op=next) { |
next = op->below; | | next = op->below; |
| | |
/* Not marked as starting equipment, so set 0 value. */ | | /* Not marked as starting equipment, so set 0 value. */ |
if (QUERY_FLAG(op,FLAG_IS_THROWN)) | | if (QUERY_FLAG(op,FLAG_IS_THROWN)) |
op->value=0; | | op->value=0; |
| | if(op->type==FORCE) { SET_FLAG(op,FLAG_APPLIED);}; |
if(op->type==SPELLBOOK) { /* fix spells for first level spells */ | | if(op->type==SPELLBOOK) { /* fix spells for first level spells */ |
if(!strcmp(op->arch->name,"cleric_book")) | | if(!strcmp(op->arch->name,"cleric_book")) |
op->stats.sp=start_prayers[RANDOM()%(sizeof(start_prayers)/sizeof(uint8))]; | | op->stats.sp=start_prayers[RANDOM()%(sizeof(start_prayers)/sizeof(uint8))]; |
| | |
send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "What is the password?\n:"); | | send_query(&op->contr->socket, CS_QUERY_HIDEINPUT, "What is the password?\n:"); |
} | | } |
| | |
| | |
| | /* This rolls four 1-6 rolls and sums the best 3 of the 4. */ |
int roll_stat() { | | int roll_stat() { |
int a[4],i,j,k; | | int a[4],i,j,k; |
for(i=0;i<4;i++) | | for(i=0;i<4;i++) |
| | |
#endif | | #endif |
switch (key) { | | switch (key) { |
case 'n': | | case 'n': |
case 'N': | | case 'N': { |
SET_FLAG(op, FLAG_WIZ); | | SET_FLAG(op, FLAG_WIZ); |
if(op->map==NULL) { | | if(op->map==NULL) { |
LOG(llevError,"Map == NULL in state 2\n"); | | LOG(llevError,"Map == NULL in state 2\n"); |
break; | | break; |
} | | } |
| | |
/* So that enter_exit will put us at startx/starty */ | | /* So that enter_exit will put us at startx/starty */ |
op->x= -1; | | op->x= -1; |
| | |
enter_exit(op,NULL); | | enter_exit(op,NULL); |
| | |
/* Enter exit adds a player otherwise */ | | /* Enter exit adds a player otherwise */ |
if(op->contr->loading == NULL) { | | if(op->contr->loading == NULL) { |
insert_ob_in_map(op,op->map,op); | | insert_ob_in_map(op,op->map,op); |
| | |
send_query(&op->contr->socket,CS_QUERY_SINGLECHAR,"Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"); | | send_query(&op->contr->socket,CS_QUERY_SINGLECHAR,"Now choose a character.\nPress any key to change outlook.\nPress `d' when you're pleased.\n"); |
op->contr->state = ST_CHANGE_CLASS; | | op->contr->state = ST_CHANGE_CLASS; |
return 0; | | return 0; |
| | } |
case 'y': | | case 'y': |
case 'Y': | | case 'Y': |
roll_stats(op); | | roll_stats(op); |
| | |
#ifdef ALLOW_SKILLS | | #ifdef ALLOW_SKILLS |
(void) init_player_exp(op); | | (void) init_player_exp(op); |
#endif | | #endif |
give_initial_items(op); | | give_initial_items(op,op->randomitems); |
#ifdef ALLOW_SKILLS | | #ifdef ALLOW_SKILLS |
(void) link_player_skills(op); | | (void) link_player_skills(op); |
#endif | | #endif |
esrv_send_inventory(op, op); | | esrv_send_inventory(op, op); |
| | { |
| | object *WoR = get_archetype("force"); |
| | WoR->speed = .5; |
| | WoR->speed_left = -1; |
| | WoR->type = WORD_OF_RECALL; |
| | WoR->stats.hp = 1; |
| | EXIT_PATH(WoR) = add_string("/HallOfSelection"); |
| | EXIT_X(WoR) = 1; |
| | EXIT_Y(WoR) = 1; |
| | insert_ob_in_ob(WoR,op); |
| | } |
return 0; | | return 0; |
} | | } |
| | |
| | |
int gen_hp, gen_sp, gen_grace; | | int gen_hp, gen_sp, gen_grace; |
int over_hp, over_sp, over_grace; | | int over_hp, over_sp, over_grace; |
int i; | | int i; |
const int rate_hp = 1200; | | int rate_hp = 1200; |
const int rate_sp = 2500; | | int rate_sp = 2500; |
const int rate_grace = 2000; | | int rate_grace = 2000; |
const int max_hp = 1; | | const int max_hp = 1; |
const int max_sp = 1; | | const int max_sp = 1; |
const int max_grace = 1; | | const int max_grace = 1; |
| | |
} | | } |
| | |
if(op->contr->state==ST_PLAYING) { | | if(op->contr->state==ST_PLAYING) { |
| | |
| | /* these next three if clauses make it possible to SLOW DOWN |
| | hp/grace/spellpoint regeneration. */ |
| | if(op->contr->gen_hp >= 0 ) |
gen_hp=(op->contr->gen_hp+1)*op->stats.maxhp; | | gen_hp=(op->contr->gen_hp+1)*op->stats.maxhp; |
| | else { |
| | gen_hp = op->stats.maxhp; |
| | rate_hp -= rate_hp/2 * op->contr->gen_hp; |
| | } |
| | if(op->contr->gen_sp >= 0 ) |
gen_sp=(op->contr->gen_sp+1)*op->stats.maxsp; | | gen_sp=(op->contr->gen_sp+1)*op->stats.maxsp; |
| | else { |
| | gen_sp = op->stats.maxsp; |
| | rate_sp -= rate_sp/2 * op->contr->gen_sp; |
| | } |
| | if(op->contr->gen_grace >= 0) |
gen_grace=(op->contr->gen_grace+1)*op->stats.maxgrace; | | gen_grace=(op->contr->gen_grace+1)*op->stats.maxgrace; |
| | else { |
| | gen_grace = op->stats.maxgrace; |
| | rate_grace -= rate_grace/2 * op->contr->gen_grace; |
| | } |
| | |
/* Regenerate Spell Points */ | | /* Regenerate Spell Points */ |
if(op->contr->golem==NULL&&--op->last_sp<0) { | | if(op->contr->golem==NULL&&--op->last_sp<0) { |
| | |
if(--op->last_eat<0) { | | if(--op->last_eat<0) { |
int bonus=op->contr->digestion>0?op->contr->digestion:0, | | int bonus=op->contr->digestion>0?op->contr->digestion:0, |
penalty=op->contr->digestion<0?-op->contr->digestion:0; | | penalty=op->contr->digestion<0?-op->contr->digestion:0; |
| | if(op->contr->gen_hp > 0) |
op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); | | op->last_eat=25*(1+bonus)/(op->contr->gen_hp+penalty+1); |
| | else |
| | op->last_eat=25*(1+bonus)/(penalty +1); |
op->stats.food--; | | op->stats.food--; |
} | | } |
} | | } |