mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-11-28 20:50:13 +00:00
tidying
This commit is contained in:
parent
848b2469ae
commit
d71cabb754
@ -24,6 +24,9 @@ class CharacterV1 extends Character
|
||||
public int ageInWeeks;
|
||||
public int assetValue;
|
||||
|
||||
int[] mageSpells = new int[7];
|
||||
int[] priestSpells = new int[7];
|
||||
|
||||
private final List<Spell> spellBook = new ArrayList<> ();
|
||||
private final List<Possession> possessions = new ArrayList<> ();
|
||||
|
||||
@ -75,11 +78,18 @@ class CharacterV1 extends Character
|
||||
hpLeft = Utility.getShort (buffer, 134);
|
||||
hpMax = Utility.getShort (buffer, 136);
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public void linkItems (List<ItemV1> itemList)
|
||||
public void link (List<ItemV1> itemList, List<Spell> spellList,
|
||||
List<ExperienceLevel> experienceLevels)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
for (Possession baggage : possessions)
|
||||
@ -87,12 +97,7 @@ class CharacterV1 extends Character
|
||||
baggage.item = itemList.get (baggage.itemId);
|
||||
assetValue += baggage.item.getCost ();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public void linkSpells (List<Spell> spellList)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int index = 0;
|
||||
for (int i = 138; i < 145; i++)
|
||||
for (int bit = 0; bit < 8; bit++)
|
||||
@ -103,6 +108,8 @@ class CharacterV1 extends Character
|
||||
if (++index >= spellList.size ())
|
||||
break;
|
||||
}
|
||||
|
||||
nextLevel = experienceLevels.get (typeInt).getExperiencePoints (characterLevel + 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
@ -112,8 +119,8 @@ class CharacterV1 extends Character
|
||||
{
|
||||
StringBuilder text = new StringBuilder ();
|
||||
|
||||
text.append ("Character name ..... " + getName ());
|
||||
text.append ("\n\nRace ............... " + race);
|
||||
text.append (String.format ("Character name ..... %s%n", getName ()));
|
||||
text.append ("\nRace ............... " + race);
|
||||
text.append ("\nType ............... " + type);
|
||||
text.append ("\nAlignment .......... " + alignment);
|
||||
text.append ("\nStatus ............. " + status);
|
||||
@ -138,15 +145,13 @@ class CharacterV1 extends Character
|
||||
text.append ("\nAgility ............ " + attributes[4]);
|
||||
text.append ("\nLuck ............... " + attributes[5]);
|
||||
|
||||
int[] spellPoints = getMageSpellPoints ();
|
||||
text.append ("\n\nMage spell points ..");
|
||||
for (int i = 0; i < spellPoints.length; i++)
|
||||
text.append (" " + spellPoints[i]);
|
||||
for (int i = 0; i < mageSpells.length; i++)
|
||||
text.append (" " + mageSpells[i]);
|
||||
|
||||
spellPoints = getPriestSpellPoints ();
|
||||
text.append ("\nPriest spell points ");
|
||||
for (int i = 0; i < spellPoints.length; i++)
|
||||
text.append (" " + spellPoints[i]);
|
||||
for (int i = 0; i < priestSpells.length; i++)
|
||||
text.append (" " + priestSpells[i]);
|
||||
|
||||
text.append ("\n\nSpells :");
|
||||
for (Spell s : spellBook)
|
||||
@ -159,37 +164,6 @@ class CharacterV1 extends Character
|
||||
return text.toString ();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public void linkExperience (ExperienceLevel exp)
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
nextLevel = exp.getExperiencePoints (characterLevel);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public int[] getMageSpellPoints ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int[] spells = new int[7];
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
spells[i] = buffer[146 + i * 2];
|
||||
|
||||
return spells;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public int[] getPriestSpellPoints ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int[] spells = new int[7];
|
||||
|
||||
for (int i = 0; i < 7; i++)
|
||||
spells[i] = buffer[160 + i * 2];
|
||||
|
||||
return spells;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
public Long getNextLevel ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -18,6 +18,7 @@ public class CharacterV4 extends Character
|
||||
int id;
|
||||
int nextCharacterId;
|
||||
CharacterParty party;
|
||||
String partialSlogan;
|
||||
|
||||
public final Race race;
|
||||
public final CharacterClass characterClass;
|
||||
@ -58,6 +59,8 @@ public class CharacterV4 extends Character
|
||||
this.id = id;
|
||||
scenario = 4;
|
||||
|
||||
partialSlogan = buffer[17] == 0 ? "" : HexFormatter.getPascalString (buffer, 17);
|
||||
|
||||
inMaze = Utility.getShort (buffer, 33) != 0;
|
||||
race = Race.values ()[Utility.getShort (buffer, 35)];
|
||||
characterClass = CharacterClass.values ()[Utility.getShort (buffer, 37)];
|
||||
@ -155,7 +158,8 @@ public class CharacterV4 extends Character
|
||||
String getPartialSlogan ()
|
||||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
return buffer[17] == 0 ? "" : HexFormatter.getPascalString (buffer, 17);
|
||||
// return buffer[17] == 0 ? "" : HexFormatter.getPascalString (buffer, 17);
|
||||
return partialSlogan;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------//
|
||||
|
@ -34,7 +34,7 @@ public class WizardryScenarioDisk extends PascalDisk
|
||||
public List<MessageV1> messages;
|
||||
public List<MonsterV1> monsters;
|
||||
public List<MazeLevel> levels;
|
||||
List<ExperienceLevel> experiences;
|
||||
List<ExperienceLevel> experienceLevels;
|
||||
List<Reward> rewards;
|
||||
|
||||
private int monsterId;
|
||||
@ -108,12 +108,7 @@ public class WizardryScenarioDisk extends PascalDisk
|
||||
|
||||
// add information about each characters' baggage, spells known etc.
|
||||
for (CharacterV1 character : characters)
|
||||
{
|
||||
character.linkItems (items);
|
||||
character.linkSpells (spells);
|
||||
int type = character.typeInt;
|
||||
character.linkExperience (experiences.get (type));
|
||||
}
|
||||
character.link (items, spells, experienceLevels);
|
||||
|
||||
for (ItemV1 item : items)
|
||||
item.link (items, spells);
|
||||
@ -592,7 +587,7 @@ public class WizardryScenarioDisk extends PascalDisk
|
||||
{
|
||||
List<DiskAddress> nodeSectors = new ArrayList<> ();
|
||||
ScenarioData sd = scenarioHeader.data.get (Header.EXPERIENCE_AREA);
|
||||
experiences = new ArrayList<> (sd.total);
|
||||
experienceLevels = new ArrayList<> (sd.total);
|
||||
int max = sd.totalBlocks / 2;
|
||||
|
||||
int count = 0;
|
||||
@ -613,7 +608,7 @@ public class WizardryScenarioDisk extends PascalDisk
|
||||
byte[] newBuffer = new byte[78];
|
||||
System.arraycopy (buffer, ptr, newBuffer, 0, newBuffer.length);
|
||||
ExperienceLevel el = new ExperienceLevel (classes[count++], newBuffer);
|
||||
experiences.add (el);
|
||||
experienceLevels.add (el);
|
||||
addToNode (el, node, blocks, experienceSector);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user