diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/sneed/pkrandom/config/gen3_offsets.ini | 6 | ||||
-rw-r--r-- | src/com/sneed/pkrandom/constants/Gen3Constants.java | 4 | ||||
-rwxr-xr-x | src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java | 44 |
3 files changed, 53 insertions, 1 deletions
diff --git a/src/com/sneed/pkrandom/config/gen3_offsets.ini b/src/com/sneed/pkrandom/config/gen3_offsets.ini index 18baf86..6d61d76 100755 --- a/src/com/sneed/pkrandom/config/gen3_offsets.ini +++ b/src/com/sneed/pkrandom/config/gen3_offsets.ini @@ -306,6 +306,7 @@ TrainerClassNameLength=13 TrainerNameLength=12 DoublesTrainerClasses=[34, 46, 55, 56, 57] EliteFourIndices=[261, 262, 263, 264, 335] +MossdeepStevenTeamOffset=0x5DD6D0 ItemEntrySize=44 ItemCount=376 MoveCount=354 @@ -903,6 +904,7 @@ StarterPokemon=0x5B63E4 StarterItems=0xB118E TrainerData=0x317B60 TrainerClassNames=0x317804 +MossdeepStevenTeamOffset=0x5E1BCC MoveDescriptions=0x620920 TmMoves=0x619F1C TmMovesDuplicate=0x61A3C8 @@ -1084,6 +1086,7 @@ StarterPokemon=0x5C2FB0 StarterItems=0xB1196 TrainerData=0x3249A0 TrainerClassNames=0x324644 +MossdeepStevenTeamOffset=0x5EEA98 MoveDescriptions=0x62DA80 TmMoves=0x62705C TmMovesDuplicate=0x627508 @@ -1265,6 +1268,7 @@ StarterPokemon=0x5B49FC StarterItems=0xBE596 TrainerData=0x316294 TrainerClassNames=0x315F38 +MossdeepStevenTeamOffset=0x5E04A4 MoveDescriptions=0x61EE38 TmMoves=0x6189D4 TmMovesDuplicate=0x618E80 @@ -1446,6 +1450,7 @@ StarterPokemon=0x5AE994 StarterItems=0xBE596 TrainerData=0x30F9F4 TrainerClassNames=0x30F698 +MossdeepStevenTeamOffset=0x5DA218 MoveDescriptions=0x619038 TmMoves=0x612730 TmMovesDuplicate=0x612BDC @@ -2098,6 +2103,7 @@ TrainerClassNameLength=11 TrainerNameLength=6 DoublesTrainerClasses=[34, 46, 55, 56, 57] EliteFourIndices=[261, 262, 263, 264, 335] +MossdeepStevenTeamOffset=0x5BC614 ItemEntrySize=40 ItemCount=376 MoveCount=354 diff --git a/src/com/sneed/pkrandom/constants/Gen3Constants.java b/src/com/sneed/pkrandom/constants/Gen3Constants.java index 7f440a0..90f6ecd 100644 --- a/src/com/sneed/pkrandom/constants/Gen3Constants.java +++ b/src/com/sneed/pkrandom/constants/Gen3Constants.java @@ -172,6 +172,8 @@ public class Gen3Constants { public static final int cacophonyIndex = 76, airLockIndex = 77, highestAbilityIndex = 77; + public static final int emMeteorFallsStevenIndex = 804; + public static final Map<Integer,List<Integer>> abilityVariations = setupAbilityVariations(); private static Map<Integer,List<Integer>> setupAbilityVariations() { @@ -711,7 +713,7 @@ public class Gen3Constants { tag(trs, "THEMED:WALLY-STRONG", 0x207, 0x290, 0x291, 0x292, 0x293, 0x294); // Steven - tag(trs, 0x324, "UBER"); + tag(trs, emMeteorFallsStevenIndex, "UBER"); } 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) { |