Class SpellsIndex

java.lang.Object
SpellsIndex

public class SpellsIndex extends Object
Index of available spells.
Since:
2018-12-05
  • Field Details

    • SPELLS_FILE

      final String SPELLS_FILE
      Name of file with spells.
      See Also:
    • instance

      static SpellsIndex instance
      The singleton class instance.
    • spellList

      Spell[] spellList
      Table of spell information.
    • numAtLevel

      int[] numAtLevel
      Number of spells at each level.
    • numAtLevelCastable

      int[] numAtLevelCastable
      Number of castable spells at each level.
    • maxLevel

      int maxLevel
      Maximum spell level.
  • Constructor Details

    • SpellsIndex

      protected SpellsIndex() throws IOException
      Constructor (read from dedicated file).
      Throws:
      IOException
  • Method Details

    • getInstance

      public static SpellsIndex 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

      public Spell getRandom(int level)
      Get random spell by level.
    • getRandomCastable

      public Spell getRandomCastable(int level)
      Get random castable spell by level.
    • findByName

      public Spell findByName(String name)
      Find a spell by name.
    • main

      public static void main(String[] args)
      Main test function.