version 1.9 | | version 1.10 |
---|
| | |
/* | | /* |
* static char *rcsid_alchemy_c = | | * static char *rcsid_alchemy_c = |
* "$Id: alchemy.c,v 1.9 2001/09/26 21:34:08 garbled Exp $"; | | * "$Id: alchemy.c,v 1.10 2001/10/15 21:12:08 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
char * cauldron_sound ( void ) { | | char * cauldron_sound ( void ) { |
int size=sizeof(cauldron_effect)/sizeof(char *); | | int size=sizeof(cauldron_effect)/sizeof(char *); |
| | |
return cauldron_effect[RANDOM()%size]; | | return cauldron_effect[rndm(0, size-1)]; |
} | | } |
| | |
/* attempt_do_alchemy() - Main part of the ALCHEMY code. From this we call fctns | | /* attempt_do_alchemy() - Main part of the ALCHEMY code. From this we call fctns |
| | |
if(lvl<=0) lvl = 1; /* lets avoid div by zero! */ | | if(lvl<=0) lvl = 1; /* lets avoid div by zero! */ |
if(item->nrof) { | | if(item->nrof) { |
/* nrof = (RANDOM() % yield + RANDOM() % yield + RANDOM() % yield)/ 3 + 1;*/ | | /* nrof = (RANDOM() % yield + RANDOM() % yield + RANDOM() % yield)/ 3 + 1;*/ |
nrof = ( 1.0 - 1.0/(lvl/10.0 + 1.0)) * (RANDOM() % yield + RANDOM() % yield + RANDOM() % yield) + 1; | | nrof = ( 1.0 - 1.0/(lvl/10.0 + 1.0)) * (rndm(0, yield-1) + rndm(0, yield-1) + rndm(0, yield-1)) + 1; |
if(nrof > yield) nrof = yield; | | if(nrof > yield) nrof = yield; |
item->nrof=nrof; | | item->nrof=nrof; |
} | | } |
| | |
if(level<25) { /* INGREDIENTS USED/SLAGGED */ | | if(level<25) { /* INGREDIENTS USED/SLAGGED */ |
object *item=NULL; | | object *item=NULL; |
| | |
if(RANDOM()%3) { /* slag created */ | | if(rndm(0, 2)) { /* slag created */ |
object *tmp=cauldron->inv; | | object *tmp=cauldron->inv; |
int weight=0; | | int weight=0; |
uint16 material=M_STONE; | | uint16 material=M_STONE; |
| | |
| | |
/* special stuff for consumables */ | | /* special stuff for consumables */ |
if(tmp->type==POTION||tmp->type==FOOD) { | | if(tmp->type==POTION||tmp->type==FOOD) { |
if(tmp->stats.sp&&RANDOM()%2) /* drains magic */ | | if(tmp->stats.sp && rndm(0 ,1)) /* drains magic */ |
tmp->stats.sp = SP_REGENERATE_SPELLPOINTS; | | tmp->stats.sp = SP_REGENERATE_SPELLPOINTS; |
else | | else |
tmp->stats.sp = 0; /* so it can drain stats */ | | tmp->stats.sp = 0; /* so it can drain stats */ |
if(RANDOM()%2) { /* poisonous */ | | if(rndm(0, 1)) { /* poisonous */ |
tmp->type=FOOD; | | tmp->type=FOOD; |
tmp->stats.hp=random_roll(0, 149, op, PREFER_LOW); | | tmp->stats.hp=random_roll(0, 149, op, PREFER_LOW); |
} | | } |
| | |
| | |
/* change stats downward */ | | /* change stats downward */ |
do { | | do { |
change_attr_value(&tmp->stats,RANDOM()%7,-1*(RANDOM()%3+1)); | | change_attr_value(&tmp->stats,rndm(0, 6),-1*(rndm(1, 3))); |
} while (RANDOM()%3); | | } while (rndm(0, 2)); |
} | | } |
return; | | return; |
| | |
| | |
else if (level<50) { /* MINOR EXPLOSION/FIREBALL */ | | else if (level<50) { /* MINOR EXPLOSION/FIREBALL */ |
object *tmp; | | object *tmp; |
remove_contents(cauldron->inv,NULL); | | remove_contents(cauldron->inv,NULL); |
switch(RANDOM()%3) { | | switch(rndm(0, 2)) { |
case 0: | | case 0: |
tmp=get_archetype("bomb"); | | tmp=get_archetype("bomb"); |
tmp->stats.dam=random_roll(1, level, op, PREFER_LOW); | | tmp->stats.dam=random_roll(1, level, op, PREFER_LOW); |
| | |
SET_FLAG(cauldron,FLAG_CURSED); | | SET_FLAG(cauldron,FLAG_CURSED); |
else cauldron->magic--; | | else cauldron->magic--; |
cauldron->magic -= random_roll(0, 4, op, PREFER_LOW); | | cauldron->magic -= random_roll(0, 4, op, PREFER_LOW); |
if(RANDOM()%2) { | | if(rndm(0, 1)) { |
remove_contents(cauldron->inv,NULL); | | remove_contents(cauldron->inv,NULL); |
new_draw_info_format(NDI_UNIQUE,0,op, | | new_draw_info_format(NDI_UNIQUE,0,op, |
"Your %s turns darker then makes a gulping sound!", | | "Your %s turns darker then makes a gulping sound!", |
| | |
return; | | return; |
| | |
} else if (level<150) { /* COMBO EFFECT */ | | } else if (level<150) { /* COMBO EFFECT */ |
int roll = RANDOM()%3+1; | | int roll = rndm(1, 3); |
while(roll) { | | while(roll) { |
alchemy_failure_effect(op,cauldron,rp,level-39); | | alchemy_failure_effect(op,cauldron,rp,level-39); |
roll--; | | roll--; |