summaryrefslogtreecommitdiff
path: root/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java')
-rwxr-xr-xsrc/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
index a9dff29..36c92a7 100755
--- a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
+++ b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java
@@ -4112,6 +4112,7 @@ public class Gen3RomHandler extends AbstractGBRomHandler {
if (romEntry.romType == Gen3Constants.RomType_FRLG) {
available |= MiscTweak.BALANCE_STATIC_LEVELS.getValue();
}
+ available |= MiscTweak.GUARANTEED_POKEMON_CATCHING.getValue();
return available;
}
@@ -4141,6 +4142,8 @@ public class Gen3RomHandler extends AbstractGBRomHandler {
}
} else if (tweak == MiscTweak.UPDATE_TYPE_EFFECTIVENESS) {
updateTypeEffectiveness();
+ } else if (tweak == MiscTweak.GUARANTEED_POKEMON_CATCHING) {
+ enableGuaranteedPokemonCatching();
}
}
@@ -4329,6 +4332,23 @@ public class Gen3RomHandler extends AbstractGBRomHandler {
}
}
+ private void enableGuaranteedPokemonCatching() {
+ int offset = find(rom, Gen3Constants.catchFailBranchLocator);
+ if (offset > 0) {
+ // In Cmd_handleballthrow, the middle of the function checks if the odds of catching a Pokemon
+ // is greater than 254; if it is, then the Pokemon is automatically caught. In ASM, this is
+ // represented by:
+ // cmp r6, #0xFE
+ // bls oddsLessThanOrEqualTo254
+ // The below code just nops these two instructions so that we *always* act like our odds are 255,
+ // and Pokemon are automatically caught no matter what.
+ rom[offset] = 0x00;
+ rom[offset + 1] = 0x00;
+ rom[offset + 2] = 0x00;
+ rom[offset + 3] = 0x00;
+ }
+ }
+
@Override
public boolean isRomValid() {
return romEntry.expectedCRC32 == actualCRC32;