From c5e32a2e30bdae5df663ef47b42dad7a9b1eab42 Mon Sep 17 00:00:00 2001 From: tom-overton Date: Tue, 17 May 2022 08:39:15 -0700 Subject: Read sound move information from moves --- src/com/sneed/pkrandom/constants/Gen3Constants.java | 4 ++++ src/com/sneed/pkrandom/constants/Gen4Constants.java | 4 ++++ src/com/sneed/pkrandom/pokemon/Move.java | 1 + src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java | 1 + src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java | 1 + src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java | 3 ++- src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java | 3 ++- src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java | 3 ++- 8 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/com/sneed/pkrandom/constants/Gen3Constants.java b/src/com/sneed/pkrandom/constants/Gen3Constants.java index 4721893..34dd4a9 100644 --- a/src/com/sneed/pkrandom/constants/Gen3Constants.java +++ b/src/com/sneed/pkrandom/constants/Gen3Constants.java @@ -207,6 +207,10 @@ public class Gen3Constants { noDamageAtkAndDefPlusOneEffect = 208, poisonTailEffect = 209, noDamageSpAtkAndSpDefPlusOneEffect = 211, noDamageAtkAndSpePlusOneEffect = 212; + public static final List soundMoves = Arrays.asList(Moves.growl, Moves.roar, Moves.sing, Moves.supersonic, + Moves.screech, Moves.snore, Moves.uproar, Moves.metalSound, Moves.grassWhistle, Moves.hyperVoice, + Moves.perishSong, Moves.healBell); + public static final List rsRequiredFieldTMs = Arrays.asList(1, 2, 6, 7, 11, 18, 22, 23, 26, 30, 37, 48); diff --git a/src/com/sneed/pkrandom/constants/Gen4Constants.java b/src/com/sneed/pkrandom/constants/Gen4Constants.java index b573913..4f44d6f 100644 --- a/src/com/sneed/pkrandom/constants/Gen4Constants.java +++ b/src/com/sneed/pkrandom/constants/Gen4Constants.java @@ -706,6 +706,10 @@ public class Gen4Constants { damageRecoil50PercentEffect = 269, damageSpDefMinusTwoEffect = 271, fireFangEffect = 273, iceFangEffect = 274, thunderFangEffect = 275, damageUserSpAtkPlusOneEffect = 276; + public static final List soundMoves = Arrays.asList(Moves.growl, Moves.roar, Moves.sing, Moves.supersonic, + Moves.screech, Moves.snore, Moves.uproar, Moves.metalSound, Moves.grassWhistle, Moves.hyperVoice, + Moves.bugBuzz, Moves.chatter, Moves.perishSong, Moves.healBell); + public static final List dpRequiredFieldTMs = Arrays.asList(2, 3, 5, 9, 12, 19, 23, 28, 34, 39, 41, 43, 46, 47, 49, 50, 62, 69, 79, 80, 82, 84, 85, 87); diff --git a/src/com/sneed/pkrandom/pokemon/Move.java b/src/com/sneed/pkrandom/pokemon/Move.java index a9e42ff..e1c4860 100755 --- a/src/com/sneed/pkrandom/pokemon/Move.java +++ b/src/com/sneed/pkrandom/pokemon/Move.java @@ -50,6 +50,7 @@ public class Move { public int absorbPercent; public int priority; public boolean makesContact; + public boolean isSoundMove; public int effectIndex; public int target; public double hitCount = 1; // not saved, only used in randomized move powers. diff --git a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java index 803a975..fe851c3 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java @@ -832,6 +832,7 @@ public class Gen3RomHandler extends AbstractGBRomHandler { moves[i].priority = rom[offs + i * 0xC + 7]; int flags = rom[offs + i * 0xC + 8] & 0xFF; moves[i].makesContact = (flags & 1) != 0; + moves[i].isSoundMove = Gen3Constants.soundMoves.contains(moves[i].number); if (i == Moves.swift) { perfectAccuracy = (int)moves[i].hitratio; diff --git a/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java index 223ba55..aea807e 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen4RomHandler.java @@ -577,6 +577,7 @@ public class Gen4RomHandler extends AbstractDSRomHandler { moves[i].priority = moveData[10]; int flags = moveData[11] & 0xFF; moves[i].makesContact = (flags & 1) != 0; + moves[i].isSoundMove = Gen4Constants.soundMoves.contains(moves[i].number); if (i == Moves.swift) { perfectAccuracy = (int)moves[i].hitratio; diff --git a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java index 4791888..287ed76 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen5RomHandler.java @@ -568,7 +568,8 @@ public class Gen5RomHandler extends AbstractDSRomHandler { } int flags = FileFunctions.readFullInt(moveData, 32); - moves[i].makesContact = (flags & 1) != 0; + moves[i].makesContact = (flags & 0x001) != 0; + moves[i].isSoundMove = (flags & 0x100) != 0; int qualities = moveData[1]; int recoilOrAbsorbPercent = moveData[18]; if (qualities == Gen5Constants.damageAbsorbQuality) { diff --git a/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java index e4c9bde..ecbbcf9 100644 --- a/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen6RomHandler.java @@ -619,7 +619,8 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { } int flags = FileFunctions.readFullInt(moveData, 32); - moves[i].makesContact = (flags & 1) != 0; + moves[i].makesContact = (flags & 0x001) != 0; + moves[i].isSoundMove = (flags & 0x100) != 0; int qualities = moveData[1]; int recoilOrAbsorbPercent = moveData[18]; if (qualities == Gen6Constants.damageAbsorbQuality) { diff --git a/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java index 9d4ceb7..161d62e 100644 --- a/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen7RomHandler.java @@ -691,7 +691,8 @@ public class Gen7RomHandler extends Abstract3DSRomHandler { } int flags = FileFunctions.readFullInt(moveData, 36); - moves[i].makesContact = (flags & 1) != 0; + moves[i].makesContact = (flags & 0x001) != 0; + moves[i].isSoundMove = (flags & 0x100) != 0; int qualities = moveData[1]; int recoilOrAbsorbPercent = moveData[18]; if (qualities == Gen7Constants.damageAbsorbQuality) { -- cgit v1.2.3