PDA

View Full Version : Stat growth algorithm in java?



Stregone
04-20-2004, 02:18 PM
I'm writing up a java character trainer, and have gotten a basic console interface version finished that does simple stat growth calculation. Unfortunatly the algorithm I'm using just isn't working (stats grow WAY too slow).

The stats are stored in an array, the first index is which stat, starting with con at 0, and aura at 9, the second index is the level, from 0-100.

This is the algorithm I have(that isn't working right).


// s = which stat it is (con, str, ...)
public void calcStat(int s){
for (int lvl = 1; lvl <= 100; lvl++){
if ((stat[s][lvl - 1] / growthInterval[s]) % lvl == 0) {
stat[s][lvl] = stat[s][lvl - 1] + 1;
}
else{
stat[s][lvl] = stat[s][lvl - 1];
}
}
}


Oh yeah, I'm posting here because I don't play GS anymore. I always wanted to write a trainer program because I always had to pirate MS office to use the trainer spreadsheet. Now I can write one, and I need to keep programming so I don't get rusty :)

imported_Kranar
04-20-2004, 10:14 PM
You want to do this

lvl % ((stat[s][lvl - 1] / growthInterval[s]) == 0

Not the other way around.

Anyways, AIM me still.

Stregone
04-20-2004, 11:09 PM
Sweet, that worked. Thanks!

http://www.student.nvcc.edu/home/mappleman/gs4trainer.jar

Run it by opening a console and moving to where the file is and typing "java -jar gs4trainer.jar" or pasting that into a batch file in the same folder (and run the batch file).

It asks for a name, race, profession, then starting stats. After that it spits out a txt file with all 100 levels of stats.