Wednesday, December 5, 2007

Java: DII Character Simulator Update #4

The rest of the groundwork for the application was completed with the addition of listeners to each and every JButton, JComboBox and JCheckBox. The equipment tabs were fairly simply due to how similar they are, the code was written for one and then copied to each other class file with only minor adjustments required. These listeners don't do anything yet as the methods that govern the program aren't written, but that is all that is required code-wise for this section.

As for the final stats tab, more than just listeners were added. Along with finishing up any needed listeners the entire page was reworked, specifically the skill display panel was removed. I decided that it was going to be a duplication of work as that same information would be available in the skill calculator tab, so doing it twice was unnecessary. Also, the layout of the final stats panel was a bit crowded, and this freed up the needed space.

Some functionality was added to the buttons and fields of this tab as well. Specifically:

Stat Points panel
  • Plus button has check to ensure points can't be added if no points available
  • Minus button has check to ensure points can't be removed if the base value is displayed
  • Points to Vitality increase the displayed life value
  • Points to Energy increase the displayed mana value

Button panel
  • Character name changed depending on which character type selected in the skills tab
  • Change in Difficulty Finished JComboBox increases the stat points remaining and resistance values
  • Change in character level JComboBox changes remaining stat point value as well as mana/life values

Mods of Note panel
  • The Blocking field was moved to this panel from the Damage/AR panel

Damage/AR panel
  • Blocking was removed
  • Attack rating and Damage fields for Undead and Demon were added

In order to track changes to mods, life, mana and resistances a trio of arrays were created that would hold any additions to these values.

static int[] resistance = {0, 0, 0, 0};
static int[] stats = {0, 0, 0, 0, 0, 0};
static int[] modsOfNote = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

These arrays will be present in each equipment class as well as the final stat class. When an action is taken that could possibly add to any of these values, whether it be adding a vitality point to a piece of equipment, the values of these arrays are summed and the result displayed in the appropriate JTextField.

The only fields that aren't attached to any methods or listeners at this time are the Damage/AR and Misc Mods panels. I'm going to wait until the rest of the program is in place before getting these panels working. This means the next step is to finish the Skill Calculator tab by locating the necessary equations for calculating the skill values and implement a way to view skill bonuses in that tab.

No comments: