version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_gods_c = | | * static char *rcsid_gods_c = |
* "$Id: gods.c,v 1.5 2000/04/14 04:48:19 cvs Exp $"; | | * "$Id: gods.c,v 1.6 2000/04/27 07:35:01 cvs Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
void pray_at_altar(object *pl, object *altar) { | | void pray_at_altar(object *pl, object *altar) { |
object *pl_god=find_god(determine_god(pl)); | | object *pl_god=find_god(determine_god(pl)); |
| | |
| | |
#ifdef MULTIPLE_GODS | | #ifdef MULTIPLE_GODS |
| | /* If non consecrate altar, don't do anything */ |
| | if (!altar->other_arch) return; |
| | |
/* hmm. what happend depends on pl's current god, level, etc */ | | /* hmm. what happend depends on pl's current god, level, etc */ |
if(!pl_god) { /*new convert */ | | if(!pl_god) { /*new convert */ |
become_follower(pl,altar->title); | | become_follower(pl,&altar->other_arch->clone); |
return; | | return; |
| | |
} else if(!strcmp(pl_god->name,altar->title)) { /* pray at your gods altar */ | | } else if(!strcmp(pl_god->name,altar->other_arch->clone.name)) { /* pray at your gods altar */ |
int bonus = ((pl->stats.Wis/10)+(SK_level(pl)/10)); | | int bonus = ((pl->stats.Wis/10)+(SK_level(pl)/10)); |
| | |
/* we can get neg grace up faster */ | | /* we can get neg grace up faster */ |
| | |
/* we can super-charge grace to 2x max */ | | /* we can super-charge grace to 2x max */ |
if(pl->stats.grace<(2*pl->stats.maxgrace)) { | | if(pl->stats.grace<(2*pl->stats.maxgrace)) { |
pl->stats.grace+=bonus/2; | | pl->stats.grace+=bonus/2; |
| | } |
| | /* I think there was a bug here in that this was nested |
| | * in the if immediately above |
| | */ |
if(pl->stats.grace>(2*pl->stats.maxgrace)) { | | if(pl->stats.grace>(2*pl->stats.maxgrace)) { |
pl->stats.grace=(2*pl->stats.maxgrace); | | pl->stats.grace=(2*pl->stats.maxgrace); |
} | | } |
} | | |
| | |
/* Every once in a while, the god decides to checkup on their | | /* Every once in a while, the god decides to checkup on their |
* follower, and may intervene to help them out. */ | | * follower, and may intervene to help them out. |
| | */ |
bonus += pl->stats.luck; /* -- DAMN -- */ | | bonus += pl->stats.luck; /* -- DAMN -- */ |
if((RANDOM()%500-bonus)<0) god_intervention(pl,pl_god); | | if((RANDOM()%500-bonus)<0) god_intervention(pl,pl_god); |
| | |
} else if(altar->title) { /* praying to another god! */ | | } else { /* praying to another god! */ |
int loss = 0,angry=1; | | int loss = 0,angry=1; |
object *alt_god=find_god(altar->title); | | |
| | |
if(alt_god&&(!strcmp(alt_god->name,pl_god->name))) { /* Youch, praying to an enemy god! */ | | /* I believe the logic for detecting opposing gods was completely |
| | * broken - I think it should work now. altar->other_arch |
| | * points to the god of this altar (which we have |
| | * already verified is non null). pl_god->other_arch |
| | * is the opposing god - we need to verify that exists before |
| | * using its values. |
| | */ |
| | 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()%(SK_level(pl)+3))-5 > 0) { /* you really screwed up */ |
angry=3; | | angry=3; |
| | |
if((angry==1)&&!(RANDOM()%(pl->chosen_skill->exp_obj->level+1))) { | | if((angry==1)&&!(RANDOM()%(pl->chosen_skill->exp_obj->level+1))) { |
int i; /* index over known_spells */ | | int i; /* index over known_spells */ |
int sp; /* spell index */ | | int sp; /* spell index */ |
become_follower(pl,altar->title); | | |
| | become_follower(pl,&altar->other_arch->clone); |
| | |
/* Forget all the special spells from your former God */ | | /* Forget all the special spells from your former God */ |
for(i=0;i<pl->contr->nrofknownspells;i++) | | for(i=0;i<pl->contr->nrofknownspells;i++) |
| | /* Can this ever be false? */ |
if((sp=pl->contr->known_spells[i])>0) { | | if((sp=pl->contr->known_spells[i])>0) { |
if(spells[sp].cleric && spells[sp].books == 0) { | | if(spells[sp].cleric && spells[sp].books == 0) { |
pl->contr->nrofknownspells--; | | pl->contr->nrofknownspells--; |
| | |
pl->contr->known_spells[pl->contr->nrofknownspells]; | | pl->contr->known_spells[pl->contr->nrofknownspells]; |
new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,pl, | | new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,pl, |
"You lose your knowledge of %s!",spells[sp].name); | | "You lose your knowledge of %s!",spells[sp].name); |
| | /* I think we can just do an i-- here and still |
| | * have it work - i=0 is probably excessive */ |
i=0; | | i=0; |
} | | |
} | | |
| | |
} | | } /* if cleric spell not normally found */ |
} | | } /* if ... */ |
#endif | | |
| | |
| | } /* If angry... switching gods */ |
| | } /* If prayed at altar to other god */ |
| | #endif |
} | | } |
| | |
void become_follower (object *op, char *godname) { | | void become_follower (object *op, object *new_god) { |
object *exp_obj = op->chosen_skill->exp_obj; | | object *exp_obj = op->chosen_skill->exp_obj; |
object *new_god = find_god(godname); | | |
| | |
if(!op||!new_god) return; | | if(!op||!new_god) return; |
| | |
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!",godname); | | new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,op,"Fool! %s detests your kind!", |
| | new_god->name); |
if(RANDOM()%(op->level)-5>0) | | if(RANDOM()%(op->level)-5>0) |
cast_mana_storm(op,new_god->level+10); | | cast_mana_storm(op,new_god->level+10); |
return; | | return; |
| | |
| | |
new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,op, | | new_draw_info_format(NDI_UNIQUE|NDI_NAVY,0,op, |
"You become a follower of %s!",new_god->name); | | "You become a follower of %s!",new_god->name); |
| | |
if(exp_obj->title) { /* get rid of old god */ | | if(exp_obj->title) { /* get rid of old god */ |
new_draw_info_format(NDI_UNIQUE,0,op, | | new_draw_info_format(NDI_UNIQUE,0,op, |
"%s's blessing is withdrawn from you.",exp_obj->title); | | "%s's blessing is withdrawn from you.",exp_obj->title); |
| | |
| | |
SET_FLAG(exp_obj,FLAG_APPLIED); | | SET_FLAG(exp_obj,FLAG_APPLIED); |
(void) change_abil(op,exp_obj); | | (void) change_abil(op,exp_obj); |
| | |
} | | } |
| | |
int worship_forbids_use (object *op, object *exp_obj, uint32 flag, char *string) { | | int worship_forbids_use (object *op, object *exp_obj, uint32 flag, char *string) { |