Class MonsterTables

java.lang.Object
MonsterTables
All Implemented Interfaces:
Iterable<List<Monster>>

public class MonsterTables extends Object implements Iterable<List<Monster>>
Tables of monsters organized by level. For use in generating & data-tracking random encounters.
Since:
2014-07-18
  • Field Details

    • MONSTER_LEVEL_MATRIX_FILE

      final String MONSTER_LEVEL_MATRIX_FILE
      Name of file with monster information.
      See Also:
    • instance

      static MonsterTables instance
      The singleton class instance.
    • monsterLevelMatrix

      List<List<Integer>> monsterLevelMatrix
      Matrix of what level monster appears.
    • monsterTables

      List<List<Monster>> monsterTables
      Tables of monsters at each level.
  • Constructor Details

    • MonsterTables

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

    • getInstance

      public static MonsterTables getInstance()
      Access the singleton class instance.
    • iterator

      public Iterator<List<Monster>> iterator()
      Return iterator for the iterable interface.
      Specified by:
      iterator in interface Iterable<List<Monster>>
    • readMonsterLevelMatrix

      private void readMonsterLevelMatrix() throws IOException
      Read in the monster level matrix.
      Throws:
      IOException
    • compileMonsterTables

      private void compileMonsterTables()
      Compile the table of monsters at each level.
    • getNumTables

      public int getNumTables()
      Get the number of tables (i.e., max monster level).
    • getTable

      public List<Monster> getTable(int level)
      Access one of the monster tables (1-based).
    • randomMonsterByDungeonLevel

      public Monster randomMonsterByDungeonLevel(int dungeonLevel)
      Roll a new random monster on a given dungeon level.
    • randomMonsterByTableLevel

      private Monster randomMonsterByTableLevel(int tableLevel)
      Roll a new random monster of a given table level.
    • randomMonsterLevel

      private int randomMonsterLevel(int dungeonLevel)
      Roll a random monster level for a given dungeon level.
    • getMatrixRow

      private List<Integer> getMatrixRow(int dungeonLevel)
      Convert dungeon level to row in matrix.
    • getTotalKillsAtLevel

      public int getTotalKillsAtLevel(int tableLevel)
      Get total kills for a given monster table.
    • getGrandTotalKills

      public int getGrandTotalKills()
      Get grand total monster kills.
    • main

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