version 1.150 | | version 1.151 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.150 2006/03/18 15:05:37 ryo_saeba Exp $"; | | * "$Id: spell_effect.c,v 1.151 2006/03/22 09:29:05 akirschbaum Exp $"; |
*/ | | */ |
| | |
| | |
| | |
* is finished. | | * is finished. |
*/ | | */ |
static object *small, *large; | | static object *small, *large; |
| | static uint64 small_value, large_value; |
| | |
static void alchemy_object(object *obj, int *small_nuggets, | | static void alchemy_object(object *obj, int *small_nuggets, |
int *large_nuggets, int *weight) | | int *large_nuggets, int *weight) |
| | |
if ((obj->value>0) && rndm(0, 29)) { | | if ((obj->value>0) && rndm(0, 29)) { |
int count; | | int count; |
| | |
count = value / large->value; | | count = value / large_value; |
*large_nuggets += count; | | *large_nuggets += count; |
value -= (uint64)count * (uint64)large->value; | | value -= (uint64)count * large_value; |
count = value / small->value; | | count = value / small_value; |
*small_nuggets += count; | | *small_nuggets += count; |
} | | } |
| | |
| | |
* of large nuggets is not evenly divisable by the small nugget | | * of large nuggets is not evenly divisable by the small nugget |
* value, take off an extra small_nugget (Assuming small_nuggets!=0) | | * value, take off an extra small_nugget (Assuming small_nuggets!=0) |
*/ | | */ |
if (*small_nuggets * small->value >= large->value) { | | if (*small_nuggets * small_value >= large_value) { |
(*large_nuggets)++; | | (*large_nuggets)++; |
*small_nuggets -= large->value / small->value; | | *small_nuggets -= large_value / small_value; |
if (*small_nuggets && large->value % small->value) | | if (*small_nuggets && large_value % small_value) |
(*small_nuggets)--; | | (*small_nuggets)--; |
} | | } |
weight += obj->weight; | | weight += obj->weight; |
| | |
weight_max *= 1000; | | weight_max *= 1000; |
small=get_archetype("smallnugget"), | | small=get_archetype("smallnugget"), |
large=get_archetype("largenugget"); | | large=get_archetype("largenugget"); |
| | small_value = query_cost(small, NULL, F_TRUE); |
| | large_value = query_cost(large, NULL, F_TRUE); |
| | |
for(y= op->y-1;y<=op->y+1;y++) { | | for(y= op->y-1;y<=op->y+1;y++) { |
for(x= op->x-1;x<=op->x+1;x++) { | | for(x= op->x-1;x<=op->x+1;x++) { |