diff options
author | Ajarmar <axel.jarmar@gmail.com> | 2021-12-10 00:08:19 +0100 |
---|---|---|
committer | Ajarmar <axel.jarmar@gmail.com> | 2021-12-10 00:08:19 +0100 |
commit | 8a16bea310af9f5b6a8ca7469f135c7532803cf4 (patch) | |
tree | 11fdb1e7c0da106771cee56c7d44ab41eafbcce3 | |
parent | 7da38301fcbd2c8976045b51aa4870097c9abe3b (diff) |
add option for banning irregular alt formes
16 files changed, 335 insertions, 10 deletions
diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java index 4008dff..1f7731e 100644 --- a/src/com/dabomstew/pkrandom/Settings.java +++ b/src/com/dabomstew/pkrandom/Settings.java @@ -64,6 +64,7 @@ public class Settings { private boolean raceMode;
private boolean blockBrokenMoves;
private boolean limitPokemon;
+ private boolean banIrregularAltFormes;
public enum BaseStatisticsMod {
UNCHANGED, SHUFFLE, RANDOM,
@@ -568,7 +569,8 @@ public class Settings { // 49 pickup item randomization
out.write(makeByteSelected(pickupItemsMod == PickupItemsMod.RANDOM,
- pickupItemsMod == PickupItemsMod.UNCHANGED, banBadRandomPickupItems));
+ pickupItemsMod == PickupItemsMod.UNCHANGED, banBadRandomPickupItems,
+ banIrregularAltFormes));
try {
byte[] romName = this.romName.getBytes("US-ASCII");
@@ -852,6 +854,7 @@ public class Settings { 1, // UNCHANGED
0)); // RANDOMIZE
settings.setBanBadRandomPickupItems(restoreState(data[49], 2));
+ settings.setBanIrregularAltFormes(restoreState(data[49], 3));
int romNameLength = data[LENGTH_OF_SETTINGS_DATA] & 0xFF;
String romName = new String(data, LENGTH_OF_SETTINGS_DATA + 1, romNameLength, "US-ASCII");
@@ -1097,6 +1100,14 @@ public class Settings { this.raceMode = raceMode;
}
+ public boolean isBanIrregularAltFormes() {
+ return banIrregularAltFormes;
+ }
+
+ public void setBanIrregularAltFormes(boolean banIrregularAltFormes) {
+ this.banIrregularAltFormes = banIrregularAltFormes;
+ }
+
public boolean doBlockBrokenMoves() {
return blockBrokenMoves;
}
diff --git a/src/com/dabomstew/pkrandom/constants/Gen5Constants.java b/src/com/dabomstew/pkrandom/constants/Gen5Constants.java index f1dd32c..5f477fc 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen5Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen5Constants.java @@ -176,6 +176,14 @@ public class Gen5Constants { return absolutePokeNumsByBaseForme.getOrDefault(baseForme,dummyAbsolutePokeNums).getOrDefault(formNum,baseForme);
}
+ public static final List<Integer> irregularFormes = Arrays.asList(
+ Species.Gen5Formes.castformF, Species.Gen5Formes.castformW, Species.Gen5Formes.castformI,
+ Species.Gen5Formes.darmanitanZ,
+ Species.Gen5Formes.meloettaP,
+ Species.Gen5Formes.kyuremW,
+ Species.Gen5Formes.kyuremB
+ );
+
public static final List<Integer> emptyPlaythroughTrainers = Arrays.asList(new Integer[] { });
public static final List<Integer> bw1MainPlaythroughTrainers = Arrays.asList(
diff --git a/src/com/dabomstew/pkrandom/constants/Gen6Constants.java b/src/com/dabomstew/pkrandom/constants/Gen6Constants.java index a70ef52..7d4fbd7 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen6Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen6Constants.java @@ -80,6 +80,63 @@ public class Gen6Constants { return formeSuffixesByBaseForme.getOrDefault(baseForme,dummyFormeSuffixes).getOrDefault(formNum,""); } + public static final List<Integer> irregularFormes = Arrays.asList( + Species.Gen6Formes.castformF, Species.Gen6Formes.castformW, Species.Gen6Formes.castformI, + Species.Gen6Formes.darmanitanZ, + Species.Gen6Formes.meloettaP, + Species.Gen6Formes.kyuremW, + Species.Gen6Formes.kyuremB, + Species.Gen6Formes.gengarMega, + Species.Gen6Formes.gardevoirMega, + Species.Gen6Formes.ampharosMega, + Species.Gen6Formes.venusaurMega, + Species.Gen6Formes.charizardMegaX, Species.Gen6Formes.charizardMegaY, + Species.Gen6Formes.mewtwoMegaX, Species.Gen6Formes.mewtwoMegaY, + Species.Gen6Formes.blazikenMega, + Species.Gen6Formes.medichamMega, + Species.Gen6Formes.houndoomMega, + Species.Gen6Formes.aggronMega, + Species.Gen6Formes.banetteMega, + Species.Gen6Formes.tyranitarMega, + Species.Gen6Formes.scizorMega, + Species.Gen6Formes.pinsirMega, + Species.Gen6Formes.aerodactylMega, + Species.Gen6Formes.lucarioMega, + Species.Gen6Formes.abomasnowMega, + Species.Gen6Formes.aegislashB, + Species.Gen6Formes.blastoiseMega, + Species.Gen6Formes.kangaskhanMega, + Species.Gen6Formes.gyaradosMega, + Species.Gen6Formes.absolMega, + Species.Gen6Formes.alakazamMega, + Species.Gen6Formes.heracrossMega, + Species.Gen6Formes.mawileMega, + Species.Gen6Formes.manectricMega, + Species.Gen6Formes.garchompMega, + Species.Gen6Formes.latiosMega, + Species.Gen6Formes.latiasMega, + Species.Gen6Formes.swampertMega, + Species.Gen6Formes.sceptileMega, + Species.Gen6Formes.sableyeMega, + Species.Gen6Formes.altariaMega, + Species.Gen6Formes.galladeMega, + Species.Gen6Formes.audinoMega, + Species.Gen6Formes.sharpedoMega, + Species.Gen6Formes.slowbroMega, + Species.Gen6Formes.steelixMega, + Species.Gen6Formes.pidgeotMega, + Species.Gen6Formes.glalieMega, + Species.Gen6Formes.diancieMega, + Species.Gen6Formes.metagrossMega, + Species.Gen6Formes.kyogreP, + Species.Gen6Formes.groudonP, + Species.Gen6Formes.rayquazaMega, + Species.Gen6Formes.cameruptMega, + Species.Gen6Formes.lopunnyMega, + Species.Gen6Formes.salamenceMega, + Species.Gen6Formes.beedrillMega + ); + private static final int moveCountXY = 617, moveCountORAS = 621; private static final int highestAbilityIndexXY = Abilities.auraBreak, highestAbilityIndexORAS = Abilities.deltaStream; diff --git a/src/com/dabomstew/pkrandom/constants/Gen7Constants.java b/src/com/dabomstew/pkrandom/constants/Gen7Constants.java index dab0616..86a965d 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen7Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen7Constants.java @@ -67,6 +67,140 @@ public class Gen7Constants { return formeSuffixesByBaseForme.getOrDefault(baseForme,dummyFormeSuffixes).getOrDefault(formNum,""); } + public static List<Integer> getIrregularFormes(int romType) { + if (romType == Type_SM) { + return irregularFormesSM; + } else if (romType == Type_USUM) { + return irregularFormesUSUM; + } + return irregularFormesSM; + } + + public static final List<Integer> irregularFormesSM = Arrays.asList( + Species.SMFormes.castformF, Species.SMFormes.castformW, Species.SMFormes.castformI, + Species.SMFormes.darmanitanZ, + Species.SMFormes.meloettaP, + Species.SMFormes.kyuremW, + Species.SMFormes.kyuremB, + Species.SMFormes.gengarMega, + Species.SMFormes.gardevoirMega, + Species.SMFormes.ampharosMega, + Species.SMFormes.venusaurMega, + Species.SMFormes.charizardMegaX, Species.SMFormes.charizardMegaY, + Species.SMFormes.mewtwoMegaX, Species.SMFormes.mewtwoMegaY, + Species.SMFormes.blazikenMega, + Species.SMFormes.medichamMega, + Species.SMFormes.houndoomMega, + Species.SMFormes.aggronMega, + Species.SMFormes.banetteMega, + Species.SMFormes.tyranitarMega, + Species.SMFormes.scizorMega, + Species.SMFormes.pinsirMega, + Species.SMFormes.aerodactylMega, + Species.SMFormes.lucarioMega, + Species.SMFormes.abomasnowMega, + Species.SMFormes.aegislashB, + Species.SMFormes.blastoiseMega, + Species.SMFormes.kangaskhanMega, + Species.SMFormes.gyaradosMega, + Species.SMFormes.absolMega, + Species.SMFormes.alakazamMega, + Species.SMFormes.heracrossMega, + Species.SMFormes.mawileMega, + Species.SMFormes.manectricMega, + Species.SMFormes.garchompMega, + Species.SMFormes.latiosMega, + Species.SMFormes.latiasMega, + Species.SMFormes.swampertMega, + Species.SMFormes.sceptileMega, + Species.SMFormes.sableyeMega, + Species.SMFormes.altariaMega, + Species.SMFormes.galladeMega, + Species.SMFormes.audinoMega, + Species.SMFormes.sharpedoMega, + Species.SMFormes.slowbroMega, + Species.SMFormes.steelixMega, + Species.SMFormes.pidgeotMega, + Species.SMFormes.glalieMega, + Species.SMFormes.diancieMega, + Species.SMFormes.metagrossMega, + Species.SMFormes.kyogreP, + Species.SMFormes.groudonP, + Species.SMFormes.rayquazaMega, + Species.SMFormes.cameruptMega, + Species.SMFormes.lopunnyMega, + Species.SMFormes.salamenceMega, + Species.SMFormes.beedrillMega, + Species.SMFormes.wishiwashiS, + Species.SMFormes.greninjaA, + Species.SMFormes.zygardeC, + Species.SMFormes.miniorC + ); + + public static final List<Integer> irregularFormesUSUM = Arrays.asList( + Species.USUMFormes.castformF, Species.USUMFormes.castformW, Species.USUMFormes.castformI, + Species.USUMFormes.darmanitanZ, + Species.USUMFormes.meloettaP, + Species.USUMFormes.kyuremW, + Species.USUMFormes.kyuremB, + Species.USUMFormes.gengarMega, + Species.USUMFormes.gardevoirMega, + Species.USUMFormes.ampharosMega, + Species.USUMFormes.venusaurMega, + Species.USUMFormes.charizardMegaX, Species.USUMFormes.charizardMegaY, + Species.USUMFormes.mewtwoMegaX, Species.USUMFormes.mewtwoMegaY, + Species.USUMFormes.blazikenMega, + Species.USUMFormes.medichamMega, + Species.USUMFormes.houndoomMega, + Species.USUMFormes.aggronMega, + Species.USUMFormes.banetteMega, + Species.USUMFormes.tyranitarMega, + Species.USUMFormes.scizorMega, + Species.USUMFormes.pinsirMega, + Species.USUMFormes.aerodactylMega, + Species.USUMFormes.lucarioMega, + Species.USUMFormes.abomasnowMega, + Species.USUMFormes.aegislashB, + Species.USUMFormes.blastoiseMega, + Species.USUMFormes.kangaskhanMega, + Species.USUMFormes.gyaradosMega, + Species.USUMFormes.absolMega, + Species.USUMFormes.alakazamMega, + Species.USUMFormes.heracrossMega, + Species.USUMFormes.mawileMega, + Species.USUMFormes.manectricMega, + Species.USUMFormes.garchompMega, + Species.USUMFormes.latiosMega, + Species.USUMFormes.latiasMega, + Species.USUMFormes.swampertMega, + Species.USUMFormes.sceptileMega, + Species.USUMFormes.sableyeMega, + Species.USUMFormes.altariaMega, + Species.USUMFormes.galladeMega, + Species.USUMFormes.audinoMega, + Species.USUMFormes.sharpedoMega, + Species.USUMFormes.slowbroMega, + Species.USUMFormes.steelixMega, + Species.USUMFormes.pidgeotMega, + Species.USUMFormes.glalieMega, + Species.USUMFormes.diancieMega, + Species.USUMFormes.metagrossMega, + Species.USUMFormes.kyogreP, + Species.USUMFormes.groudonP, + Species.USUMFormes.rayquazaMega, + Species.USUMFormes.cameruptMega, + Species.USUMFormes.lopunnyMega, + Species.USUMFormes.salamenceMega, + Species.USUMFormes.beedrillMega, + Species.USUMFormes.wishiwashiS, + Species.USUMFormes.greninjaA, + Species.USUMFormes.zygardeC, + Species.USUMFormes.miniorC, + Species.USUMFormes.necrozmaDM, + Species.USUMFormes.necrozmaDW, + Species.USUMFormes.necrozmaU + ); + public static final MoveCategory[] moveCategoryIndices = { MoveCategory.STATUS, MoveCategory.PHYSICAL, MoveCategory.SPECIAL }; diff --git a/src/com/dabomstew/pkrandom/newgui/Bundle.properties b/src/com/dabomstew/pkrandom/newgui/Bundle.properties index e4bad46..768655b 100644 --- a/src/com/dabomstew/pkrandom/newgui/Bundle.properties +++ b/src/com/dabomstew/pkrandom/newgui/Bundle.properties @@ -7,6 +7,8 @@ GUI.limitPokemonCheckBox.text=Limit Pokemon GUI.limitPokemonCheckBox.toolTipText=<html>Select this to allow yourself to limit the Pokemon used by the randomization.<br /><b>If this box isn't checked all Pokemon will be allowed.</b> GUI.raceModeCheckBox.toolTipText=<html>Select this to enable certain things which are useful for a speedrun race of the ROM you create.<br />The ability to save a log file will be disabled, and a check value will be generated.<br />You can send this value around with the preset file to ensure that everyone has the same ROM to race with. GUI.raceModeCheckBox.text=Race Mode +GUI.noIrregularAltFormesCheckBox.text=No Irregular Alt Formes +GUI.noIrregularAltFormesCheckBox.toolTipText=<html>Bans "irregular" alternate formes from the Pokemon pool when "Allow Alternate Formes" is selected for Wild Pokemon, Trainer Pokemon, Evolutions, etc.<br />Irregular formes are those that normally cannot exist outside of battle (such as Mega Evolutions and other in-battle transformations like Darmanitan-Z, Zygarde-C, etc),<br />as well as the "Fusion" Pokemon (Kyurem-B/W and Necrozma-DM/DW).<br />These alternate formes still exist and will get randomized base stats, abilities and so on (according to your settings),<br />but they can only be accessed through their regular means (such as by Mega Evolving or transforming because of an Ability). GUI.romInformationPanel.title=ROM Information GUI.noRomLoaded=NO ROM LOADED GUI.openROMButton.toolTipText= diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form index 6742180..b17ca14 100644 --- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form +++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form @@ -2,7 +2,7 @@ <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.dabomstew.pkrandom.newgui.NewRandomizerGUI"> <grid id="27dc6" binding="mainPanel" layout-manager="GridBagLayout"> <constraints> - <xy x="7" y="20" width="1084" height="836"/> + <xy x="7" y="20" width="1084" height="929"/> </constraints> <properties/> <border type="none"> @@ -11,7 +11,7 @@ <children> <grid id="73235" layout-manager="GridBagLayout"> <constraints> - <grid row="1" column="2" row-span="2" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/> + <grid row="1" column="2" row-span="3" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/> <gridbag weightx="0.0" weighty="0.0"/> </constraints> <properties> @@ -25,7 +25,7 @@ <children> <component id="f2100" class="javax.swing.JCheckBox" binding="raceModeCheckBox" default-binding="true"> <constraints> - <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <gridbag top="0" left="0" bottom="0" right="30" weightx="0.0" weighty="0.0"/> </constraints> <properties> @@ -55,6 +55,17 @@ <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.limitPokemonCheckBox.text"/> </properties> </component> + <component id="41e69" class="javax.swing.JCheckBox" binding="noIrregularAltFormesCheckBox" default-binding="true"> + <constraints> + <grid row="1" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <gridbag weightx="0.0" weighty="0.0"/> + </constraints> + <properties> + <enabled value="false"/> + <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.noIrregularAltFormesCheckBox.text"/> + <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.noIrregularAltFormesCheckBox.toolTipText"/> + </properties> + </component> </children> </grid> <vspacer id="7ea6"> diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java index 77a4531..53a3664 100644 --- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java +++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java @@ -293,6 +293,7 @@ public class NewRandomizerGUI { private JCheckBox puBanBadItemsCheckBox; private JCheckBox miscForceChallengeModeCheckBox; private JCheckBox pbsAssignEvoStatsRandomlyCheckBox; + private JCheckBox noIrregularAltFormesCheckBox; private static JFrame frame; @@ -1551,6 +1552,7 @@ public class NewRandomizerGUI { settings.setLimitPokemon(limitPokemonCheckBox.isSelected() && limitPokemonCheckBox.isVisible()); settings.setCurrentRestrictions(currentRestrictions); + settings.setBanIrregularAltFormes(noIrregularAltFormesCheckBox.isSelected() && noIrregularAltFormesCheckBox.isVisible()); settings.setRaceMode(raceModeCheckBox.isSelected()); settings.setChangeImpossibleEvolutions(peChangeImpossibleEvosCheckBox.isSelected() && peChangeImpossibleEvosCheckBox.isVisible()); @@ -1837,6 +1839,9 @@ public class NewRandomizerGUI { limitPokemonCheckBox.setSelected(false); limitPokemonButton.setVisible(true); limitPokemonButton.setEnabled(false); + noIrregularAltFormesCheckBox.setVisible(true); + noIrregularAltFormesCheckBox.setEnabled(false); + noIrregularAltFormesCheckBox.setSelected(false); raceModeCheckBox.setVisible(true); raceModeCheckBox.setEnabled(false); raceModeCheckBox.setSelected(false); @@ -2506,6 +2511,9 @@ public class NewRandomizerGUI { limitPokemonCheckBox.setEnabled(true); limitPokemonButton.setVisible(true); + noIrregularAltFormesCheckBox.setVisible(pokemonGeneration >= 4); + noIrregularAltFormesCheckBox.setEnabled(pokemonGeneration >= 4); + raceModeCheckBox.setEnabled(true); loadSettingsButton.setEnabled(true); diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java index 5347158..04214c9 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java @@ -680,6 +680,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean balanceShakingGrass = settings.isBalanceShakingGrass(); int levelModifier = settings.isWildLevelsModified() ? settings.getWildLevelModifier() : 0; boolean allowAltFormes = settings.isAllowWildAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; List<EncounterSet> currentEncounters = this.getEncounters(useTimeOfDay); @@ -706,6 +707,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } // Assume EITHER catch em all OR type themed OR match strength for now if (catchEmAll) { @@ -894,6 +898,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean noLegendaries = settings.isBlockWildLegendaries(); int levelModifier = settings.isWildLevelsModified() ? settings.getWildLevelModifier() : 0; boolean allowAltFormes = settings.isAllowWildAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; checkPokemonRestrictions(); @@ -903,6 +908,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } // New: randomize the order encounter sets are randomized in. // Leads to less predictable results for various modifiers. @@ -1103,6 +1111,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean noLegendaries = settings.isBlockWildLegendaries(); int levelModifier = settings.isWildLevelsModified() ? settings.getWildLevelModifier() : 0; boolean allowAltFormes = settings.isAllowWildAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; checkPokemonRestrictions(); @@ -1125,6 +1134,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } // Banned pokemon should be mapped to themselves for (Pokemon bannedPK : banned) { translateMap.put(bannedPK, bannedPK); @@ -1246,8 +1258,17 @@ public abstract class AbstractRomHandler implements RomHandler { boolean usePowerLevels = settings.getWildPokemonRestrictionMod() == Settings.WildPokemonRestrictionMod.SIMILAR_STRENGTH; boolean noLegendaries = settings.isBlockWildLegendaries(); boolean allowAltFormes = settings.isAllowWildAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); + boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; List<Pokemon> banned = this.bannedForWildEncounters(); + if (!abilitiesAreRandomized) { + List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); + banned.addAll(abilityDependentFormes); + } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } Map<Integer, List<EncounterSet>> zonesToEncounters = mapZonesToEncounters(collapsedEncounters); Map<Type, List<Pokemon>> cachedPokeLists = new TreeMap<>(); for (List<EncounterSet> encountersInZone : zonesToEncounters.values()) { @@ -1536,6 +1557,7 @@ public abstract class AbstractRomHandler implements RomHandler { settings.getTrainersMod() == Settings.TrainersMod.MAINPLAYTHROUGH; boolean mainPlaythroughSetting = settings.getTrainersMod() == Settings.TrainersMod.MAINPLAYTHROUGH; boolean includeFormes = settings.isAllowTrainerAlternateFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean swapMegaEvos = settings.isSwapTrainerMegaEvos(); boolean shinyChance = settings.isShinyChance(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; @@ -1567,6 +1589,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } cachedAllList.removeAll(banned); // Fully random is easy enough - randomize then worry about rival @@ -1603,7 +1628,8 @@ public abstract class AbstractRomHandler implements RomHandler { true, swapThisMegaEvo, abilitiesAreRandomized, - includeFormes + includeFormes, + banIrregularAltFormes ); setPlacementHistory(newPK); tp.absolutePokeNumber = newPK.number; @@ -1622,7 +1648,8 @@ public abstract class AbstractRomHandler implements RomHandler { false, swapThisMegaEvo, abilitiesAreRandomized, - includeFormes + includeFormes, + banIrregularAltFormes ); tp.absolutePokeNumber = newPK.number; tp.pokemon = newPK; @@ -1640,7 +1667,8 @@ public abstract class AbstractRomHandler implements RomHandler { distributionSetting, swapThisMegaEvo, abilitiesAreRandomized, - includeFormes + includeFormes, + banIrregularAltFormes ); if (distributionSetting) { setPlacementHistory(newPK); @@ -1703,6 +1731,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean noEarlyWonderGuard = settings.isTrainersBlockEarlyWonderGuard(); int levelModifier = settings.isTrainersLevelModified() ? settings.getTrainersLevelModifier() : 0; boolean includeFormes = settings.isAllowTrainerAlternateFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean swapMegaEvos = settings.isSwapTrainerMegaEvos(); boolean shinyChance = settings.isShinyChance(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; @@ -1732,6 +1761,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } cachedAllList.removeAll(banned); // Construct groupings for types @@ -1812,7 +1844,8 @@ public abstract class AbstractRomHandler implements RomHandler { false, swapThisMegaEvo, abilitiesAreRandomized, - includeFormes + includeFormes, + banIrregularAltFormes ); tp.absolutePokeNumber = newPK.number; tp.pokemon = newPK; @@ -1874,7 +1907,8 @@ public abstract class AbstractRomHandler implements RomHandler { false, swapThisMegaEvo, abilitiesAreRandomized, - includeFormes + includeFormes, + banIrregularAltFormes ); tp.absolutePokeNumber = newPK.number; tp.pokemon = newPK; @@ -3073,6 +3107,7 @@ public abstract class AbstractRomHandler implements RomHandler { public void randomizeStarters(Settings settings) { boolean abilitiesUnchanged = settings.getAbilitiesMod() == Settings.AbilitiesMod.UNCHANGED; boolean allowAltFormes = settings.isAllowStarterAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); int starterCount = starterCount(); pickedStarters = new ArrayList<>(); @@ -3081,6 +3116,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } for (int i = 0; i < starterCount; i++) { Pokemon pkmn = allowAltFormes ? randomPokemonInclFormes() : randomPokemon(); while (pickedStarters.contains(pkmn) || banned.contains(pkmn) || pkmn.actuallyCosmetic) { @@ -3095,6 +3133,7 @@ public abstract class AbstractRomHandler implements RomHandler { public void randomizeBasicTwoEvosStarters(Settings settings) { boolean abilitiesUnchanged = settings.getAbilitiesMod() == Settings.AbilitiesMod.UNCHANGED; boolean allowAltFormes = settings.isAllowStarterAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); int starterCount = starterCount(); pickedStarters = new ArrayList<>(); @@ -3103,6 +3142,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } for (int i = 0; i < starterCount; i++) { Pokemon pkmn = random2EvosPokemon(allowAltFormes); while (pickedStarters.contains(pkmn) || banned.contains(pkmn)) { @@ -3126,6 +3168,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean limitMainGameLegendaries = settings.isLimitMainGameLegendaries(); boolean limit600 = settings.isLimit600(); boolean allowAltFormes = settings.isAllowStaticAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean swapMegaEvos = settings.isSwapStaticMegaEvos(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; int levelModifier = settings.isStaticLevelModified() ? settings.getStaticLevelModifier() : 0; @@ -3141,6 +3184,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } boolean reallySwapMegaEvos = forceSwapStaticMegaEvos() || swapMegaEvos; Map<Integer,Integer> specialMusicStaticChanges = new HashMap<>(); @@ -4525,6 +4571,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean limitToThreeStages = settings.isEvosMaxThreeStages(); boolean forceChange = settings.isEvosForceChange(); boolean allowAltFormes = settings.isEvosAllowAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; checkPokemonRestrictions(); @@ -4537,6 +4584,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } for (int i = 0; i < pokemonPool.size(); i++) { Pokemon pk = pokemonPool.get(i); @@ -5722,7 +5772,7 @@ public abstract class AbstractRomHandler implements RomHandler { private Pokemon pickReplacement(Pokemon current, boolean usePowerLevels, Type type, boolean noLegendaries, boolean wonderGuardAllowed, boolean usePlacementHistory, boolean swapMegaEvos, - boolean abilitiesAreRandomized, boolean allowAltFormes) { + boolean abilitiesAreRandomized, boolean allowAltFormes, boolean banIrregularAltFormes) { List<Pokemon> pickFrom; if (swapMegaEvos) { pickFrom = megaEvolutionsList @@ -5754,6 +5804,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); pokemonOfType.removeAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + pokemonOfType.removeAll(getIrregularFormes()); + } cachedReplacementLists.put(type, pokemonOfType); } if (swapMegaEvos) { @@ -5985,6 +6038,7 @@ public abstract class AbstractRomHandler implements RomHandler { boolean randomizeHeldItems = settings.isRandomizeTotemHeldItems(); int levelModifier = settings.isTotemLevelsModified() ? settings.getTotemLevelModifier() : 0; boolean allowAltFormes = settings.isAllowTotemAltFormes(); + boolean banIrregularAltFormes = settings.isBanIrregularAltFormes(); boolean abilitiesAreRandomized = settings.getAbilitiesMod() == Settings.AbilitiesMod.RANDOMIZE; checkPokemonRestrictions(); @@ -5995,6 +6049,9 @@ public abstract class AbstractRomHandler implements RomHandler { List<Pokemon> abilityDependentFormes = getAbilityDependentFormes(); banned.addAll(abilityDependentFormes); } + if (banIrregularAltFormes) { + banned.addAll(getIrregularFormes()); + } List<Pokemon> listInclFormesExclCosmetics = mainPokemonListInclFormes .stream() diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java index 37d0136..6455390 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java @@ -1029,6 +1029,11 @@ public class Gen1RomHandler extends AbstractGBCRomHandler { }
@Override
+ public List<Pokemon> getIrregularFormes() {
+ return new ArrayList<>();
+ }
+
+ @Override
public boolean hasFunctionalFormes() {
return false;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java index ec026f3..f722839 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java @@ -1010,6 +1010,11 @@ public class Gen2RomHandler extends AbstractGBCRomHandler { }
@Override
+ public List<Pokemon> getIrregularFormes() {
+ return new ArrayList<>();
+ }
+
+ @Override
public boolean hasFunctionalFormes() {
return false;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java index b83135e..da139bf 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java @@ -1649,6 +1649,11 @@ public class Gen3RomHandler extends AbstractGBRomHandler { } @Override + public List<Pokemon> getIrregularFormes() { + return new ArrayList<>(); + } + + @Override public boolean hasFunctionalFormes() { return false; } diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java index 85005a4..e10c260 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java @@ -776,6 +776,11 @@ public class Gen4RomHandler extends AbstractDSRomHandler { }
@Override
+ public List<Pokemon> getIrregularFormes() {
+ return new ArrayList<>();
+ }
+
+ @Override
public boolean hasFunctionalFormes() {
return romEntry.romType != Gen4Constants.Type_DP;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java index 00ab9b0..ab57120 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java @@ -723,6 +723,11 @@ public class Gen5RomHandler extends AbstractDSRomHandler { }
@Override
+ public List<Pokemon> getIrregularFormes() {
+ return Gen5Constants.irregularFormes.stream().map(i -> pokes[i]).collect(Collectors.toList());
+ }
+
+ @Override
public boolean hasFunctionalFormes() {
return true;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java index b04d953..196bbed 100644 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java @@ -890,6 +890,11 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { } @Override + public List<Pokemon> getIrregularFormes() { + return Gen6Constants.irregularFormes.stream().map(i -> pokes[i]).collect(Collectors.toList()); + } + + @Override public boolean hasFunctionalFormes() { return true; } diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java index a586429..9556293 100644 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java @@ -966,6 +966,11 @@ public class Gen7RomHandler extends Abstract3DSRomHandler { } @Override + public List<Pokemon> getIrregularFormes() { + return Gen7Constants.getIrregularFormes(romEntry.romType).stream().map(i -> pokes[i]).collect(Collectors.toList()); + } + + @Override public boolean hasFunctionalFormes() { return true; } diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java index bbcf279..19c1297 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java @@ -98,6 +98,8 @@ public interface RomHandler { Pokemon getAltFormeOfPokemon(Pokemon pk, int forme);
+ List<Pokemon> getIrregularFormes();
+
// ==================================
// Methods to set up Gen Restrictions
// ==================================
|