Class DungeonTreasureTable
java.lang.Object
DungeonTreasureTable
Treasure based on underworld level beneath surface (Vol-3, p. 7).
- Since:
- 2017-11-18
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription(package private) final String
Name of file with treasure information.private static DungeonTreasureTable
The singleton class instance.private DungeonTreasureTable.TreasureRecord[]
Array of TreasureType records. -
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor (read from dedicated file). -
Method Summary
Modifier and TypeMethodDescriptionstatic DungeonTreasureTable
Access the singleton class instance.getRecordByLevel
(int level) Get a treasure record by matching its level code.static void
Main test method.int
randomValueByLevel
(int level) Generate random treasure based on level indicator.private int
Get random value for one treasure record.
-
Field Details
-
DUNGEON_TREASURE_FILE
Name of file with treasure information.- See Also:
-
instance
The singleton class instance. -
treasureTable
Array of TreasureType records.
-
-
Constructor Details
-
DungeonTreasureTable
Constructor (read from dedicated file).- Throws:
IOException
-
-
Method Details
-
getInstance
Access the singleton class instance. -
getRecordByLevel
Get a treasure record by matching its level code. -
randomValueByRecord
Get random value for one treasure record. -
randomValueByLevel
public int randomValueByLevel(int level) Generate random treasure based on level indicator.- Parameters:
level
- Level beneath surface of dungeon
-
main
Main test method.
-