version 1.122 | | version 1.123 |
---|
| | |
/* | | /* |
* static char *rcsid_player_c = | | * static char *rcsid_player_c = |
* "$Id: player.c,v 1.122 2003/02/14 05:50:37 garbled Exp $"; | | * "$Id: player.c,v 1.123 2003/02/19 06:52:07 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
/* This rolls four 1-6 rolls and sums the best 3 of the 4. */ | | /* 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++) |
a[i]=(int)RANDOM()%6+1; | | a[i]=(int)RANDOM()%6+1; |
| | |
for(i=0,j=0,k=7;i<4;i++) | | for(i=0,j=0,k=7;i<4;i++) |
if(a[i]<k) | | if(a[i]<k) |
k=a[i],j=i; | | k=a[i],j=i; |
| | |
for(i=0,k=0;i<4;i++) { | | for(i=0,k=0;i<4;i++) { |
if(i!=j) | | if(i!=j) |
k+=a[i]; | | k+=a[i]; |
| | |
| | |
void roll_stats(object *op) { | | void roll_stats(object *op) { |
int sum=0; | | int sum=0; |
| | int i = 0, j = 0; |
| | int statsort[7]; |
| | |
do { | | do { |
op->stats.Str=roll_stat(); | | op->stats.Str=roll_stat(); |
op->stats.Dex=roll_stat(); | | op->stats.Dex=roll_stat(); |
| | |
op->stats.Con+op->stats.Wis+op->stats.Pow+ | | op->stats.Con+op->stats.Wis+op->stats.Pow+ |
op->stats.Cha; | | op->stats.Cha; |
} while(sum<82||sum>116); | | } while(sum<82||sum>116); |
/* Sort the stats so that rerolling is easier... */ | | |
{ | | |
int i = 0, j = 0; | | |
int statsort[7]; | | |
| | |
| | /* Sort the stats so that rerolling is easier... */ |
statsort[0] = op->stats.Str; | | statsort[0] = op->stats.Str; |
statsort[1] = op->stats.Dex; | | statsort[1] = op->stats.Dex; |
statsort[2] = op->stats.Int; | | statsort[2] = op->stats.Int; |
| | |
op->stats.Wis = statsort[4]; | | op->stats.Wis = statsort[4]; |
op->stats.Pow = statsort[5]; | | op->stats.Pow = statsort[5]; |
op->stats.Cha = statsort[6]; | | op->stats.Cha = statsort[6]; |
} | | |
| | |
op->contr->orig_stats.Str=op->stats.Str; | | op->contr->orig_stats.Str=op->stats.Str; |
op->contr->orig_stats.Dex=op->stats.Dex; | | op->contr->orig_stats.Dex=op->stats.Dex; |
| | |
op->stats.sp=0; | | op->stats.sp=0; |
op->stats.grace=0; | | op->stats.grace=0; |
op->stats.ac=0; | | op->stats.ac=0; |
add_exp(op,0); | | player_lvl_adj(op, NULL); |
op->stats.sp=op->stats.maxsp; | | op->stats.sp=op->stats.maxsp; |
op->stats.hp=op->stats.maxhp; | | op->stats.hp=op->stats.maxhp; |
op->stats.grace=0; | | op->stats.grace=0; |
| | |
op->stats.Cha = op->contr->orig_stats.Cha; | | op->stats.Cha = op->contr->orig_stats.Cha; |
op->stats.hp= -10000; | | op->stats.hp= -10000; |
op->level=0; | | op->level=0; |
op->stats.exp=0; | | op->stats.exp=1; |
op->stats.sp=0; | | op->stats.sp=0; |
op->stats.grace=0; | | op->stats.grace=0; |
op->stats.ac=0; | | op->stats.ac=0; |
add_exp(op,0); | | player_lvl_adj(op,NULL); |
op->stats.sp=op->stats.maxsp; | | op->stats.sp=op->stats.maxsp; |
op->stats.grace=0; | | op->stats.grace=0; |
op->stats.hp=op->stats.maxhp; | | op->stats.hp=op->stats.maxhp; |
add_exp(op,0); | | |
op->contr->Swap_First=-1; | | op->contr->Swap_First=-1; |
} | | } |
| | |