diff --git a/src/com/bytezone/diskbrowser/wizardry/Character.java b/src/com/bytezone/diskbrowser/wizardry/Character.java index d34ced3..de3562f 100644 --- a/src/com/bytezone/diskbrowser/wizardry/Character.java +++ b/src/com/bytezone/diskbrowser/wizardry/Character.java @@ -7,6 +7,9 @@ import com.bytezone.diskbrowser.utilities.Utility; public abstract class Character extends AbstractFile // -----------------------------------------------------------------------------------// { + static int MAGE_SPELLS = 0; + static int PRIEST_SPELLS = 1; + static String[] races = { "No race", "Human", "Elf", "Dwarf", "Gnome", "Hobbit" }; static String[] alignments = { "Unalign", "Good", "Neutral", "Evil" }; static String[] types = @@ -78,6 +81,12 @@ public abstract class Character extends AbstractFile protected void checkKnownSpells (byte[] buffer, int ptr) // ---------------------------------------------------------------------------------// { + for (int i = 0; i < 7; i++) + { + spellAllowance[MAGE_SPELLS][i] = Utility.getShort (buffer, ptr + 8 + i * 2); + spellAllowance[PRIEST_SPELLS][i] = Utility.getShort (buffer, ptr + 22 + i * 2); + } + int bit = 1; // skip first bit int val = buffer[ptr]; mysteryBit = (val & 0x01) == 1; diff --git a/src/com/bytezone/diskbrowser/wizardry/CharacterV1.java b/src/com/bytezone/diskbrowser/wizardry/CharacterV1.java index a0d6d7e..46ef1a4 100755 --- a/src/com/bytezone/diskbrowser/wizardry/CharacterV1.java +++ b/src/com/bytezone/diskbrowser/wizardry/CharacterV1.java @@ -24,8 +24,8 @@ class CharacterV1 extends Character public int ageInWeeks; public int assetValue; - int[] mageSpells = new int[7]; - int[] priestSpells = new int[7]; + // int[] mageSpells = new int[7]; + // int[] priestSpells = new int[7]; private final List spellBook = new ArrayList<> (); private final List possessions = new ArrayList<> (); @@ -80,12 +80,6 @@ class CharacterV1 extends Character checkKnownSpells (buffer, 138); - for (int i = 0; i < 7; i++) - mageSpells[i] = buffer[146 + i * 2]; - - for (int i = 0; i < 7; i++) - priestSpells[i] = buffer[160 + i * 2]; - armourClass = buffer[176]; } @@ -141,12 +135,12 @@ class CharacterV1 extends Character text.append ("\nLuck ............... " + attributes[5]); text.append ("\n\nMage spell points .."); - for (int i = 0; i < mageSpells.length; i++) - text.append (" " + mageSpells[i]); + for (int i = 0; i < spellAllowance[MAGE_SPELLS].length; i++) + text.append (" " + spellAllowance[MAGE_SPELLS][i]); text.append ("\nPriest spell points "); - for (int i = 0; i < priestSpells.length; i++) - text.append (" " + priestSpells[i]); + for (int i = 0; i < spellAllowance[PRIEST_SPELLS].length; i++) + text.append (" " + spellAllowance[PRIEST_SPELLS][i]); text.append ("\n\nSpells :"); for (Spell s : spellBook) diff --git a/src/com/bytezone/diskbrowser/wizardry/CharacterV4.java b/src/com/bytezone/diskbrowser/wizardry/CharacterV4.java index 84e7f13..ec0c63c 100644 --- a/src/com/bytezone/diskbrowser/wizardry/CharacterV4.java +++ b/src/com/bytezone/diskbrowser/wizardry/CharacterV4.java @@ -99,12 +99,6 @@ public class CharacterV4 extends Character checkKnownSpells (buffer, 139); - for (int i = 0; i < 7; i++) - { - spellAllowance[MAGE_SPELLS][i] = Utility.getShort (buffer, 147 + i * 2); - spellAllowance[PRIEST_SPELLS][i] = Utility.getShort (buffer, 161 + i * 2); - } - hpCalCmd = Utility.getSignedShort (buffer, 175); // armourClass = Utility.getSignedShort (buffer, 177); // see offset 39 healPts = Utility.getShort (buffer, 179);