View Single Post
Old 08-25-2008, 11:15 AM   #8 (permalink)
slitz
euro scum
 
slitz's Avatar
 
Join Date: Aug 2002
Location: Sweden
Posts: 819
-9 Internets
Yeah that's one way to do it, but it wasn't what I was talking about.
Basically, you've made the formula itself static while keeping the variables changable. What I'm talking about is making the formula itself changable.

Lets use a very simple example:

Code:
public double getPrice(double rarity, int durability, Material material){ return (rarity*durability)/material.getPrice(); }
Now what I've done here is hardcoded the formula. No matter what I do the price will always be rarity*durability/material.getPrice();
In some cases this will never ever change, but in other cases it might! (combat formulas etc)

Code:
public double getPrice(Formula formula, Item item){ // parsing logics here which apply formula with item variables }
Now all of a sudden I can change the formula of a item at runtime, as long as I have a functioning evalutor (which isn't hard to do). Meaning, I can even read the formula from a XML file / database.
Note this is rather complex way of doing it if you ask me, so it shouldn't be used if you only need one formula for combat/item values/item droprate/whatever, but if you're looking for a bigger project I think that it sounds like a good idea in theory at least 8).
__________________
slitz is offline   Reply With Quote

 
Uberguilds Network