rollTable() method added to loot classes.

This commit is contained in:
2023-08-07 09:42:40 -04:00
parent 2e59f7f01c
commit 8a5924eeee
5 changed files with 69 additions and 52 deletions
+17
View File
@@ -8,8 +8,11 @@
package engine.loot;
import engine.gameManager.LootManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
public class GenTableEntry {
public int minRoll;
@@ -25,4 +28,18 @@ public class GenTableEntry {
this.pModTable = rs.getInt("pModTableID");
this.sModTable = rs.getInt("sModTableID");
}
public static GenTableEntry rollTable(int genTable, int roll) {
GenTableEntry genTableEntry = null;
List<GenTableEntry> genTableEntryList;
genTableEntryList = LootManager._genTables.get(genTable);
for (GenTableEntry iteration : genTableEntryList)
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
genTableEntry = iteration;
return genTableEntry;
}
}