diff options
author | tom-overton <tom.overton@outlook.com> | 2022-05-09 00:35:59 -0700 |
---|---|---|
committer | tom-overton <tom.overton@outlook.com> | 2022-05-11 12:34:21 -0700 |
commit | 328ec752c7065b994590d237b2d05330b207174d (patch) | |
tree | aebff63f9ed63c62d1e0f8590a72d5c7646aa452 /src/com/dabomstew/pkrandom | |
parent | b81279fb4a46d62c5f2320b613925f0fbe29ca52 (diff) |
Read stat change information for every move
Diffstat (limited to 'src/com/dabomstew/pkrandom')
17 files changed, 929 insertions, 4 deletions
diff --git a/src/com/dabomstew/pkrandom/constants/Gen1Constants.java b/src/com/dabomstew/pkrandom/constants/Gen1Constants.java index 9e271e6..0979121 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen1Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen1Constants.java @@ -67,6 +67,13 @@ public class Gen1Constants { public static final List<Integer> fieldMoves = Arrays.asList( Moves.cut, Moves.fly, Moves.surf, Moves.strength, Moves.flash, Moves.dig, Moves.teleport); + public static final int noDamageAtkPlusOneEffect = 10, noDamageDefPlusOneEffect = 11, noDamageSpecialPlusOneEffect = 13, + noDamageEvasionPlusOneEffect = 15, noDamageAtkMinusOneEffect = 18, noDamageDefMinusOneEffect = 19, + noDamageSpeMinusOneEffect = 20, noDamageAccuracyMinusOneEffect = 22, noDamageAtkPlusTwoEffect = 50, + noDamageDefPlusTwoEffect = 51, noDamageSpePlusTwoEffect = 52, noDamageSpecialPlusTwoEffect = 53, + noDamageDefMinusTwoEffect = 59, damageAtkMinusOneEffect = 68, damageDefMinusOneEffect = 69, + damageSpeMinusOneEffect = 70, damageSpecialMinusOneEffect = 71; + public static final List<Integer> earlyRequiredHMs = Collections.singletonList(Moves.cut); public static final int hmsStartIndex = Gen1Items.hm01, tmsStartIndex = Gen1Items.tm01; diff --git a/src/com/dabomstew/pkrandom/constants/Gen2Constants.java b/src/com/dabomstew/pkrandom/constants/Gen2Constants.java index e0361bf..c3164af 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen2Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen2Constants.java @@ -72,6 +72,16 @@ public class Gen2Constants { public static final int mapGroupCount = 26, mapsInLastGroup = 11; + public static final int noDamageAtkPlusOneEffect = 10, noDamageDefPlusOneEffect = 11, noDamageSpAtkPlusOneEffect = 13, + noDamageEvasionPlusOneEffect = 16, noDamageAtkMinusOneEffect = 18, noDamageDefMinusOneEffect = 19, + noDamageSpeMinusOneEffect = 20, noDamageAccuracyMinusOneEffect = 23, noDamageEvasionMinusOneEffect = 24, + noDamageAtkPlusTwoEffect = 50, noDamageDefPlusTwoEffect = 51, noDamageSpePlusTwoEffect = 52, + noDamageSpDefPlusTwoEffect = 54, noDamageAtkMinusTwoEffect = 58, noDamageDefMinusTwoEffect = 59, + noDamageSpeMinusTwoEffect = 60, noDamageSpDefMinusTwoEffect = 62, damageAtkMinusOneEffect = 68, + damageDefMinusOneEffect = 69, damageSpeMinusOneEffect = 70, damageSpDefMinusOneEffect = 72, + damageAccuracyMinusOneEffect = 73, swaggerEffect = 118, damageUserDefPlusOneEffect = 138, + damageUserAtkPlusOneEffect = 139, damageUserAllPlusOneEffect = 140, defenseCurlEffect = 156; + public static final List<Integer> requiredFieldTMs = Arrays.asList(4, 20, 22, 26, 28, 34, 35, 39, 40, 43, 44, 46); diff --git a/src/com/dabomstew/pkrandom/constants/Gen3Constants.java b/src/com/dabomstew/pkrandom/constants/Gen3Constants.java index c5f4b62..f904d1b 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen3Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen3Constants.java @@ -185,6 +185,20 @@ public class Gen3Constants { public static final int frlgMapLabelsStart = 0x58; + public static final int noDamageAtkPlusOneEffect = 10, noDamageDefPlusOneEffect = 11, noDamageSpAtkPlusOneEffect = 13, + noDamageEvasionPlusOneEffect = 16, noDamageAtkMinusOneEffect = 18, noDamageDefMinusOneEffect = 19, + noDamageSpeMinusOneEffect = 20, noDamageAccuracyMinusOneEffect = 23, noDamageEvasionMinusOneEffect = 24, + noDamageAtkPlusTwoEffect = 50, noDamageDefPlusTwoEffect = 51, noDamageSpePlusTwoEffect = 52, + noDamageSpAtkPlusTwoEffect = 53, noDamageSpDefPlusTwoEffect = 54, noDamageAtkMinusTwoEffect = 58, + noDamageDefMinusTwoEffect = 59, noDamageSpeMinusTwoEffect = 60, noDamageSpDefMinusTwoEffect = 62, + damageAtkMinusOneEffect = 68, damageDefMinusOneEffect = 69, damageSpeMinusOneEffect = 70, + damageSpAtkMinusOneEffect = 71, damageSpDefMinusOneEffect = 72, damageAccuracyMinusOneEffect = 73, + minimizeEffect = 108, swaggerEffect = 118, damageUserDefPlusOneEffect = 138, damageUserAtkPlusOneEffect = 139, + damageUserAllPlusOneEffect = 140, defenseCurlEffect = 156, flatterEffect = 166, chargeEffect = 174, + damageUserAtkAndDefMinusOneEffect = 182, damageUserSpAtkMinusTwoEffect = 204, noDamageAtkAndDefMinusOneEffect = 205, + noDamageDefAndSpDefPlusOneEffect = 206, noDamageAtkAndDefPlusOneEffect = 208, noDamageSpAtkAndSpDefPlusOneEffect = 211, + noDamageAtkAndSpePlusOneEffect = 212; + public static final List<Integer> rsRequiredFieldTMs = Arrays.asList(1, 2, 6, 7, 11, 18, 22, 23, 26, 30, 37, 48); diff --git a/src/com/dabomstew/pkrandom/constants/Gen4Constants.java b/src/com/dabomstew/pkrandom/constants/Gen4Constants.java index 47a4148..6218581 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen4Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen4Constants.java @@ -681,6 +681,21 @@ public class Gen4Constants { } } + public static final int noDamageAtkPlusOneEffect = 10, noDamageDefPlusOneEffect = 11, noDamageSpAtkPlusOneEffect = 13, + noDamageEvasionPlusOneEffect = 16, noDamageAtkMinusOneEffect = 18, noDamageDefMinusOneEffect = 19, + noDamageSpeMinusOneEffect = 20, noDamageAccuracyMinusOneEffect = 23, noDamageEvasionMinusOneEffect = 24, + noDamageAtkPlusTwoEffect = 50, noDamageDefPlusTwoEffect = 51, noDamageSpePlusTwoEffect = 52, + noDamageSpAtkPlusTwoEffect = 53, noDamageSpDefPlusTwoEffect = 54, noDamageAtkMinusTwoEffect = 58, + noDamageDefMinusTwoEffect = 59, noDamageSpeMinusTwoEffect = 60, noDamageSpDefMinusTwoEffect = 62, + damageAtkMinusOneEffect = 68, damageDefMinusOneEffect = 69, damageSpeMinusOneEffect = 70, + damageSpAtkMinusOneEffect = 71, damageSpDefMinusOneEffect = 72, damageAccuracyMinusOneEffect = 73, + minimizeEffect = 108, swaggerEffect = 118, damageUserDefPlusOneEffect = 138, damageUserAtkPlusOneEffect = 139, + damageUserAllPlusOneEffect = 140, defenseCurlEffect = 156, flatterEffect = 166, chargeEffect = 174, + damageUserAtkAndDefMinusOneEffect = 182, damageUserSpAtkMinusTwoEffect = 204, noDamageAtkAndDefMinusOneEffect = 205, + noDamageDefAndSpDefPlusOneEffect = 206, noDamageAtkAndDefPlusOneEffect = 208, noDamageSpAtkAndSpDefPlusOneEffect = 211, + noDamageAtkAndSpePlusOneEffect = 212, damageUserSpeMinusOneEffect = 218, damageUserDefAndSpDefMinusOneEffect = 229, + noDamageSpAtkMinusTwoEffect = 265, damageSpDefMinusTwoEffect = 271, damageUserSpAtkPlusOneEffect = 276; + public static final List<Integer> 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/dabomstew/pkrandom/constants/Gen5Constants.java b/src/com/dabomstew/pkrandom/constants/Gen5Constants.java index aa1d920..ff1471c 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen5Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen5Constants.java @@ -156,6 +156,8 @@ public class Gen5Constants { }
}
+ public static final int noDamageStatChangeQuality = 2, noDamageStatusAndStatChangeQuality = 5, damageTargetDebuffQuality = 6, damageUserBuffQuality = 7;
+
public static final Type[] typeTable = constructTypeTable();
private static final Map<Integer,String> bw1FormeSuffixes = setupFormeSuffixes(Gen5Constants.Type_BW);
diff --git a/src/com/dabomstew/pkrandom/constants/Gen6Constants.java b/src/com/dabomstew/pkrandom/constants/Gen6Constants.java index 2706dc4..8911568 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen6Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen6Constants.java @@ -192,6 +192,8 @@ public class Gen6Constants { } } + public static final int noDamageStatChangeQuality = 2, noDamageStatusAndStatChangeQuality = 5, damageTargetDebuffQuality = 6, damageUserBuffQuality = 7; + public static List<Integer> bannedMoves = Collections.singletonList(Moves.hyperspaceFury); public static final Type[] typeTable = constructTypeTable(); diff --git a/src/com/dabomstew/pkrandom/constants/Gen7Constants.java b/src/com/dabomstew/pkrandom/constants/Gen7Constants.java index b526631..2728fb8 100644 --- a/src/com/dabomstew/pkrandom/constants/Gen7Constants.java +++ b/src/com/dabomstew/pkrandom/constants/Gen7Constants.java @@ -216,6 +216,8 @@ public class Gen7Constants { } } + public static final int noDamageStatChangeQuality = 2, noDamageStatusAndStatChangeQuality = 5, damageTargetDebuffQuality = 6, damageUserBuffQuality = 7; + public static List<Integer> bannedMoves = Arrays.asList(Moves.darkVoid, Moves.hyperspaceFury); public static final Type[] typeTable = constructTypeTable(); diff --git a/src/com/dabomstew/pkrandom/pokemon/Move.java b/src/com/dabomstew/pkrandom/pokemon/Move.java index 73da4e3..3940339 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Move.java +++ b/src/com/dabomstew/pkrandom/pokemon/Move.java @@ -25,6 +25,11 @@ package com.dabomstew.pkrandom.pokemon; /*----------------------------------------------------------------------------*/ public class Move { + public class StatChange { + public StatBuffType type; + public int stages; + public double percentChance; + } public String name; public int number; @@ -33,11 +38,24 @@ public class Move { public int pp; public double hitratio; public Type type; + public StatChangeType statChangeType = StatChangeType.NONE_OR_UNKNOWN; + public StatChange[] statChanges = new StatChange[3]; public int effectIndex; + public int target; public MoveCategory category; public double hitCount = 1; // not saved, only used in randomized move powers. + public double secondaryEffectChance; public int priority; + public Move() { + // Initialize all statStageChanges to something sensible so that we don't need to have + // each RomHandler mess with them if they don't need to. + for (int i = 0; i < this.statChanges.length; i++) { + this.statChanges[i] = new StatChange(); + this.statChanges[i].type = StatBuffType.NONE; + } + } + public String toString() { return "#" + number + " " + name + " - Power: " + power + ", Base PP: " + pp + ", Type: " + type + ", Hit%: " + (hitratio) + ", Effect: " + effectIndex + ", Priority: " + priority; diff --git a/src/com/dabomstew/pkrandom/pokemon/StatBuffType.java b/src/com/dabomstew/pkrandom/pokemon/StatBuffType.java new file mode 100644 index 0000000..5fb1591 --- /dev/null +++ b/src/com/dabomstew/pkrandom/pokemon/StatBuffType.java @@ -0,0 +1,39 @@ +package com.dabomstew.pkrandom.pokemon; + +/*----------------------------------------------------------------------------*/ +/*-- StatBuffType.java - represents the types of stat buffs that a move --*/ +/*-- can apply. --*/ +/*-- --*/ +/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/ +/*-- Originally part of "Universal Pokemon Randomizer" by Dabomstew --*/ +/*-- Pokemon and any associated names and the like are --*/ +/*-- trademark and (C) Nintendo 1996-2020. --*/ +/*-- --*/ +/*-- The custom code written here is licensed under the terms of the GPL: --*/ +/*-- --*/ +/*-- This program is free software: you can redistribute it and/or modify --*/ +/*-- it under the terms of the GNU General Public License as published by --*/ +/*-- the Free Software Foundation, either version 3 of the License, or --*/ +/*-- (at your option) any later version. --*/ +/*-- --*/ +/*-- This program is distributed in the hope that it will be useful, --*/ +/*-- but WITHOUT ANY WARRANTY; without even the implied warranty of --*/ +/*-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --*/ +/*-- GNU General Public License for more details. --*/ +/*-- --*/ +/*-- You should have received a copy of the GNU General Public License --*/ +/*-- along with this program. If not, see <http://www.gnu.org/licenses/>. --*/ +/*----------------------------------------------------------------------------*/ + +public enum StatBuffType { + NONE, + ATTACK, + DEFENSE, + SPECIAL_ATTACK, + SPECIAL_DEFENSE, + SPEED, + ACCURACY, + EVASION, + ALL, + SPECIAL +}
\ No newline at end of file diff --git a/src/com/dabomstew/pkrandom/pokemon/StatChangeType.java b/src/com/dabomstew/pkrandom/pokemon/StatChangeType.java new file mode 100644 index 0000000..03d8baf --- /dev/null +++ b/src/com/dabomstew/pkrandom/pokemon/StatChangeType.java @@ -0,0 +1,35 @@ +package com.dabomstew.pkrandom.pokemon; + +/*----------------------------------------------------------------------------*/ +/*-- StatChangeType.java - represents the different types of moves --*/ +/*-- that can change a battler's stats. --*/ +/*-- --*/ +/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/ +/*-- Pokemon and any associated names and the like are --*/ +/*-- trademark and (C) Nintendo 1996-2020. --*/ +/*-- --*/ +/*-- The custom code written here is licensed under the terms of the GPL: --*/ +/*-- --*/ +/*-- This program is free software: you can redistribute it and/or modify --*/ +/*-- it under the terms of the GNU General Public License as published by --*/ +/*-- the Free Software Foundation, either version 3 of the License, or --*/ +/*-- (at your option) any later version. --*/ +/*-- --*/ +/*-- This program is distributed in the hope that it will be useful, --*/ +/*-- but WITHOUT ANY WARRANTY; without even the implied warranty of --*/ +/*-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --*/ +/*-- GNU General Public License for more details. --*/ +/*-- --*/ +/*-- You should have received a copy of the GNU General Public License --*/ +/*-- along with this program. If not, see <http://www.gnu.org/licenses/>. --*/ +/*----------------------------------------------------------------------------*/ + +public enum StatChangeType { + NONE_OR_UNKNOWN, + NO_DAMAGE_STAT_CHANGE_TARGET, + NO_DAMAGE_STAT_CHANGE_USER, + NO_DAMAGE_STAT_CHANGE_ALL, + NO_DAMAGE_STAT_CHANGE_ALLY, + DAMAGE_STAT_CHANGE_TARGET, + DAMAGE_STAT_CHANGE_USER +} diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java index 5669de8..257ddfc 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen1RomHandler.java @@ -460,9 +460,114 @@ public class Gen1RomHandler extends AbstractGBCRomHandler { } else if (GlobalConstants.doubleHitMoves.contains(i)) {
moves[trueMoveIndex].hitCount = 2;
}
+
+ loadStatChangesFromEffect(moves[trueMoveIndex]);
}
}
+ }
+ private void loadStatChangesFromEffect(Move move) {
+ switch (move.effectIndex) {
+ case Gen1Constants.noDamageAtkPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen1Constants.noDamageDefPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen1Constants.noDamageSpecialPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen1Constants.noDamageEvasionPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.EVASION;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen1Constants.noDamageAtkMinusOneEffect:
+ case Gen1Constants.damageAtkMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen1Constants.noDamageDefMinusOneEffect:
+ case Gen1Constants.damageDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen1Constants.noDamageSpeMinusOneEffect:
+ case Gen1Constants.damageSpeMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen1Constants.noDamageAccuracyMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ACCURACY;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen1Constants.noDamageAtkPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen1Constants.noDamageDefPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen1Constants.noDamageSpePlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen1Constants.noDamageSpecialPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen1Constants.noDamageDefMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen1Constants.damageSpecialMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL;
+ move.statChanges[0].stages = -1;
+ break;
+ default:
+ // Move does not have a stat-changing effect
+ return;
+ }
+
+ switch (move.effectIndex) {
+ case Gen1Constants.noDamageAtkPlusOneEffect:
+ case Gen1Constants.noDamageDefPlusOneEffect:
+ case Gen1Constants.noDamageSpecialPlusOneEffect:
+ case Gen1Constants.noDamageEvasionPlusOneEffect:
+ case Gen1Constants.noDamageAtkMinusOneEffect:
+ case Gen1Constants.noDamageDefMinusOneEffect:
+ case Gen1Constants.noDamageSpeMinusOneEffect:
+ case Gen1Constants.noDamageAccuracyMinusOneEffect:
+ case Gen1Constants.noDamageAtkPlusTwoEffect:
+ case Gen1Constants.noDamageDefPlusTwoEffect:
+ case Gen1Constants.noDamageSpePlusTwoEffect:
+ case Gen1Constants.noDamageSpecialPlusTwoEffect:
+ case Gen1Constants.noDamageDefMinusTwoEffect:
+ if (move.statChanges[0].stages < 0) {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET;
+ } else {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER;
+ }
+ break;
+
+ case Gen1Constants.damageAtkMinusOneEffect:
+ case Gen1Constants.damageDefMinusOneEffect:
+ case Gen1Constants.damageSpeMinusOneEffect:
+ case Gen1Constants.damageSpecialMinusOneEffect:
+ move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET;
+ break;
+ }
+
+ if (move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_TARGET) {
+ for (int i = 0; i < move.statChanges.length; i++) {
+ if (move.statChanges[i].type != StatBuffType.NONE) {
+ move.statChanges[i].percentChance = 85 / 256.0;
+ }
+ }
+ }
}
private void saveMoves() {
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java index 5c48e20..3abb31d 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen2RomHandler.java @@ -412,6 +412,7 @@ 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;
+ moves[i].secondaryEffectChance = ((rom[offs + (i - 1) * 7 + 6] & 0xFF)) / 255.0 * 100;
if (i == Moves.swift) {
perfectAccuracy = (int)moves[i].hitratio;
@@ -438,8 +439,154 @@ public class Gen2RomHandler extends AbstractGBCRomHandler { } else {
moves[i].priority = 1;
}
+
+ loadStatChangesFromEffect(moves[i]);
+ }
+ }
+
+ private void loadStatChangesFromEffect(Move move) {
+ switch (move.effectIndex) {
+ case Gen2Constants.noDamageAtkPlusOneEffect:
+ case Gen2Constants.damageUserAtkPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen2Constants.noDamageDefPlusOneEffect:
+ case Gen2Constants.damageUserDefPlusOneEffect:
+ case Gen2Constants.defenseCurlEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen2Constants.noDamageSpAtkPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen2Constants.noDamageEvasionPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.EVASION;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen2Constants.noDamageAtkMinusOneEffect:
+ case Gen2Constants.damageAtkMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.noDamageDefMinusOneEffect:
+ case Gen2Constants.damageDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.noDamageSpeMinusOneEffect:
+ case Gen2Constants.damageSpeMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.noDamageAccuracyMinusOneEffect:
+ case Gen2Constants.damageAccuracyMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ACCURACY;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.noDamageEvasionMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.EVASION;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.noDamageAtkPlusTwoEffect:
+ case Gen2Constants.swaggerEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen2Constants.noDamageDefPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen2Constants.noDamageSpePlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen2Constants.noDamageSpDefPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen2Constants.noDamageAtkMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen2Constants.noDamageDefMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen2Constants.noDamageSpeMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen2Constants.noDamageSpDefMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen2Constants.damageSpDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen2Constants.damageUserAllPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ALL;
+ move.statChanges[0].stages = 1;
+ break;
+ default:
+ // Move does not have a stat-changing effect
+ return;
+ }
+
+ switch (move.effectIndex) {
+ case Gen2Constants.noDamageAtkPlusOneEffect:
+ case Gen2Constants.noDamageDefPlusOneEffect:
+ case Gen2Constants.noDamageSpAtkPlusOneEffect:
+ case Gen2Constants.noDamageEvasionPlusOneEffect:
+ case Gen2Constants.noDamageAtkMinusOneEffect:
+ case Gen2Constants.noDamageDefMinusOneEffect:
+ case Gen2Constants.noDamageSpeMinusOneEffect:
+ case Gen2Constants.noDamageAccuracyMinusOneEffect:
+ case Gen2Constants.noDamageEvasionMinusOneEffect:
+ case Gen2Constants.noDamageAtkPlusTwoEffect:
+ case Gen2Constants.noDamageDefPlusTwoEffect:
+ case Gen2Constants.noDamageSpePlusTwoEffect:
+ case Gen2Constants.noDamageSpDefPlusTwoEffect:
+ case Gen2Constants.noDamageAtkMinusTwoEffect:
+ case Gen2Constants.noDamageDefMinusTwoEffect:
+ case Gen2Constants.noDamageSpeMinusTwoEffect:
+ case Gen2Constants.noDamageSpDefMinusTwoEffect:
+ case Gen2Constants.swaggerEffect:
+ case Gen2Constants.defenseCurlEffect:
+ if (move.statChanges[0].stages < 0 || move.effectIndex == Gen2Constants.swaggerEffect) {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET;
+ } else {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER;
+ }
+ break;
+
+ case Gen2Constants.damageAtkMinusOneEffect:
+ case Gen2Constants.damageDefMinusOneEffect:
+ case Gen2Constants.damageSpeMinusOneEffect:
+ case Gen2Constants.damageSpDefMinusOneEffect:
+ case Gen2Constants.damageAccuracyMinusOneEffect:
+ move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET;
+ break;
+
+ case Gen2Constants.damageUserDefPlusOneEffect:
+ case Gen2Constants.damageUserAtkPlusOneEffect:
+ case Gen2Constants.damageUserAllPlusOneEffect:
+ move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER;
+ break;
}
+ if (move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_TARGET || move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_USER) {
+ for (int i = 0; i < move.statChanges.length; i++) {
+ if (move.statChanges[i].type != StatBuffType.NONE) {
+ move.statChanges[i].percentChance = move.secondaryEffectChance;
+ if (move.statChanges[i].percentChance == 0.0) {
+ move.statChanges[i].percentChance = 100.0;
+ }
+ }
+ }
+ }
}
private void saveMoves() {
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java index 2c4abed..ef25346 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen3RomHandler.java @@ -824,8 +824,10 @@ public class Gen3RomHandler extends AbstractGBRomHandler { moves[i].power = rom[offs + i * 0xC + 1] & 0xFF; moves[i].pp = rom[offs + i * 0xC + 4] & 0xFF; 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; moves[i].priority = rom[offs + i * 0xC + 7]; + moves[i].secondaryEffectChance = rom[offs + i * 0xC + 5] & 0xFF; if (i == Moves.swift) { perfectAccuracy = (int)moves[i].hitratio; @@ -838,8 +840,216 @@ public class Gen3RomHandler extends AbstractGBRomHandler { } else if (i == Moves.tripleKick) { moves[i].hitCount = 2.71; // this assumes the first hit lands } + + loadStatChangesFromEffect(moves[i]); + } + } + + private void loadStatChangesFromEffect(Move move) { + switch (move.effectIndex) { + case Gen3Constants.noDamageAtkPlusOneEffect: + case Gen3Constants.noDamageDefPlusOneEffect: + case Gen3Constants.noDamageSpAtkPlusOneEffect: + case Gen3Constants.noDamageEvasionPlusOneEffect: + case Gen3Constants.noDamageAtkMinusOneEffect: + case Gen3Constants.noDamageDefMinusOneEffect: + case Gen3Constants.noDamageSpeMinusOneEffect: + case Gen3Constants.noDamageAccuracyMinusOneEffect: + case Gen3Constants.noDamageEvasionMinusOneEffect: + case Gen3Constants.noDamageAtkPlusTwoEffect: + case Gen3Constants.noDamageDefPlusTwoEffect: + case Gen3Constants.noDamageSpePlusTwoEffect: + case Gen3Constants.noDamageSpAtkPlusTwoEffect: + case Gen3Constants.noDamageSpDefPlusTwoEffect: + case Gen3Constants.noDamageAtkMinusTwoEffect: + case Gen3Constants.noDamageDefMinusTwoEffect: + case Gen3Constants.noDamageSpeMinusTwoEffect: + case Gen3Constants.noDamageSpDefMinusTwoEffect: + case Gen3Constants.minimizeEffect: + case Gen3Constants.swaggerEffect: + case Gen3Constants.defenseCurlEffect: + case Gen3Constants.flatterEffect: + case Gen3Constants.chargeEffect: + case Gen3Constants.noDamageAtkAndDefMinusOneEffect: + case Gen3Constants.noDamageDefAndSpDefPlusOneEffect: + case Gen3Constants.noDamageAtkAndDefPlusOneEffect: + case Gen3Constants.noDamageSpAtkAndSpDefPlusOneEffect: + case Gen3Constants.noDamageAtkAndSpePlusOneEffect: + if (move.target == 16) { + move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER; + } else { + move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET; + } + break; + + case Gen3Constants.damageAtkMinusOneEffect: + case Gen3Constants.damageDefMinusOneEffect: + case Gen3Constants.damageSpeMinusOneEffect: + case Gen3Constants.damageSpAtkMinusOneEffect: + case Gen3Constants.damageSpDefMinusOneEffect: + case Gen3Constants.damageAccuracyMinusOneEffect: + move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET; + break; + + case Gen3Constants.damageUserDefPlusOneEffect: + case Gen3Constants.damageUserAtkPlusOneEffect: + case Gen3Constants.damageUserAllPlusOneEffect: + case Gen3Constants.damageUserAtkAndDefMinusOneEffect: + case Gen3Constants.damageUserSpAtkMinusTwoEffect: + move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER; + break; + + default: + // Move does not have a stat-changing effect + return; + } + + switch (move.effectIndex) { + case Gen3Constants.noDamageAtkPlusOneEffect: + case Gen3Constants.damageUserAtkPlusOneEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.noDamageDefPlusOneEffect: + case Gen3Constants.damageUserDefPlusOneEffect: + case Gen3Constants.defenseCurlEffect: + move.statChanges[0].type = StatBuffType.DEFENSE; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.noDamageSpAtkPlusOneEffect: + case Gen3Constants.flatterEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.noDamageEvasionPlusOneEffect: + case Gen3Constants.minimizeEffect: + move.statChanges[0].type = StatBuffType.EVASION; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.noDamageAtkMinusOneEffect: + case Gen3Constants.damageAtkMinusOneEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.noDamageDefMinusOneEffect: + case Gen3Constants.damageDefMinusOneEffect: + move.statChanges[0].type = StatBuffType.DEFENSE; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.noDamageSpeMinusOneEffect: + case Gen3Constants.damageSpeMinusOneEffect: + move.statChanges[0].type = StatBuffType.SPEED; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.noDamageAccuracyMinusOneEffect: + case Gen3Constants.damageAccuracyMinusOneEffect: + move.statChanges[0].type = StatBuffType.ACCURACY; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.noDamageEvasionMinusOneEffect: + move.statChanges[0].type = StatBuffType.EVASION; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.noDamageAtkPlusTwoEffect: + case Gen3Constants.swaggerEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = 2; + break; + case Gen3Constants.noDamageDefPlusTwoEffect: + move.statChanges[0].type = StatBuffType.DEFENSE; + move.statChanges[0].stages = 2; + break; + case Gen3Constants.noDamageSpePlusTwoEffect: + move.statChanges[0].type = StatBuffType.SPEED; + move.statChanges[0].stages = 2; + break; + case Gen3Constants.noDamageSpAtkPlusTwoEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK; + move.statChanges[0].stages = 2; + break; + case Gen3Constants.noDamageSpDefPlusTwoEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[0].stages = 2; + break; + case Gen3Constants.noDamageAtkMinusTwoEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = -2; + break; + case Gen3Constants.noDamageDefMinusTwoEffect: + move.statChanges[0].type = StatBuffType.DEFENSE; + move.statChanges[0].stages = -2; + break; + case Gen3Constants.noDamageSpeMinusTwoEffect: + move.statChanges[0].type = StatBuffType.SPEED; + move.statChanges[0].stages = -2; + break; + case Gen3Constants.noDamageSpDefMinusTwoEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[0].stages = -2; + break; + case Gen3Constants.damageSpAtkMinusOneEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.damageSpDefMinusOneEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[0].stages = -1; + break; + case Gen3Constants.damageUserAllPlusOneEffect: + move.statChanges[0].type = StatBuffType.ALL; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.chargeEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[0].stages = 1; + break; + case Gen3Constants.damageUserAtkAndDefMinusOneEffect: + case Gen3Constants.noDamageAtkAndDefMinusOneEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = -1; + move.statChanges[1].type = StatBuffType.DEFENSE; + move.statChanges[1].stages = -1; + break; + case Gen3Constants.damageUserSpAtkMinusTwoEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK; + move.statChanges[0].stages = -2; + break; + case Gen3Constants.noDamageDefAndSpDefPlusOneEffect: + move.statChanges[0].type = StatBuffType.DEFENSE; + move.statChanges[0].stages = 1; + move.statChanges[1].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[1].stages = 1; + break; + case Gen3Constants.noDamageAtkAndDefPlusOneEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = 1; + move.statChanges[1].type = StatBuffType.DEFENSE; + move.statChanges[1].stages = 1; + break; + case Gen3Constants.noDamageSpAtkAndSpDefPlusOneEffect: + move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK; + move.statChanges[0].stages = 1; + move.statChanges[1].type = StatBuffType.SPECIAL_DEFENSE; + move.statChanges[1].stages = 1; + break; + case Gen3Constants.noDamageAtkAndSpePlusOneEffect: + move.statChanges[0].type = StatBuffType.ATTACK; + move.statChanges[0].stages = 1; + move.statChanges[1].type = StatBuffType.SPEED; + move.statChanges[1].stages = 1; + break; } + if (move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_TARGET || move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_USER) { + for (int i = 0; i < move.statChanges.length; i++) { + if (move.statChanges[i].type != StatBuffType.NONE) { + move.statChanges[i].percentChance = move.secondaryEffectChance; + if (move.statChanges[i].percentChance == 0.0) { + move.statChanges[i].percentChance = 100.0; + } + } + } + } } private void saveMoves() { diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java index 1e74e45..5b53330 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen4RomHandler.java @@ -37,6 +37,7 @@ import com.dabomstew.pkrandom.*; import com.dabomstew.pkrandom.constants.*;
import com.dabomstew.pkrandom.exceptions.RandomizationException;
import com.dabomstew.pkrandom.pokemon.*;
+import sun.reflect.generics.tree.Tree;
import thenewpoketext.PokeTextData;
import thenewpoketext.TextToPoke;
@@ -572,7 +573,9 @@ public class Gen4RomHandler extends AbstractDSRomHandler { moves[i].power = moveData[3] & 0xFF;
moves[i].pp = moveData[6] & 0xFF;
moves[i].type = Gen4Constants.typeTable[moveData[4] & 0xFF];
+ moves[i].target = readWord(moveData, 8);
moves[i].category = Gen4Constants.moveCategoryIndices[moveData[2] & 0xFF];
+ moves[i].secondaryEffectChance = moveData[7] & 0xFF;
moves[i].priority = moveData[10];
if (i == Moves.swift) {
@@ -584,14 +587,236 @@ public class Gen4RomHandler extends AbstractDSRomHandler { } else if (GlobalConstants.doubleHitMoves.contains(i)) {
moves[i].hitCount = 2;
} else if (i == Moves.tripleKick) {
- moves[i].hitCount = 2.71; // this assumes the first hit
- // lands
+ moves[i].hitCount = 2.71; // this assumes the first hit lands
}
+
+ loadStatChangesFromEffect(moves[i]);
}
} catch (IOException e) {
throw new RandomizerIOException(e);
}
+ }
+
+ private void loadStatChangesFromEffect(Move move) {
+ switch (move.effectIndex) {
+ case Gen4Constants.noDamageAtkPlusOneEffect:
+ case Gen4Constants.noDamageDefPlusOneEffect:
+ case Gen4Constants.noDamageSpAtkPlusOneEffect:
+ case Gen4Constants.noDamageEvasionPlusOneEffect:
+ case Gen4Constants.noDamageAtkMinusOneEffect:
+ case Gen4Constants.noDamageDefMinusOneEffect:
+ case Gen4Constants.noDamageSpeMinusOneEffect:
+ case Gen4Constants.noDamageAccuracyMinusOneEffect:
+ case Gen4Constants.noDamageEvasionMinusOneEffect:
+ case Gen4Constants.noDamageAtkPlusTwoEffect:
+ case Gen4Constants.noDamageDefPlusTwoEffect:
+ case Gen4Constants.noDamageSpePlusTwoEffect:
+ case Gen4Constants.noDamageSpAtkPlusTwoEffect:
+ case Gen4Constants.noDamageSpDefPlusTwoEffect:
+ case Gen4Constants.noDamageAtkMinusTwoEffect:
+ case Gen4Constants.noDamageDefMinusTwoEffect:
+ case Gen4Constants.noDamageSpeMinusTwoEffect:
+ case Gen4Constants.noDamageSpDefMinusTwoEffect:
+ case Gen4Constants.minimizeEffect:
+ case Gen4Constants.swaggerEffect:
+ case Gen4Constants.defenseCurlEffect:
+ case Gen4Constants.flatterEffect:
+ case Gen4Constants.chargeEffect:
+ case Gen4Constants.noDamageAtkAndDefMinusOneEffect:
+ case Gen4Constants.noDamageDefAndSpDefPlusOneEffect:
+ case Gen4Constants.noDamageAtkAndDefPlusOneEffect:
+ case Gen4Constants.noDamageSpAtkAndSpDefPlusOneEffect:
+ case Gen4Constants.noDamageAtkAndSpePlusOneEffect:
+ case Gen4Constants.noDamageSpAtkMinusTwoEffect:
+ if (move.target == 16) {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER;
+ } else {
+ move.statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET;
+ }
+ break;
+
+ case Gen4Constants.damageAtkMinusOneEffect:
+ case Gen4Constants.damageDefMinusOneEffect:
+ case Gen4Constants.damageSpeMinusOneEffect:
+ case Gen4Constants.damageSpAtkMinusOneEffect:
+ case Gen4Constants.damageSpDefMinusOneEffect:
+ case Gen4Constants.damageAccuracyMinusOneEffect:
+ case Gen4Constants.damageSpDefMinusTwoEffect:
+ move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET;
+ break;
+
+ case Gen4Constants.damageUserDefPlusOneEffect:
+ case Gen4Constants.damageUserAtkPlusOneEffect:
+ case Gen4Constants.damageUserAllPlusOneEffect:
+ case Gen4Constants.damageUserAtkAndDefMinusOneEffect:
+ case Gen4Constants.damageUserSpAtkMinusTwoEffect:
+ case Gen4Constants.damageUserSpeMinusOneEffect:
+ case Gen4Constants.damageUserDefAndSpDefMinusOneEffect:
+ case Gen4Constants.damageUserSpAtkPlusOneEffect:
+ move.statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER;
+ break;
+
+ default:
+ // Move does not have a stat-changing effect
+ return;
+ }
+ switch (move.effectIndex) {
+ case Gen4Constants.noDamageAtkPlusOneEffect:
+ case Gen4Constants.damageUserAtkPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.noDamageDefPlusOneEffect:
+ case Gen4Constants.damageUserDefPlusOneEffect:
+ case Gen4Constants.defenseCurlEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.noDamageSpAtkPlusOneEffect:
+ case Gen4Constants.flatterEffect:
+ case Gen4Constants.damageUserSpAtkPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.noDamageEvasionPlusOneEffect:
+ case Gen4Constants.minimizeEffect:
+ move.statChanges[0].type = StatBuffType.EVASION;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.noDamageAtkMinusOneEffect:
+ case Gen4Constants.damageAtkMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.noDamageDefMinusOneEffect:
+ case Gen4Constants.damageDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.noDamageSpeMinusOneEffect:
+ case Gen4Constants.damageSpeMinusOneEffect:
+ case Gen4Constants.damageUserSpeMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.noDamageAccuracyMinusOneEffect:
+ case Gen4Constants.damageAccuracyMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ACCURACY;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.noDamageEvasionMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.EVASION;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.noDamageAtkPlusTwoEffect:
+ case Gen4Constants.swaggerEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen4Constants.noDamageDefPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen4Constants.noDamageSpePlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen4Constants.noDamageSpAtkPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen4Constants.noDamageSpDefPlusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = 2;
+ break;
+ case Gen4Constants.noDamageAtkMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen4Constants.noDamageDefMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen4Constants.noDamageSpeMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPEED;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen4Constants.noDamageSpDefMinusTwoEffect:
+ case Gen4Constants.damageSpDefMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen4Constants.damageSpAtkMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.damageSpDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = -1;
+ break;
+ case Gen4Constants.damageUserAllPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ALL;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.chargeEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[0].stages = 1;
+ break;
+ case Gen4Constants.damageUserAtkAndDefMinusOneEffect:
+ case Gen4Constants.noDamageAtkAndDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = -1;
+ move.statChanges[1].type = StatBuffType.DEFENSE;
+ move.statChanges[1].stages = -1;
+ break;
+ case Gen4Constants.damageUserSpAtkMinusTwoEffect:
+ case Gen4Constants.noDamageSpAtkMinusTwoEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = -2;
+ break;
+ case Gen4Constants.noDamageDefAndSpDefPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = 1;
+ move.statChanges[1].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[1].stages = 1;
+ break;
+ case Gen4Constants.noDamageAtkAndDefPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 1;
+ move.statChanges[1].type = StatBuffType.DEFENSE;
+ move.statChanges[1].stages = 1;
+ break;
+ case Gen4Constants.noDamageSpAtkAndSpDefPlusOneEffect:
+ move.statChanges[0].type = StatBuffType.SPECIAL_ATTACK;
+ move.statChanges[0].stages = 1;
+ move.statChanges[1].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[1].stages = 1;
+ break;
+ case Gen4Constants.noDamageAtkAndSpePlusOneEffect:
+ move.statChanges[0].type = StatBuffType.ATTACK;
+ move.statChanges[0].stages = 1;
+ move.statChanges[1].type = StatBuffType.SPEED;
+ move.statChanges[1].stages = 1;
+ break;
+ case Gen4Constants.damageUserDefAndSpDefMinusOneEffect:
+ move.statChanges[0].type = StatBuffType.DEFENSE;
+ move.statChanges[0].stages = -1;
+ move.statChanges[1].type = StatBuffType.SPECIAL_DEFENSE;
+ move.statChanges[1].stages = -1;
+ break;
+ }
+
+ if (move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_TARGET || move.statChangeType == StatChangeType.DAMAGE_STAT_CHANGE_USER) {
+ for (int i = 0; i < move.statChanges.length; i++) {
+ if (move.statChanges[i].type != StatBuffType.NONE) {
+ move.statChanges[i].percentChance = move.secondaryEffectChance;
+ if (move.statChanges[i].percentChance == 0.0) {
+ move.statChanges[i].percentChance = 100.0;
+ }
+ }
+ }
+ }
}
private void loadPokemonStats() {
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java index 2fa91cb..20d65c9 100755 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen5RomHandler.java @@ -555,6 +555,7 @@ public class Gen5RomHandler extends AbstractDSRomHandler { moves[i].power = moveData[3] & 0xFF;
moves[i].pp = moveData[5] & 0xFF;
moves[i].type = Gen5Constants.typeTable[moveData[0] & 0xFF];
+ moves[i].target = moveData[20] & 0xFF;
moves[i].category = Gen5Constants.moveCategoryIndices[moveData[2] & 0xFF];
moves[i].priority = moveData[6];
@@ -567,8 +568,35 @@ public class Gen5RomHandler extends AbstractDSRomHandler { } else if (GlobalConstants.doubleHitMoves.contains(i)) {
moves[i].hitCount = 2;
} else if (i == Moves.tripleKick) {
- moves[i].hitCount = 2.71; // this assumes the first hit
- // lands
+ moves[i].hitCount = 2.71; // this assumes the first hit lands
+ }
+
+ int qualities = moveData[1];
+ switch (qualities) {
+ case Gen5Constants.noDamageStatChangeQuality:
+ case Gen5Constants.noDamageStatusAndStatChangeQuality:
+ // All Allies or Self
+ if (moves[i].target == 6 || moves[i].target == 7) {
+ moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER;
+ } else {
+ moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET;
+ }
+ break;
+ case Gen5Constants.damageTargetDebuffQuality:
+ moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET;
+ break;
+ case Gen5Constants.damageUserBuffQuality:
+ moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER;
+ break;
+ default:
+ moves[i].statChangeType = StatChangeType.NONE_OR_UNKNOWN;
+ break;
+ }
+
+ for (int statChange = 0; statChange < 3; statChange++) {
+ moves[i].statChanges[statChange].type = StatBuffType.values()[moveData[21 + statChange]];
+ moves[i].statChanges[statChange].stages = moveData[24 + statChange];
+ moves[i].statChanges[statChange].percentChance = moveData[27 + statChange];
}
}
} catch (IOException e) {
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java index e0c607e..aace612 100644 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java @@ -606,6 +606,7 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { moves[i].power = moveData[3] & 0xFF; moves[i].pp = moveData[5] & 0xFF; moves[i].type = Gen6Constants.typeTable[moveData[0] & 0xFF]; + moves[i].target = moveData[20] & 0xFF; moves[i].category = Gen6Constants.moveCategoryIndices[moveData[2] & 0xFF]; moves[i].priority = moveData[6]; @@ -620,6 +621,38 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { } else if (i == Moves.tripleKick) { moves[i].hitCount = 2.71; // this assumes the first hit lands } + + int qualities = moveData[1]; + switch (qualities) { + case Gen6Constants.noDamageStatChangeQuality: + case Gen6Constants.noDamageStatusAndStatChangeQuality: + // All Allies or Self + if (moves[i].target == 6 || moves[i].target == 7) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER; + } else if (moves[i].target == 2) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_ALLY; + } else if (moves[i].target == 8) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_ALL; + } else { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET; + } + break; + case Gen6Constants.damageTargetDebuffQuality: + moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET; + break; + case Gen6Constants.damageUserBuffQuality: + moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER; + break; + default: + moves[i].statChangeType = StatChangeType.NONE_OR_UNKNOWN; + break; + } + + for (int statChange = 0; statChange < 3; statChange++) { + moves[i].statChanges[statChange].type = StatBuffType.values()[moveData[21 + statChange]]; + moves[i].statChanges[statChange].stages = moveData[24 + statChange]; + moves[i].statChanges[statChange].percentChance = moveData[27 + statChange]; + } } } catch (IOException e) { throw new RandomizerIOException(e); diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java index 0300036..28f6453 100644 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen7RomHandler.java @@ -678,6 +678,7 @@ public class Gen7RomHandler extends Abstract3DSRomHandler { moves[i].power = moveData[3] & 0xFF; moves[i].pp = moveData[5] & 0xFF; moves[i].type = Gen7Constants.typeTable[moveData[0] & 0xFF]; + moves[i].target = moveData[20] & 0xFF; moves[i].category = Gen7Constants.moveCategoryIndices[moveData[2] & 0xFF]; moves[i].priority = moveData[6]; @@ -692,6 +693,38 @@ public class Gen7RomHandler extends Abstract3DSRomHandler { } else if (i == Moves.tripleKick) { moves[i].hitCount = 2.71; // this assumes the first hit lands } + + int qualities = moveData[1]; + switch (qualities) { + case Gen7Constants.noDamageStatChangeQuality: + case Gen7Constants.noDamageStatusAndStatChangeQuality: + // All Allies or Self + if (moves[i].target == 6 || moves[i].target == 7) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_USER; + } else if (moves[i].target == 2) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_ALLY; + } else if (moves[i].target == 8) { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_ALL; + } else { + moves[i].statChangeType = StatChangeType.NO_DAMAGE_STAT_CHANGE_TARGET; + } + break; + case Gen7Constants.damageTargetDebuffQuality: + moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_TARGET; + break; + case Gen7Constants.damageUserBuffQuality: + moves[i].statChangeType = StatChangeType.DAMAGE_STAT_CHANGE_USER; + break; + default: + moves[i].statChangeType = StatChangeType.NONE_OR_UNKNOWN; + break; + } + + for (int statChange = 0; statChange < 3; statChange++) { + moves[i].statChanges[statChange].type = StatBuffType.values()[moveData[21 + statChange]]; + moves[i].statChanges[statChange].stages = moveData[24 + statChange]; + moves[i].statChanges[statChange].percentChance = moveData[27 + statChange]; + } } } catch (IOException e) { throw new RandomizerIOException(e); |