Friday, February 27, 2009

Java: CharSi Update #21

Apparently there were more bugs and problems with CharSi than I thought. I posted on the Diii.net for anyone who wanted to download the current version of CharSi. It seems more than I thought did, but as a result they found several issues or necessary improvements that need to be addressed to make CharSi much more viable.

A few of the issues were very basic. They ranged from adding "on attack" and "on monster kill" to the CtC section of the rare/magical item generator, correcting the spelling of the unique belt's pathname and switching the "\" characters with "/" characters to support operating systems other than Windows. These were resolved almost instantly and with little fuss.

Other issues were a little more complex but didn't require anything I hadn't already done before. For example adding a tool tip to the Defense JLabel that displays the current blocking percentage or a tool tip to the Character JLabel (in Stats tab) to display the required character level for the equipment worn. These followed the code for the strength/dexterity tool tips almost exactly. The same can be said for the JButton added to the magical/rare generator for adding automods to equipment. This borrowed completely from the JButtons already present for Charges and CtC mods.

However a few of the issues were definitely more involved and required some reorganization of the code to implement. In the Skill calculator a prerequisite can be unchecked while leaving the skill that depends on it with points present. Also I added the feature that when a skill has points added, if it's prerequisites don't already have points then a single one is added. A typical example would be the following:

if(event.getActionCommand().compareTo(FIREBALL) == 0){
fireSpellsArray[3] = Integer.parseInt(levelSelected);
if(fireSpellsArray[1] == 0 && fireSpellsArray[3] > 0)
fireBoltBox.setSelectedIndex(1);
if(fireSpellsArray[3] == 0){
meteorBox.setSelectedIndex(0);
hydraBox.setSelectedIndex(0);
enchantBox.setSelectedIndex(0);
fireBallBox.setSelectedIndex(0);
}
}

When the JComboBox for Fire Ball is utilized a few things must now happen. First the value selected is saved in the appropriate array for damage calculations. Then the first If statement checks that all prerequisites (fire Bolt) have a value greater than one, and if they don't then one point is added. The next If statement checks to ensure that if the value for Fire Ball is set to zero that all skills for which Fire Ball is a prerequisite are also set to zero.

Another option that was added from suggestions made by the Diii.net crowd was in the Stats page. Specifically the GUI portion that controls which difficulty the virtual character is in and which quests are completed needed to be reworked so that these two pieces were independent of each other. Up to this point if the character were in Hell, it was assumed all quests up to that point were completed and therefore the quest rewards already applied. To correct that the JCheckBoxes for the quests were changed to JButtons. When a button is pressed a dialog appears asking how many times the quest is completed. Then depending on the answer the appropriate bonus value is applied to the character. Along with that the JComboBox for difficulty selection had all of the code corresponding to the quest rewards removed, so now all it changes is the difficulty resistance value (0, -40, 100 respectively).

The last major piece that was added was also a suggestion from the Diii.net group. It was mentioned that too much user input is required to equip items with variable stats. So I added the ability to have those values automatically assigned a value. The values I allowed were maximum, minimum and average, along with the normal user input. To allow for this the DetermineRangeValue method in each class file needed to have a few lines of code added.

if(CharSi.userInput)
userInput = Integer.parseInt(JOptionPane.showInputDialog(helmBackPanel, "Choose a value between " + start + " and " + end, modName, JOptionPane.PLAIN_MESSAGE));
if(CharSi.maxValue)
userInput = Integer.parseInt(end);
if(CharSi.avgValue)
userInput = (Integer.parseInt(start) + Integer.parseInt(end))/2;
if(CharSi.minValue)
userInput = Integer.parseInt(start);

The method returns userInput so beyond the alteration to the DetermineRangeValue method nothing else needed to be done. I did set it so the value the user wants is saved from one session of CharSi to another, as I'm sure it would be annoying to have to reset this every time the program is used.

I did make changes based on every suggestion made by the Diii.net forum. I made the changes I could do relatively quickly. There are still some, for instance the option to save a virtual character for loading later on, that are on the To-Do list currently. The ones left are more features than bugs, so I'm leaving them for now and will get back to them later. First I want to add the ability to create any type of charm and then equip it to the virtual character's inventory so that those stats can be counted as well. Once that piece is done I'll make the updates available.

No comments: