Class SavingThrows
java.lang.Object
SavingThrows
Saving throws table (singleton pattern).
- Since:
- 2016-01-20
-
Nested Class Summary
Modifier and TypeClassDescription(package private) class
Class to store save targets at one class level.private static enum
Available saving throw rules.static enum
Saving throw types. -
Field Summary
Modifier and TypeFieldDescription(package private) static SavingThrows
The singleton class instance.(package private) static final int[]
OED-style adjustments per save type.(package private) static final SavingThrows.SaveRule
Rule to use for adjudications.(package private) static final String
Name of file for ODD-style saves table.(package private) SavingThrows.SaveRecord[]
Table of saving throw targets. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SavingThrows
Access the singleton class instance.private SavingThrows.SaveRecord
getSaveRecord
(String asClass, int level) Find the correct SaveRecord for this class/level.int
getSaveTarget
(SavingThrows.Type saveType, String asClass, int level) Get the target score for a saving throw.static void
Main test method.boolean
rollSave
(SavingThrows.Type saveType, String asClass, int level) Roll a saving throw without a modifier.boolean
rollSave
(SavingThrows.Type saveType, String asClass, int level, int modifier) Roll a saving throw with a modifier.
-
Field Details
-
SAVE_RULE
Rule to use for adjudications. -
SAVING_THROWS_FILE
Name of file for ODD-style saves table.- See Also:
-
OED_ADJUST
static final int[] OED_ADJUSTOED-style adjustments per save type. -
instance
The singleton class instance. -
targetsTable
SavingThrows.SaveRecord[] targetsTableTable of saving throw targets.
-
-
Constructor Details
-
SavingThrows
Constructor (read from dedicated file).- Throws:
IOException
-
-
Method Details
-
getInstance
Access the singleton class instance. -
rollSave
Roll a saving throw with a modifier.- Returns:
- True if the save was successful.
-
rollSave
Roll a saving throw without a modifier.- Returns:
- True if the save was successful.
-
getSaveTarget
Get the target score for a saving throw. -
getSaveRecord
Find the correct SaveRecord for this class/level. -
main
Main test method.
-