version 1.8 | | version 1.9 |
---|
| | |
/* | | /* |
* static char *rcsid_alchemy_c = | | * static char *rcsid_alchemy_c = |
* "$Id: alchemy.c,v 1.8 2001/07/14 04:11:18 mwedel Exp $"; | | * "$Id: alchemy.c,v 1.9 2001/09/26 21:34:08 garbled Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
change_skill(caster,SK_ALCHEMY); | | change_skill(caster,SK_ALCHEMY); |
ability+=SK_level(caster)*((4.0 + cauldron->magic)/4.0); | | ability+=SK_level(caster)*((4.0 + cauldron->magic)/4.0); |
} | | } |
/* Add caster's luck to alcheky skill */ | | |
/* cauldron->magic multiplies luck only half as much as * | | |
* it does Alchemy skill. -- DAMN */ | | |
ability += caster->stats.luck*((8.0 + cauldron->magic)/8.0); | | |
| | |
#ifdef ALCHEMY_DEBUG | | #ifdef ALCHEMY_DEBUG |
LOG(llevDebug,"Got alchemy ability lvl = %d\n",ability); | | LOG(llevDebug,"Got alchemy ability lvl = %d\n",ability); |
| | |
#endif | | #endif |
| | |
/* roll the dice */ | | /* roll the dice */ |
if((float)(RANDOM()%100) <= 100.0 * success_chance) { | | if((float)(random_roll(0, 99, caster, PREFER_LOW)) <= 100.0 * success_chance) { |
/* we learn from our experience IF we know something of the alchemical arts */ | | /* we learn from our experience IF we know something of the alchemical arts */ |
if(caster->chosen_skill&&caster->chosen_skill->stats.sp==SK_ALCHEMY) { | | if(caster->chosen_skill&&caster->chosen_skill->stats.sp==SK_ALCHEMY) { |
/* more exp is given for higher ingred number recipes */ | | /* more exp is given for higher ingred number recipes */ |
| | |
| | |
if(!op || !cauldron) return; | | if(!op || !cauldron) return; |
| | |
if(danger>1) level=RANDOM()%danger+1; | | if(danger>1) level=random_roll(1, danger, op, PREFER_LOW); |
| | |
#ifdef ALCHEMY_DEBUG | | #ifdef ALCHEMY_DEBUG |
LOG(llevDebug,"Alchemy_failure_effect(): using level=%d\n",level); | | LOG(llevDebug,"Alchemy_failure_effect(): using level=%d\n",level); |
| | |
tmp->stats.sp = 0; /* so it can drain stats */ | | tmp->stats.sp = 0; /* so it can drain stats */ |
if(RANDOM()%2) { /* poisonous */ | | if(RANDOM()%2) { /* poisonous */ |
tmp->type=FOOD; | | tmp->type=FOOD; |
tmp->stats.hp=RANDOM()%150; | | tmp->stats.hp=random_roll(0, 149, op, PREFER_LOW); |
} | | } |
} | | } |
| | |
| | |
switch(RANDOM()%3) { | | switch(RANDOM()%3) { |
case 0: | | case 0: |
tmp=get_archetype("bomb"); | | tmp=get_archetype("bomb"); |
tmp->stats.dam=RANDOM()%level+1; | | tmp->stats.dam=random_roll(1, level, op, PREFER_LOW); |
tmp->stats.hp=RANDOM()%level+1; | | tmp->stats.hp=random_roll(1, level, op, PREFER_LOW); |
new_draw_info_format(NDI_UNIQUE,0,op,"The %s creates a bomb!", | | new_draw_info_format(NDI_UNIQUE,0,op,"The %s creates a bomb!", |
cauldron->name); | | cauldron->name); |
break; | | break; |
default: | | default: |
tmp=get_archetype("fireball"); | | tmp=get_archetype("fireball"); |
tmp->stats.dam=(RANDOM()%level+1)/5+1; | | tmp->stats.dam=random_roll(1, level, op, PREFER_LOW)/5+1; |
tmp->stats.hp=(RANDOM()%level+1)/10+2; | | tmp->stats.hp=random_roll(1, level, op, PREFER_LOW)/10+2; |
new_draw_info_format(NDI_UNIQUE,0,op,"The %s erupts in flame!", | | new_draw_info_format(NDI_UNIQUE,0,op,"The %s erupts in flame!", |
cauldron->name); | | cauldron->name); |
break; | | break; |
| | |
if(!QUERY_FLAG(cauldron,FLAG_CURSED)) | | if(!QUERY_FLAG(cauldron,FLAG_CURSED)) |
SET_FLAG(cauldron,FLAG_CURSED); | | SET_FLAG(cauldron,FLAG_CURSED); |
else cauldron->magic--; | | else cauldron->magic--; |
cauldron->magic -= RANDOM()%5; | | cauldron->magic -= random_roll(0, 4, op, PREFER_LOW); |
if(RANDOM()%2) { | | if(RANDOM()%2) { |
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, |
| | |
remove_contents(cauldron->inv,NULL); | | remove_contents(cauldron->inv,NULL); |
if(!tmp) | | if(!tmp) |
alchemy_failure_effect(op,cauldron,rp,level); | | alchemy_failure_effect(op,cauldron,rp,level); |
else if(summon_hostile_monsters(cauldron,RANDOM()%10+1,tmp->arch->name)) | | else if(summon_hostile_monsters(cauldron, |
| | random_roll(1, 10, op, PREFER_LOW), tmp->arch->name)) |
new_draw_info_format(NDI_UNIQUE, 0,op, | | new_draw_info_format(NDI_UNIQUE, 0,op, |
"The %s %s and then pours forth monsters!", | | "The %s %s and then pours forth monsters!", |
cauldron->name,cauldron_sound()); | | cauldron->name,cauldron_sound()); |
| | |
* formulalist) */ | | * formulalist) */ |
if(!rp) rp=get_random_recipe((recipelist *) NULL); | | if(!rp) rp=get_random_recipe((recipelist *) NULL); |
if(rp && (tmp=get_archetype(rp->arch_name))) { | | if(rp && (tmp=get_archetype(rp->arch_name))) { |
generate_artifact(tmp,RANDOM()%((op->level/2)+2)+2); | | generate_artifact(tmp,random_roll(1, op->level/2+1, op, PREFER_HIGH)+1); |
if((tmp=insert_ob_in_ob(tmp,cauldron))) { | | if((tmp=insert_ob_in_ob(tmp,cauldron))) { |
remove_contents(cauldron->inv,tmp); | | remove_contents(cauldron->inv,tmp); |
new_draw_info_format(NDI_UNIQUE, 0,op, | | new_draw_info_format(NDI_UNIQUE, 0,op, |