Class SpellsIndex
java.lang.Object
SpellsIndex
Index of available spells.
- Since:
- 2018-12-05
-
Field Summary
Modifier and TypeFieldDescription(package private) static SpellsIndex
The singleton class instance.(package private) int
Maximum spell level.(package private) int[]
Number of spells at each level.(package private) int[]
Number of castable spells at each level.(package private) Spell[]
Table of spell information.(package private) final String
Name of file with spells. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
Count spells at each level.private void
Count spells castable by level.findByName
(String name) Find a spell by name.static SpellsIndex
Access the singleton class instance.int
Get the maximum level.int
getNumAtLevel
(int level) Get number at a given level.int
getNumAtLevelCastable
(int level) Get number castable at a given level.getRandom
(int level) Get random spell by level.getRandomCastable
(int level) Get random castable spell by level.private void
Link spells to available in-game casting formulae.static void
Main test function.private void
Set the maximum level.
-
Field Details
-
SPELLS_FILE
Name of file with spells.- See Also:
-
instance
The singleton class instance. -
spellList
Spell[] spellListTable of spell information. -
numAtLevel
int[] numAtLevelNumber of spells at each level. -
numAtLevelCastable
int[] numAtLevelCastableNumber of castable spells at each level. -
maxLevel
int maxLevelMaximum spell level.
-
-
Constructor Details
-
SpellsIndex
Constructor (read from dedicated file).- Throws:
IOException
-
-
Method Details
-
getInstance
Access the singleton class instance. -
linkSpellsToCastings
private void linkSpellsToCastings()Link spells to available in-game casting formulae. -
getMaxLevel
public int getMaxLevel()Get the maximum level. -
setMaxLevel
private void setMaxLevel()Set the maximum level. -
getNumAtLevel
public int getNumAtLevel(int level) Get number at a given level. -
countNumAtLevels
private void countNumAtLevels()Count spells at each level. -
getNumAtLevelCastable
public int getNumAtLevelCastable(int level) Get number castable at a given level. -
countNumCastable
private void countNumCastable()Count spells castable by level. -
getRandom
Get random spell by level. -
getRandomCastable
Get random castable spell by level. -
findByName
Find a spell by name. -
main
Main test function.
-