Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: Alchemy and costs of generated items




Hi there!

Since several people on this list mentioned that the alchemy code was
not so useful and that it was not worth spending some time finding the
items that are required by most formulas, I wrote some code to compare
the value of the generated item with the value of the ingredients.
This code is only useful for debugging, not for playing.

Although the code is not perfect yet (there are still a few formulas
for which it cannot find the value of some ingredients), I could
already find some errors in the formulas (e.g. a formula requiring "20
arrows" instead of "20 arrow").

Here is how it works: for each formula, it finds the value of the
generated item, i.e. the price you would have to pay if you had to buy
it in a shop.  Then it does the same for all ingredients.  This is the
tricky part, since the name of each ingredient can match an archetype
("diamond", "potion of wisdom"), an artifact ("potion of firestorm",
"water of ruby") or some monster's bodyparts ("madman's head",
"electric dragon's steak").  Finally it prints the total costs of the
ingredients and compares it with the cost of the generated item.

If the formula can generate more than one item, then the cost of a
single item is multiplied by (formula.yield + 1) / 2, in order to get
an average value for the results of the formula.

I think that a formula is useful if the result is worth 2 to 10 times
the sum of all ingredients.  I would like some comments on this...

      value of result * (nrof + 1) / 2
r =  ----------------------------------
        total value of ingredients

      r <  1  ingredients are much too expensive - bad formula
 1 <= r <  2  ingredients are too expensive, but acceptable
 2 <= r < 10  good formula
10 <= r       ingredients are too cheap - bad formula

There are two things that I would like to improve:
- Take the number of ingredients into account and lower the value of
  "r" as this number increases, since the risks of failure increase too.
  Dividing "r" by the number of ingredients (or its square root) is a
  bit excessive.  Other ideas?
- Try to be more realistic about the value of some monster's body parts.
  Their value should be increased if they have a low probability of
  appearing.  For example, getting a sage's head is not easy, even if
  the sages have a low level.

-Raphael

[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]


Follow-Ups: