Fix wrong potentials in star tower potential selector

This commit is contained in:
Melledy
2025-12-02 23:44:45 -08:00
parent 893b23b50d
commit e4dc85a50f
3 changed files with 47 additions and 11 deletions

View File

@@ -114,9 +114,11 @@ public class GameData {
@Getter private static DataTable<StarTowerGrowthNodeDef> StarTowerGrowthNodeDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerFloorExpDef> StarTowerFloorExpDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerTeamExpDef> StarTowerTeamExpDataTable = new DataTable<>();
@Getter private static DataTable<PotentialDef> PotentialDataTable = new DataTable<>();
@Getter private static DataTable<SubNoteSkillPromoteGroupDef> SubNoteSkillPromoteGroupDataTable = new DataTable<>();
@Getter private static DataTable<PotentialDef> PotentialDataTable = new DataTable<>();
@Getter private static DataTable<CharPotentialDef> CharPotentialDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerBookFateCardBundleDef> StarTowerBookFateCardBundleDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerBookFateCardQuestDef> StarTowerBookFateCardQuestDataTable = new DataTable<>();
@Getter private static DataTable<StarTowerBookFateCardDef> StarTowerBookFateCardDataTable = new DataTable<>();

View File

@@ -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;
}
}

View File

@@ -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<PotentialDef> 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