Wednesday, January 7, 2009

Java: CharSi Update #15

Not done by any stretch of the imagination, but enough was completed to warrant an update. First thing on the agenda was to alter the GUI component so that it could better display the needed information. First off I removed the damage/AR to demons and undead components. While I still intend to provide that information, I think I'll do it as a ToolTip rather than in the GUI component itself, since that information is a tad less important.

In its place I've included damage and attack rating fields for the off-hand weapon, assassin kicking, paladin smiting and throwing of the primary weapon. So now that they are present, I have to determine how to populate data into each of these components. First step was to create a int array to hold the attack rating information. Then I needed the equation that determines what the true attack rating should be. This I found on the Amazon Basin when I was browsing it as the DIII forums were down for "maintenance". I created a method that would combine all of the mods associated with attack rating into one equation and then populate the attack rating int array appropriately. Adding the necessary JTextField.setText calls for the attack rating fields in the overall SetAll method means whenever anything is changed, these values will be updated.

Doing the same for the damage fields fell along the same lines, but there were quite a few more pieces to work together. First off the necessary equations were found in the Strategy Compendium. All of the needed mods were already summed up under other methods in the Stats class, so I simply plugged them into the equation inside of a new method and called this method when the SetAll method is run. Granted there were a few pieces that needed extra attention before this could be considered a success.

First I had to decide how to handle the StatsBonus variable. Each of the item descriptions contains the base item as its second line, all except the white items that is. So once I added this descriptor to all the white item text files I was able to save this information into its own variable. This variable was then compared to an array of Strings to determine if the chosen item falls into any of the special categories.

String[] hammers = {WARHAM, MAUL, GREATMAUL, BATHAM, WARCLUB, MARTEL, LEGMALL, OGREMAUL, THUMAUL};

for(int i = 0; i <>
if(hammers[i].compareTo(base) == 0){
hammer = true;
break;
}
}

If there is a match then a boolean variable is set to true, for use later.

if(hammer)
statBonus = (float)(1.10*(baseStats[0] + stats[0] + userStats[0]))/100;

With that variable determined I now only have the Modifier variable to deal with. This one is modified depending on what type of skill is being used. As a result I'm leaving this one until later as I have quite a few other pieces that need to be connected between the Skills class and Stats class that I'd like to handle all at once. However the damage panel does display a Normal attack without difficulties now.

Last but not least I did create the necessary methods to sum the +skill mods from the equipment worn by the virtual character. This information is then transferred over to the appropriate Skills sub class so that now the Skill Calculator can display values greater than level 20. It now accurately shows what level the character's skills will be at for the equipment worn.

However I'm not done yet. There is quite a bit of information that still needs to be attached between the Skills, Stats and Equipment classes. For example the auras used by the Paladin aren't considered for defense, attack speed, resistance or anything similar in the Stats panel. Correspondingly the mods given by equipment for +elemental damage aren't considered in the Skills panel information. So the next step is to finish attaching all of the different pieces behind the scenes until I have accounted for everything possible in all three JPanels.

No comments: