diff options
author | Ajarmar <axel.jarmar@gmail.com> | 2019-10-26 22:22:55 +0200 |
---|---|---|
committer | Ajarmar <axel.jarmar@gmail.com> | 2019-10-26 22:22:55 +0200 |
commit | d7ce778ea9b8d98324b5f32dfb40108011f35e2f (patch) | |
tree | 1fe7745a2a31ac123b29e5e2155f901824078367 | |
parent | 5556c570df5b959fe007ee65d29568d0b76080ba (diff) |
some refactoring
7 files changed, 41 insertions, 23 deletions
diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java index e3b2a43..f69c118 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java @@ -48,7 +48,6 @@ import com.dabomstew.pkrandom.CustomNamesSet; import com.dabomstew.pkrandom.MiscTweak; import com.dabomstew.pkrandom.RomFunctions; import com.dabomstew.pkrandom.constants.GlobalConstants; -import com.dabomstew.pkrandom.constants.Gen5Constants; import com.dabomstew.pkrandom.exceptions.RandomizationException; import com.dabomstew.pkrandom.pokemon.Encounter; import com.dabomstew.pkrandom.pokemon.EncounterSet; @@ -3764,7 +3763,7 @@ public abstract class AbstractRomHandler implements RomHandler { } - protected void setPlacementHistory(Pokemon newPK) { + private void setPlacementHistory(Pokemon newPK) { List<Pokemon> placedPK = new ArrayList<Pokemon>(placementHistory.keySet()); if (placedPK.contains(newPK)) { placementHistory.put(newPK, placementHistory.get(newPK) + 1); @@ -3776,7 +3775,7 @@ public abstract class AbstractRomHandler implements RomHandler { } - public int getPlacementHistory(Pokemon newPK) { + private int getPlacementHistory(Pokemon newPK) { List<Pokemon> placedPK = new ArrayList<Pokemon>(placementHistory.keySet()); if (placedPK.contains(newPK)) { return placementHistory.get(newPK); @@ -3787,7 +3786,7 @@ public abstract class AbstractRomHandler implements RomHandler { } // currently not used - public boolean decidePlacementAverage(Pokemon newPK) { + private boolean decidePlacementAverage(Pokemon newPK) { // This method will return true if the number of times a pokemon has been // placed is less than average of all placed pokemon's appearances // E.g., Charmander's been placed once, but the average for all pokemon is 2.2 @@ -3816,7 +3815,7 @@ public abstract class AbstractRomHandler implements RomHandler { } - public List<Pokemon> getBelowAveragePlacements() { + private List<Pokemon> getBelowAveragePlacements() { // This method will return true if the number of times a pokemon has been // placed is less than average of all placed pokemon's appearances // E.g., Charmander's been placed once, but the average for all pokemon is 2.2 @@ -3859,24 +3858,8 @@ public abstract class AbstractRomHandler implements RomHandler { return toPlacePK; } - - public List<Integer> getMainPlaythroughTrainers() { - if (this.getROMCode().equals("IRBO") || this.getROMCode().equals("IRAO")) { // BW1 - List<Integer> trainers = Gen5Constants.bw1MainPlaythroughTrainers; - return trainers; - } - else if (this.getROMCode().equals("IRDO") || this.getROMCode().equals("IREO")) { // BW2 - List<Integer> trainers = Gen5Constants.bw2MainPlaythroughTrainers; - return trainers; - } - else { - return Gen5Constants.emptyPlaythroughTrainers; - - } - - - } + @Override public void renderPlacementHistory() { List<Pokemon> placedPK = new ArrayList<Pokemon>(placementHistory.keySet()); for (Pokemon p : placedPK) { diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java index 16ef273..d4f9dfd 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java @@ -1021,6 +1021,11 @@ public class Gen1RomHandler extends AbstractGBCRomHandler { return allTrainers; } + @Override + public List<Integer> getMainPlaythroughTrainers() { + return new ArrayList<>(); // Not implemented + } + public void setTrainers(List<Trainer> trainerData) { int traineroffset = romEntry.getValue("TrainerDataTableOffset"); int traineramount = Gen1Constants.trainerClassCount; diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java index 7ae788b..0cca73f 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java @@ -888,6 +888,11 @@ public class Gen2RomHandler extends AbstractGBCRomHandler { } @Override + public List<Integer> getMainPlaythroughTrainers() { + return new ArrayList<>(); // Not implemented + } + + @Override public void setTrainers(List<Trainer> trainerData) { int traineroffset = romEntry.getValue("TrainerDataTableOffset"); int traineramount = romEntry.getValue("TrainerClassAmount"); diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java index a89760b..3e31f37 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java @@ -1430,6 +1430,11 @@ public class Gen3RomHandler extends AbstractGBRomHandler { } @Override + public List<Integer> getMainPlaythroughTrainers() { + return new ArrayList<>(); // Not implemented + } + + @Override public void setTrainers(List<Trainer> trainerData) { int baseOffset = romEntry.getValue("TrainerData"); int amount = romEntry.getValue("TrainerCount"); diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java index e317573..4f3b65a 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java @@ -1340,6 +1340,11 @@ public class Gen4RomHandler extends AbstractDSRomHandler { } @Override + public List<Integer> getMainPlaythroughTrainers() { + return new ArrayList<>(); // Not implemented + } + + @Override public void setTrainers(List<Trainer> trainerData) { Iterator<Trainer> allTrainers = trainerData.iterator(); try { diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java index 2bb8357..667fa42 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java @@ -1100,6 +1100,19 @@ public class Gen5RomHandler extends AbstractDSRomHandler { } @Override + public List<Integer> getMainPlaythroughTrainers() { + if (romEntry.romType == Gen5Constants.Type_BW) { // BW1 + return Gen5Constants.bw1MainPlaythroughTrainers; + } + else if (romEntry.romType == Gen5Constants.Type_BW2) { // BW2 + return Gen5Constants.bw2MainPlaythroughTrainers; + } + else { + return Gen5Constants.emptyPlaythroughTrainers; + } + } + + @Override public void setTrainers(List<Trainer> trainerData) { Iterator<Trainer> allTrainers = trainerData.iterator(); try { diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java index 4529fc0..82128ae 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java @@ -161,6 +161,8 @@ public interface RomHandler { // Randomizer: trainer pokemon public List<Trainer> getTrainers(); + public List<Integer> getMainPlaythroughTrainers(); + public void setTrainers(List<Trainer> trainerData); public void randomizeTrainerPokes(boolean usePowerLevels, boolean noLegendaries, boolean noEarlyWonderGuard, @@ -226,7 +228,7 @@ public interface RomHandler { public boolean setStaticPokemon(List<Pokemon> staticPokemon); - public void randomizeStaticPokemon(boolean swap_legendaries, boolean similar_strength, boolean limit_bw_muskateers); + public void randomizeStaticPokemon(boolean swapLegendaries, boolean similarStrength, boolean limitMusketeers); public boolean canChangeStaticPokemon(); |