version 1.23 | | version 1.24 |
---|
| | |
/* | | /* |
* static char *rcsid_gods_c = | | * static char *rcsid_gods_c = |
* "$Id: gods.c,v 1.23 2001/09/20 16:44:37 avogl Exp $"; | | * "$Id: gods.c,v 1.24 2001/09/26 21:34:08 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
*/ | | */ |
bonus = MAX(1, bonus + MAX(pl->stats.luck, -3)); /* -- DAMN -- */ | | bonus = MAX(1, bonus + MAX(pl->stats.luck, -3)); /* -- DAMN -- */ |
| | |
if(((RANDOM()%400)-bonus)<0) god_intervention(pl,pl_god); | | if(((random_roll(0, 399, pl, PREFER_LOW))-bonus)<0) |
| | god_intervention(pl,pl_god); |
| | |
} else { /* praying to another god! */ | | } else { /* praying to another god! */ |
int loss = 0,angry=1; | | int loss = 0,angry=1; |
| | |
*/ | | */ |
if(pl_god->other_arch && (altar->other_arch->name==pl_god->other_arch->name)) { | | if(pl_god->other_arch && (altar->other_arch->name==pl_god->other_arch->name)) { |
angry=2; | | angry=2; |
if((RANDOM()%(SK_level(pl)+3))-5 > 0) { /* you really screwed up */ | | if(random_roll(0, SK_level(pl)+2, pl, PREFER_LOW)-5 > 0) { |
| | /* you really screwed up */ |
angry=3; | | angry=3; |
new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,pl, | | new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,pl, |
"Foul Priest! %s punishes you!",pl_god->name); | | "Foul Priest! %s punishes you!",pl_god->name); |
| | |
* we lose experience from the clerical experience obj */ | | * we lose experience from the clerical experience obj */ |
| | |
loss = 0.1 * (float) pl->chosen_skill->exp_obj->stats.exp; | | loss = 0.1 * (float) pl->chosen_skill->exp_obj->stats.exp; |
if(loss) lose_priest_exp(pl,RANDOM()%(loss*angry)); | | if(loss) |
| | lose_priest_exp(pl, random_roll(0, loss*angry-1, pl, PREFER_LOW)); |
| | |
/* May switch Gods, but its random chance based on our current level | | /* May switch Gods, but its random chance based on our current level |
* note it gets harder to swap gods the higher we get */ | | * note it gets harder to swap gods the higher we get */ |
if((angry==1)&&!(RANDOM()%(pl->chosen_skill->exp_obj->level+1))) { | | if((angry==1) && |
| | !(random_roll(0, pl->chosen_skill->exp_obj->level, pl, |
| | PREFER_LOW))) { |
become_follower(pl,&altar->other_arch->clone); | | become_follower(pl,&altar->other_arch->clone); |
} /* If angry... switching gods */ | | } /* If angry... switching gods */ |
else { /* toss this player off the altar. He can try again. */ | | else { /* toss this player off the altar. He can try again. */ |
| | |
if(op->race&&new_god->slaying&&strstr(op->race,new_god->slaying)) { | | if(op->race&&new_god->slaying&&strstr(op->race,new_god->slaying)) { |
new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,op,"Fool! %s detests your kind!", | | new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,op,"Fool! %s detests your kind!", |
new_god->name); | | new_god->name); |
if(RANDOM()%(op->level)-5>0) | | if(random_roll(0, op->level-1, op, PREFER_LOW)-5>0) |
cast_mana_storm(op,new_god->level+10); | | cast_mana_storm(op,new_god->level+10); |
return; | | return; |
} | | } |
| | |
for (tr = god->randomitems->items; tr != NULL; tr = tr->next) { | | for (tr = god->randomitems->items; tr != NULL; tr = tr->next) { |
object *item; | | object *item; |
| | |
if (tr->chance <= (RANDOM() % 100)) | | if (tr->chance <= random_roll(0, 99, op, PREFER_HIGH)) |
continue; | | continue; |
| | |
/* Treasurelist - generate some treasure for the follower */ | | /* Treasurelist - generate some treasure for the follower */ |
| | |
{ | | { |
if (op->stats.grace >= 0) | | if (op->stats.grace >= 0) |
continue; | | continue; |
op->stats.grace = RANDOM() % 10; | | op->stats.grace = random_roll(0, 9, op, PREFER_HIGH); |
new_draw_info (NDI_UNIQUE, 0, op, | | new_draw_info (NDI_UNIQUE, 0, op, |
"You are returned to a state of grace."); | | "You are returned to a state of grace."); |
return; | | return; |
| | |
{ | | { |
int max = op->stats.maxsp * (item->stats.maxsp / 100.0); | | int max = op->stats.maxsp * (item->stats.maxsp / 100.0); |
/* Restore to 50 .. 100%, if sp < 50% */ | | /* Restore to 50 .. 100%, if sp < 50% */ |
int new_sp = (RANDOM() % 1000 + 1000) / 2000.0 * max; | | int new_sp = random_roll(1000, 1999, op, PREFER_HIGH) / 2000.0 * max; |
if (op->stats.sp >= max / 2) | | if (op->stats.sp >= max / 2) |
continue; | | continue; |
new_draw_info (NDI_UNIQUE, 0, op, "A blue lightning strikes " | | new_draw_info (NDI_UNIQUE, 0, op, "A blue lightning strikes " |
| | |
int angry = abs(reaction); | | int angry = abs(reaction); |
if(op->chosen_skill->exp_obj) | | if(op->chosen_skill->exp_obj) |
loss = 0.05 * (float) op->chosen_skill->exp_obj->stats.exp; | | loss = 0.05 * (float) op->chosen_skill->exp_obj->stats.exp; |
lose_priest_exp(op,RANDOM()%(loss*angry)); | | lose_priest_exp(op, random_roll(0, loss*angry-1, op, PREFER_LOW)); |
if(RANDOM()%(angry+1)) | | if(random_roll(0, angry, op, PREFER_LOW)) |
cast_mana_storm(op,SK_level(op)+(angry*3)); | | cast_mana_storm(op,SK_level(op)+(angry*3)); |
sprintf(buf,"%s becomes angry and punishes you!",god->name); | | sprintf(buf,"%s becomes angry and punishes you!",god->name); |
new_draw_info(NDI_UNIQUE|NDI_NAVY,0,op,buf); | | new_draw_info(NDI_UNIQUE|NDI_NAVY,0,op,buf); |