summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authortom-overton <tom.overton@outlook.com>2022-07-13 00:20:12 -0700
committerrafa_99 <raroma09@gmail.com>2022-07-16 16:19:33 +0100
commitd3c970b67e3be3120f30c06eea3fac2dd9faa684 (patch)
treebd1d8f2a89fc958fceb3d69b8395e05c1c1cf489 /src/com
parent551615aba7baa32ae714da0c367f0d729817c9c3 (diff)
Make Evos Easier now makes Pokemon evolve at 160 happiness (was 220)
Diffstat (limited to 'src/com')
-rw-r--r--src/com/sneed/pkrandom/Randomizer.java3
-rw-r--r--src/com/sneed/pkrandom/constants/Gen2Constants.java2
-rw-r--r--src/com/sneed/pkrandom/constants/Gen3Constants.java2
-rw-r--r--src/com/sneed/pkrandom/constants/Gen4Constants.java2
-rw-r--r--src/com/sneed/pkrandom/constants/Gen5Constants.java2
-rw-r--r--src/com/sneed/pkrandom/constants/Gen6Constants.java2
-rw-r--r--src/com/sneed/pkrandom/constants/Gen7Constants.java2
-rw-r--r--src/com/sneed/pkrandom/newgui/Bundle.properties2
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java31
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java20
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java17
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java17
-rw-r--r--src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java17
-rw-r--r--src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java17
14 files changed, 133 insertions, 3 deletions
diff --git a/src/com/sneed/pkrandom/Randomizer.java b/src/com/sneed/pkrandom/Randomizer.java
index c518eda..86462c1 100644
--- a/src/com/sneed/pkrandom/Randomizer.java
+++ b/src/com/sneed/pkrandom/Randomizer.java
@@ -245,6 +245,9 @@ public class Randomizer {
if (settings.isMakeEvolutionsEasier()) {
log.println("--Making Evolutions Easier--");
+ if (!(romHandler instanceof Gen1RomHandler)) {
+ log.println("Friendship evolutions now take 160 happiness (was 220).");
+ }
logUpdatedEvolutions(log, romHandler.getEasierEvoUpdates(), null);
}
diff --git a/src/com/sneed/pkrandom/constants/Gen2Constants.java b/src/com/sneed/pkrandom/constants/Gen2Constants.java
index 4dde2bf..fd4992e 100644
--- a/src/com/sneed/pkrandom/constants/Gen2Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen2Constants.java
@@ -120,6 +120,8 @@ public class Gen2Constants {
public static final int priorityHitEffectIndex = 0x67, protectEffectIndex = 0x6F, endureEffectIndex = 0x74,
forceSwitchEffectIndex = 0x1C,counterEffectIndex = 0x59, mirrorCoatEffectIndex = 0x90;
+ public static final String friendshipValueForEvoLocator = "FEDCDA";
+
private static Type[] constructTypeTable() {
Type[] table = new Type[256];
table[0x00] = Type.NORMAL;
diff --git a/src/com/sneed/pkrandom/constants/Gen3Constants.java b/src/com/sneed/pkrandom/constants/Gen3Constants.java
index 5c075c3..98815e6 100644
--- a/src/com/sneed/pkrandom/constants/Gen3Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen3Constants.java
@@ -162,6 +162,8 @@ public class Gen3Constants {
public static final String eNatDexScriptPart2 = "3229610825F00129E40825F30116CD40010003";
+ public static final String friendshipValueForEvoLocator = "DB2900D8";
+
public static final int unhackedMaxPokedex = 411, unhackedRealPokedex = 386, hoennPokesStart = 252;
public static final int evolutionMethodCount = 15;
diff --git a/src/com/sneed/pkrandom/constants/Gen4Constants.java b/src/com/sneed/pkrandom/constants/Gen4Constants.java
index a998472..7a0acfa 100644
--- a/src/com/sneed/pkrandom/constants/Gen4Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen4Constants.java
@@ -768,6 +768,8 @@ public class Gen4Constants {
public static final String pickupTableLocator = "110012001A000300", rarePickupTableLocator = "19005C00DD00";
public static final int numberOfCommonPickupItems = 18, numberOfRarePickupItems = 11;
+ public static final String friendshipValueForEvoLocator = "DC286AD3";
+
public static final int[] dpptOverworldDexMaps = new int[] {
1, 2, 3, 4, 5, -1, -1, 6, -1, 7, // 0-9 (cities, pkmn league, wind/ironworks)
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10-19 (all mt coronet)
diff --git a/src/com/sneed/pkrandom/constants/Gen5Constants.java b/src/com/sneed/pkrandom/constants/Gen5Constants.java
index a510041..110e1b4 100644
--- a/src/com/sneed/pkrandom/constants/Gen5Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen5Constants.java
@@ -373,6 +373,8 @@ public class Gen5Constants {
public static final String pickupTableLocator = "19005C00DD00";
public static final int numberOfPickupItems = 29;
+ public static final String friendshipValueForEvoLocator = "DC282FD3";
+
public static final List<Integer> consumableHeldItems = setupAllConsumableItems();
private static List<Integer> setupAllConsumableItems() {
diff --git a/src/com/sneed/pkrandom/constants/Gen6Constants.java b/src/com/sneed/pkrandom/constants/Gen6Constants.java
index db50e46..4b2f2d6 100644
--- a/src/com/sneed/pkrandom/constants/Gen6Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen6Constants.java
@@ -247,6 +247,8 @@ public class Gen6Constants {
public static final int ingameTradeSize = 0x24;
+ public static final String friendshipValueForEvoLocator = "DC0050E3BC00002A";
+
public static final String[] fastestTextPrefixes = new String[]{"1080BDE80000A0E31080BDE8F0412DE9", "485080E59C4040E24C50C0E5EC009FE5"};
private static final List<Integer> mainGameShopsXY = Arrays.asList(
diff --git a/src/com/sneed/pkrandom/constants/Gen7Constants.java b/src/com/sneed/pkrandom/constants/Gen7Constants.java
index e549624..cd78fd3 100644
--- a/src/com/sneed/pkrandom/constants/Gen7Constants.java
+++ b/src/com/sneed/pkrandom/constants/Gen7Constants.java
@@ -317,6 +317,8 @@ public class Gen7Constants {
public static final int zygardeAssemblyScriptFile = 45;
public static final String zygardeAssemblyFormePrefix = "BC21CDE1B801CDE1", zygardeAssemblySpeciesPrefix = "FBEB4CD08DE20400A0E1F08FBDE8";
+ public static final String friendshipValueForEvoLocator = "DC0050E3F700002A";
+
public static int getPokemonCount(int romType) {
if (romType == Type_SM) {
return pokemonCountSM;
diff --git a/src/com/sneed/pkrandom/newgui/Bundle.properties b/src/com/sneed/pkrandom/newgui/Bundle.properties
index b3e55da..b81e0dc 100644
--- a/src/com/sneed/pkrandom/newgui/Bundle.properties
+++ b/src/com/sneed/pkrandom/newgui/Bundle.properties
@@ -84,7 +84,7 @@ GUI.peForceChangeCheckBox.toolTipText=<html>When selected, every evolution of a
GUI.peForceChangeCheckBox.text=Force Change
GUI.peChangeImpossibleEvosCheckBox.toolTipText=<html>If this is checked, every evolution that isn't possible to do without trading in the current game will be changed.<br /><b>Takes effect regardless of whether evolutions are randomized or not.</b><br />Some of the types that will be changed are:<ul><li>"Normal" trade evolutions<li>Trade evolutions with another condition, such as held item or Pokemon traded for<li>Day/night evolutions if there isn't day/night in the game<li>Contest-stat evolutions if there aren't contests in the game<li>Location-based evolutions, if those locations don't exist in the game<li>Move-based evolutions, <b>only if you randomize movesets</b></ul>
GUI.peChangeImpossibleEvosCheckBox.text=Change Impossible Evolutions
-GUI.peMakeEvolutionsEasierCheckBox.toolTipText=<html>If this is checked, Pokemon that evolve at a very high level will evolve at lower levels to make them more viable for shorter playthroughs.<br />Specifically, every Pokemon will evolve to its final stage by level 40, and three-stage evolutions will reach their middle stage by no later than level 30.<br />Additionally, Pokemon that normally evolve by having another specific Pokemon in the party will instead evolve at level 35.<br /><b>Takes effect regardless of whether evolutions are randomized or not.</b>
+GUI.peMakeEvolutionsEasierCheckBox.toolTipText=<html>If this is checked, Pokemon that evolve at a very high level will evolve at lower levels to make them more viable for shorter playthroughs.<br />Specifically, every Pokemon will evolve to its final stage by level 40, and three-stage evolutions will reach their middle stage by no later than level 30.<br />Additionally, Pokemon that normally evolve by having another specific Pokemon in the party will instead evolve at level 35.<br />Lastly, Pokemon that evolve via friendship will evolve at 160 happiness (down from 220), similar to how it works in the Switch Pokemon games.<br /><b>Takes effect regardless of whether evolutions are randomized or not.</b>
GUI.peMakeEvolutionsEasierCheckBox.text=Make Evolutions Easier
GUI.peRemoveTimeBasedEvolutions.toolTipText=<html>If this is checked, evolutions that require a certain time of day will now be possible regardless of the in-game time.<br />Split time-based evolutions (like Eevee => Espeon/Umbreon and Rockruff => Lycanroc) will be changed to stone evolutions instead.
GUI.peRemoveTimeBasedEvolutions.text=Remove Time-Based Evolutions
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java
index 1c47661..388bdbc 100755
--- a/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java
@@ -1780,6 +1780,24 @@ public class Gen2RomHandler extends AbstractGBCRomHandler {
return "Complete";
}
+ private static int find(byte[] haystack, String hexString) {
+ if (hexString.length() % 2 != 0) {
+ return -3; // error
+ }
+ byte[] searchFor = new byte[hexString.length() / 2];
+ for (int i = 0; i < searchFor.length; i++) {
+ searchFor[i] = (byte) Integer.parseInt(hexString.substring(i * 2, i * 2 + 2), 16);
+ }
+ List<Integer> found = RomFunctions.search(haystack, searchFor);
+ if (found.size() == 0) {
+ return -1; // not found
+ } else if (found.size() > 1) {
+ return -2; // not unique
+ } else {
+ return found.get(0);
+ }
+ }
+
@Override
public boolean hasTimeBasedEncounters() {
return true; // All GSC do
@@ -1888,7 +1906,18 @@ public class Gen2RomHandler extends AbstractGBCRomHandler {
@Override
public void makeEvolutionsEasier(Settings settings) {
- // No such thing
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(rom, Gen2Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // The thing we're looking at is actually one byte before what we
+ // want to change; this makes it work in both G/S and Crystal.
+ offset++;
+
+ // Amount of required happiness for all happiness evolutions.
+ if (rom[offset] == (byte)220) {
+ rom[offset] = (byte)160;
+ }
+ }
}
@Override
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
index 513c549..14a0987 100755
--- a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
@@ -3189,7 +3189,25 @@ public class Gen3RomHandler extends AbstractGBRomHandler {
@Override
public void makeEvolutionsEasier(Settings settings) {
- // No such thing
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(rom, Gen3Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // Amount of required happiness for HAPPINESS evolutions.
+ if (rom[offset] == (byte)219) {
+ rom[offset] = (byte)159;
+ }
+ // FRLG doesn't have code to handle time-based evolutions.
+ if (romEntry.romType != Gen3Constants.RomType_FRLG) {
+ // Amount of required happiness for HAPPINESS_DAY evolutions.
+ if (rom[offset + 38] == (byte)219) {
+ rom[offset + 38] = (byte)159;
+ }
+ // Amount of required happiness for HAPPINESS_NIGHT evolutions.
+ if (rom[offset + 66] == (byte)219) {
+ rom[offset + 66] = (byte)159;
+ }
+ }
+ }
}
@Override
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java
index 7632c8f..76e867a 100755
--- a/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java
@@ -4362,6 +4362,23 @@ public class Gen4RomHandler extends AbstractDSRomHandler {
public void makeEvolutionsEasier(Settings settings) {
boolean wildsRandomized = !settings.getWildPokemonMod().equals(Settings.WildPokemonMod.UNCHANGED);
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(arm9, Gen4Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // Amount of required happiness for HAPPINESS evolutions.
+ if (arm9[offset] == (byte)220) {
+ arm9[offset] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_DAY evolutions.
+ if (arm9[offset + 22] == (byte)220) {
+ arm9[offset + 22] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_NIGHT evolutions.
+ if (arm9[offset + 44] == (byte)220) {
+ arm9[offset + 44] = (byte)160;
+ }
+ }
+
if (wildsRandomized) {
for (Pokemon pkmn : pokes) {
if (pkmn != null) {
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java
index 075088c..0243132 100755
--- a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java
@@ -3189,6 +3189,23 @@ public class Gen5RomHandler extends AbstractDSRomHandler {
public void makeEvolutionsEasier(Settings settings) {
boolean wildsRandomized = !settings.getWildPokemonMod().equals(Settings.WildPokemonMod.UNCHANGED);
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(arm9, Gen5Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // Amount of required happiness for HAPPINESS evolutions.
+ if (arm9[offset] == (byte)220) {
+ arm9[offset] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_DAY evolutions.
+ if (arm9[offset + 20] == (byte)220) {
+ arm9[offset + 20] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_NIGHT evolutions.
+ if (arm9[offset + 38] == (byte)220) {
+ arm9[offset + 38] = (byte)160;
+ }
+ }
+
if (wildsRandomized) {
for (Pokemon pkmn : pokes) {
if (pkmn != null) {
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java
index b314667..6a388bf 100644
--- a/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java
@@ -3109,6 +3109,23 @@ public class Gen6RomHandler extends Abstract3DSRomHandler {
public void makeEvolutionsEasier(Settings settings) {
boolean wildsRandomized = !settings.getWildPokemonMod().equals(Settings.WildPokemonMod.UNCHANGED);
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(code, Gen6Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // Amount of required happiness for HAPPINESS evolutions.
+ if (code[offset] == (byte)220) {
+ code[offset] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_DAY evolutions.
+ if (code[offset + 12] == (byte)220) {
+ code[offset + 12] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_NIGHT evolutions.
+ if (code[offset + 36] == (byte)220) {
+ code[offset + 36] = (byte)160;
+ }
+ }
+
if (wildsRandomized) {
for (Pokemon pkmn : pokes) {
if (pkmn != null) {
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java
index 4faac9b..e99843c 100644
--- a/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java
@@ -2752,6 +2752,23 @@ public class Gen7RomHandler extends Abstract3DSRomHandler {
public void makeEvolutionsEasier(Settings settings) {
boolean wildsRandomized = !settings.getWildPokemonMod().equals(Settings.WildPokemonMod.UNCHANGED);
+ // Reduce the amount of happiness required to evolve.
+ int offset = find(code, Gen7Constants.friendshipValueForEvoLocator);
+ if (offset > 0) {
+ // Amount of required happiness for HAPPINESS evolutions.
+ if (code[offset] == (byte)220) {
+ code[offset] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_DAY evolutions.
+ if (code[offset + 12] == (byte)220) {
+ code[offset + 12] = (byte)160;
+ }
+ // Amount of required happiness for HAPPINESS_NIGHT evolutions.
+ if (code[offset + 36] == (byte)220) {
+ code[offset + 36] = (byte)160;
+ }
+ }
+
for (Pokemon pkmn : pokes) {
if (pkmn != null) {
Evolution extraEntry = null;