summaryrefslogtreecommitdiff
path: root/src/com/dabomstew/pkrandom
diff options
context:
space:
mode:
authortom-overton <tom.overton@outlook.com>2020-11-15 22:40:32 -0800
committertom-overton <tom.overton@outlook.com>2020-11-15 22:40:32 -0800
commite1f7006aa4b379834915d4770b0068fac18a2cb8 (patch)
treee7588bc64fb851ac1da5be6f66d8981126b1ea17 /src/com/dabomstew/pkrandom
parentdaf1e7f613c5bf948a0f405e5321b9b7ebc33428 (diff)
Add feature to select which EXP curve is used for Standardize EXP Curves
Diffstat (limited to 'src/com/dabomstew/pkrandom')
-rw-r--r--src/com/dabomstew/pkrandom/Randomizer.java2
-rw-r--r--src/com/dabomstew/pkrandom/Settings.java16
-rw-r--r--src/com/dabomstew/pkrandom/newgui/Bundle.properties8
-rw-r--r--src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form12
-rw-r--r--src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java38
-rwxr-xr-xsrc/com/dabomstew/pkrandom/pokemon/ExpCurve.java19
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java8
-rwxr-xr-xsrc/com/dabomstew/pkrandom/romhandlers/RomHandler.java2
8 files changed, 94 insertions, 11 deletions
diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java
index 49beda4..8a25d3c 100644
--- a/src/com/dabomstew/pkrandom/Randomizer.java
+++ b/src/com/dabomstew/pkrandom/Randomizer.java
@@ -151,7 +151,7 @@ public class Randomizer {
}
if (settings.isStandardizeEXPCurves()) {
- romHandler.standardizeEXPCurves(settings.getExpCurveMod());
+ romHandler.standardizeEXPCurves(settings.getExpCurveMod(), settings.getSelectedEXPCurve());
}
diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java
index 9fc82e8..6d29c29 100644
--- a/src/com/dabomstew/pkrandom/Settings.java
+++ b/src/com/dabomstew/pkrandom/Settings.java
@@ -36,6 +36,7 @@ import java.util.Base64;
import java.util.List;
import java.util.zip.CRC32;
+import com.dabomstew.pkrandom.pokemon.ExpCurve;
import com.dabomstew.pkrandom.pokemon.GenRestrictions;
import com.dabomstew.pkrandom.pokemon.Pokemon;
import com.dabomstew.pkrandom.romhandlers.Gen1RomHandler;
@@ -48,7 +49,7 @@ public class Settings {
public static final int VERSION = Version.VERSION;
- public static final int LENGTH_OF_SETTINGS_DATA = 46;
+ public static final int LENGTH_OF_SETTINGS_DATA = 47;
private CustomNamesSet customNames;
@@ -77,6 +78,7 @@ public class Settings {
private boolean updateBaseStats;
private int updateBaseStatsToGeneration;
private boolean standardizeEXPCurves;
+ private ExpCurve selectedEXPCurve;
private ExpCurveMod expCurveMod = ExpCurveMod.LEGENDARIES;
public enum AbilitiesMod {
@@ -534,6 +536,8 @@ public class Settings {
out.write(updateMovesToGeneration);
+ out.write(selectedEXPCurve.toByte());
+
try {
byte[] romName = this.romName.getBytes("US-ASCII");
out.write(romName.length);
@@ -795,6 +799,8 @@ public class Settings {
settings.setUpdateMovesToGeneration(data[45]);
+ settings.setSelectedEXPCurve(ExpCurve.fromByte(data[46]));
+
int romNameLength = data[LENGTH_OF_SETTINGS_DATA] & 0xFF;
String romName = new String(data, LENGTH_OF_SETTINGS_DATA + 1, romNameLength, "US-ASCII");
settings.setRomName(romName);
@@ -1097,6 +1103,14 @@ public class Settings {
this.expCurveMod = expCurveMod;
}
+ public ExpCurve getSelectedEXPCurve() {
+ return selectedEXPCurve;
+ }
+
+ public void setSelectedEXPCurve(ExpCurve expCurve) {
+ this.selectedEXPCurve = expCurve;
+ }
+
public boolean isUpdateBaseStats() {
return updateBaseStats;
}
diff --git a/src/com/dabomstew/pkrandom/newgui/Bundle.properties b/src/com/dabomstew/pkrandom/newgui/Bundle.properties
index 600e758..72f227d 100644
--- a/src/com/dabomstew/pkrandom/newgui/Bundle.properties
+++ b/src/com/dabomstew/pkrandom/newgui/Bundle.properties
@@ -32,10 +32,10 @@ GUI.pbsLegendariesSlowRadioButton.toolTipText=All legendaries get the "Slow" EXP
GUI.pbsLegendariesSlowRadioButton.text=Legendaries: Slow
GUI.pbsStrongLegendariesSlowRadioButton.toolTipText=<html>Strong legendaries get the "Slow" EXP Curve.<br />This includes all legendaries with >600 BST.
GUI.pbsStrongLegendariesSlowRadioButton.text=Strong Legendaries: Slow
-GUI.pbsAllMediumFastRadioButton.toolTipText=All Pokemon get the "Medium Fast" EXP Curve.
-GUI.pbsAllMediumFastRadioButton.text=All Medium Fast
-GUI.pbsStandardizeEXPCurvesCheckBox.toolTipText=<html>When this is selected, every Pokemon's EXP curve will be changed to one of the following:<ul><li>Medium Fast (1,000,000 EXP to Level 100) if it isn't a legendary<li>Slow (1,250,000 EXP to Level 100) according to the setting to the right.</ul>This will cause Pokemon to be better or worse based more on their stats/moves/type rather than the difficulty of leveling them.<br /><b>WARNING: This will break trade compatibility with ROMs that don't have this option enabled. Use with caution.</b><br />Note that this will affect evolutions; A Pokemon cannot evolve into a Pokemon with a different EXP Curve.
-GUI.pbsStandardizeEXPCurvesCheckBox.text=Standardize EXP Curves
+GUI.pbsAllMediumFastRadioButton.toolTipText=All Pokemon get the selected EXP Curve.
+GUI.pbsAllMediumFastRadioButton.text=All Pokemon
+GUI.pbsStandardizeEXPCurvesCheckBox.toolTipText=<html>When this is selected, every Pokemon's EXP curve will be changed to one of the following:<ul><li>The selected EXP curve if it isn't a legendary.<li>Slow (1,250,000 EXP to Level 100) according to the setting to the right.</ul>This will cause Pokemon to be better or worse based more on their stats/moves/type rather than the difficulty of leveling them.<br /><b>WARNING: This will break trade compatibility with ROMs that don't have this option enabled. Use with caution.</b><br />Note that this will affect evolutions; A Pokemon cannot evolve into a Pokemon with a different EXP Curve.
+GUI.pbsStandardizeEXPCurvesCheckBox.text=Standardize EXP Curves to:
GUI.pbsFollowEvolutionsCheckBox.toolTipText=<html>When this is selected and base stats are shuffled or randomized, evolutions of a Pokemon will inherit from their base form's rolls.<br />Shuffle: The same new ordering of stats will be used.<br />Randomized: The evolution will have the same proportion of stats as the base form.
GUI.pbsFollowEvolutionsCheckBox.text=Follow Evolutions
GUI.pbsUpdateBaseStatsCheckBox.toolTipText=<html>Select this to update the base stats of Pokemon in the loaded game to their values in the generation chosen to the right.<br />This does NOT:<br />* Add any new Pokemon to the game<br />* Split Special Attack and Special Defense in Gen 1.
diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
index 0843864..92b7779 100644
--- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
+++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.form
@@ -287,6 +287,18 @@
</model>
</properties>
</component>
+ <component id="7eb1a" class="javax.swing.JComboBox" binding="pbsEXPCurveComboBox">
+ <constraints>
+ <grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
+ <gridbag weightx="0.0" weighty="0.0"/>
+ </constraints>
+ <properties>
+ <enabled value="false"/>
+ <model>
+ <item value="Medium Fast"/>
+ </model>
+ </properties>
+ </component>
</children>
</grid>
<hspacer id="17e6a">
diff --git a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
index b9c963b..a159733 100644
--- a/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
+++ b/src/com/dabomstew/pkrandom/newgui/NewRandomizerGUI.java
@@ -30,6 +30,7 @@ import com.dabomstew.pkrandom.constants.GlobalConstants;
import com.dabomstew.pkrandom.exceptions.EncryptedROMException;
import com.dabomstew.pkrandom.exceptions.InvalidSupplementFilesException;
import com.dabomstew.pkrandom.exceptions.RandomizationException;
+import com.dabomstew.pkrandom.pokemon.ExpCurve;
import com.dabomstew.pkrandom.pokemon.GenRestrictions;
import com.dabomstew.pkrandom.pokemon.Pokemon;
import com.dabomstew.pkrandom.romhandlers.*;
@@ -52,6 +53,9 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+import static com.dabomstew.pkrandom.pokemon.ExpCurve.MEDIUM_FAST;
+import static com.dabomstew.pkrandom.pokemon.ExpCurve.MEDIUM_SLOW;
+
public class NewRandomizerGUI {
private JTabbedPane tabbedPane1;
private JCheckBox raceModeCheckBox;
@@ -273,6 +277,7 @@ public class NewRandomizerGUI {
private JCheckBox paWeighDuplicatesTogetherCheckBox;
private JCheckBox miscBalanceStaticLevelsCheckBox;
private JCheckBox miscRetainAltFormesCheckBox;
+ private JComboBox pbsEXPCurveComboBox;
private static JFrame frame;
@@ -1239,6 +1244,14 @@ public class NewRandomizerGUI {
pbsLegendariesSlowRadioButton.setSelected(settings.getExpCurveMod() == Settings.ExpCurveMod.LEGENDARIES);
pbsStrongLegendariesSlowRadioButton.setSelected(settings.getExpCurveMod() == Settings.ExpCurveMod.STRONG_LEGENDARIES);
pbsAllMediumFastRadioButton.setSelected(settings.getExpCurveMod() == Settings.ExpCurveMod.ALL);
+ ExpCurve[] expCurves = getEXPCurvesForGeneration(romHandler.generationOfPokemon());
+ int index = 0;
+ for (int i = 0; i < expCurves.length; i++) {
+ if (expCurves[i] == settings.getSelectedEXPCurve()) {
+ index = i;
+ }
+ }
+ pbsEXPCurveComboBox.setSelectedIndex(index);
pbsFollowMegaEvosCheckBox.setSelected(settings.isBaseStatsFollowMegaEvolutions());
paUnchangedRadioButton.setSelected(settings.getAbilitiesMod() == Settings.AbilitiesMod.UNCHANGED);
@@ -1463,6 +1476,8 @@ public class NewRandomizerGUI {
settings.setStandardizeEXPCurves(pbsStandardizeEXPCurvesCheckBox.isSelected());
settings.setExpCurveMod(pbsLegendariesSlowRadioButton.isSelected(), pbsStrongLegendariesSlowRadioButton.isSelected(),
pbsAllMediumFastRadioButton.isSelected());
+ ExpCurve[] expCurves = getEXPCurvesForGeneration(romHandler.generationOfPokemon());
+ settings.setSelectedEXPCurve(expCurves[pbsEXPCurveComboBox.getSelectedIndex()]);
settings.setBaseStatsFollowMegaEvolutions(pbsFollowMegaEvosCheckBox.isSelected() && pbsFollowMegaEvosCheckBox.isVisible());
settings.setAbilitiesMod(paUnchangedRadioButton.isSelected(), paRandomRadioButton.isSelected());
@@ -1758,6 +1773,10 @@ public class NewRandomizerGUI {
pbsStandardizeEXPCurvesCheckBox.setVisible(true);
pbsStandardizeEXPCurvesCheckBox.setEnabled(false);
pbsStandardizeEXPCurvesCheckBox.setSelected(false);
+ pbsEXPCurveComboBox.setVisible(true);
+ pbsEXPCurveComboBox.setEnabled(false);
+ pbsEXPCurveComboBox.setSelectedIndex(0);
+ pbsEXPCurveComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "Medium Fast" }));
pbsFollowEvolutionsCheckBox.setVisible(true);
pbsFollowEvolutionsCheckBox.setEnabled(false);
pbsFollowEvolutionsCheckBox.setSelected(false);
@@ -2343,6 +2362,13 @@ public class NewRandomizerGUI {
pbsUpdateBaseStatsCheckBox.setEnabled(pokemonGeneration < 8);
pbsFollowMegaEvosCheckBox.setVisible(romHandler.hasMegaEvolutions());
pbsUpdateComboBox.setVisible(pokemonGeneration < 8);
+ ExpCurve[] expCurves = getEXPCurvesForGeneration(pokemonGeneration);
+ String[] expCurveNames = new String[expCurves.length];
+ for (int i = 0; i < expCurves.length; i++) {
+ expCurveNames[i] = expCurves[i].toString();
+ }
+ pbsEXPCurveComboBox.setModel(new DefaultComboBoxModel<>(expCurveNames));
+ pbsEXPCurveComboBox.setSelectedIndex(0);
// Pokemon Types
ptUnchangedRadioButton.setEnabled(true);
@@ -2669,11 +2695,13 @@ public class NewRandomizerGUI {
pbsLegendariesSlowRadioButton.setEnabled(true);
pbsStrongLegendariesSlowRadioButton.setEnabled(true);
pbsAllMediumFastRadioButton.setEnabled(true);
+ pbsEXPCurveComboBox.setEnabled(true);
} else {
pbsLegendariesSlowRadioButton.setEnabled(false);
pbsLegendariesSlowRadioButton.setSelected(true);
pbsStrongLegendariesSlowRadioButton.setEnabled(false);
pbsAllMediumFastRadioButton.setEnabled(false);
+ pbsEXPCurveComboBox.setEnabled(false);
}
if (pbsUpdateBaseStatsCheckBox.isSelected()) {
@@ -3333,6 +3361,16 @@ public class NewRandomizerGUI {
}
}
+ private ExpCurve[] getEXPCurvesForGeneration(int generation) {
+ ExpCurve[] result;
+ if (generation < 3) {
+ result = new ExpCurve[]{ ExpCurve.MEDIUM_FAST, ExpCurve.MEDIUM_SLOW, ExpCurve.FAST, ExpCurve.SLOW };
+ } else {
+ result = new ExpCurve[]{ ExpCurve.MEDIUM_FAST, ExpCurve.MEDIUM_SLOW, ExpCurve.FAST, ExpCurve.SLOW, ExpCurve.ERRATIC, ExpCurve.FLUCTUATING };
+ }
+ return result;
+ }
+
public static void main(String[] args) {
launcherInput = args.length > 0 ? args[0] : "";
if (launcherInput.equals("please-use-the-launcher")) usedLauncher = true;
diff --git a/src/com/dabomstew/pkrandom/pokemon/ExpCurve.java b/src/com/dabomstew/pkrandom/pokemon/ExpCurve.java
index 67d40c5..ffd4c98 100755
--- a/src/com/dabomstew/pkrandom/pokemon/ExpCurve.java
+++ b/src/com/dabomstew/pkrandom/pokemon/ExpCurve.java
@@ -64,4 +64,23 @@ public enum ExpCurve {
return 0; // default
}
+ @Override
+ public String toString() {
+ switch (this) {
+ case MEDIUM_FAST:
+ return "Medium Fast";
+ case ERRATIC:
+ return "Erratic";
+ case FLUCTUATING:
+ return "Fluctuating";
+ case MEDIUM_SLOW:
+ return "Medium Slow";
+ case FAST:
+ return "Fast";
+ case SLOW:
+ return "Slow";
+ }
+ return null;
+ }
+
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
index 9cf21c6..182b4a5 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/AbstractRomHandler.java
@@ -4382,7 +4382,7 @@ public abstract class AbstractRomHandler implements RomHandler {
}
@Override
- public void standardizeEXPCurves(Settings.ExpCurveMod mod) {
+ public void standardizeEXPCurves(Settings.ExpCurveMod mod, ExpCurve expCurve) {
List<Pokemon> pokes = getPokemonInclFormes();
switch (mod) {
case LEGENDARIES:
@@ -4390,7 +4390,7 @@ public abstract class AbstractRomHandler implements RomHandler {
if (pkmn == null) {
continue;
}
- pkmn.growthCurve = pkmn.isLegendary() ? ExpCurve.SLOW : ExpCurve.MEDIUM_FAST;
+ pkmn.growthCurve = pkmn.isLegendary() ? ExpCurve.SLOW : expCurve;
}
break;
case STRONG_LEGENDARIES:
@@ -4398,7 +4398,7 @@ public abstract class AbstractRomHandler implements RomHandler {
if (pkmn == null) {
continue;
}
- pkmn.growthCurve = pkmn.isStrongLegendary() ? ExpCurve.SLOW : ExpCurve.MEDIUM_FAST;
+ pkmn.growthCurve = pkmn.isStrongLegendary() ? ExpCurve.SLOW : expCurve;
}
break;
case ALL:
@@ -4406,7 +4406,7 @@ public abstract class AbstractRomHandler implements RomHandler {
if (pkmn == null) {
continue;
}
- pkmn.growthCurve = ExpCurve.MEDIUM_FAST;
+ pkmn.growthCurve = expCurve;
}
break;
}
diff --git a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
index f0d0346..d70c935 100755
--- a/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
+++ b/src/com/dabomstew/pkrandom/romhandlers/RomHandler.java
@@ -479,7 +479,7 @@ public interface RomHandler {
// stats stuff
void minimumCatchRate(int rateNonLegendary, int rateLegendary);
- void standardizeEXPCurves(Settings.ExpCurveMod mod);
+ void standardizeEXPCurves(Settings.ExpCurveMod mod, ExpCurve expCurve);
// (Mostly) unchanging lists of moves