diff --git a/src/main/java/emu/nebula/data/GameData.java b/src/main/java/emu/nebula/data/GameData.java index d3e119e..fea6e3d 100644 --- a/src/main/java/emu/nebula/data/GameData.java +++ b/src/main/java/emu/nebula/data/GameData.java @@ -114,9 +114,11 @@ public class GameData { @Getter private static DataTable StarTowerGrowthNodeDataTable = new DataTable<>(); @Getter private static DataTable StarTowerFloorExpDataTable = new DataTable<>(); @Getter private static DataTable StarTowerTeamExpDataTable = new DataTable<>(); - @Getter private static DataTable PotentialDataTable = new DataTable<>(); @Getter private static DataTable SubNoteSkillPromoteGroupDataTable = new DataTable<>(); + @Getter private static DataTable PotentialDataTable = new DataTable<>(); + @Getter private static DataTable CharPotentialDataTable = new DataTable<>(); + @Getter private static DataTable StarTowerBookFateCardBundleDataTable = new DataTable<>(); @Getter private static DataTable StarTowerBookFateCardQuestDataTable = new DataTable<>(); @Getter private static DataTable StarTowerBookFateCardDataTable = new DataTable<>(); diff --git a/src/main/java/emu/nebula/data/resources/CharPotentialDef.java b/src/main/java/emu/nebula/data/resources/CharPotentialDef.java new file mode 100644 index 0000000..1d08f4d --- /dev/null +++ b/src/main/java/emu/nebula/data/resources/CharPotentialDef.java @@ -0,0 +1,22 @@ +package emu.nebula.data.resources; + +import emu.nebula.data.BaseDef; +import emu.nebula.data.ResourceType; +import lombok.Getter; + +@Getter +@ResourceType(name = "CharPotential.json") +public class CharPotentialDef extends BaseDef { + private int Id; + + private int[] MasterSpecificPotentialIds; + private int[] AssistSpecificPotentialIds; + private int[] CommonPotentialIds; + private int[] MasterNormalPotentialIds; + private int[] AssistNormalPotentialIds; + + @Override + public int getId() { + return Id; + } +} diff --git a/src/main/java/emu/nebula/game/tower/StarTowerGame.java b/src/main/java/emu/nebula/game/tower/StarTowerGame.java index 3e48bde..4f8dd11 100644 --- a/src/main/java/emu/nebula/game/tower/StarTowerGame.java +++ b/src/main/java/emu/nebula/game/tower/StarTowerGame.java @@ -7,7 +7,6 @@ import dev.morphia.annotations.Entity; import emu.nebula.GameConstants; import emu.nebula.data.GameData; -import emu.nebula.data.resources.PotentialDef; import emu.nebula.data.resources.StarTowerDef; import emu.nebula.data.resources.StarTowerStageDef; import emu.nebula.game.formation.Formation; @@ -427,22 +426,35 @@ public class StarTowerGame { * Creates a potential selector for the specified character */ public StarTowerBaseCase createPotentialSelector(int charId) { - // Get random potentials - List potentials = new ArrayList<>(); - - for (var potentialData : GameData.getPotentialDataTable()) { - if (potentialData.getCharId() == charId) { - potentials.add(potentialData); - } + // Get character potentials + var data = GameData.getCharPotentialDataTable().get(charId); + if (data == null) { + return null; } + // Random potentials list + var potentials = new IntArrayList(); + + // Add potentials based on character role + boolean isMainCharacter = this.getCharIds().getInt(0) == charId; + + if (isMainCharacter) { + potentials.addElements(0, data.getMasterSpecificPotentialIds()); + potentials.addElements(0, data.getMasterNormalPotentialIds()); + } else { + potentials.addElements(0, data.getAssistSpecificPotentialIds()); + potentials.addElements(0, data.getAssistNormalPotentialIds()); + } + + potentials.addElements(0, data.getCommonPotentialIds()); + // Get up to 3 random potentials // TODO bug: this may pick duplicate potentials IntList selector = new IntArrayList(); for (int i = 0; i < 3; i++) { - var potentialData = Utils.randomElement(potentials); - selector.add(potentialData.getId()); + var potentialId = Utils.randomElement(potentials); + selector.add(potentialId); } // Creator potential selector case