summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/dabomstew/pkrandom/Randomizer.java56
-rwxr-xr-xsrc/com/dabomstew/pkrandom/RomFunctions.java12
-rw-r--r--src/com/dabomstew/pkrandom/Settings.java23
-rw-r--r--src/com/dabomstew/pkrandom/newgui/Bundle.properties6
-rw-r--r--src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form172
-rw-r--r--src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java34
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java172
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/RomHandler.java8
8 files changed, 339 insertions, 144 deletions
diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java
index 038393c..8333dc2 100644
--- a/src/com/dabomstew/pkrandom/Randomizer.java
+++ b/src/com/dabomstew/pkrandom/Randomizer.java
@@ -500,10 +500,10 @@ public class Randomizer {
// TM/HM compatibility
switch (settings.getTmsHmsCompatibilityMod()) {
case RANDOM_PREFER_TYPE:
- romHandler.randomizeTMHMCompatibility(true);
+ romHandler.randomizeTMHMCompatibility(true, settings.isTmsFollowEvolutions());
break;
case COMPLETELY_RANDOM:
- romHandler.randomizeTMHMCompatibility(false);
+ romHandler.randomizeTMHMCompatibility(false, settings.isTmsFollowEvolutions());
break;
case FULL:
romHandler.fullTMHMCompatibility();
@@ -514,6 +514,9 @@ public class Randomizer {
if (settings.isTmLevelUpMoveSanity()) {
romHandler.ensureTMCompatSanity();
+ if (settings.isTmsFollowEvolutions()) {
+ romHandler.ensureTMEvolutionSanity();
+ }
}
if (settings.isFullHMCompat()) {
@@ -546,10 +549,10 @@ public class Randomizer {
// Compatibility
switch (settings.getMoveTutorsCompatibilityMod()) {
case RANDOM_PREFER_TYPE:
- romHandler.randomizeMoveTutorCompatibility(true);
+ romHandler.randomizeMoveTutorCompatibility(true, settings.isTutorFollowEvolutions());
break;
case COMPLETELY_RANDOM:
- romHandler.randomizeMoveTutorCompatibility(false);
+ romHandler.randomizeMoveTutorCompatibility(false, settings.isTutorFollowEvolutions());
break;
case FULL:
romHandler.fullMoveTutorCompatibility();
@@ -560,6 +563,9 @@ public class Randomizer {
if (settings.isTutorLevelUpMoveSanity()) {
romHandler.ensureMoveTutorCompatSanity();
+ if (settings.isTutorFollowEvolutions()) {
+ romHandler.ensureMoveTutorEvolutionSanity();
+ }
}
}
@@ -747,6 +753,48 @@ public class Randomizer {
}
}
+ private void maybeLogTMHMCompatibility(final PrintStream log, final RomHandler romHandler) {
+ if (settings.getTmsHmsCompatibilityMod() != Settings.TMsHMsCompatibilityMod.UNCHANGED) {
+ log.println("--TM Compatibility--");
+ Map<Pokemon, boolean[]> compat = romHandler.getTMHMCompatibility();
+ List<Integer> tmHMs = new ArrayList<>(romHandler.getTMMoves());
+ tmHMs.addAll(romHandler.getHMMoves());
+ List<Move> moveData = romHandler.getMoves();
+
+ logCompatibility(log, compat, tmHMs, moveData);
+ }
+ }
+
+ private void maybeLogTutorCompatibility(final PrintStream log, final RomHandler romHandler) {
+ if (settings.getTmsHmsCompatibilityMod() != Settings.TMsHMsCompatibilityMod.UNCHANGED) {
+ log.println("--Move Tutor Compatibility--");
+ Map<Pokemon, boolean[]> compat = romHandler.getMoveTutorCompatibility();
+ List<Integer> tutorMoves = romHandler.getMoveTutorMoves();
+ List<Move> moveData = romHandler.getMoves();
+
+ logCompatibility(log, compat, tutorMoves, moveData);
+ }
+ }
+
+ private void logCompatibility(final PrintStream log, Map<Pokemon, boolean[]> compat, List<Integer> moveList,
+ List<Move> moveData) {
+ for (Map.Entry<Pokemon, boolean[]> entry : compat.entrySet()) {
+ Pokemon pkmn = entry.getKey();
+ boolean[] flags = entry.getValue();
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(pkmn.fullName()).append(": ");
+
+ for (int i = 1; i < flags.length; i++) {
+ if (flags[i]) {
+ sb.append(moveData.get(moveList.get(i - 1)).name).append(", ");
+ }
+ }
+
+ log.println(sb.toString());
+ }
+ }
+
private void maybeChangeAndLogStarters(final PrintStream log, final RomHandler romHandler) {
if (romHandler.canChangeStarters()) {
if (settings.getStartersMod() == Settings.StartersMod.CUSTOM) {
diff --git a/src/com/dabomstew/pkrandom/RomFunctions.java b/src/com/dabomstew/pkrandom/RomFunctions.java
index 7189df3..0834366 100755
--- a/src/com/dabomstew/pkrandom/RomFunctions.java
+++ b/src/com/dabomstew/pkrandom/RomFunctions.java
@@ -39,14 +39,14 @@ import com.dabomstew.pkrandom.romhandlers.RomHandler;
public class RomFunctions {
- public static Set<Pokemon> getBasicOrNoCopyPokemon(RomHandler baseRom) {
+ public static Set<Pokemon> getBasicOrNoCopyPokemon(RomHandler baseRom, boolean dontCopySplitEvos) {
List<Pokemon> allPokes = baseRom.getPokemonInclFormes();
Set<Pokemon> dontCopyPokes = new TreeSet<>();
for (Pokemon pkmn : allPokes) {
if (pkmn != null) {
if (pkmn.evolutionsTo.size() < 1) {
dontCopyPokes.add(pkmn);
- } else {
+ } else if (!dontCopySplitEvos) {
Evolution onlyEvo = pkmn.evolutionsTo.get(0);
if (!onlyEvo.carryStats) {
dontCopyPokes.add(pkmn);
@@ -57,14 +57,14 @@ public class RomFunctions {
return dontCopyPokes;
}
- public static Set<Pokemon> getMiddleEvolutions(RomHandler baseRom) {
+ public static Set<Pokemon> getMiddleEvolutions(RomHandler baseRom, boolean includeSplitEvos) {
List<Pokemon> allPokes = baseRom.getPokemon();
Set<Pokemon> middleEvolutions = new TreeSet<>();
for (Pokemon pkmn : allPokes) {
if (pkmn != null) {
if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() > 0) {
Evolution onlyEvo = pkmn.evolutionsTo.get(0);
- if (onlyEvo.carryStats) {
+ if (onlyEvo.carryStats || includeSplitEvos) {
middleEvolutions.add(pkmn);
}
}
@@ -73,14 +73,14 @@ public class RomFunctions {
return middleEvolutions;
}
- public static Set<Pokemon> getFinalEvolutions(RomHandler baseRom) {
+ public static Set<Pokemon> getFinalEvolutions(RomHandler baseRom, boolean includeSplitEvos) {
List<Pokemon> allPokes = baseRom.getPokemon();
Set<Pokemon> finalEvolutions = new TreeSet<>();
for (Pokemon pkmn : allPokes) {
if (pkmn != null) {
if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() == 0) {
Evolution onlyEvo = pkmn.evolutionsTo.get(0);
- if (onlyEvo.carryStats) {
+ if (onlyEvo.carryStats || includeSplitEvos) {
finalEvolutions.add(pkmn);
}
}
diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java
index 60528bb..e585dbe 100644
--- a/src/com/dabomstew/pkrandom/Settings.java
+++ b/src/com/dabomstew/pkrandom/Settings.java
@@ -242,6 +242,7 @@ public class Settings {
private boolean tmsForceGoodDamaging;
private int tmsGoodDamagingPercent = 0;
private boolean blockBrokenTMMoves;
+ private boolean tmsFollowEvolutions;
public enum TMsHMsCompatibilityMod {
UNCHANGED, RANDOM_PREFER_TYPE, COMPLETELY_RANDOM, FULL
@@ -259,6 +260,7 @@ public class Settings {
private boolean tutorsForceGoodDamaging;
private int tutorsGoodDamagingPercent = 0;
private boolean blockBrokenTutorMoves;
+ private boolean tutorFollowEvolutions;
public enum MoveTutorsCompatibilityMod {
UNCHANGED, RANDOM_PREFER_TYPE, COMPLETELY_RANDOM, FULL
@@ -424,7 +426,7 @@ public class Settings {
// 19 tms part 2
// new in 170
- out.write(makeByteSelected(fullHMCompat));
+ out.write(makeByteSelected(fullHMCompat, tmsFollowEvolutions, tutorFollowEvolutions));
// 20 tms good damaging
out.write((tmsForceGoodDamaging ? 0x80 : 0) | tmsGoodDamagingPercent);
@@ -684,7 +686,10 @@ public class Settings {
));
settings.setTmLevelUpMoveSanity(restoreState(data[18], 5));
settings.setKeepFieldMoveTMs(restoreState(data[18], 6));
+
settings.setFullHMCompat(restoreState(data[19], 0));
+ settings.setTmsFollowEvolutions(restoreState(data[19], 1));
+ settings.setTutorFollowEvolutions(restoreState(data[19], 2));
settings.setTmsForceGoodDamaging(restoreState(data[20], 7));
settings.setTmsGoodDamagingPercent(data[20] & 0x7F);
@@ -1908,6 +1913,14 @@ public class Settings {
this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
}
+ public boolean isTmsFollowEvolutions() {
+ return tmsFollowEvolutions;
+ }
+
+ public void setTmsFollowEvolutions(boolean tmsFollowEvolutions) {
+ this.tmsFollowEvolutions = tmsFollowEvolutions;
+ }
+
public MoveTutorMovesMod getMoveTutorMovesMod() {
return moveTutorMovesMod;
}
@@ -1972,6 +1985,14 @@ public class Settings {
this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
}
+ public boolean isTutorFollowEvolutions() {
+ return tutorFollowEvolutions;
+ }
+
+ public void setTutorFollowEvolutions(boolean tutorFollowEvolutions) {
+ this.tutorFollowEvolutions = tutorFollowEvolutions;
+ }
+
public InGameTradesMod getInGameTradesMod() {
return inGameTradesMod;
}
diff --git a/src/com/dabomstew/pkrandom/newgui/Bundle.properties b/src/com/dabomstew/pkrandom/newgui/Bundle.properties
index 34747a4..56fc225 100644
--- a/src/com/dabomstew/pkrandom/newgui/Bundle.properties
+++ b/src/com/dabomstew/pkrandom/newgui/Bundle.properties
@@ -574,4 +574,8 @@ GUI.settingsStringTooNew=The settings string was generated with a newer randomiz
GUI.settingsStringTooOld=The settings string was generated with an older randomizer version. It can only be used with version %s.
GUI.settingsStringLoaded=Settings loaded from string.
GUI.settingsStringOlder=This settings string was created by an older randomizer version.\nThe randomizer will attempt to open it anyway, but you should look out for new options added since you made it.
-GUI.pleaseUseTheLauncher=<html>The randomizer was not started via the launcher. You will not be able to load 3DS games into the randomizer.<br /><br />If you are seeing this message despite using the launcher, make sure that you are using the launcher bundled<br /> with version 4.0.2 (or later) of the randomizer. \ No newline at end of file
+GUI.pleaseUseTheLauncher=<html>The randomizer was not started via the launcher. You will not be able to load 3DS games into the randomizer.<br /><br />If you are seeing this message despite using the launcher, make sure that you are using the launcher bundled<br /> with version 4.0.2 (or later) of the randomizer.
+GUI.tmFollowEvolutionsCheckBox.text=Follow Evolutions
+GUI.tmFollowEvolutionsCheckBox.toolTipText=<html>When this is selected and TM compatibility is randomized, evolutions of a Pokemon will inherit that Pokemon's TM compatibilities.<br />Additionally, when a Pokemon evolves, each TM will have:<br /><b>Random (prefer same type)</b>: A 90% chance of becoming learnable if the Pokemon just gained its type through evolution, a 10% chance otherwise.<br/><b>Random (completely)</b>: A 25% chance of becoming learnable regardless of type.
+GUI.mtFollowEvolutionsCheckBox.text=Follow Evolutions
+GUI.mtFollowEvolutionsCheckBox.toolTipText=<html>When this is selected and move tutor compatibility is randomized, evolutions of a Pokemon will inherit that Pokemon's move tutor compatibilities.<br />Additionally, when a Pokemon evolves, each move will have:<br /><b>Random (prefer same type)</b>: A 90% chance of becoming learnable if the Pokemon just gained its type through evolution, a 10% chance otherwise.<br/><b>Random (completely)</b>: A 25% chance of becoming learnable regardless of type. \ No newline at end of file
diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
index 28d489d..3be2fd5 100644
--- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
+++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
@@ -2384,15 +2384,9 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmUnchangedRadioButton.toolTipText"/>
</properties>
</component>
- <hspacer id="f34b7">
- <constraints>
- <grid row="1" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
- <gridbag top="0" left="40" bottom="0" right="0" weightx="0.0" weighty="0.0"/>
- </constraints>
- </hspacer>
<vspacer id="c775">
<constraints>
- <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
</vspacer>
@@ -2419,31 +2413,20 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmRandomRadioButton.toolTipText"/>
</properties>
</component>
- <component id="b7d85" class="javax.swing.JCheckBox" binding="tmFullHMCompatibilityCheckBox">
- <constraints>
- <grid row="3" column="1" row-span="1" col-span="1" 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.tmFullHMCompatibilityCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmFullHMCompatibilityCheckBox.toolTipText"/>
- </properties>
- </component>
- <component id="7ba73" class="javax.swing.JCheckBox" binding="tmLevelupMoveSanityCheckBox" default-binding="true">
+ <component id="e94bb" class="javax.swing.JCheckBox" binding="tmNoGameBreakingMovesCheckBox">
<constraints>
- <grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" 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.tmLevelupMoveSanityCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmLevelupMoveSanityCheckBox.toolTipText"/>
+ <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmNoGameBreakingMovesCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmNoGameBreakingMovesCheckBox.toolTipText"/>
</properties>
</component>
<component id="e66ed" class="javax.swing.JCheckBox" binding="tmKeepFieldMoveTMsCheckBox">
<constraints>
- <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="2" row-span="1" col-span="1" 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>
@@ -2454,7 +2437,7 @@
</component>
<component id="39544" class="javax.swing.JCheckBox" binding="tmForceGoodDamagingCheckBox" default-binding="true">
<constraints>
- <grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="2" column="2" row-span="1" col-span="1" 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>
@@ -2465,7 +2448,7 @@
</component>
<component id="60c91" class="javax.swing.JSlider" binding="tmForceGoodDamagingSlider" default-binding="true">
<constraints>
- <grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ <grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
@@ -2479,17 +2462,6 @@
<value value="0"/>
</properties>
</component>
- <component id="e94bb" class="javax.swing.JCheckBox" binding="tmNoGameBreakingMovesCheckBox">
- <constraints>
- <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" 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.tmNoGameBreakingMovesCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmNoGameBreakingMovesCheckBox.toolTipText"/>
- </properties>
- </component>
</children>
</grid>
<hspacer id="fc0a6">
@@ -2535,12 +2507,6 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.thcUnchangedRadioButton.toolTipText"/>
</properties>
</component>
- <hspacer id="ba5b4">
- <constraints>
- <grid row="1" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
- <gridbag weightx="0.0" weighty="0.0"/>
- </constraints>
- </hspacer>
<vspacer id="f28aa">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
@@ -2592,6 +2558,39 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.thcFullCompatibilityRadioButton.toolTipText"/>
</properties>
</component>
+ <component id="65e15" class="javax.swing.JCheckBox" binding="tmFollowEvolutionsCheckBox">
+ <constraints>
+ <grid row="2" column="2" row-span="1" col-span="1" 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.tmFollowEvolutionsCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmFollowEvolutionsCheckBox.toolTipText"/>
+ </properties>
+ </component>
+ <component id="7ba73" class="javax.swing.JCheckBox" binding="tmLevelupMoveSanityCheckBox" default-binding="true">
+ <constraints>
+ <grid row="1" column="2" row-span="1" col-span="1" 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.tmLevelupMoveSanityCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmLevelupMoveSanityCheckBox.toolTipText"/>
+ </properties>
+ </component>
+ <component id="b7d85" class="javax.swing.JCheckBox" binding="tmFullHMCompatibilityCheckBox">
+ <constraints>
+ <grid row="3" column="2" row-span="1" col-span="1" 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.tmFullHMCompatibilityCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.tmFullHMCompatibilityCheckBox.toolTipText"/>
+ </properties>
+ </component>
</children>
</grid>
</children>
@@ -2649,15 +2648,9 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtUnchangedRadioButton.toolTipText"/>
</properties>
</component>
- <hspacer id="54b8">
- <constraints>
- <grid row="1" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
- <gridbag top="0" left="40" bottom="0" right="0" weightx="0.0" weighty="0.0"/>
- </constraints>
- </hspacer>
<vspacer id="e8b9">
<constraints>
- <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
+ <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
</vspacer>
@@ -2684,64 +2677,53 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtRandomRadioButton.toolTipText"/>
</properties>
</component>
- <component id="801a1" class="javax.swing.JCheckBox" binding="mtLevelupMoveSanityCheckBox">
- <constraints>
- <grid row="1" column="2" row-span="1" col-span="1" 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.mtLevelupMoveSanityCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtLevelupMoveSanityCheckBox.toolTipText"/>
- </properties>
- </component>
- <component id="d8aa" class="javax.swing.JCheckBox" binding="mtKeepFieldMoveTutorsCheckBox">
+ <component id="108c3" class="javax.swing.JSlider" binding="mtForceGoodDamagingSlider">
<constraints>
- <grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" 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.mtKeepFieldMoveTutorsCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtKeepFieldMoveTutorsCheckBox.toolTipText"/>
+ <majorTickSpacing value="20"/>
+ <minorTickSpacing value="5"/>
+ <paintLabels value="true"/>
+ <paintTicks value="true"/>
+ <snapToTicks value="true"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtForceGoodDamagingSlider.toolTipText"/>
+ <value value="0"/>
</properties>
</component>
- <component id="5a253" class="javax.swing.JCheckBox" binding="mtForceGoodDamagingCheckBox">
+ <component id="3c7ba" class="javax.swing.JCheckBox" binding="mtNoGameBreakingMovesCheckBox">
<constraints>
- <grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" 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.mtForceGoodDamagingCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtForceGoodDamagingCheckBox.toolTipText"/>
+ <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtNoGameBreakingMovesCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtNoGameBreakingMovesCheckBox.toolTipText"/>
</properties>
</component>
- <component id="108c3" class="javax.swing.JSlider" binding="mtForceGoodDamagingSlider">
+ <component id="d8aa" class="javax.swing.JCheckBox" binding="mtKeepFieldMoveTutorsCheckBox">
<constraints>
- <grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ <grid row="1" column="2" row-span="1" col-span="1" 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"/>
- <majorTickSpacing value="20"/>
- <minorTickSpacing value="5"/>
- <paintLabels value="true"/>
- <paintTicks value="true"/>
- <snapToTicks value="true"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtForceGoodDamagingSlider.toolTipText"/>
- <value value="0"/>
+ <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtKeepFieldMoveTutorsCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtKeepFieldMoveTutorsCheckBox.toolTipText"/>
</properties>
</component>
- <component id="3c7ba" class="javax.swing.JCheckBox" binding="mtNoGameBreakingMovesCheckBox">
+ <component id="5a253" class="javax.swing.JCheckBox" binding="mtForceGoodDamagingCheckBox">
<constraints>
- <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
+ <grid row="2" column="2" row-span="1" col-span="1" 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.mtNoGameBreakingMovesCheckBox.text"/>
- <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtNoGameBreakingMovesCheckBox.toolTipText"/>
+ <text resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtForceGoodDamagingCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtForceGoodDamagingCheckBox.toolTipText"/>
</properties>
</component>
</children>
@@ -2789,12 +2771,6 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtcUnchangedRadioButton.toolTipText"/>
</properties>
</component>
- <hspacer id="f81b6">
- <constraints>
- <grid row="1" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
- <gridbag weightx="0.0" weighty="0.0"/>
- </constraints>
- </hspacer>
<vspacer id="993c4">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
@@ -2846,6 +2822,28 @@
<toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtcFullCompatibilityRadioButton.toolTipText"/>
</properties>
</component>
+ <component id="e4773" class="javax.swing.JCheckBox" binding="mtFollowEvolutionsCheckBox">
+ <constraints>
+ <grid row="2" column="2" row-span="1" col-span="1" 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.mtFollowEvolutionsCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtFollowEvolutionsCheckBox.toolTipText"/>
+ </properties>
+ </component>
+ <component id="801a1" class="javax.swing.JCheckBox" binding="mtLevelupMoveSanityCheckBox">
+ <constraints>
+ <grid row="1" column="2" row-span="1" col-span="1" 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.mtLevelupMoveSanityCheckBox.text"/>
+ <toolTipText resource-bundle="com/dabomstew/pkrandom/newgui/Bundle" key="GUI.mtLevelupMoveSanityCheckBox.toolTipText"/>
+ </properties>
+ </component>
</children>
</grid>
<component id="5bbc3" class="javax.swing.JLabel" binding="mtNoExistLabel">
diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
index 26b9bba..92d0793 100644
--- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
+++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
@@ -280,6 +280,8 @@ public class NewRandomizerGUI {
private JComboBox pbsEXPCurveComboBox;
private JCheckBox miscRunWithoutRunningShoesCheckBox;
private JCheckBox peRemoveTimeBasedEvolutionsCheckBox;
+ private JCheckBox tmFollowEvolutionsCheckBox;
+ private JCheckBox mtFollowEvolutionsCheckBox;
private JCheckBox stpPercentageLevelModifierCheckBox;
private JSlider stpPercentageLevelModifierSlider;
@@ -526,6 +528,8 @@ public class NewRandomizerGUI {
ptRandomFollowEvolutionsRadioButton.addActionListener(e -> enableOrDisableSubControls());
ptRandomCompletelyRadioButton.addActionListener(e -> enableOrDisableSubControls());
spRandomizeStarterHeldItemsCheckBox.addActionListener(e -> enableOrDisableSubControls());
+ tmLevelupMoveSanityCheckBox.addActionListener(e -> enableOrDisableSubControls());
+ mtLevelupMoveSanityCheckBox.addActionListener(e -> enableOrDisableSubControls());
}
private void showInitialPopup() {
@@ -1415,6 +1419,7 @@ public class NewRandomizerGUI {
tmForceGoodDamagingCheckBox.setSelected(settings.isTmsForceGoodDamaging());
tmForceGoodDamagingSlider.setValue(settings.getTmsGoodDamagingPercent());
tmNoGameBreakingMovesCheckBox.setSelected(settings.isBlockBrokenTMMoves());
+ tmFollowEvolutionsCheckBox.setSelected(settings.isTmsFollowEvolutions());
mtcRandomCompletelyRadioButton
.setSelected(settings.getMoveTutorsCompatibilityMod() == Settings.MoveTutorsCompatibilityMod.COMPLETELY_RANDOM);
@@ -1431,6 +1436,7 @@ public class NewRandomizerGUI {
mtForceGoodDamagingCheckBox.setSelected(settings.isTutorsForceGoodDamaging());
mtForceGoodDamagingSlider.setValue(settings.getTutorsGoodDamagingPercent());
mtNoGameBreakingMovesCheckBox.setSelected(settings.isBlockBrokenTutorMoves());
+ mtFollowEvolutionsCheckBox.setSelected(settings.isTutorFollowEvolutions());
igtRandomizeBothRequestedGivenRadioButton
.setSelected(settings.getInGameTradesMod() == Settings.InGameTradesMod.RANDOMIZE_GIVEN_AND_REQUESTED);
@@ -1607,6 +1613,7 @@ public class NewRandomizerGUI {
settings.setTmsForceGoodDamaging(tmForceGoodDamagingCheckBox.isSelected());
settings.setTmsGoodDamagingPercent(tmForceGoodDamagingSlider.getValue());
settings.setBlockBrokenTMMoves(tmNoGameBreakingMovesCheckBox.isSelected());
+ settings.setTmsFollowEvolutions(tmFollowEvolutionsCheckBox.isSelected());
settings.setMoveTutorMovesMod(mtUnchangedRadioButton.isSelected(), mtRandomRadioButton.isSelected());
settings.setMoveTutorsCompatibilityMod(mtcUnchangedRadioButton.isSelected(), mtcRandomPreferSameTypeRadioButton.isSelected(),
@@ -1616,6 +1623,7 @@ public class NewRandomizerGUI {
settings.setTutorsForceGoodDamaging(mtForceGoodDamagingCheckBox.isSelected());
settings.setTutorsGoodDamagingPercent(mtForceGoodDamagingSlider.getValue());
settings.setBlockBrokenTutorMoves(mtNoGameBreakingMovesCheckBox.isSelected());
+ settings.setTutorFollowEvolutions(mtFollowEvolutionsCheckBox.isSelected());
settings.setInGameTradesMod(igtUnchangedRadioButton.isSelected(), igtRandomizeGivenPokemonOnlyRadioButton.isSelected(), igtRandomizeBothRequestedGivenRadioButton.isSelected());
settings.setRandomizeInGameTradesItems(igtRandomizeItemsCheckBox.isSelected());
@@ -2218,6 +2226,9 @@ public class NewRandomizerGUI {
tmForceGoodDamagingSlider.setVisible(true);
tmForceGoodDamagingSlider.setEnabled(false);
tmForceGoodDamagingSlider.setValue(tmForceGoodDamagingSlider.getMinimum());
+ tmFollowEvolutionsCheckBox.setVisible(true);
+ tmFollowEvolutionsCheckBox.setEnabled(false);
+ tmFollowEvolutionsCheckBox.setSelected(false);
thcUnchangedRadioButton.setVisible(true);
thcUnchangedRadioButton.setEnabled(false);
thcUnchangedRadioButton.setSelected(false);
@@ -2251,6 +2262,9 @@ public class NewRandomizerGUI {
mtForceGoodDamagingSlider.setVisible(true);
mtForceGoodDamagingSlider.setEnabled(false);
mtForceGoodDamagingSlider.setValue(mtForceGoodDamagingSlider.getMinimum());
+ mtFollowEvolutionsCheckBox.setVisible(true);
+ mtFollowEvolutionsCheckBox.setEnabled(false);
+ mtFollowEvolutionsCheckBox.setSelected(false);
mtcUnchangedRadioButton.setVisible(true);
mtcUnchangedRadioButton.setEnabled(false);
mtcUnchangedRadioButton.setSelected(false);
@@ -3069,6 +3083,8 @@ public class NewRandomizerGUI {
tmForceGoodDamagingCheckBox.setSelected(false);
tmNoGameBreakingMovesCheckBox.setEnabled(false);
tmNoGameBreakingMovesCheckBox.setSelected(false);
+ tmFollowEvolutionsCheckBox.setEnabled(false);
+ tmFollowEvolutionsCheckBox.setSelected(false);
mtLevelupMoveSanityCheckBox.setEnabled(false);
mtLevelupMoveSanityCheckBox.setSelected(false);
@@ -3078,6 +3094,8 @@ public class NewRandomizerGUI {
mtForceGoodDamagingCheckBox.setSelected(false);
mtNoGameBreakingMovesCheckBox.setEnabled(false);
mtNoGameBreakingMovesCheckBox.setSelected(false);
+ mtFollowEvolutionsCheckBox.setEnabled(false);
+ mtFollowEvolutionsCheckBox.setSelected(false);
} else {
tmUnchangedRadioButton.setEnabled(true);
tmRandomRadioButton.setEnabled(true);
@@ -3093,6 +3111,14 @@ public class NewRandomizerGUI {
tmLevelupMoveSanityCheckBox.setSelected(false);
}
+ if ((!thcUnchangedRadioButton.isSelected()) || (tmLevelupMoveSanityCheckBox.isSelected())) {
+ tmFollowEvolutionsCheckBox.setEnabled(true);
+ }
+ else {
+ tmFollowEvolutionsCheckBox.setEnabled(false);
+ tmFollowEvolutionsCheckBox.setSelected(false);
+ }
+
if (!(tmUnchangedRadioButton.isSelected())) {
tmKeepFieldMoveTMsCheckBox.setEnabled(true);
tmForceGoodDamagingCheckBox.setEnabled(true);
@@ -3115,6 +3141,14 @@ public class NewRandomizerGUI {
mtLevelupMoveSanityCheckBox.setSelected(false);
}
+ if (!(mtcUnchangedRadioButton.isSelected()) || (mtLevelupMoveSanityCheckBox.isSelected())) {
+ mtFollowEvolutionsCheckBox.setEnabled(true);
+ }
+ else {
+ mtFollowEvolutionsCheckBox.setEnabled(false);
+ mtFollowEvolutionsCheckBox.setSelected(false);
+ }
+
if (romHandler.hasMoveTutors() && !(mtUnchangedRadioButton.isSelected())) {
mtKeepFieldMoveTutorsCheckBox.setEnabled(true);
mtForceGoodDamagingCheckBox.setEnabled(true);
diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
index f64f941..26f92c7 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
@@ -3316,40 +3316,95 @@ public abstract class AbstractRomHandler implements RomHandler {
}
@Override
- public void randomizeTMHMCompatibility(boolean preferSameType) {
+ public void randomizeTMHMCompatibility(boolean preferSameType, boolean followEvolutions) {
// Get current compatibility
// new: increase HM chances if required early on
List<Integer> requiredEarlyOn = this.getEarlyRequiredHMMoves();
Map<Pokemon, boolean[]> compat = this.getTMHMCompatibility();
List<Integer> tmHMs = new ArrayList<>(this.getTMMoves());
tmHMs.addAll(this.getHMMoves());
+
+ if (followEvolutions) {
+ copyUpEvolutionsHelper(pk -> randomizePokemonMoveCompatibility(
+ pk, compat.get(pk), tmHMs, requiredEarlyOn, preferSameType),
+ (evFrom, evTo, toMonIsFinalEvo) -> copyPokemonMoveCompatibilityUpEvolutions(
+ evFrom, evTo, compat.get(evFrom), compat.get(evTo), tmHMs, preferSameType
+ ), true);
+ }
+ else {
+ for (Map.Entry<Pokemon, boolean[]> compatEntry : compat.entrySet()) {
+ randomizePokemonMoveCompatibility(compatEntry.getKey(), compatEntry.getValue(), tmHMs,
+ requiredEarlyOn, preferSameType);
+ }
+ }
+
+ // Set the new compatibility
+ this.setTMHMCompatibility(compat);
+ }
+
+ private void randomizePokemonMoveCompatibility(Pokemon pkmn, boolean[] moveCompatibilityFlags,
+ List<Integer> moveIDs, List<Integer> prioritizedMoves,
+ boolean preferSameType) {
List<Move> moveData = this.getMoves();
- for (Map.Entry<Pokemon, boolean[]> compatEntry : compat.entrySet()) {
- Pokemon pkmn = compatEntry.getKey();
- boolean[] flags = compatEntry.getValue();
- for (int i = 1; i <= tmHMs.size(); i++) {
- int move = tmHMs.get(i - 1);
+ for (int i = 1; i <= moveIDs.size(); i++) {
+ int move = moveIDs.get(i - 1);
+ Move mv = moveData.get(move);
+ double probability = getMoveCompatibilityProbability(
+ pkmn,
+ mv,
+ prioritizedMoves.contains(move),
+ preferSameType
+ );
+ moveCompatibilityFlags[i] = (this.random.nextDouble() < probability);
+ }
+ }
+
+ private void copyPokemonMoveCompatibilityUpEvolutions(Pokemon evFrom, Pokemon evTo, boolean[] prevCompatibilityFlags,
+ boolean[] toCompatibilityFlags, List<Integer> moveIDs,
+ boolean preferSameType) {
+ List<Move> moveData = this.getMoves();
+ for (int i = 1; i <= moveIDs.size(); i++) {
+ if (!prevCompatibilityFlags[i]) {
+ // Slight chance to gain TM/HM compatibility for a move if not learned by an earlier evolution step
+ // Without prefer same type: 25% chance
+ // With prefer same type: 10% chance, 90% chance for a type new to this evolution
+ int move = moveIDs.get(i - 1);
Move mv = moveData.get(move);
- double probability = 0.5;
+ double probability = 0.25;
if (preferSameType) {
- if (pkmn.primaryType.equals(mv.type)
- || (pkmn.secondaryType != null && pkmn.secondaryType.equals(mv.type))) {
+ probability = 0.1;
+ if (evTo.primaryType.equals(mv.type)
+ && !evTo.primaryType.equals(evFrom.primaryType) && !evTo.primaryType.equals(evFrom.secondaryType)
+ || evTo.secondaryType != null && evTo.secondaryType.equals(mv.type)
+ && !evTo.secondaryType.equals(evFrom.secondaryType) && !evTo.secondaryType.equals(evFrom.primaryType)) {
probability = 0.9;
- } else if (mv.type != null && mv.type.equals(Type.NORMAL)) {
- probability = 0.5;
- } else {
- probability = 0.25;
}
}
- if (requiredEarlyOn.contains(move)) {
- probability = Math.min(1.0, probability * 1.8);
- }
- flags[i] = (this.random.nextDouble() < probability);
+ toCompatibilityFlags[i] = (this.random.nextDouble() < probability);
+ }
+ else {
+ toCompatibilityFlags[i] = prevCompatibilityFlags[i];
}
}
+ }
- // Set the new compatibility
- this.setTMHMCompatibility(compat);
+ private double getMoveCompatibilityProbability(Pokemon pkmn, Move mv, boolean requiredEarlyOn,
+ boolean preferSameType) {
+ double probability = 0.5;
+ if (preferSameType) {
+ if (pkmn.primaryType.equals(mv.type)
+ || (pkmn.secondaryType != null && pkmn.secondaryType.equals(mv.type))) {
+ probability = 0.9;
+ } else if (mv.type != null && mv.type.equals(Type.NORMAL)) {
+ probability = 0.5;
+ } else {
+ probability = 0.25;
+ }
+ }
+ if (requiredEarlyOn) {
+ probability = Math.min(1.0, probability * 1.8);
+ }
+ return probability;
}
@Override
@@ -3386,6 +3441,20 @@ public abstract class AbstractRomHandler implements RomHandler {
}
@Override
+ public void ensureTMEvolutionSanity() {
+ Map<Pokemon, boolean[]> compat = this.getTMHMCompatibility();
+ // Don't do anything with the base, just copy upwards to ensure later evolutions retain learn compatibility
+ copyUpEvolutionsHelper(pk -> {}, ((evFrom, evTo, toMonIsFinalEvo) -> {
+ boolean[] fromCompat = compat.get(evFrom);
+ boolean[] toCompat = compat.get(evTo);
+ for (int i = 1; i < toCompat.length; i++) {
+ toCompat[i] |= fromCompat[i];
+ }
+ }), true);
+ this.setTMHMCompatibility(compat);
+ }
+
+ @Override
public void fullHMCompatibility() {
Map<Pokemon, boolean[]> compat = this.getTMHMCompatibility();
int tmCount = this.getTMCount();
@@ -3481,38 +3550,32 @@ public abstract class AbstractRomHandler implements RomHandler {
}
@Override
- public void randomizeMoveTutorCompatibility(boolean preferSameType) {
+ public void randomizeMoveTutorCompatibility(boolean preferSameType, boolean followEvolutions) {
if (!this.hasMoveTutors()) {
return;
}
// Get current compatibility
Map<Pokemon, boolean[]> compat = this.getMoveTutorCompatibility();
List<Integer> mts = this.getMoveTutorMoves();
- List<Move> moveData = this.getMoves();
- for (Map.Entry<Pokemon, boolean[]> compatEntry : compat.entrySet()) {
- Pokemon pkmn = compatEntry.getKey();
- boolean[] flags = compatEntry.getValue();
- for (int i = 1; i <= mts.size(); i++) {
- int move = mts.get(i - 1);
- Move mv = moveData.get(move);
- double probability = 0.5;
- if (preferSameType) {
- if (pkmn.primaryType.equals(mv.type)
- || (pkmn.secondaryType != null && pkmn.secondaryType.equals(mv.type))) {
- probability = 0.9;
- } else if (mv.type != null && mv.type.equals(Type.NORMAL)) {
- probability = 0.5;
- } else {
- probability = 0.25;
- }
- }
- flags[i] = (this.random.nextDouble() < probability);
+
+ // Empty list
+ List<Integer> priorityTutors = new ArrayList<Integer>();
+
+ if (followEvolutions) {
+ copyUpEvolutionsHelper(pk -> randomizePokemonMoveCompatibility(
+ pk, compat.get(pk), mts, priorityTutors, preferSameType),
+ (evFrom, evTo, toMonIsFinalEvo) -> copyPokemonMoveCompatibilityUpEvolutions(
+ evFrom, evTo, compat.get(evFrom), compat.get(evTo), mts, preferSameType
+ ), true);
+ }
+ else {
+ for (Map.Entry<Pokemon, boolean[]> compatEntry : compat.entrySet()) {
+ randomizePokemonMoveCompatibility(compatEntry.getKey(), compatEntry.getValue(), mts, priorityTutors, preferSameType);
}
}
// Set the new compatibility
this.setMoveTutorCompatibility(compat);
-
}
@Override
@@ -3552,7 +3615,23 @@ public abstract class AbstractRomHandler implements RomHandler {
}
}
this.setMoveTutorCompatibility(compat);
+ }
+ @Override
+ public void ensureMoveTutorEvolutionSanity() {
+ if (!this.hasMoveTutors()) {
+ return;
+ }
+ Map<Pokemon, boolean[]> compat = this.getMoveTutorCompatibility();
+ // Don't do anything with the base, just copy upwards to ensure later evolutions retain learn compatibility
+ copyUpEvolutionsHelper(pk -> {}, ((evFrom, evTo, toMonIsFinalEvo) -> {
+ boolean[] fromCompat = compat.get(evFrom);
+ boolean[] toCompat = compat.get(evTo);
+ for (int i = 1; i < toCompat.length; i++) {
+ toCompat[i] |= fromCompat[i];
+ }
+ }), true);
+ this.setMoveTutorCompatibility(compat);
}
@SuppressWarnings("unchecked")
@@ -4658,8 +4737,11 @@ public abstract class AbstractRomHandler implements RomHandler {
* Method to run on all base or no-copy Pokemon
* @param epAction
* Method to run on all evolved Pokemon with a linear chain of
+ * @param dontCopySplitEvos
+ * If true, treat split evolutions the same as other evolutions
*/
- private void copyUpEvolutionsHelper(BasePokemonAction bpAction, EvolvedPokemonAction epAction) {
+ private void copyUpEvolutionsHelper(BasePokemonAction bpAction, EvolvedPokemonAction epAction,
+ boolean dontCopySplitEvos) {
List<Pokemon> allPokes = this.getPokemonInclFormes();
for (Pokemon pk : allPokes) {
if (pk != null) {
@@ -4668,8 +4750,8 @@ public abstract class AbstractRomHandler implements RomHandler {
}
// Get evolution data.
- Set<Pokemon> dontCopyPokes = RomFunctions.getBasicOrNoCopyPokemon(this);
- Set<Pokemon> middleEvos = RomFunctions.getMiddleEvolutions(this);
+ Set<Pokemon> dontCopyPokes = RomFunctions.getBasicOrNoCopyPokemon(this, dontCopySplitEvos);
+ Set<Pokemon> middleEvos = RomFunctions.getMiddleEvolutions(this, dontCopySplitEvos);
for (Pokemon pk : dontCopyPokes) {
bpAction.applyTo(pk);
@@ -4705,6 +4787,10 @@ public abstract class AbstractRomHandler implements RomHandler {
}
}
+ private void copyUpEvolutionsHelper(BasePokemonAction bpAction, EvolvedPokemonAction epAction) {
+ copyUpEvolutionsHelper(bpAction, epAction, false);
+ }
+
private boolean checkForUnusedMove(List<Move> potentialList, Set<Integer> alreadyUsed) {
for (Move mv : potentialList) {
if (!alreadyUsed.contains(mv.number)) {
diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
index 06a5397..f288732 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
@@ -320,7 +320,7 @@ public interface RomHandler {
void setTMHMCompatibility(Map<Pokemon, boolean[]> compatData);
- void randomizeTMHMCompatibility(boolean preferSameType);
+ void randomizeTMHMCompatibility(boolean preferSameType, boolean evolutionSanity);
void fullTMHMCompatibility();
@@ -328,6 +328,8 @@ public interface RomHandler {
void ensureTMCompatSanity();
+ void ensureTMEvolutionSanity();
+
// new 170: full HM (but not TM) compat override
void fullHMCompatibility();
@@ -346,7 +348,7 @@ public interface RomHandler {
void setMoveTutorCompatibility(Map<Pokemon, boolean[]> compatData);
- void randomizeMoveTutorCompatibility(boolean preferSameType);
+ void randomizeMoveTutorCompatibility(boolean preferSameType, boolean evolutionSanity);
void fullMoveTutorCompatibility();
@@ -354,6 +356,8 @@ public interface RomHandler {
void ensureMoveTutorCompatSanity();
+ void ensureMoveTutorEvolutionSanity();
+
// Randomizer: trainer names
boolean canChangeTrainerText();