From ae45e1a40a7ecef5f843e72a73349aa51642c458 Mon Sep 17 00:00:00 2001 From: Ajarmar Date: Sun, 15 May 2022 22:02:13 +0200 Subject: set status moves correctly in gen 1-3 --- src/com/sneed/pkrandom/constants/GlobalConstants.java | 7 +++++++ src/com/sneed/pkrandom/romhandlers/Gen1RomHandler.java | 3 +++ src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java | 3 +++ src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java | 3 +++ 4 files changed, 16 insertions(+) diff --git a/src/com/sneed/pkrandom/constants/GlobalConstants.java b/src/com/sneed/pkrandom/constants/GlobalConstants.java index 4d3a594..1ac0b90 100644 --- a/src/com/sneed/pkrandom/constants/GlobalConstants.java +++ b/src/com/sneed/pkrandom/constants/GlobalConstants.java @@ -210,6 +210,13 @@ public class GlobalConstants { Abilities.shadowShield, Abilities.prismArmor, Abilities.libero, Abilities.stalwart ); + public static final List noPowerNonStatusMoves = Arrays.asList( + Moves.guillotine, Moves.hornDrill, Moves.sonicBoom, Moves.lowKick, Moves.counter, Moves.seismicToss, + Moves.dragonRage, Moves.fissure, Moves.nightShade, Moves.bide, Moves.psywave, Moves.superFang, + Moves.flail, Moves.revenge, Moves.returnTheMoveNotTheKeyword, Moves.present, Moves.frustration, + Moves.magnitude, Moves.mirrorCoat, Moves.beatUp, Moves.spitUp, Moves.sheerCold + ); + public static final int MIN_DAMAGING_MOVE_POWER = 50; public static final int HIGHEST_POKEMON_GEN = 8; diff --git a/src/com/sneed/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen1RomHandler.java index 1e08a8b..4d7f243 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen1RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen1RomHandler.java @@ -450,6 +450,9 @@ public class Gen1RomHandler extends AbstractGBCRomHandler { moves[trueMoveIndex].pp = rom[movesOffset + (i - 1) * 6 + 5] & 0xFF; moves[trueMoveIndex].type = idToType(rom[movesOffset + (i - 1) * 6 + 3] & 0xFF); moves[trueMoveIndex].category = GBConstants.physicalTypes.contains(moves[trueMoveIndex].type) ? MoveCategory.PHYSICAL : MoveCategory.SPECIAL; + if (moves[trueMoveIndex].power == 0 && !GlobalConstants.noPowerNonStatusMoves.contains(trueMoveIndex)) { + moves[trueMoveIndex].category = MoveCategory.STATUS; + } if (moves[trueMoveIndex].name.equals("Swift")) { perfectAccuracy = (int)moves[trueMoveIndex].hitratio; diff --git a/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java index 50daebd..a5f456d 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen2RomHandler.java @@ -412,6 +412,9 @@ public class Gen2RomHandler extends AbstractGBCRomHandler { moves[i].pp = rom[offs + (i - 1) * 7 + 5] & 0xFF; moves[i].type = Gen2Constants.typeTable[rom[offs + (i - 1) * 7 + 3]]; moves[i].category = GBConstants.physicalTypes.contains(moves[i].type) ? MoveCategory.PHYSICAL : MoveCategory.SPECIAL; + if (moves[i].power == 0 && !GlobalConstants.noPowerNonStatusMoves.contains(i)) { + moves[i].category = MoveCategory.STATUS; + } moves[i].secondaryEffectChance = ((rom[offs + (i - 1) * 7 + 6] & 0xFF)) / 255.0 * 100; if (i == Moves.swift) { diff --git a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java index c5f7f35..f9160bd 100755 --- a/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/sneed/pkrandom/romhandlers/Gen3RomHandler.java @@ -826,6 +826,9 @@ public class Gen3RomHandler extends AbstractGBRomHandler { moves[i].type = Gen3Constants.typeTable[rom[offs + i * 0xC + 2]]; moves[i].target = rom[offs + i * 0xC + 6] & 0xFF; moves[i].category = GBConstants.physicalTypes.contains(moves[i].type) ? MoveCategory.PHYSICAL : MoveCategory.SPECIAL; + if (moves[i].power == 0 && !GlobalConstants.noPowerNonStatusMoves.contains(i)) { + moves[i].category = MoveCategory.STATUS; + } moves[i].priority = rom[offs + i * 0xC + 7]; moves[i].secondaryEffectChance = rom[offs + i * 0xC + 5] & 0xFF; int flags = rom[offs + i * 0xC + 8] & 0xFF; -- cgit v1.2.3