version 1.116 | | version 1.117 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.116 2004/04/07 06:49:38 mwedel Exp $"; | | * "$Id: spell_effect.c,v 1.117 2004/04/25 07:17:40 mwedel Exp $"; |
*/ | | */ |
| | |
| | |
| | |
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) |
{ | | { |
int value=query_cost(obj, NULL, F_TRUE); | | uint64 value=query_cost(obj, NULL, F_TRUE); |
| | |
/* Give third price when we alchemy money (This should hopefully | | /* Give third price when we alchemy money (This should hopefully |
* make it so that it isn't worth it to alchemy money, sell | | * make it so that it isn't worth it to alchemy money, sell |
| | |
value *= 0.9; | | value *= 0.9; |
| | |
if ((obj->value>0) && rndm(0, 29)) { | | if ((obj->value>0) && rndm(0, 29)) { |
static int value_store; | | |
int count; | | int count; |
| | |
value_store += value; | | count = value / large->value; |
count = value_store / large->value; | | |
*large_nuggets += count; | | *large_nuggets += count; |
value_store -= count * large->value; | | value -= (uint64)count * (uint64)large->value; |
count = value_store / small->value; | | count = value / small->value; |
*small_nuggets += count; | | *small_nuggets += count; |
value_store -= count * small->value; | | |
/* LOG(llevDebug, "alchemize value %d, remainder %d\n", value, value_store); */ | | |
} | | } |
| | |
/* Turn 25 small nuggets into 1 large nugget. If the value | | /* Turn 25 small nuggets into 1 large nugget. If the value |