diff options
author | tom-overton <tom.overton@outlook.com> | 2022-12-28 03:08:53 -0800 |
---|---|---|
committer | Rafael Marçalo <raroma09@gmail.com> | 2023-01-03 14:46:08 +0000 |
commit | 1cf78f475bdfb332b135ce5b50f02eabe00899c2 (patch) | |
tree | 0e1b6733db8df66ab9895d2f4039071aebf8abda /src/com | |
parent | c340cfcc1991228fe37ff0cf4768ccb8e416d548 (diff) |
Don't randomize Pokemon that are banned for wilds when Catch Em All is enabled (fixes #537)
Diffstat (limited to 'src/com')
-rwxr-xr-x | src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java b/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java index aade38d..77223e9 100755 --- a/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/AbstractRomHandler.java @@ -716,7 +716,6 @@ public abstract class AbstractRomHandler implements RomHandler { } // Assume EITHER catch em all OR type themed OR match strength for now if (catchEmAll) { - List<Pokemon> allPokes; if (allowAltFormes) { allPokes = noLegendaries ? new ArrayList<>(noLegendaryListInclFormes) : new ArrayList<>( @@ -735,6 +734,13 @@ public abstract class AbstractRomHandler implements RomHandler { pickablePokemon.removeAll(area.bannedPokemon); } for (Encounter enc : area.encounters) { + // In Catch 'Em All mode, don't randomize encounters for Pokemon that are banned for + // wild encounters. Otherwise, it may be impossible to obtain this Pokemon unless it + // randomly appears as a static or unless it becomes a random evolution. + if (banned.contains(enc.pokemon)) { + continue; + } + // Pick a random pokemon if (pickablePokemon.size() == 0) { // Only banned pokes are left, ignore them and pick @@ -935,7 +941,6 @@ public abstract class AbstractRomHandler implements RomHandler { } allPokes.removeAll(banned); for (EncounterSet area : scrambledEncounters) { - // Poke-set Set<Pokemon> inArea = pokemonInArea(area); // Build area map using catch em all Map<Pokemon, Pokemon> areaMap = new TreeMap<>(); @@ -989,6 +994,12 @@ public abstract class AbstractRomHandler implements RomHandler { } } for (Encounter enc : area.encounters) { + // In Catch 'Em All mode, don't randomize encounters for Pokemon that are banned for + // wild encounters. Otherwise, it may be impossible to obtain this Pokemon unless it + // randomly appears as a static or unless it becomes a random evolution. + if (banned.contains(enc.pokemon)) { + continue; + } // Apply the map enc.pokemon = areaMap.get(enc.pokemon); setFormeForEncounter(enc, enc.pokemon); |