diff options
author | tom-overton <tom.overton@outlook.com> | 2022-12-24 01:14:27 -0800 |
---|---|---|
committer | Rafael Marçalo <raroma09@gmail.com> | 2023-01-03 14:40:57 +0000 |
commit | f5880a1039828686ff0d7d0bf8fac304044f9b62 (patch) | |
tree | 14f0be402724964a23ad59d8ba7d34b7241f8fbe /src/com/sneed/pkrandom/romhandlers | |
parent | ba8f9d0e32807bda37a6119b6692f5bc6bcc5095 (diff) |
Emerald: Add support for randomizing Mossdeep Steven
Diffstat (limited to 'src/com/sneed/pkrandom/romhandlers')
-rwxr-xr-x | src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java index e27d0f2..35961c8 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java @@ -1889,6 +1889,35 @@ public class Gen3RomHandler extends AbstractGBRomHandler { theTrainers.add(tr); } + if (romEntry.romType == Gen3Constants.RomType_Em) { + int mossdeepStevenOffset = romEntry.getValue("MossdeepStevenTeamOffset"); + Trainer mossdeepSteven = new Trainer(); + mossdeepSteven.offset = mossdeepStevenOffset; + mossdeepSteven.index = amount; + mossdeepSteven.poketype = 1; // Custom moves, but no held items + + // This is literally how the game does it too, lol. Have to subtract one because the + // trainers internally are one-indexed, but then theTrainers is zero-indexed. + Trainer meteorFallsSteven = theTrainers.get(Gen3Constants.emMeteorFallsStevenIndex - 1); + mossdeepSteven.trainerclass = meteorFallsSteven.trainerclass; + mossdeepSteven.name = meteorFallsSteven.name; + mossdeepSteven.fullDisplayName = meteorFallsSteven.fullDisplayName; + + for (int i = 0; i < 3; i++) { + int currentOffset = mossdeepStevenOffset + (i * 20); + TrainerPokemon thisPoke = new TrainerPokemon(); + thisPoke.pokemon = pokesInternal[readWord(currentOffset)]; + thisPoke.IVs = rom[currentOffset + 2]; + thisPoke.level = rom[currentOffset + 3]; + for (int move = 0; move < 4; move++) { + thisPoke.moves[move] = readWord(currentOffset + 12 + (move * 2)); + } + mossdeepSteven.pokemon.add(thisPoke); + } + + theTrainers.add(mossdeepSteven); + } + if (romEntry.romType == Gen3Constants.RomType_Ruby || romEntry.romType == Gen3Constants.RomType_Sapp) { Gen3Constants.trainerTagsRS(theTrainers, romEntry.romType); } else if (romEntry.romType == Gen3Constants.RomType_Em) { @@ -2012,6 +2041,21 @@ public class Gen3RomHandler extends AbstractGBRomHandler { } } + if (romEntry.romType == Gen3Constants.RomType_Em) { + int mossdeepStevenOffset = romEntry.getValue("MossdeepStevenTeamOffset"); + Trainer mossdeepSteven = trainerData.get(amount - 1); + + for (int i = 0; i < 3; i++) { + int currentOffset = mossdeepStevenOffset + (i * 20); + TrainerPokemon tp = mossdeepSteven.pokemon.get(i); + writeWord(currentOffset, pokedexToInternal[tp.pokemon.number]); + rom[currentOffset + 2] = (byte)tp.IVs; + rom[currentOffset + 3] = (byte)tp.level; + for (int move = 0; move < 4; move++) { + writeWord(currentOffset + 12 + (move * 2), tp.moves[move]); + } + } + } } private void writeWildArea(int offset, int numOfEntries, EncounterSet encounters) { |