summaryrefslogtreecommitdiff
path: root/src/com/rafa_99/pkrandom/pokemon
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/rafa_99/pkrandom/pokemon')
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/Aura.java80
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/Effectiveness.java123
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Encounter.java49
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/EncounterSet.java44
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Evolution.java84
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/EvolutionType.java112
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/EvolutionUpdate.java72
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/ExpCurve.java86
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/FormeInfo.java36
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/Gen1Pokemon.java149
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/GenRestrictions.java145
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/IngameTrade.java41
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/ItemList.java106
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/MegaEvolution.java39
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Move.java69
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/MoveCategory.java29
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/MoveLearnt.java36
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/PickupItem.java11
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Pokemon.java325
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/SOSType.java28
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/Shop.java43
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/Stat.java45
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StatChange.java35
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StatChangeMoveType.java35
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StatChangeType.java38
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StaticEncounter.java98
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StatusMoveType.java31
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/StatusType.java37
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/TotemPokemon.java56
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Trainer.java130
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/TrainerPokemon.java106
-rwxr-xr-xsrc/com/rafa_99/pkrandom/pokemon/Type.java63
-rw-r--r--src/com/rafa_99/pkrandom/pokemon/TypeRelationship.java37
33 files changed, 2418 insertions, 0 deletions
diff --git a/src/com/rafa_99/pkrandom/pokemon/Aura.java b/src/com/rafa_99/pkrandom/pokemon/Aura.java
new file mode 100644
index 0000000..70667e6
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Aura.java
@@ -0,0 +1,80 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Aura.java - handles the Aura that Totem Pokemon have --*/
+/*-- --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import com.rafa_99.pkrandom.RomFunctions;
+
+import java.util.Random;
+
+public class Aura {
+
+ private enum AuraStat {
+ NONE, ATTACK, DEFENSE, SPECIAL_ATTACK, SPECIAL_DEFENSE, SPEED, ALL
+ }
+
+ public AuraStat stat;
+
+ public int stages;
+
+ public Aura(byte b) {
+ if (b == 0) {
+ stat = AuraStat.NONE;
+ stages = 0;
+ } else {
+ stat = AuraStat.values()[((b - 1) / 3) + 1];
+ stages = ((b - 1) % 3) + 1;
+ }
+ }
+
+ private Aura(AuraStat stat, int stages) {
+ this.stat = stat;
+ this.stages = stages;
+ }
+
+ public byte toByte() {
+ if (stat == AuraStat.NONE) {
+ return 0;
+ } else {
+ return (byte)(((stat.ordinal() - 1) * 3) + (stages));
+ }
+ }
+
+ public static Aura randomAura(Random random) {
+ return new Aura((byte)(random.nextInt(18) + 1));
+ }
+
+ public static Aura randomAuraSimilarStrength(Random random, Aura old) {
+ if (old.stat == AuraStat.NONE || old.stat == AuraStat.ALL) {
+ return old;
+ } else {
+ return new Aura(AuraStat.values()[random.nextInt(5) + 1], old.stages);
+ }
+ }
+
+ @Override
+ public String toString() {
+ String ret = RomFunctions.camelCase(stat.toString()).replace("_"," ");
+ return stat == AuraStat.NONE ? ret : ret + " +" + stages;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Effectiveness.java b/src/com/rafa_99/pkrandom/pokemon/Effectiveness.java
new file mode 100644
index 0000000..3d2a457
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Effectiveness.java
@@ -0,0 +1,123 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Effectiveness.java - represents a type's effectiveness and the --*/
+/*-- results of applying super effectiveness and resistance --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public enum Effectiveness {
+ ZERO, HALF, NEUTRAL, DOUBLE, QUARTER, QUADRUPLE;
+
+ public static Map<Type, Effectiveness> against(Type primaryType, Type secondaryType, int gen) {
+ return against(primaryType, secondaryType, gen, false);
+ }
+
+ // Returns a map where the key is a type and the value is the effectiveness against
+ // a pokemon with the two types in a given gen. It does not account for abilities.
+ public static Map<Type, Effectiveness> against(Type primaryType, Type secondaryType, int gen, boolean effectivenessUpdated) {
+ if (gen >= 2 && gen <= 5) {
+ if (effectivenessUpdated) {
+ return against(primaryType, secondaryType, gen6PlusTable, Type.GEN2THROUGH5);
+ } else {
+ return against(primaryType, secondaryType, gen2Through5Table, Type.GEN2THROUGH5);
+ }
+ }
+ if (gen >= 6) {
+ return against(primaryType, secondaryType, gen6PlusTable, Type.GEN6PLUS);
+ }
+ return null;
+ }
+
+ private static Map<Type, Effectiveness> against(Type primaryType, Type secondaryType, Effectiveness[][] effectivenesses, List<Type> allTypes) {
+ Map<Type, Effectiveness> result = new HashMap<>();
+ for(Type type : allTypes) {
+ Effectiveness effect = effectivenesses[type.ordinal()][primaryType.ordinal()];
+ if (secondaryType != null) {
+ effect = effect.combine(effectivenesses[type.ordinal()][secondaryType.ordinal()]);
+ }
+ result.put(type, effect);
+ }
+ return result;
+ }
+
+ // Attacking type is the row, Defending type is the column. This corresponds to the ordinal of types.
+ private static final Effectiveness[][] gen2Through5Table = {
+ /* NORMAL,FIGHTING, FLYING, GRASS , WATER, FIRE , ROCK , GROUND, PSYCHIC, BUG , DRAGON,ELECTRIC, GHOST , POISON, ICE , STEEL , DARK */
+ /*NORMAL */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, HALF, NEUTRAL},
+ /*FIGHTING*/{ DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, ZERO, HALF, DOUBLE, DOUBLE, DOUBLE},
+ /*FLYING */ {NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL},
+ /*GRASS */ {NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, HALF, DOUBLE, DOUBLE, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, HALF, NEUTRAL, HALF, NEUTRAL},
+ /*WATER */ {NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL},
+ /*FIRE */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, HALF, HALF, HALF, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, DOUBLE, NEUTRAL},
+ /*ROCK */ {NEUTRAL, HALF, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL},
+ /*GROUND */ {NEUTRAL, NEUTRAL, ZERO, HALF, NEUTRAL, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL},
+ /*PSYCHIC*/ {NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, ZERO},
+ /*BUG */ {NEUTRAL, HALF, HALF, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, HALF, DOUBLE},
+ /*DRAGON */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL},
+ /*ELECTRIC*/{NEUTRAL, NEUTRAL, DOUBLE, HALF, DOUBLE, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL},
+ /*GHOST */ { ZERO, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF},
+ /*POISON */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, ZERO, NEUTRAL},
+ /*ICE */ {NEUTRAL, NEUTRAL, DOUBLE, DOUBLE, HALF, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL},
+ /*STEEL */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL},
+ /*DARK */ {NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF},
+ };
+ private static final Effectiveness[][] gen6PlusTable = {
+ /* NORMAL,FIGHTING, FLYING, GRASS , WATER, FIRE , ROCK , GROUND, PSYCHIC, BUG , DRAGON,ELECTRIC, GHOST , POISON, ICE , STEEL , DARK , FAIRY */
+ /*NORMAL */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL},
+ /*FIGHTING*/{ DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, ZERO, HALF, DOUBLE, DOUBLE, DOUBLE, HALF},
+ /*FLYING */ {NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL},
+ /*GRASS */ {NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, HALF, DOUBLE, DOUBLE, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, HALF, NEUTRAL, HALF, NEUTRAL, NEUTRAL},
+ /*WATER */ {NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL},
+ /*FIRE */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, HALF, HALF, HALF, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL},
+ /*ROCK */ {NEUTRAL, HALF, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL, NEUTRAL},
+ /*GROUND */ {NEUTRAL, NEUTRAL, ZERO, HALF, NEUTRAL, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL},
+ /*PSYCHIC*/ {NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, ZERO, NEUTRAL},
+ /*BUG */ {NEUTRAL, HALF, HALF, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, HALF, DOUBLE, HALF},
+ /*DRAGON */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, ZERO},
+ /*ELECTRIC*/{NEUTRAL, NEUTRAL, DOUBLE, HALF, DOUBLE, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL},
+ /*GHOST */ { ZERO, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL},
+ /*POISON */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, ZERO, NEUTRAL, DOUBLE},
+ /*ICE */ {NEUTRAL, NEUTRAL, DOUBLE, DOUBLE, HALF, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL},
+ /*STEEL */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL, DOUBLE},
+ /*DARK */ {NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF},
+ /*FAIRY */ {NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, HALF, DOUBLE, NEUTRAL},
+ };
+
+ private Effectiveness combine(Effectiveness other) {
+ return combineTable[this.ordinal()][other.ordinal()];
+ }
+
+ // Allows easier calculation of combining a single type attacking a double typed pokemon.
+ // The rows and columns are the ordinals of Effectiveness (but only the first 4, as we don't need to
+ // combine 3 or more type considerations).
+ private static final Effectiveness[][] combineTable = {
+ {ZERO, ZERO, ZERO, ZERO},
+ {ZERO, QUARTER, HALF, NEUTRAL},
+ {ZERO, HALF, NEUTRAL, DOUBLE},
+ {ZERO, NEUTRAL, DOUBLE, QUADRUPLE},
+ };
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Encounter.java b/src/com/rafa_99/pkrandom/pokemon/Encounter.java
new file mode 100755
index 0000000..f102429
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Encounter.java
@@ -0,0 +1,49 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Encounter.java - contains one wild Pokemon slot --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class Encounter {
+
+ public int level;
+ public int maxLevel;
+ public Pokemon pokemon;
+ public int formeNumber;
+
+ // Used only for Gen 7's SOS mechanic
+ public boolean isSOS;
+ public SOSType sosType;
+
+ public String toString() {
+ if (pokemon == null) {
+ return "ERROR";
+ }
+ if (maxLevel == 0) {
+ return pokemon.name + " Lv" + level;
+ } else {
+ return pokemon.name + " Lvs " + level + "-" + maxLevel;
+ }
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/EncounterSet.java b/src/com/rafa_99/pkrandom/pokemon/EncounterSet.java
new file mode 100755
index 0000000..54d2950
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/EncounterSet.java
@@ -0,0 +1,44 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- EncounterSet.java - contains a group of wild Pokemon --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class EncounterSet {
+
+ public int rate;
+ public List<Encounter> encounters = new ArrayList<>();
+ public Set<Pokemon> bannedPokemon = new HashSet<>();
+ public String displayName;
+ public int offset;
+
+ public String toString() {
+ return "Encounter [Rate = " + rate + ", Encounters = " + encounters + "]";
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Evolution.java b/src/com/rafa_99/pkrandom/pokemon/Evolution.java
new file mode 100755
index 0000000..0633a84
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Evolution.java
@@ -0,0 +1,84 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Evolution.java - represents an evolution between 2 Pokemon. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class Evolution implements Comparable<Evolution> {
+
+ public Pokemon from;
+ public Pokemon to;
+ public boolean carryStats;
+ public EvolutionType type;
+ public int extraInfo;
+ public int forme;
+ public String formeSuffix = "";
+ public int level = 0;
+
+ public Evolution(Pokemon from, Pokemon to, boolean carryStats, EvolutionType type, int extra) {
+ this.from = from;
+ this.to = to;
+ this.carryStats = carryStats;
+ this.type = type;
+ this.extraInfo = extra;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + from.number;
+ result = prime * result + to.number;
+ result = prime * result + type.ordinal();
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Evolution other = (Evolution) obj;
+ return from == other.from && to == other.to && type == other.type;
+ }
+
+ @Override
+ public int compareTo(Evolution o) {
+ if (this.from.number < o.from.number) {
+ return -1;
+ } else if (this.from.number > o.from.number) {
+ return 1;
+ } else if (this.to.number < o.to.number) {
+ return -1;
+ } else if (this.to.number > o.to.number) {
+ return 1;
+ } else return Integer.compare(this.type.ordinal(), o.type.ordinal());
+ }
+
+ public String toFullName() {
+ return to.name + formeSuffix;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/EvolutionType.java b/src/com/rafa_99/pkrandom/pokemon/EvolutionType.java
new file mode 100755
index 0000000..5c81a7a
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/EvolutionType.java
@@ -0,0 +1,112 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- EvolutionType.java - describes what process is necessary for an --*/
+/*-- evolution to occur --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 EvolutionType {
+ /* @formatter:off */
+ LEVEL(1, 1, 4, 4, 4, 4, 4),
+ STONE(2, 2, 7, 7, 8, 8, 8),
+ TRADE(3, 3, 5, 5, 5, 5, 5),
+ TRADE_ITEM(-1, 3, 6, 6, 6, 6, 6),
+ HAPPINESS(-1, 4, 1, 1, 1, 1, 1),
+ HAPPINESS_DAY(-1, 4, 2, 2, 2, 2, 2),
+ HAPPINESS_NIGHT(-1, 4, 3, 3, 3, 3, 3),
+ LEVEL_ATTACK_HIGHER(-1, 5, 8, 8, 9, 9, 9),
+ LEVEL_DEFENSE_HIGHER(-1, 5, 10, 10, 11, 11, 11),
+ LEVEL_ATK_DEF_SAME(-1, 5, 9, 9, 10, 10, 10),
+ LEVEL_LOW_PV(-1, -1, 11, 11, 12, 12, 12),
+ LEVEL_HIGH_PV(-1, -1, 12, 12, 13, 13, 13),
+ LEVEL_CREATE_EXTRA(-1, -1, 13, 13, 14, 14, 14),
+ LEVEL_IS_EXTRA(-1, -1, 14, 14, 15, 15, 15),
+ LEVEL_HIGH_BEAUTY(-1, -1, 15, 15, 16, 16, 16),
+ STONE_MALE_ONLY(-1, -1, -1, 16, 17, 17, 17),
+ STONE_FEMALE_ONLY(-1, -1, -1, 17, 18, 18, 18),
+ LEVEL_ITEM_DAY(-1, -1, -1, 18, 19, 19, 19),
+ LEVEL_ITEM_NIGHT(-1, -1, -1, 19, 20, 20, 20),
+ LEVEL_WITH_MOVE(-1, -1, -1, 20, 21, 21, 21),
+ LEVEL_WITH_OTHER(-1, -1, -1, 21, 22, 22, 22),
+ LEVEL_MALE_ONLY(-1, -1, -1, 22, 23, 23, 23),
+ LEVEL_FEMALE_ONLY(-1, -1, -1, 23, 24, 24, 24),
+ LEVEL_ELECTRIFIED_AREA(-1, -1, -1, 24, 25, 25, 25),
+ LEVEL_MOSS_ROCK(-1, -1, -1, 25, 26, 26, 26),
+ LEVEL_ICY_ROCK(-1, -1, -1, 26, 27, 27, 27),
+ TRADE_SPECIAL(-1, -1, -1, -1, 7, 7, 7),
+ FAIRY_AFFECTION(-1, -1, -1, -1, -1, 29, 29),
+ LEVEL_WITH_DARK(-1, -1, -1, -1, -1, 30, 30),
+ LEVEL_UPSIDE_DOWN(-1, -1, -1, -1, -1, 28, 28),
+ LEVEL_RAIN(-1, -1, -1, -1, -1, 31, 31),
+ LEVEL_DAY(-1, -1, -1, -1, -1, 32, 32),
+ LEVEL_NIGHT(-1, -1, -1, -1, -1, 33, 33),
+ LEVEL_FEMALE_ESPURR(-1, -1, -1, -1, -1, 34, 34),
+ LEVEL_GAME(-1, -1, -1, -1, -1, -1, 36),
+ LEVEL_DAY_GAME(-1, -1, -1, -1, -1, -1, 37),
+ LEVEL_NIGHT_GAME(-1, -1, -1, -1, -1, -1, 38),
+ LEVEL_SNOWY(-1, -1, -1, -1, -1, -1, 39),
+ LEVEL_DUSK(-1, -1, -1, -1, -1, -1, 40),
+ LEVEL_NIGHT_ULTRA(-1, -1, -1, -1, -1, -1, 41),
+ STONE_ULTRA(-1, -1, -1, -1, -1, -1, 42),
+ NONE(-1, -1, -1, -1, -1, -1, -1);
+ /* @formatter:on */
+
+ private int[] indexNumbers;
+ private static EvolutionType[][] reverseIndexes = new EvolutionType[7][50];
+
+ static {
+ for (EvolutionType et : EvolutionType.values()) {
+ for (int i = 0; i < et.indexNumbers.length; i++) {
+ if (et.indexNumbers[i] > 0 && reverseIndexes[i][et.indexNumbers[i]] == null) {
+ reverseIndexes[i][et.indexNumbers[i]] = et;
+ }
+ }
+ }
+ }
+
+ EvolutionType(int... indexes) {
+ this.indexNumbers = indexes;
+ }
+
+ public int toIndex(int generation) {
+ return indexNumbers[generation - 1];
+ }
+
+ public static EvolutionType fromIndex(int generation, int index) {
+ return reverseIndexes[generation - 1][index];
+ }
+
+ public boolean usesLevel() {
+ return (this == LEVEL) || (this == LEVEL_ATTACK_HIGHER) || (this == LEVEL_DEFENSE_HIGHER)
+ || (this == LEVEL_ATK_DEF_SAME) || (this == LEVEL_LOW_PV) || (this == LEVEL_HIGH_PV)
+ || (this == LEVEL_CREATE_EXTRA) || (this == LEVEL_IS_EXTRA) || (this == LEVEL_MALE_ONLY)
+ || (this == LEVEL_FEMALE_ONLY) || (this == LEVEL_WITH_DARK)|| (this == LEVEL_UPSIDE_DOWN)
+ || (this == LEVEL_RAIN) || (this == LEVEL_DAY)|| (this == LEVEL_NIGHT)|| (this == LEVEL_FEMALE_ESPURR)
+ || (this == LEVEL_GAME) || (this == LEVEL_DAY_GAME) || (this == LEVEL_NIGHT_GAME)
+ || (this == LEVEL_SNOWY) || (this == LEVEL_DUSK) || (this == LEVEL_NIGHT_ULTRA);
+ }
+
+ public boolean skipSplitEvo() {
+ return (this == LEVEL_HIGH_BEAUTY) || (this == LEVEL_NIGHT_ULTRA) || (this == STONE_ULTRA);
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/EvolutionUpdate.java b/src/com/rafa_99/pkrandom/pokemon/EvolutionUpdate.java
new file mode 100644
index 0000000..4af2ef3
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/EvolutionUpdate.java
@@ -0,0 +1,72 @@
+package com.rafa_99.pkrandom.pokemon;
+
+public class EvolutionUpdate implements Comparable<EvolutionUpdate> {
+
+ private Pokemon from, to;
+ private String fromName, toName;
+ private EvolutionType type;
+ private String extraInfo;
+ private boolean condensed;
+ private boolean additional;
+
+
+ public EvolutionUpdate(Pokemon from, Pokemon to, EvolutionType type, String extraInfo, boolean condensed, boolean additional) {
+ this.from = from;
+ this.to = to;
+ fromName = from.fullName();
+ toName = to.fullName();
+ this.type = type;
+ this.extraInfo = extraInfo;
+ this.condensed = condensed;
+ this.additional = additional;
+ }
+
+ public boolean isCondensed() {
+ return condensed;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ EvolutionUpdate other = (EvolutionUpdate) obj;
+ return from == other.from && to == other.to && type == other.type;
+ }
+
+ @Override
+ public int compareTo(EvolutionUpdate o) {
+ if (this.from.number < o.from.number) {
+ return -1;
+ } else if (this.from.number > o.from.number) {
+ return 1;
+ } else return Integer.compare(this.to.number, o.to.number);
+ }
+
+ @Override
+ public String toString() {
+ switch (type) {
+ case LEVEL:
+ if (condensed) {
+ String formatLength = this.additional ? "%-15s" : "%-20s";
+ return String.format("%-15s now%s evolves into " + formatLength + " at minimum level %s",
+ fromName, additional ? " also" : "", toName, extraInfo);
+ } else {
+ return String.format("%-15s -> %-15s at level %s", fromName, toName, extraInfo);
+ }
+ case STONE:
+ return String.format("%-15s -> %-15s using a %s", fromName, toName, extraInfo);
+ case HAPPINESS:
+ return String.format("%-15s -> %-15s by reaching high happiness", fromName, toName);
+ case LEVEL_ITEM_DAY:
+ return String.format("%-15s -> %-15s by leveling up holding %s", fromName, toName, extraInfo);
+ case LEVEL_WITH_OTHER:
+ return String.format("%-15s -> %-15s by leveling up with %s in the party", fromName, toName, extraInfo);
+ default:
+ return "";
+ }
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/ExpCurve.java b/src/com/rafa_99/pkrandom/pokemon/ExpCurve.java
new file mode 100755
index 0000000..2bda5ed
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/ExpCurve.java
@@ -0,0 +1,86 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- ExpCurve.java - represents the EXP curves that a Pokemon can have. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 ExpCurve {
+
+ SLOW, MEDIUM_SLOW, MEDIUM_FAST, FAST, ERRATIC, FLUCTUATING;
+
+ public static ExpCurve fromByte(byte curve) {
+ switch (curve) {
+ case 0:
+ return MEDIUM_FAST;
+ case 1:
+ return ERRATIC;
+ case 2:
+ return FLUCTUATING;
+ case 3:
+ return MEDIUM_SLOW;
+ case 4:
+ return FAST;
+ case 5:
+ return SLOW;
+ }
+ return null;
+ }
+
+ public byte toByte() {
+ switch (this) {
+ case SLOW:
+ return 5;
+ case MEDIUM_SLOW:
+ return 3;
+ case MEDIUM_FAST:
+ return 0;
+ case FAST:
+ return 4;
+ case ERRATIC:
+ return 1;
+ case FLUCTUATING:
+ return 2;
+ }
+ return 0; // default
+ }
+
+ @Override
+ public String toString() {
+ switch (this) {
+ case MEDIUM_FAST:
+ return "Medium Fast";
+ case ERRATIC:
+ return "Erratic";
+ case FLUCTUATING:
+ return "Fluctuating";
+ case MEDIUM_SLOW:
+ return "Medium Slow";
+ case FAST:
+ return "Fast";
+ case SLOW:
+ return "Slow";
+ }
+ return null;
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/FormeInfo.java b/src/com/rafa_99/pkrandom/pokemon/FormeInfo.java
new file mode 100644
index 0000000..2792305
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/FormeInfo.java
@@ -0,0 +1,36 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- FormeInfo.java - stores information about a Pokemon's alt formes. --*/
+/*-- --*/
+/*-- 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 class FormeInfo {
+ public int baseForme;
+ public int formeNumber;
+ public int formeSpriteOffset;
+
+ public FormeInfo(int baseForme, int formeNumber, int formeSpriteOffset) {
+ this.baseForme = baseForme;
+ this.formeNumber = formeNumber;
+ this.formeSpriteOffset = formeSpriteOffset;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Gen1Pokemon.java b/src/com/rafa_99/pkrandom/pokemon/Gen1Pokemon.java
new file mode 100644
index 0000000..6aa34e2
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Gen1Pokemon.java
@@ -0,0 +1,149 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Gen1Pokemon.java - represents an individual Gen 1 Pokemon. Used to --*/
+/*-- handle things related to stats because of the lack --*/
+/*-- of the Special split in Gen 1. --*/
+/*-- --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+public class Gen1Pokemon extends Pokemon {
+
+ public Gen1Pokemon() {
+ shuffledStatsOrder = Arrays.asList(0, 1, 2, 3, 4);
+ }
+
+ @Override
+ public void copyShuffledStatsUpEvolution(Pokemon evolvesFrom) {
+ // If stats were already shuffled once, un-shuffle them
+ shuffledStatsOrder = Arrays.asList(
+ shuffledStatsOrder.indexOf(0),
+ shuffledStatsOrder.indexOf(1),
+ shuffledStatsOrder.indexOf(2),
+ shuffledStatsOrder.indexOf(3),
+ shuffledStatsOrder.indexOf(4));
+ applyShuffledOrderToStats();
+ shuffledStatsOrder = evolvesFrom.shuffledStatsOrder;
+ applyShuffledOrderToStats();
+ }
+
+ @Override
+ protected void applyShuffledOrderToStats() {
+ List<Integer> stats = Arrays.asList(hp, attack, defense, special, speed);
+
+ // Copy in new stats
+ hp = stats.get(shuffledStatsOrder.get(0));
+ attack = stats.get(shuffledStatsOrder.get(1));
+ defense = stats.get(shuffledStatsOrder.get(2));
+ special = stats.get(shuffledStatsOrder.get(3));
+ speed = stats.get(shuffledStatsOrder.get(4));
+ }
+
+ @Override
+ public void randomizeStatsWithinBST(Random random) {
+ // Minimum 20 HP, 10 everything else
+ int bst = bst() - 60;
+
+ // Make weightings
+ double hpW = random.nextDouble(), atkW = random.nextDouble(), defW = random.nextDouble();
+ double specW = random.nextDouble(), speW = random.nextDouble();
+
+ double totW = hpW + atkW + defW + specW + speW;
+
+ hp = (int) Math.max(1, Math.round(hpW / totW * bst)) + 20;
+ attack = (int) Math.max(1, Math.round(atkW / totW * bst)) + 10;
+ defense = (int) Math.max(1, Math.round(defW / totW * bst)) + 10;
+ special = (int) Math.max(1, Math.round(specW / totW * bst)) + 10;
+ speed = (int) Math.max(1, Math.round(speW / totW * bst)) + 10;
+
+ // Check for something we can't store
+ if (hp > 255 || attack > 255 || defense > 255 || special > 255 || speed > 255) {
+ // re roll
+ randomizeStatsWithinBST(random);
+ }
+ }
+
+ @Override
+ public void copyRandomizedStatsUpEvolution(Pokemon evolvesFrom) {
+ double ourBST = bst();
+ double theirBST = evolvesFrom.bst();
+
+ double bstRatio = ourBST / theirBST;
+
+ hp = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.hp * bstRatio)));
+ attack = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.attack * bstRatio)));
+ defense = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.defense * bstRatio)));
+ speed = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.speed * bstRatio)));
+ special = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.special * bstRatio)));
+ }
+
+ @Override
+ public void assignNewStatsForEvolution(Pokemon evolvesFrom, Random random) {
+ double ourBST = bst();
+ double theirBST = evolvesFrom.bst();
+
+ double bstDiff = ourBST - theirBST;
+
+ // Make weightings
+ double hpW = random.nextDouble(), atkW = random.nextDouble(), defW = random.nextDouble();
+ double specW = random.nextDouble(), speW = random.nextDouble();
+
+ double totW = hpW + atkW + defW + specW + speW;
+
+ double hpDiff = Math.round((hpW / totW) * bstDiff);
+ double atkDiff = Math.round((atkW / totW) * bstDiff);
+ double defDiff = Math.round((defW / totW) * bstDiff);
+ double specDiff = Math.round((specW / totW) * bstDiff);
+ double speDiff = Math.round((speW / totW) * bstDiff);
+
+ hp = (int) Math.min(255, Math.max(1, evolvesFrom.hp + hpDiff));
+ attack = (int) Math.min(255, Math.max(1, evolvesFrom.attack + atkDiff));
+ defense = (int) Math.min(255, Math.max(1, evolvesFrom.defense + defDiff));
+ speed = (int) Math.min(255, Math.max(1, evolvesFrom.speed + speDiff));
+ special = (int) Math.min(255, Math.max(1, evolvesFrom.special + specDiff));
+ }
+
+ @Override
+ protected int bst() {
+ return hp + attack + defense + special + speed;
+ }
+
+ @Override
+ public int bstForPowerLevels() {
+ return hp + attack + defense + special + speed;
+ }
+
+ @Override
+ public double getAttackSpecialAttackRatio() {
+ return (double)attack / ((double)attack + (double)special);
+ }
+
+ @Override
+ public String toString() {
+ return "Pokemon [name=" + name + ", number=" + number + ", primaryType=" + primaryType + ", secondaryType="
+ + secondaryType + ", hp=" + hp + ", attack=" + attack + ", defense=" + defense + ", special=" + special
+ + ", speed=" + speed + "]";
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/GenRestrictions.java b/src/com/rafa_99/pkrandom/pokemon/GenRestrictions.java
new file mode 100755
index 0000000..8dbc17c
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/GenRestrictions.java
@@ -0,0 +1,145 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- GenRestrictions.java - stores what generations the user has limited. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class GenRestrictions {
+
+ public boolean allow_gen1, allow_gen2, allow_gen3, allow_gen4, allow_gen5, allow_gen6, allow_gen7;
+ public boolean allow_evolutionary_relatives;
+
+ public GenRestrictions() {
+ }
+
+ public GenRestrictions(int state) {
+ allow_gen1 = (state & 1) > 0;
+ allow_gen2 = (state & 2) > 0;
+ allow_gen3 = (state & 4) > 0;
+ allow_gen4 = (state & 8) > 0;
+ allow_gen5 = (state & 16) > 0;
+ allow_gen6 = (state & 32) > 0;
+ allow_gen7 = (state & 64) > 0;
+ allow_evolutionary_relatives = (state & 128) > 0;
+ }
+
+ public boolean nothingSelected() {
+ return !allow_gen1 && !allow_gen2 && !allow_gen3 && !allow_gen4 && !allow_gen5 && !allow_gen6 && !allow_gen7;
+ }
+
+ public int toInt() {
+ return makeIntSelected(allow_gen1, allow_gen2, allow_gen3, allow_gen4, allow_gen5, allow_gen6, allow_gen7,
+ allow_evolutionary_relatives);
+ }
+
+ public void limitToGen(int generation) {
+ if (generation < 2) {
+ allow_gen2 = false;
+ }
+ if (generation < 3) {
+ allow_gen3 = false;
+ }
+ if (generation < 4) {
+ allow_gen4 = false;
+ }
+ if (generation < 5) {
+ allow_gen5 = false;
+ }
+ if (generation < 6) {
+ allow_gen6 = false;
+ }
+ if (generation < 7) {
+ allow_gen7 = false;
+ }
+ }
+
+ public boolean allowTrainerSwapMegaEvolvables(boolean isXY, boolean isTypeThemedTrainers) {
+ if (isTypeThemedTrainers) {
+ return megaEvolutionsOfEveryTypeAreInPool(isXY);
+ } else {
+ return megaEvolutionsAreInPool(isXY);
+ }
+ }
+
+ public boolean megaEvolutionsOfEveryTypeAreInPool(boolean isXY) {
+ Set<Type> typePool = new HashSet<>();
+ if (allow_gen1) {
+ typePool.addAll(Arrays.asList(Type.GRASS, Type.POISON, Type.FIRE, Type.FLYING, Type.WATER, Type.PSYCHIC,
+ Type.GHOST, Type.NORMAL, Type.BUG, Type.ROCK));
+ }
+ if (allow_gen2) {
+ typePool.addAll(Arrays.asList(Type.ELECTRIC, Type.BUG, Type.STEEL, Type.FIGHTING, Type.DARK,
+ Type.FIRE, Type.ROCK));
+ if (!isXY) {
+ typePool.add(Type.GROUND);
+ }
+ }
+ if (allow_gen3) {
+ typePool.addAll(Arrays.asList(Type.FIRE, Type.FIGHTING, Type.PSYCHIC, Type.FAIRY, Type.STEEL, Type.ROCK,
+ Type.ELECTRIC, Type.GHOST, Type.DARK, Type.DRAGON));
+ if (!isXY) {
+ typePool.addAll(Arrays.asList(Type.GRASS, Type.WATER, Type.GROUND, Type.FLYING, Type.ICE));
+ }
+ }
+ if (allow_gen4) {
+ typePool.addAll(Arrays.asList(Type.DRAGON, Type.GROUND, Type.FIGHTING, Type.STEEL, Type.GRASS, Type.ICE));
+ if (!isXY) {
+ typePool.addAll(Arrays.asList(Type.NORMAL, Type.PSYCHIC));
+ }
+ }
+ if (allow_gen5 && !isXY) {
+ typePool.add(Type.NORMAL);
+ }
+ if (allow_gen6 && !isXY) {
+ typePool.addAll(Arrays.asList(Type.ROCK, Type.FAIRY));
+ }
+ return typePool.size() == 18;
+ }
+
+ public boolean megaEvolutionsAreInPool(boolean isXY) {
+ if (isXY) {
+ return allow_gen1 || allow_gen2 || allow_gen3 || allow_gen4;
+ } else {
+ return allow_gen1 || allow_gen2 || allow_gen3 || allow_gen4 || allow_gen5 || allow_gen6;
+ }
+ }
+
+ private int makeIntSelected(boolean... switches) {
+ if (switches.length > 32) {
+ // No can do
+ return 0;
+ }
+ int initial = 0;
+ int state = 1;
+ for (boolean b : switches) {
+ initial |= b ? state : 0;
+ state *= 2;
+ }
+ return initial;
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/IngameTrade.java b/src/com/rafa_99/pkrandom/pokemon/IngameTrade.java
new file mode 100755
index 0000000..97360c2
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/IngameTrade.java
@@ -0,0 +1,41 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- IngameTrade.java - stores Pokemon trades with in-game NPCs. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class IngameTrade {
+
+ public int id;
+
+ public Pokemon requestedPokemon, givenPokemon;
+
+ public String nickname, otName;
+
+ public int otId;
+
+ public int[] ivs = new int[0];
+
+ public int item = 0;
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/ItemList.java b/src/com/rafa_99/pkrandom/pokemon/ItemList.java
new file mode 100755
index 0000000..97f0e5f
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/ItemList.java
@@ -0,0 +1,106 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- ItemList.java - contains the list of all items in the game. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.Random;
+
+public class ItemList {
+
+ private boolean[] items;
+ private boolean[] tms;
+
+ public ItemList(int highestIndex) {
+ items = new boolean[highestIndex + 1];
+ tms = new boolean[highestIndex + 1];
+ for (int i = 1; i <= highestIndex; i++) {
+ items[i] = true;
+ }
+ }
+
+ public boolean isTM(int index) {
+ return index >= 0 && index < tms.length && tms[index];
+ }
+
+ public boolean isAllowed(int index) {
+ return index >= 0 && index < tms.length && items[index];
+ }
+
+ public void banSingles(int... indexes) {
+ for (int index : indexes) {
+ items[index] = false;
+ }
+ }
+
+ public void banRange(int startIndex, int length) {
+ for (int i = 0; i < length; i++) {
+ items[i + startIndex] = false;
+ }
+ }
+
+ public void tmRange(int startIndex, int length) {
+ for (int i = 0; i < length; i++) {
+ tms[i + startIndex] = true;
+ }
+ }
+
+ public int randomItem(Random random) {
+ int chosen = 0;
+ while (!items[chosen]) {
+ chosen = random.nextInt(items.length);
+ }
+ return chosen;
+ }
+
+ public int randomNonTM(Random random) {
+ int chosen = 0;
+ while (!items[chosen] || tms[chosen]) {
+ chosen = random.nextInt(items.length);
+ }
+ return chosen;
+ }
+
+ public int randomTM(Random random) {
+ int chosen = 0;
+ while (!tms[chosen]) {
+ chosen = random.nextInt(items.length);
+ }
+ return chosen;
+ }
+
+ public ItemList copy() {
+ ItemList other = new ItemList(items.length - 1);
+ System.arraycopy(items, 0, other.items, 0, items.length);
+ System.arraycopy(tms, 0, other.tms, 0, tms.length);
+ return other;
+ }
+
+ public ItemList copy(int newMax) {
+ ItemList other = new ItemList(newMax);
+ System.arraycopy(items, 0, other.items, 0, items.length);
+ System.arraycopy(tms, 0, other.tms, 0, tms.length);
+ return other;
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/MegaEvolution.java b/src/com/rafa_99/pkrandom/pokemon/MegaEvolution.java
new file mode 100644
index 0000000..979c97b
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/MegaEvolution.java
@@ -0,0 +1,39 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- MegaEvolution.java - represents an mega evolution --*/
+/*-- --*/
+/*-- 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 class MegaEvolution {
+ public Pokemon from;
+ public Pokemon to;
+ public int method;
+ public int argument;
+ public boolean carryStats = true;
+
+ public MegaEvolution(Pokemon from, Pokemon to, int method, int argument) {
+ this.from = from;
+ this.to = to;
+ this.method = method;
+ this.argument = argument;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Move.java b/src/com/rafa_99/pkrandom/pokemon/Move.java
new file mode 100755
index 0000000..01e3817
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Move.java
@@ -0,0 +1,69 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Move.java - represents a move usable by Pokemon. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class Move {
+ public class StatChange {
+ public StatChangeType type;
+ public int stages;
+ public double percentChance;
+ }
+
+ public String name;
+ public int number;
+ public int internalId;
+ public int power;
+ public int pp;
+ public double hitratio;
+ public Type type;
+ public StatChangeMoveType statChangeMoveType = StatChangeMoveType.NONE_OR_UNKNOWN;
+ public StatChange[] statChanges = new StatChange[3];
+ public StatusMoveType statusMoveType = StatusMoveType.NONE_OR_UNKNOWN;
+ public StatusType statusType = StatusType.NONE;
+ public double statusPercentChance;
+ public double flinchPercentChance;
+ 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 boolean makesContact;
+
+ 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 = StatChangeType.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/rafa_99/pkrandom/pokemon/MoveCategory.java b/src/com/rafa_99/pkrandom/pokemon/MoveCategory.java
new file mode 100644
index 0000000..8cd6ec8
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/MoveCategory.java
@@ -0,0 +1,29 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- DamageType.java - represents a move's Physical/Special split value. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 MoveCategory {
+ PHYSICAL, SPECIAL, STATUS
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/MoveLearnt.java b/src/com/rafa_99/pkrandom/pokemon/MoveLearnt.java
new file mode 100755
index 0000000..b1284d0
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/MoveLearnt.java
@@ -0,0 +1,36 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- MoveLearnt.java - represents a move learnt by a Pokemon at a level. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class MoveLearnt {
+
+ public int move;
+ public int level;
+
+ public String toString() {
+ return "move " + move + " at level " + level;
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/PickupItem.java b/src/com/rafa_99/pkrandom/pokemon/PickupItem.java
new file mode 100644
index 0000000..a02eb90
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/PickupItem.java
@@ -0,0 +1,11 @@
+package com.rafa_99.pkrandom.pokemon;
+
+public class PickupItem {
+ public int item;
+ public int[] probabilities;
+
+ public PickupItem(int item) {
+ this.item = item;
+ this.probabilities = new int[10];
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Pokemon.java b/src/com/rafa_99/pkrandom/pokemon/Pokemon.java
new file mode 100755
index 0000000..8c0185d
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Pokemon.java
@@ -0,0 +1,325 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Pokemon.java - represents an individual Pokemon, and contains --*/
+/*-- common Pokemon-related functions. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import com.rafa_99.pkrandom.constants.Species;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+public class Pokemon implements Comparable<Pokemon> {
+
+ public String name;
+ public int number;
+
+ public String formeSuffix = "";
+ public Pokemon baseForme = null;
+ public int formeNumber = 0;
+ public int cosmeticForms = 0;
+ public int formeSpriteIndex = 0;
+ public boolean actuallyCosmetic = false;
+ public List<Integer> realCosmeticFormNumbers = new ArrayList<>();
+
+ public Type primaryType, secondaryType;
+
+ public int hp, attack, defense, spatk, spdef, speed, special;
+
+ public int ability1, ability2, ability3;
+
+ public int catchRate, expYield;
+
+ public int guaranteedHeldItem, commonHeldItem, rareHeldItem, darkGrassHeldItem;
+
+ public int genderRatio;
+
+ public int frontSpritePointer, picDimensions;
+
+ public int callRate;
+
+ public ExpCurve growthCurve;
+
+ public List<Evolution> evolutionsFrom = new ArrayList<>();
+ public List<Evolution> evolutionsTo = new ArrayList<>();
+
+ public List<MegaEvolution> megaEvolutionsFrom = new ArrayList<>();
+ public List<MegaEvolution> megaEvolutionsTo = new ArrayList<>();
+
+ protected List<Integer> shuffledStatsOrder;
+
+ // A flag to use for things like recursive stats copying.
+ // Must not rely on the state of this flag being preserved between calls.
+ public boolean temporaryFlag;
+
+ public Pokemon() {
+ shuffledStatsOrder = Arrays.asList(0, 1, 2, 3, 4, 5);
+ }
+
+ public void shuffleStats(Random random) {
+ Collections.shuffle(shuffledStatsOrder, random);
+ applyShuffledOrderToStats();
+ }
+
+ public void copyShuffledStatsUpEvolution(Pokemon evolvesFrom) {
+ // If stats were already shuffled once, un-shuffle them
+ shuffledStatsOrder = Arrays.asList(
+ shuffledStatsOrder.indexOf(0),
+ shuffledStatsOrder.indexOf(1),
+ shuffledStatsOrder.indexOf(2),
+ shuffledStatsOrder.indexOf(3),
+ shuffledStatsOrder.indexOf(4),
+ shuffledStatsOrder.indexOf(5));
+ applyShuffledOrderToStats();
+ shuffledStatsOrder = evolvesFrom.shuffledStatsOrder;
+ applyShuffledOrderToStats();
+ }
+
+ protected void applyShuffledOrderToStats() {
+ List<Integer> stats = Arrays.asList(hp, attack, defense, spatk, spdef, speed);
+
+ // Copy in new stats
+ hp = stats.get(shuffledStatsOrder.get(0));
+ attack = stats.get(shuffledStatsOrder.get(1));
+ defense = stats.get(shuffledStatsOrder.get(2));
+ spatk = stats.get(shuffledStatsOrder.get(3));
+ spdef = stats.get(shuffledStatsOrder.get(4));
+ speed = stats.get(shuffledStatsOrder.get(5));
+ }
+
+ public void randomizeStatsWithinBST(Random random) {
+ if (number == Species.shedinja) {
+ // Shedinja is horribly broken unless we restrict him to 1HP.
+ int bst = bst() - 51;
+
+ // Make weightings
+ double atkW = random.nextDouble(), defW = random.nextDouble();
+ double spaW = random.nextDouble(), spdW = random.nextDouble(), speW = random.nextDouble();
+
+ double totW = atkW + defW + spaW + spdW + speW;
+
+ hp = 1;
+ attack = (int) Math.max(1, Math.round(atkW / totW * bst)) + 10;
+ defense = (int) Math.max(1, Math.round(defW / totW * bst)) + 10;
+ spatk = (int) Math.max(1, Math.round(spaW / totW * bst)) + 10;
+ spdef = (int) Math.max(1, Math.round(spdW / totW * bst)) + 10;
+ speed = (int) Math.max(1, Math.round(speW / totW * bst)) + 10;
+ } else {
+ // Minimum 20 HP, 10 everything else
+ int bst = bst() - 70;
+
+ // Make weightings
+ double hpW = random.nextDouble(), atkW = random.nextDouble(), defW = random.nextDouble();
+ double spaW = random.nextDouble(), spdW = random.nextDouble(), speW = random.nextDouble();
+
+ double totW = hpW + atkW + defW + spaW + spdW + speW;
+
+ hp = (int) Math.max(1, Math.round(hpW / totW * bst)) + 20;
+ attack = (int) Math.max(1, Math.round(atkW / totW * bst)) + 10;
+ defense = (int) Math.max(1, Math.round(defW / totW * bst)) + 10;
+ spatk = (int) Math.max(1, Math.round(spaW / totW * bst)) + 10;
+ spdef = (int) Math.max(1, Math.round(spdW / totW * bst)) + 10;
+ speed = (int) Math.max(1, Math.round(speW / totW * bst)) + 10;
+ }
+
+ // Check for something we can't store
+ if (hp > 255 || attack > 255 || defense > 255 || spatk > 255 || spdef > 255 || speed > 255) {
+ // re roll
+ randomizeStatsWithinBST(random);
+ }
+
+ }
+
+ public void copyRandomizedStatsUpEvolution(Pokemon evolvesFrom) {
+ double ourBST = bst();
+ double theirBST = evolvesFrom.bst();
+
+ double bstRatio = ourBST / theirBST;
+
+ hp = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.hp * bstRatio)));
+ attack = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.attack * bstRatio)));
+ defense = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.defense * bstRatio)));
+ speed = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.speed * bstRatio)));
+ spatk = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.spatk * bstRatio)));
+ spdef = (int) Math.min(255, Math.max(1, Math.round(evolvesFrom.spdef * bstRatio)));
+ }
+
+ public void assignNewStatsForEvolution(Pokemon evolvesFrom, Random random) {
+
+ double ourBST = bst();
+ double theirBST = evolvesFrom.bst();
+
+ double bstDiff = ourBST - theirBST;
+
+ // Make weightings
+ double hpW = random.nextDouble(), atkW = random.nextDouble(), defW = random.nextDouble();
+ double spaW = random.nextDouble(), spdW = random.nextDouble(), speW = random.nextDouble();
+
+ double totW = hpW + atkW + defW + spaW + spdW + speW;
+
+ double hpDiff = Math.round((hpW / totW) * bstDiff);
+ double atkDiff = Math.round((atkW / totW) * bstDiff);
+ double defDiff = Math.round((defW / totW) * bstDiff);
+ double spaDiff = Math.round((spaW / totW) * bstDiff);
+ double spdDiff = Math.round((spdW / totW) * bstDiff);
+ double speDiff = Math.round((speW / totW) * bstDiff);
+
+ hp = (int) Math.min(255, Math.max(1, evolvesFrom.hp + hpDiff));
+ attack = (int) Math.min(255, Math.max(1, evolvesFrom.attack + atkDiff));
+ defense = (int) Math.min(255, Math.max(1, evolvesFrom.defense + defDiff));
+ speed = (int) Math.min(255, Math.max(1, evolvesFrom.speed + speDiff));
+ spatk = (int) Math.min(255, Math.max(1, evolvesFrom.spatk + spaDiff));
+ spdef = (int) Math.min(255, Math.max(1, evolvesFrom.spdef + spdDiff));
+ }
+
+ protected int bst() {
+ return hp + attack + defense + spatk + spdef + speed;
+ }
+
+ public int bstForPowerLevels() {
+ // Take into account Shedinja's purposefully nerfed HP
+ if (number == Species.shedinja) {
+ return (attack + defense + spatk + spdef + speed) * 6 / 5;
+ } else {
+ return hp + attack + defense + spatk + spdef + speed;
+ }
+ }
+
+ public double getAttackSpecialAttackRatio() {
+ return (double)attack / ((double)attack + (double)spatk);
+ }
+
+ public int getBaseNumber() {
+ Pokemon base = this;
+ while (base.baseForme != null) {
+ base = base.baseForme;
+ }
+ return base.number;
+ }
+
+ public void copyBaseFormeBaseStats(Pokemon baseForme) {
+ hp = baseForme.hp;
+ attack = baseForme.attack;
+ defense = baseForme.defense;
+ speed = baseForme.speed;
+ spatk = baseForme.spatk;
+ spdef = baseForme.spdef;
+ }
+
+ public void copyBaseFormeAbilities(Pokemon baseForme) {
+ ability1 = baseForme.ability1;
+ ability2 = baseForme.ability2;
+ ability3 = baseForme.ability3;
+ }
+
+ public void copyBaseFormeEvolutions(Pokemon baseForme) {
+ evolutionsFrom = baseForme.evolutionsFrom;
+ }
+
+ public int getSpriteIndex() {
+ return formeNumber == 0 ? number : formeSpriteIndex + formeNumber - 1;
+ }
+
+ public String fullName() {
+ return name + formeSuffix;
+ }
+
+ @Override
+ public String toString() {
+ return "Pokemon [name=" + name + formeSuffix + ", number=" + number + ", primaryType=" + primaryType
+ + ", secondaryType=" + secondaryType + ", hp=" + hp + ", attack=" + attack + ", defense=" + defense
+ + ", spatk=" + spatk + ", spdef=" + spdef + ", speed=" + speed + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + number;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Pokemon other = (Pokemon) obj;
+ return number == other.number;
+ }
+
+ @Override
+ public int compareTo(Pokemon o) {
+ return number - o.number;
+ }
+
+ private static final List<Integer> legendaries = Arrays.asList(Species.articuno, Species.zapdos, Species.moltres,
+ Species.mewtwo, Species.mew, Species.raikou, Species.entei, Species.suicune, Species.lugia, Species.hoOh,
+ Species.celebi, Species.regirock, Species.regice, Species.registeel, Species.latias, Species.latios,
+ Species.kyogre, Species.groudon, Species.rayquaza, Species.jirachi, Species.deoxys, Species.uxie,
+ Species.mesprit, Species.azelf, Species.dialga, Species.palkia, Species.heatran, Species.regigigas,
+ Species.giratina, Species.cresselia, Species.phione, Species.manaphy, Species.darkrai, Species.shaymin,
+ Species.arceus, Species.victini, Species.cobalion, Species.terrakion, Species.virizion, Species.tornadus,
+ Species.thundurus, Species.reshiram, Species.zekrom, Species.landorus, Species.kyurem, Species.keldeo,
+ Species.meloetta, Species.genesect, Species.xerneas, Species.yveltal, Species.zygarde, Species.diancie,
+ Species.hoopa, Species.volcanion, Species.typeNull, Species.silvally, Species.tapuKoko, Species.tapuLele,
+ Species.tapuBulu, Species.tapuFini, Species.cosmog, Species.cosmoem, Species.solgaleo, Species.lunala,
+ Species.necrozma, Species.magearna, Species.marshadow, Species.zeraora);
+
+ private static final List<Integer> strongLegendaries = Arrays.asList(Species.mewtwo, Species.lugia, Species.hoOh,
+ Species.kyogre, Species.groudon, Species.rayquaza, Species.dialga, Species.palkia, Species.regigigas,
+ Species.giratina, Species.arceus, Species.reshiram, Species.zekrom, Species.kyurem, Species.xerneas,
+ Species.yveltal, Species.cosmog, Species.cosmoem, Species.solgaleo, Species.lunala);
+
+ private static final List<Integer> ultraBeasts = Arrays.asList(Species.nihilego, Species.buzzwole, Species.pheromosa,
+ Species.xurkitree, Species.celesteela, Species.kartana, Species.guzzlord, Species.poipole, Species.naganadel,
+ Species.stakataka, Species.blacephalon);
+
+ public boolean isLegendary() {
+ return formeNumber == 0 ? legendaries.contains(this.number) : legendaries.contains(this.baseForme.number);
+ }
+
+ public boolean isStrongLegendary() {
+ return formeNumber == 0 ? strongLegendaries.contains(this.number) : strongLegendaries.contains(this.baseForme.number);
+ }
+
+ // This method can only be used in contexts where alt formes are NOT involved; otherwise, some alt formes
+ // will be considered as Ultra Beasts in SM.
+ // In contexts where formes are involved, use "if (ultraBeastList.contains(...))" instead,
+ // assuming "checkPokemonRestrictions" has been used at some point beforehand.
+ public boolean isUltraBeast() {
+ return ultraBeasts.contains(this.number);
+ }
+
+ public int getCosmeticFormNumber(int num) {
+ return realCosmeticFormNumbers.isEmpty() ? num : realCosmeticFormNumbers.get(num);
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/SOSType.java b/src/com/rafa_99/pkrandom/pokemon/SOSType.java
new file mode 100644
index 0000000..a3647d2
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/SOSType.java
@@ -0,0 +1,28 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- SOSType.java - represents a Gen 7 SOS Encounter's type --*/
+/*-- --*/
+/*-- 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 SOSType {
+ GENERIC, RAIN, HAIL, SAND
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Shop.java b/src/com/rafa_99/pkrandom/pokemon/Shop.java
new file mode 100644
index 0000000..c8c90c8
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Shop.java
@@ -0,0 +1,43 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Shop.java - represents a shop with a list of purchasable items. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.List;
+
+public class Shop {
+ public List<Integer> items;
+ public String name;
+ public boolean isMainGame;
+
+ public Shop() {
+ this.isMainGame = false;
+ }
+
+ public Shop(Shop otherShop) {
+ this.items = otherShop.items;
+ this.name = otherShop.name;
+ this.isMainGame = otherShop.isMainGame;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Stat.java b/src/com/rafa_99/pkrandom/pokemon/Stat.java
new file mode 100644
index 0000000..1816d34
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Stat.java
@@ -0,0 +1,45 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Stat.java - represents a Pokemon's stat --*/
+/*-- --*/
+/*-- 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 Stat {
+ HP(1),
+ ATK(1 << 1),
+ DEF(1 << 2),
+ SPATK(1 << 3),
+ SPDEF(1 << 4),
+ SPEED(1 << 5),
+ SPECIAL(1 << 6),
+ POWER(1 << 7),
+ ACCURACY(1 << 8),
+ PP(1 << 9),
+ TYPE(1 << 10),
+ CATEGORY(1 << 11);
+
+ public final int val;
+
+ Stat(int val) {
+ this.val = val;
+ }
+} \ No newline at end of file
diff --git a/src/com/rafa_99/pkrandom/pokemon/StatChange.java b/src/com/rafa_99/pkrandom/pokemon/StatChange.java
new file mode 100644
index 0000000..8acdf45
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StatChange.java
@@ -0,0 +1,35 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- StatChange.java - stores updated stat information for a Pokemon --*/
+/*-- --*/
+/*-- 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 class StatChange {
+
+ public int stat;
+ public int[] values;
+
+ public StatChange(int stat, int... values) {
+ this.stat = stat;
+ this.values = values;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/StatChangeMoveType.java b/src/com/rafa_99/pkrandom/pokemon/StatChangeMoveType.java
new file mode 100644
index 0000000..b300397
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StatChangeMoveType.java
@@ -0,0 +1,35 @@
+package com.rafa_99.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 StatChangeMoveType {
+ NONE_OR_UNKNOWN,
+ NO_DAMAGE_TARGET,
+ NO_DAMAGE_USER,
+ NO_DAMAGE_ALL,
+ NO_DAMAGE_ALLY,
+ DAMAGE_TARGET,
+ DAMAGE_USER
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/StatChangeType.java b/src/com/rafa_99/pkrandom/pokemon/StatChangeType.java
new file mode 100644
index 0000000..b0beef4
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StatChangeType.java
@@ -0,0 +1,38 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- StatChangeType.java - represents the types of stat buffs that a move --*/
+/*-- can apply. --*/
+/*-- --*/
+/*-- 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,
+ ATTACK,
+ DEFENSE,
+ SPECIAL_ATTACK,
+ SPECIAL_DEFENSE,
+ SPEED,
+ ACCURACY,
+ EVASION,
+ ALL,
+ SPECIAL
+} \ No newline at end of file
diff --git a/src/com/rafa_99/pkrandom/pokemon/StaticEncounter.java b/src/com/rafa_99/pkrandom/pokemon/StaticEncounter.java
new file mode 100644
index 0000000..3c82efd
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StaticEncounter.java
@@ -0,0 +1,98 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- StaticEncounter.java - stores a static encounter in Gen 6+ --*/
+/*-- --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class StaticEncounter {
+ public Pokemon pkmn;
+ public int forme = 0;
+ public int level;
+ public int maxLevel = 0;
+ public int heldItem;
+ public boolean isEgg = false;
+ public boolean resetMoves = false;
+ public boolean restrictedPool = false;
+ public List<Pokemon> restrictedList = new ArrayList<>();
+
+ // In the games, sometimes what is logically an encounter or set of encounters with one specific Pokemon
+ // can actually consist of multiple encounters internally. This can happen because:
+ // - The same Pokemon appears in multiple locations (e.g., Reshiram/Zekrom in BW1, Giratina in Pt)
+ // - The same Pokemon appears at different levels depending on game progression (e.g., Volcarona in BW2)
+ // - Rebattling a Pokemon actually is different encounter entirely (e.g., Xerneas/Yveltal in XY)
+ // This list tracks encounters that should logically have the same species and forme, but *may* have
+ // differences in other properties like level.
+ public List<StaticEncounter> linkedEncounters;
+
+ public StaticEncounter() {
+ this.linkedEncounters = new ArrayList<>();
+ }
+
+ public StaticEncounter(Pokemon pkmn) {
+ this.pkmn = pkmn;
+ this.linkedEncounters = new ArrayList<>();
+ }
+
+ @Override
+ public String toString() {
+ return this.toString(true);
+ }
+
+ public String toString(boolean printLevel) {
+ if (isEgg) {
+ return pkmn.fullName() + " (egg)";
+ }
+ else if (!printLevel) {
+ return pkmn.fullName();
+ }
+ StringBuilder levelStringBuilder = new StringBuilder("Lv" + level);
+ if (maxLevel > 0) {
+ levelStringBuilder.append("-").append(maxLevel);
+ }
+ boolean needToDisplayLinkedLevels = false;
+ for (int i = 0; i < linkedEncounters.size(); i++) {
+ if (level != linkedEncounters.get(i).level) {
+ needToDisplayLinkedLevels = true;
+ }
+ }
+ if (needToDisplayLinkedLevels) {
+ for (int i = 0; i < linkedEncounters.size(); i++) {
+ levelStringBuilder.append(" / ").append("Lv").append(linkedEncounters.get(i).level);
+ }
+ }
+ return pkmn.fullName() + ", " + levelStringBuilder.toString();
+ }
+
+ public boolean canMegaEvolve() {
+ if (heldItem != 0) {
+ for (MegaEvolution mega: pkmn.megaEvolutionsFrom) {
+ if (mega.argument == heldItem) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/StatusMoveType.java b/src/com/rafa_99/pkrandom/pokemon/StatusMoveType.java
new file mode 100644
index 0000000..328fbfe
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StatusMoveType.java
@@ -0,0 +1,31 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- StatusMoveType.java - represents the different types of moves --*/
+/*-- that can inflict a status effect. --*/
+/*-- --*/
+/*-- 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 StatusMoveType {
+ NONE_OR_UNKNOWN,
+ NO_DAMAGE,
+ DAMAGE
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/StatusType.java b/src/com/rafa_99/pkrandom/pokemon/StatusType.java
new file mode 100644
index 0000000..55c7094
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/StatusType.java
@@ -0,0 +1,37 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- StatusType.java - represents the different types of status effects --*/
+/*-- that can be inflicted on a Pokemon. --*/
+/*-- --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+// This does not include statuses that are only inflicted by a single move, like Attract, Nightmare, etc.
+public enum StatusType {
+ NONE,
+ PARALYZE,
+ SLEEP,
+ FREEZE,
+ BURN,
+ POISON,
+ CONFUSION,
+ TOXIC_POISON
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/TotemPokemon.java b/src/com/rafa_99/pkrandom/pokemon/TotemPokemon.java
new file mode 100644
index 0000000..2a68b9c
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/TotemPokemon.java
@@ -0,0 +1,56 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- TotemPokemon.java - represents a Totem Pokemon encounter --*/
+/*-- --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.Map;
+import java.util.TreeMap;
+
+public class TotemPokemon extends StaticEncounter {
+ public Aura aura;
+ public int ally1Offset;
+ public int ally2Offset;
+ public Map<Integer,StaticEncounter> allies = new TreeMap<>();
+
+ public boolean unused = false;
+
+ public TotemPokemon() {
+
+ }
+
+ public TotemPokemon(Pokemon pkmn) {
+ this.pkmn = pkmn;
+ }
+
+ @Override
+ public String toString() {
+ // The %s will be formatted to include the held item.
+ String ret = pkmn.fullName() + "@%s Lv" + level + "\n Aura: " + aura.toString() + "\n";
+ int i = 1;
+ for (StaticEncounter ally: allies.values()) {
+ ret = ret.concat(" Ally " + i + ": " + ally.toString() + "\n");
+ i++;
+ }
+ return ret.concat("\n");
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Trainer.java b/src/com/rafa_99/pkrandom/pokemon/Trainer.java
new file mode 100755
index 0000000..d344254
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Trainer.java
@@ -0,0 +1,130 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Trainer.java - represents a Trainer's pokemon set/other details. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Trainer implements Comparable<Trainer> {
+ public int offset;
+ public List<TrainerPokemon> pokemon = new ArrayList<>();
+ public String tag;
+ public boolean importantTrainer;
+ // This value has some flags about the trainer's pokemon (e.g. if they have items or custom moves)
+ public int poketype;
+ public String name;
+ public int trainerclass;
+ public String fullDisplayName;
+ public MultiBattleStatus multiBattleStatus = MultiBattleStatus.NEVER;
+ public int forceStarterPosition = -1;
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder("[");
+ if (fullDisplayName != null) {
+ sb.append(fullDisplayName).append(" ");
+ } else if (name != null) {
+ sb.append(name).append(" ");
+ }
+ if (trainerclass != 0) {
+ sb.append("(").append(trainerclass).append(") - ");
+ }
+ sb.append(String.format("%x", offset));
+ sb.append(" => ");
+ boolean first = true;
+ for (TrainerPokemon p : pokemon) {
+ if (!first) {
+ sb.append(',');
+ }
+ sb.append(p.pokemon.name).append(" Lv").append(p.level);
+ first = false;
+ }
+ sb.append(']');
+ if (tag != null) {
+ sb.append(" (").append(tag).append(")");
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + offset;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Trainer other = (Trainer) obj;
+ return offset == other.offset;
+ }
+
+ @Override
+ public int compareTo(Trainer o) {
+ return offset - o.offset;
+ }
+
+ public boolean isBoss() {
+ return tag != null && (tag.startsWith("ELITE") || tag.startsWith("CHAMPION")
+ || tag.startsWith("UBER") || tag.endsWith("LEADER"));
+ }
+
+ public boolean isImportant() {
+ return tag != null && (tag.startsWith("RIVAL") || tag.startsWith("FRIEND") || tag.endsWith("STRONG"));
+ }
+
+ public boolean skipImportant() {
+ return ((tag != null) && (tag.startsWith("RIVAL1-") || tag.startsWith("FRIEND1-") || tag.endsWith("NOTSTRONG")));
+ }
+
+ public void setPokemonHaveItems(boolean haveItems) {
+ if (haveItems) {
+ this.poketype |= 2;
+ } else {
+ // https://stackoverflow.com/a/1073328
+ this.poketype = poketype & ~2;
+ }
+ }
+
+ public boolean pokemonHaveItems() {
+ // This flag seems consistent for all gens
+ return (this.poketype & 2) == 2;
+ }
+
+ public boolean pokemonHaveCustomMoves() {
+ // This flag seems consistent for all gens
+ return (this.poketype & 1) == 1;
+ }
+
+ public enum MultiBattleStatus {
+ NEVER, POTENTIAL, ALWAYS
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/TrainerPokemon.java b/src/com/rafa_99/pkrandom/pokemon/TrainerPokemon.java
new file mode 100755
index 0000000..d68f0e1
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/TrainerPokemon.java
@@ -0,0 +1,106 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- TrainerPokemon.java - represents a Pokemon owned by a trainer. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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 class TrainerPokemon {
+
+ public Pokemon pokemon;
+ public int level;
+
+ public int move1;
+ public int move2;
+ public int move3;
+ public int move4;
+
+ public int heldItem = 0;
+ public boolean hasMegaStone;
+ public boolean hasZCrystal;
+ public int abilitySlot;
+ public int forme;
+ public String formeSuffix = "";
+ public int absolutePokeNumber = 0;
+
+ public int forcedGenderFlag;
+ public byte nature;
+ public byte hpEVs;
+ public byte atkEVs;
+ public byte defEVs;
+ public byte spatkEVs;
+ public byte spdefEVs;
+ public byte speedEVs;
+ public int IVs;
+ // In gens 3-5, there is a byte or word that corresponds
+ // to the IVs a trainer's pokemon has. In X/Y, this byte
+ // also encodes some other information, possibly related
+ // to EV spread. Because of the unknown part in X/Y,
+ // we store the whole "strength byte" so we can
+ // write it unchanged when randomizing trainer pokemon.
+ public int strength;
+
+ public boolean resetMoves = false;
+
+ public String toString() {
+ String s = pokemon.name + formeSuffix;
+ if (heldItem != 0) {
+ // This can be filled in with the actual name when written to the log.
+ s += "@%s";
+ }
+ s+= " Lv" + level;
+ return s;
+ }
+
+ public boolean canMegaEvolve() {
+ if (heldItem != 0) {
+ for (MegaEvolution mega: pokemon.megaEvolutionsFrom) {
+ if (mega.argument == heldItem) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public TrainerPokemon copy() {
+ TrainerPokemon tpk = new TrainerPokemon();
+ tpk.pokemon = pokemon;
+ tpk.level = level;
+
+ tpk.move1 = move1;
+ tpk.move2 = move2;
+ tpk.move3 = move3;
+ tpk.move4 = move4;
+
+ tpk.strength = strength;
+ tpk.heldItem = heldItem;
+ tpk.abilitySlot = abilitySlot;
+ tpk.forme = forme;
+ tpk.formeSuffix = formeSuffix;
+ tpk.absolutePokeNumber = absolutePokeNumber;
+
+ tpk.resetMoves = resetMoves;
+
+ return tpk;
+ }
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/Type.java b/src/com/rafa_99/pkrandom/pokemon/Type.java
new file mode 100755
index 0000000..eec2398
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/Type.java
@@ -0,0 +1,63 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- Type.java - represents a Pokemon or move type. --*/
+/*-- --*/
+/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/
+/*-- Originally part of "Universal Pokemon Randomizer" by rafa_99 --*/
+/*-- 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/>. --*/
+/*----------------------------------------------------------------------------*/
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+import com.rafa_99.pkrandom.RomFunctions;
+
+public enum Type {
+
+ NORMAL, FIGHTING, FLYING, GRASS, WATER, FIRE, ROCK, GROUND, PSYCHIC, BUG, DRAGON, ELECTRIC, GHOST, POISON, ICE, STEEL, DARK, FAIRY,
+ GAS(true), WOOD(true), ABNORMAL(true), WIND(true), SOUND(true), LIGHT(true), TRI(true);
+
+ public boolean isHackOnly;
+
+ Type() {
+ this.isHackOnly = false;
+ }
+
+ Type(boolean isHackOnly) {
+ this.isHackOnly = isHackOnly;
+ }
+
+ private static final List<Type> VALUES = Collections.unmodifiableList(Arrays.asList(values()));
+ private static final int SIZE = VALUES.size();
+
+ public static final List<Type> GEN2THROUGH5 = Collections.unmodifiableList(Arrays.asList(values()).subList(0, DARK.ordinal()+1));
+ public static final List<Type> GEN6PLUS = Collections.unmodifiableList(Arrays.asList(values()).subList(0, FAIRY.ordinal()+1));
+
+ public static Type randomType(Random random) {
+ return VALUES.get(random.nextInt(SIZE));
+ }
+
+ public String camelCase() {
+ return RomFunctions.camelCase(this.toString());
+ }
+
+}
diff --git a/src/com/rafa_99/pkrandom/pokemon/TypeRelationship.java b/src/com/rafa_99/pkrandom/pokemon/TypeRelationship.java
new file mode 100644
index 0000000..f63583d
--- /dev/null
+++ b/src/com/rafa_99/pkrandom/pokemon/TypeRelationship.java
@@ -0,0 +1,37 @@
+package com.rafa_99.pkrandom.pokemon;
+
+/*----------------------------------------------------------------------------*/
+/*-- TypeRelationship.java - represents the relationship between an --*/
+/*-- attacking and defending Type. --*/
+/*-- --*/
+/*-- 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 class TypeRelationship {
+ public Type attacker;
+ public Type defender;
+ public Effectiveness effectiveness;
+
+ public TypeRelationship(Type attacker, Type defender, Effectiveness effectiveness) {
+ this.attacker = attacker;
+ this.defender = defender;
+ this.effectiveness = effectiveness;
+ }
+}