Class SavingThrows

java.lang.Object
SavingThrows

public class SavingThrows extends Object
Saving throws table (singleton pattern).
Since:
2016-01-20
  • Field Details

    • SAVE_RULE

      static final SavingThrows.SaveRule SAVE_RULE
      Rule to use for adjudications.
    • SAVING_THROWS_FILE

      static final String SAVING_THROWS_FILE
      Name of file for ODD-style saves table.
      See Also:
    • OED_ADJUST

      static final int[] OED_ADJUST
      OED-style adjustments per save type.
    • instance

      static SavingThrows instance
      The singleton class instance.
    • targetsTable

      SavingThrows.SaveRecord[] targetsTable
      Table of saving throw targets.
  • Constructor Details

    • SavingThrows

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

    • getInstance

      public static SavingThrows getInstance()
      Access the singleton class instance.
    • rollSave

      public boolean rollSave(SavingThrows.Type saveType, String asClass, int level, int modifier)
      Roll a saving throw with a modifier.
      Returns:
      True if the save was successful.
    • rollSave

      public boolean rollSave(SavingThrows.Type saveType, String asClass, int level)
      Roll a saving throw without a modifier.
      Returns:
      True if the save was successful.
    • getSaveTarget

      public int getSaveTarget(SavingThrows.Type saveType, String asClass, int level)
      Get the target score for a saving throw.
    • getSaveRecord

      private SavingThrows.SaveRecord getSaveRecord(String asClass, int level)
      Find the correct SaveRecord for this class/level.
    • main

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