diff options
Diffstat (limited to 'src/com/sneed/pkrandom/pokemon')
35 files changed, 0 insertions, 3791 deletions
diff --git a/src/com/sneed/pkrandom/pokemon/Aura.java b/src/com/sneed/pkrandom/pokemon/Aura.java deleted file mode 100644 index f5d9e9c..0000000 --- a/src/com/sneed/pkrandom/pokemon/Aura.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.sneed.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.sneed.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/sneed/pkrandom/pokemon/CriticalChance.java b/src/com/sneed/pkrandom/pokemon/CriticalChance.java deleted file mode 100644 index f7445d0..0000000 --- a/src/com/sneed/pkrandom/pokemon/CriticalChance.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sneed.pkrandom.pokemon; - -/*----------------------------------------------------------------------------*/ -/*-- CriticalChance.java - represents a move's odds to critical hit. --*/ -/*-- --*/ -/*-- 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 CriticalChance { - NONE, // Phased out in Gen 5+ - NORMAL, - INCREASED, - GUARANTEED -} diff --git a/src/com/sneed/pkrandom/pokemon/Effectiveness.java b/src/com/sneed/pkrandom/pokemon/Effectiveness.java deleted file mode 100644 index 362ca60..0000000 --- a/src/com/sneed/pkrandom/pokemon/Effectiveness.java +++ /dev/null @@ -1,179 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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; -import java.util.stream.Collectors; - -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; - } - - public static List<Type> notVeryEffective(Type attackingType, int generation, boolean effectivenessUpdated) { - Effectiveness[][] effectivenesses; - if (generation == 1) { - effectivenesses = effectivenessUpdated ? gen2Through5Table : gen1Table; - } else if (generation >= 2 && generation <= 5) { - effectivenesses = effectivenessUpdated ? gen6PlusTable : gen2Through5Table; - } else { - effectivenesses = gen6PlusTable; - } - List<Type> allTypes = Type.getAllTypes(generation); - - return allTypes - .stream() - .filter(defendingType -> - effectivenesses[attackingType.ordinal()][defendingType.ordinal()] == Effectiveness.HALF || - effectivenesses[attackingType.ordinal()][defendingType.ordinal()] == Effectiveness.ZERO) - .collect(Collectors.toList()); - } - - public static List<Type> superEffective(Type attackingType, int generation, boolean effectivenessUpdated) { - Effectiveness[][] effectivenesses; - if (generation == 1) { - effectivenesses = effectivenessUpdated ? gen2Through5Table : gen1Table; - } else if (generation >= 2 && generation <= 5) { - effectivenesses = effectivenessUpdated ? gen6PlusTable : gen2Through5Table; - } else { - effectivenesses = gen6PlusTable; - } - List<Type> allTypes = Type.getAllTypes(generation); - - return allTypes - .stream() - .filter(defendingType -> - effectivenesses[attackingType.ordinal()][defendingType.ordinal()] == Effectiveness.DOUBLE) - .collect(Collectors.toList()); - } - - // Attacking type is the row, Defending type is the column. This corresponds to the ordinal of types. - private static final Effectiveness[][] gen1Table = { - /* NORMAL,FIGHTING, FLYING, GRASS , WATER, FIRE , ROCK , GROUND, PSYCHIC, BUG , DRAGON,ELECTRIC, GHOST , POISON, ICE */ - /*NORMAL */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL}, - /*FIGHTING*/{ DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, ZERO, HALF, DOUBLE}, - /*FLYING */ {NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL}, - /*GRASS */ {NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, HALF, DOUBLE, DOUBLE, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, HALF, NEUTRAL}, - /*WATER */ {NEUTRAL, NEUTRAL, NEUTRAL, HALF, HALF, DOUBLE, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL}, - /*FIRE */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, HALF, HALF, HALF, NEUTRAL, NEUTRAL, DOUBLE, HALF, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE}, - /*ROCK */ {NEUTRAL, HALF, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE}, - /*GROUND */ {NEUTRAL, NEUTRAL, ZERO, HALF, NEUTRAL, DOUBLE, DOUBLE, NEUTRAL, NEUTRAL, HALF, NEUTRAL, DOUBLE, NEUTRAL, DOUBLE, NEUTRAL}, - /*PSYCHIC*/ {NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, HALF, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL}, - /*BUG */ {NEUTRAL, HALF, HALF, DOUBLE, NEUTRAL, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF, DOUBLE, NEUTRAL}, - /*DRAGON */ {NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL}, - /*ELECTRIC*/{NEUTRAL, NEUTRAL, DOUBLE, HALF, DOUBLE, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, NEUTRAL, NEUTRAL}, - /*GHOST */ { ZERO, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, NEUTRAL, ZERO, NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL}, - /*POISON */ {NEUTRAL, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, HALF, HALF, NEUTRAL}, - /*ICE */ {NEUTRAL, NEUTRAL, DOUBLE, DOUBLE, HALF, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, DOUBLE, NEUTRAL, NEUTRAL, NEUTRAL, HALF}, - }; - 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/sneed/pkrandom/pokemon/Encounter.java b/src/com/sneed/pkrandom/pokemon/Encounter.java deleted file mode 100755 index 91e169f..0000000 --- a/src/com/sneed/pkrandom/pokemon/Encounter.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/EncounterSet.java b/src/com/sneed/pkrandom/pokemon/EncounterSet.java deleted file mode 100755 index ac49523..0000000 --- a/src/com/sneed/pkrandom/pokemon/EncounterSet.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/Evolution.java b/src/com/sneed/pkrandom/pokemon/Evolution.java deleted file mode 100755 index fc29012..0000000 --- a/src/com/sneed/pkrandom/pokemon/Evolution.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/EvolutionType.java b/src/com/sneed/pkrandom/pokemon/EvolutionType.java deleted file mode 100755 index 6b3e1c7..0000000 --- a/src/com/sneed/pkrandom/pokemon/EvolutionType.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/EvolutionUpdate.java b/src/com/sneed/pkrandom/pokemon/EvolutionUpdate.java deleted file mode 100644 index 1aa937c..0000000 --- a/src/com/sneed/pkrandom/pokemon/EvolutionUpdate.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/ExpCurve.java b/src/com/sneed/pkrandom/pokemon/ExpCurve.java deleted file mode 100755 index da21f38..0000000 --- a/src/com/sneed/pkrandom/pokemon/ExpCurve.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/FormeInfo.java b/src/com/sneed/pkrandom/pokemon/FormeInfo.java deleted file mode 100644 index 8c57df3..0000000 --- a/src/com/sneed/pkrandom/pokemon/FormeInfo.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/Gen1Pokemon.java b/src/com/sneed/pkrandom/pokemon/Gen1Pokemon.java deleted file mode 100644 index b63f1ed..0000000 --- a/src/com/sneed/pkrandom/pokemon/Gen1Pokemon.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/GenRestrictions.java b/src/com/sneed/pkrandom/pokemon/GenRestrictions.java deleted file mode 100755 index 6c71a27..0000000 --- a/src/com/sneed/pkrandom/pokemon/GenRestrictions.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/IngameTrade.java b/src/com/sneed/pkrandom/pokemon/IngameTrade.java deleted file mode 100755 index 6d3bef2..0000000 --- a/src/com/sneed/pkrandom/pokemon/IngameTrade.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/ItemList.java b/src/com/sneed/pkrandom/pokemon/ItemList.java deleted file mode 100755 index ee9d11a..0000000 --- a/src/com/sneed/pkrandom/pokemon/ItemList.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/MegaEvolution.java b/src/com/sneed/pkrandom/pokemon/MegaEvolution.java deleted file mode 100644 index 2e6688f..0000000 --- a/src/com/sneed/pkrandom/pokemon/MegaEvolution.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/Move.java b/src/com/sneed/pkrandom/pokemon/Move.java deleted file mode 100755 index 4aa8c20..0000000 --- a/src/com/sneed/pkrandom/pokemon/Move.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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.sneed.pkrandom.constants.GlobalConstants; - -public class Move { - public class StatChange { - public StatChangeType type; - public int stages; - public double percentChance; - - @Override - public boolean equals(Object obj) { - StatChange other = (StatChange)obj; - return this.type == other.type && this.stages == other.stages && this.percentChance == other.percentChance; - } - - } - - public String name; - public int number; - public int internalId; - public int power; - public int pp; - public double hitratio; - public Type type; - public MoveCategory category; - 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 CriticalChance criticalChance = CriticalChance.NORMAL; - public double statusPercentChance; - public double flinchPercentChance; - public int recoilPercent; - public int absorbPercent; - public int priority; - public boolean makesContact; - public boolean isChargeMove; - public boolean isRechargeMove; - public boolean isPunchMove; - public boolean isSoundMove; - public boolean isTrapMove; // True for both binding moves (like Wrap) and trapping moves (like Mean Look) - public int effectIndex; - public int target; - public double hitCount = 1; // not saved, only used in randomized move powers. - - 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 boolean hasSpecificStatChange(StatChangeType type, boolean isPositive) { - for (StatChange sc: this.statChanges) { - if (sc.type == type && (isPositive ^ sc.stages < 0)) { - return true; - } - } - return false; - } - - public boolean hasBeneficialStatChange() { - return (statChangeMoveType == StatChangeMoveType.DAMAGE_TARGET && statChanges[0].stages < 0) || - statChangeMoveType == StatChangeMoveType.DAMAGE_USER && statChanges[0].stages > 0; - } - - public boolean isGoodDamaging(int perfectAccuracy) { - return (power * hitCount) >= 2 * GlobalConstants.MIN_DAMAGING_MOVE_POWER - || ((power * hitCount) >= GlobalConstants.MIN_DAMAGING_MOVE_POWER && (hitratio >= 90 || hitratio == perfectAccuracy)); - } - - public String toString() { - return "#" + number + " " + name + " - Power: " + power + ", Base PP: " + pp + ", Type: " + type + ", Hit%: " - + (hitratio) + ", Effect: " + effectIndex + ", Priority: " + priority; - } - -} diff --git a/src/com/sneed/pkrandom/pokemon/MoveCategory.java b/src/com/sneed/pkrandom/pokemon/MoveCategory.java deleted file mode 100644 index c8a754f..0000000 --- a/src/com/sneed/pkrandom/pokemon/MoveCategory.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/MoveLearnt.java b/src/com/sneed/pkrandom/pokemon/MoveLearnt.java deleted file mode 100755 index 87b10aa..0000000 --- a/src/com/sneed/pkrandom/pokemon/MoveLearnt.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/MoveSynergy.java b/src/com/sneed/pkrandom/pokemon/MoveSynergy.java deleted file mode 100644 index 0d1c412..0000000 --- a/src/com/sneed/pkrandom/pokemon/MoveSynergy.java +++ /dev/null @@ -1,1205 +0,0 @@ -package com.sneed.pkrandom.pokemon; - -/*----------------------------------------------------------------------------*/ -/*-- MoveSynergy.java - synergies between moves, or between --*/ -/*-- abilities/stats and moves --*/ -/*-- --*/ -/*-- Part of "Universal Pokemon Randomizer ZX" by the UPR-ZX team --*/ -/*-- Originally part of "Universal Pokemon Randomizer" by sneed --*/ -/*-- 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.sneed.pkrandom.constants.Abilities; -import com.sneed.pkrandom.constants.Moves; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class MoveSynergy { - - public static List<Move> getSoftAbilityMoveSynergy(int ability, List<Move> moveList, Type pkType1, Type pkType2) { - List<Integer> synergisticMoves = new ArrayList<>(); - - switch(ability) { - case Abilities.drizzle: - case Abilities.primordialSea: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.WATER && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.drought: - case Abilities.desolateLand: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.FIRE && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.refrigerate: - if (pkType1 == Type.ICE || pkType2 == Type.ICE) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.NORMAL && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - break; - case Abilities.galeWings: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.FLYING) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.pixilate: - if (pkType1 == Type.FAIRY || pkType2 == Type.FAIRY) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.NORMAL && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - break; - case Abilities.aerilate: - if (pkType1 == Type.FLYING || pkType2 == Type.FLYING) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.NORMAL && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - break; - case Abilities.darkAura: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.DARK && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.fairyAura: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.FAIRY && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.steelworker: - case Abilities.steelySpirit: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.STEEL && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.galvanize: - if (pkType1 == Type.ELECTRIC || pkType2 == Type.ELECTRIC) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.NORMAL && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - break; - case Abilities.electricSurge: - case Abilities.transistor: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.ELECTRIC && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.psychicSurge: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.PSYCHIC && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.grassySurge: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.GRASS && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.dragonsMaw: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.DRAGON && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - - return moveList - .stream() - .filter(mv -> synergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getSoftAbilityMoveAntiSynergy(int ability, List<Move> moveList) { - List<Integer> antiSynergisticMoves = new ArrayList<>(); - - switch(ability) { - case Abilities.drizzle: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.FIRE && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.drought: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.WATER && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.mistySurge: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.DRAGON && mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - - return moveList - .stream() - .filter(mv -> antiSynergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getHardAbilityMoveSynergy(int ability, Type pkType1, Type pkType2, List<Move> moveList, - int generation, int perfectAccuracy) { - List<Integer> synergisticMoves = new ArrayList<>(); - - switch(ability) { - case Abilities.drizzle: - case Abilities.primordialSea: - synergisticMoves.add(Moves.thunder); - synergisticMoves.add(Moves.hurricane); - if (pkType1 == Type.WATER || pkType2 == Type.WATER) { - synergisticMoves.add(Moves.weatherBall); - } - break; - case Abilities.speedBoost: - synergisticMoves.add(Moves.batonPass); - synergisticMoves.add(Moves.storedPower); - synergisticMoves.add(Moves.powerTrip); - break; - case Abilities.sturdy: - if (generation >= 5) { - synergisticMoves.add(Moves.endeavor); - synergisticMoves.add(Moves.counter); - synergisticMoves.add(Moves.mirrorCoat); - synergisticMoves.add(Moves.flail); - synergisticMoves.add(Moves.reversal); - } - break; - case Abilities.sandVeil: - case Abilities.sandRush: - synergisticMoves.add(Moves.sandstorm); - break; - case Abilities.staticTheAbilityNotTheKeyword: - synergisticMoves.add(Moves.smellingSalts); - synergisticMoves.add(Moves.hex); - break; - case Abilities.compoundEyes: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.hitratio > 0 && mv.hitratio <= 80) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.ownTempo: - case Abilities.tangledFeet: - synergisticMoves.add(Moves.petalDance); - synergisticMoves.add(Moves.thrash); - synergisticMoves.add(Moves.outrage); - break; - case Abilities.shadowTag: - case Abilities.arenaTrap: - synergisticMoves.add(Moves.perishSong); - break; - case Abilities.poisonPoint: - synergisticMoves.add(Moves.venoshock); - // fallthrough - case Abilities.effectSpore: - case Abilities.flameBody: - synergisticMoves.add(Moves.hex); - break; - case Abilities.sereneGrace: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> ((mv.statChangeMoveType == StatChangeMoveType.DAMAGE_TARGET || - mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER) && - mv.statChanges[0].percentChance < 100) || - (mv.statusMoveType == StatusMoveType.DAMAGE && mv.statusPercentChance < 100) || - mv.flinchPercentChance > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.swiftSwim: - case Abilities.rainDish: - case Abilities.drySkin: - case Abilities.hydration: - synergisticMoves.add(Moves.rainDance); - break; - case Abilities.chlorophyll: - case Abilities.harvest: - case Abilities.leafGuard: - synergisticMoves.add(Moves.sunnyDay); - break; - case Abilities.soundproof: - synergisticMoves.add(Moves.perishSong); - break; - case Abilities.sandStream: - if (pkType1 == Type.ROCK || pkType2 == Type.ROCK) { - synergisticMoves.add(Moves.weatherBall); - } - break; - case Abilities.earlyBird: - case Abilities.shedSkin: - synergisticMoves.add(Moves.rest); - break; - case Abilities.truant: - synergisticMoves.add(Moves.transform); - break; - case Abilities.hustle: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.hasSpecificStatChange(StatChangeType.ACCURACY, true)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.PHYSICAL && mv.hitratio == perfectAccuracy) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.guts: - synergisticMoves.add(Moves.facade); - break; - case Abilities.rockHead: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.recoilPercent > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.drought: - case Abilities.desolateLand: - synergisticMoves.add(Moves.solarBeam); - synergisticMoves.add(Moves.solarBlade); - synergisticMoves.add(Moves.morningSun); - synergisticMoves.add(Moves.synthesis); - synergisticMoves.add(Moves.moonlight); - if (generation >= 5) { - synergisticMoves.add(Moves.growth); - } - if (pkType1 == Type.FIRE || pkType2 == Type.FIRE) { - synergisticMoves.add(Moves.weatherBall); - } - break; - case Abilities.ironFist: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.isPunchMove) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.snowCloak: - case Abilities.iceBody: - case Abilities.slushRush: - synergisticMoves.add(Moves.hail); - break; - case Abilities.unburden: - synergisticMoves.add(Moves.fling); - synergisticMoves.add(Moves.acrobatics); - break; - case Abilities.simple: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.statChanges[0].stages > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.acupressure); - break; - case Abilities.adaptability: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category != MoveCategory.STATUS && (mv.type == pkType1 || mv.type == pkType2)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.skillLink: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.hitCount >= 3) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.sniper: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.criticalChance == CriticalChance.INCREASED || - mv.criticalChance == CriticalChance.GUARANTEED) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.magicGuard: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.recoilPercent > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.mindBlown); - break; - case Abilities.stall: - synergisticMoves.add(Moves.metalBurst); - synergisticMoves.add(Moves.payback); - break; - case Abilities.superLuck: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.criticalChance == CriticalChance.INCREASED) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.analytic: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.power > 0 && mv.priority < 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.noGuard: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.hitratio > 0 && mv.hitratio <= 70) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.technician: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.power >= 40 && mv.power <= 60) || mv.hitCount > 1) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.slowStart: - synergisticMoves.add(Moves.transform); - synergisticMoves.add(Moves.protect); - synergisticMoves.add(Moves.detect); - synergisticMoves.add(Moves.kingsShield); - synergisticMoves.add(Moves.banefulBunker); - synergisticMoves.add(Moves.fly); - synergisticMoves.add(Moves.dig); - synergisticMoves.add(Moves.bounce); - synergisticMoves.add(Moves.dive); - break; - case Abilities.snowWarning: - synergisticMoves.add(Moves.auroraVeil); - synergisticMoves.add(Moves.blizzard); - if (pkType1 == Type.ICE || pkType2 == Type.ICE) { - synergisticMoves.add(Moves.weatherBall); - } - break; - case Abilities.reckless: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.recoilPercent > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.jumpKick); - synergisticMoves.add(Moves.highJumpKick); - break; - case Abilities.badDreams: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statusType == StatusType.SLEEP) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.sheerForce: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statChangeMoveType == StatChangeMoveType.DAMAGE_TARGET || - (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER && - mv.statChanges[0].stages > 0) || - mv.statusMoveType == StatusMoveType.DAMAGE || - mv.flinchPercentChance > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.contrary: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER && - mv.statChanges[0].stages < 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.heavyMetal: - synergisticMoves.add(Moves.heatCrash); - synergisticMoves.add(Moves.heavySlam); - break; - case Abilities.moody: - synergisticMoves.add(Moves.storedPower); - synergisticMoves.add(Moves.powerTrip); - break; - case Abilities.poisonTouch: - case Abilities.toughClaws: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.makesContact) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.regenerator: - synergisticMoves.add(Moves.uTurn); - synergisticMoves.add(Moves.voltSwitch); - synergisticMoves.add(Moves.partingShot); - break; - case Abilities.prankster: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statusMoveType == StatusMoveType.NO_DAMAGE) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.destinyBond); - synergisticMoves.add(Moves.encore); - synergisticMoves.add(Moves.reflect); - synergisticMoves.add(Moves.lightScreen); - synergisticMoves.add(Moves.grudge); - synergisticMoves.add(Moves.painSplit); - synergisticMoves.add(Moves.substitute); - break; - case Abilities.strongJaw: - synergisticMoves.add(Moves.bite); - synergisticMoves.add(Moves.crunch); - synergisticMoves.add(Moves.fireFang); - synergisticMoves.add(Moves.fishiousRend); - synergisticMoves.add(Moves.hyperFang); - synergisticMoves.add(Moves.iceFang); - synergisticMoves.add(Moves.jawLock); - synergisticMoves.add(Moves.poisonFang); - synergisticMoves.add(Moves.psychicFangs); - synergisticMoves.add(Moves.thunderFang); - break; - case Abilities.megaLauncher: - synergisticMoves.add(Moves.auraSphere); - synergisticMoves.add(Moves.darkPulse); - synergisticMoves.add(Moves.dragonPulse); - synergisticMoves.add(Moves.originPulse); - synergisticMoves.add(Moves.terrainPulse); - synergisticMoves.add(Moves.waterPulse); - break; - case Abilities.wimpOut: - case Abilities.emergencyExit: - synergisticMoves.add(Moves.fakeOut); - synergisticMoves.add(Moves.firstImpression); - break; - case Abilities.merciless: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statusType == StatusType.POISON || mv.statusType == StatusType.TOXIC_POISON) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.banefulBunker); - break; - case Abilities.liquidVoice: - if (pkType1 == Type.WATER || pkType2 == Type.WATER) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.isSoundMove && mv.power > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - break; - case Abilities.triage: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.absorbPercent > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.surgeSurfer: - synergisticMoves.add(Moves.electricTerrain); - break; - case Abilities.corrosion: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.STATUS && - (mv.statusType == StatusType.POISON || mv.statusType == StatusType.TOXIC_POISON)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - - return moveList - .stream() - .filter(mv -> synergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getHardAbilityMoveAntiSynergy(int ability, List<Move> moveList) { - List<Integer> antiSynergisticMoves = new ArrayList<>(); - - switch(ability) { - case Abilities.primordialSea: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.FIRE && - mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - // fallthrough - case Abilities.drizzle: - case Abilities.sandStream: - case Abilities.snowWarning: - antiSynergisticMoves.add(Moves.solarBeam); - antiSynergisticMoves.add(Moves.solarBlade); - antiSynergisticMoves.add(Moves.morningSun); - antiSynergisticMoves.add(Moves.synthesis); - antiSynergisticMoves.add(Moves.moonlight); - antiSynergisticMoves.add(Moves.rainDance); - antiSynergisticMoves.add(Moves.sunnyDay); - antiSynergisticMoves.add(Moves.hail); - antiSynergisticMoves.add(Moves.sandstorm); - break; - case Abilities.speedBoost: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.statChanges[0].type == StatChangeType.SPEED && - mv.statChanges[0].stages > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - antiSynergisticMoves.add(Moves.psychUp); - antiSynergisticMoves.add(Moves.haze); - break; - case Abilities.desolateLand: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.type == Type.WATER && - mv.category != MoveCategory.STATUS) - .map(mv -> mv.number) - .collect(Collectors.toList())); - // fallthrough - case Abilities.drought: - antiSynergisticMoves.add(Moves.thunder); - antiSynergisticMoves.add(Moves.hurricane); - antiSynergisticMoves.add(Moves.rainDance); - antiSynergisticMoves.add(Moves.sunnyDay); - antiSynergisticMoves.add(Moves.hail); - antiSynergisticMoves.add(Moves.sandstorm); - break; - case Abilities.noGuard: - antiSynergisticMoves.add(Moves.lockOn); - antiSynergisticMoves.add(Moves.mindReader); - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.hasSpecificStatChange(StatChangeType.ACCURACY, true) || - mv.hasSpecificStatChange(StatChangeType.EVASION, true) || - mv.hasSpecificStatChange(StatChangeType.EVASION, false)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.damp: - antiSynergisticMoves.add(Moves.selfDestruct); - antiSynergisticMoves.add(Moves.explosion); - antiSynergisticMoves.add(Moves.mindBlown); - antiSynergisticMoves.add(Moves.mistyExplosion); - break; - case Abilities.insomnia: - case Abilities.vitalSpirit: - case Abilities.comatose: - case Abilities.sweetVeil: - antiSynergisticMoves.add(Moves.rest); - break; - case Abilities.airLock: - case Abilities.cloudNine: - case Abilities.deltaStream: - antiSynergisticMoves.add(Moves.rainDance); - antiSynergisticMoves.add(Moves.sunnyDay); - antiSynergisticMoves.add(Moves.sandstorm); - antiSynergisticMoves.add(Moves.hail); - break; - case Abilities.simple: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.statChanges[0].stages < 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.contrary: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.statChanges[0].stages > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - antiSynergisticMoves.add(Moves.shellSmash); - break; - case Abilities.lightMetal: - antiSynergisticMoves.add(Moves.heatCrash); - antiSynergisticMoves.add(Moves.heavySlam); - break; - case Abilities.electricSurge: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category == MoveCategory.STATUS && mv.statusType == StatusType.SLEEP)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - antiSynergisticMoves.add(Moves.rest); - break; - case Abilities.psychicSurge: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.priority > 0)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Abilities.mistySurge: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category == MoveCategory.STATUS && - (mv.statusType == StatusType.BURN || - mv.statusType == StatusType.FREEZE || - mv.statusType == StatusType.PARALYZE || - mv.statusType == StatusType.SLEEP || - mv.statusType == StatusType.POISON || - mv.statusType == StatusType.TOXIC_POISON))) - .map(mv -> mv.number) - .collect(Collectors.toList())); - antiSynergisticMoves.add(Moves.rest); - break; - case Abilities.grassySurge: - antiSynergisticMoves.add(Moves.earthquake); - antiSynergisticMoves.add(Moves.magnitude); - antiSynergisticMoves.add(Moves.bulldoze); - break; - - - } - - return moveList - .stream() - .filter(mv -> antiSynergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getStatMoveSynergy(Pokemon pk, List<Move> moveList) { - List<Integer> synergisticMoves = new ArrayList<>(); - - if ((double)pk.hp / (double)pk.bst() < 1.0/8) { - synergisticMoves.add(Moves.painSplit); - synergisticMoves.add(Moves.endeavor); - } - - if ((double)pk.hp / (double)pk.bst() >= 1.0/4) { - synergisticMoves.add(Moves.waterSpout); - synergisticMoves.add(Moves.eruption); - synergisticMoves.add(Moves.counter); - synergisticMoves.add(Moves.mirrorCoat); - } - - if (pk.attack * 2 < pk.defense) { - synergisticMoves.add(Moves.powerTrick); - } - - if ((double)(pk.attack + pk.spatk) / (double)pk.bst() < 1.0/4) { - synergisticMoves.add(Moves.powerSplit); - } - - if ((double)(pk.defense + pk.spdef) / (double)pk.bst() < 1.0/4) { - synergisticMoves.add(Moves.guardSplit); - } - - if ((double)pk.speed / (double)pk.bst() < 1.0/8) { - synergisticMoves.add(Moves.gyroBall); - } - - if ((double)pk.speed / (double)pk.bst() >= 1.0/4) { - synergisticMoves.add(Moves.electroBall); - } - - return moveList - .stream() - .filter(mv -> synergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getStatMoveAntiSynergy(Pokemon pk, List<Move> moveList) { - List<Integer> antiSynergisticMoves = new ArrayList<>(); - - if ((double)pk.hp / (double)pk.bst() >= 1.0/4) { - antiSynergisticMoves.add(Moves.painSplit); - antiSynergisticMoves.add(Moves.endeavor); - } - - if (pk.defense * 2 < pk.attack) { - antiSynergisticMoves.add(Moves.powerTrick); - } - - if ((double)(pk.attack + pk.spatk) / (double)pk.bst() >= 1.0/3) { - antiSynergisticMoves.add(Moves.powerSplit); - } - - if ((double)(pk.defense + pk.spdef) / (double)pk.bst() >= 1.0/3) { - antiSynergisticMoves.add(Moves.guardSplit); - } - - if ((double)pk.speed / (double)pk.bst() >= 1.0/4) { - antiSynergisticMoves.add(Moves.gyroBall); - } - - if ((double)pk.speed / (double)pk.bst() < 1.0/8) { - antiSynergisticMoves.add(Moves.electroBall); - } - - return moveList - .stream() - .filter(mv -> antiSynergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getMoveSynergy(Move mv1, List<Move> moveList, int generation) { - List<Integer> synergisticMoves = new ArrayList<>(); - - if ((mv1.statChangeMoveType == StatChangeMoveType.DAMAGE_TARGET && - mv1.hasSpecificStatChange(StatChangeType.SPEED, false)) || - ((mv1.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv1.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv1.hasSpecificStatChange(StatChangeType.SPEED, true))) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.flinchPercentChance > 0 && mv.priority == 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - - if (mv1.flinchPercentChance > 0 && mv1.priority == 0) { - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.statChangeMoveType == StatChangeMoveType.DAMAGE_TARGET && - mv.hasSpecificStatChange(StatChangeType.SPEED, false)) || - ((mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER || - mv.statChangeMoveType == StatChangeMoveType.NO_DAMAGE_USER) && - mv.hasSpecificStatChange(StatChangeType.SPEED, true))) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - - if (mv1.statChanges[0].stages >= 2 || mv1.statChanges[1].type != StatChangeType.NONE) { - synergisticMoves.add(Moves.batonPass); - synergisticMoves.add(Moves.storedPower); - synergisticMoves.add(Moves.powerTrip); - } - - if (mv1.statusType == StatusType.SLEEP) { - synergisticMoves.add(Moves.dreamEater); - synergisticMoves.add(Moves.nightmare); - synergisticMoves.add(Moves.hex); - } - - switch(mv1.number) { - case Moves.toxic: - synergisticMoves.add(Moves.protect); - synergisticMoves.add(Moves.detect); - synergisticMoves.add(Moves.kingsShield); - synergisticMoves.add(Moves.dig); - synergisticMoves.add(Moves.fly); - synergisticMoves.add(Moves.bounce); - synergisticMoves.add(Moves.dive); - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.isTrapMove)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - // fallthrough - case Moves.poisonPowder: - case Moves.poisonGas: - case Moves.banefulBunker: - case Moves.toxicThread: - synergisticMoves.add(Moves.venoshock); - synergisticMoves.add(Moves.hex); - break; - case Moves.venoshock: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.STATUS && - (mv.statusType == StatusType.POISON || mv.statusType == StatusType.TOXIC_POISON)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.protect: - case Moves.detect: - case Moves.kingsShield: - synergisticMoves.add(Moves.toxic); - synergisticMoves.add(Moves.leechSeed); - synergisticMoves.add(Moves.willOWisp); - break; - case Moves.batonPass: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statChanges[0].stages >= 2 || mv.statChanges[1].type != StatChangeType.NONE) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.shellSmash); - break; - case Moves.willOWisp: - synergisticMoves.add(Moves.hex); - break; - case Moves.lockOn: - case Moves.mindReader: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.hitratio <= 50)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.sunnyDay: - synergisticMoves.add(Moves.solarBlade); - synergisticMoves.add(Moves.solarBeam); - break; - case Moves.rainDance: - synergisticMoves.add(Moves.thunder); - synergisticMoves.add(Moves.hurricane); - break; - case Moves.powerSwap: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statChangeMoveType == StatChangeMoveType.DAMAGE_USER && - (mv.hasSpecificStatChange(StatChangeType.ATTACK, false) || - mv.hasSpecificStatChange(StatChangeType.SPECIAL_ATTACK, false))) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.endure: - synergisticMoves.add(Moves.reversal); - synergisticMoves.add(Moves.flail); - synergisticMoves.add(Moves.endeavor); - break; - case Moves.endeavor: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category != MoveCategory.STATUS && mv.priority > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.thunderWave: - case Moves.glare: - case Moves.stunSpore: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.flinchPercentChance > 0) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.STATUS && mv.statusType == StatusType.CONFUSION) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.hex); - break; - case Moves.hail: - synergisticMoves.add(Moves.blizzard); - synergisticMoves.add(Moves.auroraVeil); - break; - case Moves.stockpile: - synergisticMoves.add(Moves.spitUp); - synergisticMoves.add(Moves.swallow); - break; - case Moves.spitUp: - case Moves.swallow: - synergisticMoves.add(Moves.stockpile); - break; - case Moves.leechSeed: - case Moves.perishSong: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.isTrapMove)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.spikes: - case Moves.stealthRock: - case Moves.toxicSpikes: - synergisticMoves.add(Moves.roar); - synergisticMoves.add(Moves.whirlwind); - synergisticMoves.add(Moves.dragonTail); - synergisticMoves.add(Moves.circleThrow); - break; - case Moves.rest: - synergisticMoves.add(Moves.sleepTalk); - break; - case Moves.focusEnergy: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.criticalChance == CriticalChance.INCREASED) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.focusPunch: - case Moves.dreamEater: - case Moves.nightmare: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statusMoveType == StatusMoveType.NO_DAMAGE && - mv.statusType == StatusType.SLEEP) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.torment: - synergisticMoves.add(Moves.encore); - break; - case Moves.encore: - synergisticMoves.add(Moves.torment); - break; - case Moves.hex: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statusMoveType == StatusMoveType.NO_DAMAGE && - mv.statusType != StatusType.CONFUSION) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.banefulBunker); - break; - case Moves.storedPower: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.statChanges[0].stages > 1 || mv.statChanges[1].type != StatChangeType.NONE) - .map(mv -> mv.number) - .collect(Collectors.toList())); - synergisticMoves.add(Moves.acupressure); - synergisticMoves.add(Moves.shellSmash); - break; - case Moves.swagger: - synergisticMoves.add(Moves.punishment); - break; - case Moves.punishment: - synergisticMoves.add(Moves.swagger); - break; - case Moves.shellSmash: - synergisticMoves.add(Moves.storedPower); - break; - } - - return moveList - .stream() - .filter(mv -> synergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getSoftMoveSynergy(Move mv1, List<Move> moveList, int generation, - boolean effectivenessUpdated) { - List<Integer> synergisticMoves = new ArrayList<>(); - - if (mv1.category != MoveCategory.STATUS) { - List<Type> notVeryEffective = Effectiveness.notVeryEffective(mv1.type, generation, effectivenessUpdated); - for (Type nveType: notVeryEffective) { - List<Type> superEffectiveAgainstNVE = - Effectiveness.against(nveType, null, generation, effectivenessUpdated) - .entrySet() - .stream() - .filter(entry -> entry.getValue() == Effectiveness.DOUBLE) - .map(Map.Entry::getKey) - .collect(Collectors.toList()); - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category != MoveCategory.STATUS && - superEffectiveAgainstNVE.contains(mv.type)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - } - - switch(mv1.number) { - case Moves.swordsDance: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.PHYSICAL) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.nastyPlot: - case Moves.tailGlow: - synergisticMoves.addAll(moveList - .stream() - .filter(mv -> mv.category == MoveCategory.SPECIAL) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - - return moveList - .stream() - .filter(mv -> synergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getHardMoveAntiSynergy(Move mv1, List<Move> moveList) { - List<Integer> antiSynergisticMoves = new ArrayList<>(); - - - if (mv1.category == MoveCategory.STATUS && mv1.statusType != StatusType.NONE) { - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category == MoveCategory.STATUS && mv.statusType != StatusType.NONE && - (mv.statusType == mv1.statusType || - (mv1.statusType != StatusType.CONFUSION && mv.statusType != StatusType.CONFUSION)))) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - - switch(mv1.number) { - case Moves.protect: - antiSynergisticMoves.add(Moves.detect); - antiSynergisticMoves.add(Moves.banefulBunker); - antiSynergisticMoves.add(Moves.kingsShield); - break; - case Moves.detect: - antiSynergisticMoves.add(Moves.protect); - antiSynergisticMoves.add(Moves.banefulBunker); - antiSynergisticMoves.add(Moves.kingsShield); - break; - case Moves.kingsShield: - antiSynergisticMoves.add(Moves.protect); - antiSynergisticMoves.add(Moves.detect); - antiSynergisticMoves.add(Moves.banefulBunker); - break; - case Moves.banefulBunker: - antiSynergisticMoves.add(Moves.protect); - antiSynergisticMoves.add(Moves.detect); - antiSynergisticMoves.add(Moves.kingsShield); - break; - case Moves.returnTheMoveNotTheKeyword: - antiSynergisticMoves.add(Moves.frustration); - break; - case Moves.frustration: - antiSynergisticMoves.add(Moves.returnTheMoveNotTheKeyword); - break; - case Moves.leechSeed: - case Moves.perishSong: - antiSynergisticMoves.add(Moves.whirlwind); - antiSynergisticMoves.add(Moves.roar); - antiSynergisticMoves.add(Moves.circleThrow); - antiSynergisticMoves.add(Moves.dragonTail); - break; - } - - if (mv1.type != null) { - switch (mv1.type) { - case FIRE: - if (mv1.category != MoveCategory.STATUS) { - antiSynergisticMoves.add(Moves.waterSport); - } - break; - case ELECTRIC: - if (mv1.category != MoveCategory.STATUS) { - antiSynergisticMoves.add(Moves.mudSport); - } - break; - } - } - - return moveList - .stream() - .filter(mv -> antiSynergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> getSoftMoveAntiSynergy(Move mv1, List<Move> moveList) { - List<Integer> antiSynergisticMoves = new ArrayList<>(); - - - if (mv1.category != MoveCategory.STATUS) { - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category != MoveCategory.STATUS && mv.type == mv1.type)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - } - - switch (mv1.number) { - case Moves.waterSport: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category != MoveCategory.STATUS && mv.type == Type.FIRE)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - case Moves.mudSport: - antiSynergisticMoves.addAll(moveList - .stream() - .filter(mv -> (mv.category != MoveCategory.STATUS && mv.type == Type.ELECTRIC)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - - return moveList - .stream() - .filter(mv -> antiSynergisticMoves.contains(mv.number)) - .distinct() - .collect(Collectors.toList()); - } - - public static List<Move> requiresOtherMove(Move mv1, List<Move> moveList) { - List<Integer> requiresMove = new ArrayList<>(); - switch(mv1.number) { - case Moves.spitUp: - case Moves.swallow: - requiresMove.add(Moves.stockpile); - break; - case Moves.dreamEater: - case Moves.nightmare: - requiresMove.addAll(moveList - .stream() - .filter(mv -> (mv.category == MoveCategory.STATUS && mv.statusType == StatusType.SLEEP)) - .map(mv -> mv.number) - .collect(Collectors.toList())); - break; - } - return moveList.stream().filter(mv -> requiresMove.contains(mv.number)).distinct().collect(Collectors.toList()); - } -} diff --git a/src/com/sneed/pkrandom/pokemon/PickupItem.java b/src/com/sneed/pkrandom/pokemon/PickupItem.java deleted file mode 100644 index 46e180e..0000000 --- a/src/com/sneed/pkrandom/pokemon/PickupItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/Pokemon.java b/src/com/sneed/pkrandom/pokemon/Pokemon.java deleted file mode 100755 index 9d085c6..0000000 --- a/src/com/sneed/pkrandom/pokemon/Pokemon.java +++ /dev/null @@ -1,325 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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.sneed.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/sneed/pkrandom/pokemon/SOSType.java b/src/com/sneed/pkrandom/pokemon/SOSType.java deleted file mode 100644 index a5cea3f..0000000 --- a/src/com/sneed/pkrandom/pokemon/SOSType.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/Shop.java b/src/com/sneed/pkrandom/pokemon/Shop.java deleted file mode 100644 index 0c1f748..0000000 --- a/src/com/sneed/pkrandom/pokemon/Shop.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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/sneed/pkrandom/pokemon/Stat.java b/src/com/sneed/pkrandom/pokemon/Stat.java deleted file mode 100644 index 7b0b579..0000000 --- a/src/com/sneed/pkrandom/pokemon/Stat.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StatChange.java b/src/com/sneed/pkrandom/pokemon/StatChange.java deleted file mode 100644 index 8adee17..0000000 --- a/src/com/sneed/pkrandom/pokemon/StatChange.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StatChangeMoveType.java b/src/com/sneed/pkrandom/pokemon/StatChangeMoveType.java deleted file mode 100644 index 75a5c3d..0000000 --- a/src/com/sneed/pkrandom/pokemon/StatChangeMoveType.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StatChangeType.java b/src/com/sneed/pkrandom/pokemon/StatChangeType.java deleted file mode 100644 index 0908050..0000000 --- a/src/com/sneed/pkrandom/pokemon/StatChangeType.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StaticEncounter.java b/src/com/sneed/pkrandom/pokemon/StaticEncounter.java deleted file mode 100644 index 2bd1840..0000000 --- a/src/com/sneed/pkrandom/pokemon/StaticEncounter.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StatusMoveType.java b/src/com/sneed/pkrandom/pokemon/StatusMoveType.java deleted file mode 100644 index 9b1df97..0000000 --- a/src/com/sneed/pkrandom/pokemon/StatusMoveType.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/StatusType.java b/src/com/sneed/pkrandom/pokemon/StatusType.java deleted file mode 100644 index aa4ef0f..0000000 --- a/src/com/sneed/pkrandom/pokemon/StatusType.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/TotemPokemon.java b/src/com/sneed/pkrandom/pokemon/TotemPokemon.java deleted file mode 100644 index 55139aa..0000000 --- a/src/com/sneed/pkrandom/pokemon/TotemPokemon.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.sneed.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/sneed/pkrandom/pokemon/Trainer.java b/src/com/sneed/pkrandom/pokemon/Trainer.java deleted file mode 100755 index 7509628..0000000 --- a/src/com/sneed/pkrandom/pokemon/Trainer.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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 int index; - 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; - // Certain trainers (e.g., trainers in the PWT in BW2) require unique held items for all of their Pokemon to prevent a game crash. - public boolean requiresUniqueHeldItems; - - 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(") - "); - } - if (offset > 0) { - 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 + index; - 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 index == other.index; - } - - @Override - public int compareTo(Trainer o) { - return index - o.index; - } - - 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 void setPokemonHaveCustomMoves(boolean haveCustomMoves) { - if (haveCustomMoves) { - this.poketype |= 1; - } else { - this.poketype = poketype & ~1; - } - } - - public boolean pokemonHaveCustomMoves() { - // This flag seems consistent for all gens - return (this.poketype & 1) == 1; - } - - public boolean pokemonHaveUniqueHeldItems() { - List<Integer> heldItemsForThisTrainer = new ArrayList<>(); - for (TrainerPokemon poke : this.pokemon) { - if (poke.heldItem > 0) { - if (heldItemsForThisTrainer.contains(poke.heldItem)) { - return false; - } else { - heldItemsForThisTrainer.add(poke.heldItem); - } - } - } - return true; - } - - public enum MultiBattleStatus { - NEVER, POTENTIAL, ALWAYS - } -} diff --git a/src/com/sneed/pkrandom/pokemon/TrainerPokemon.java b/src/com/sneed/pkrandom/pokemon/TrainerPokemon.java deleted file mode 100755 index 98ce3bc..0000000 --- a/src/com/sneed/pkrandom/pokemon/TrainerPokemon.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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[] moves = {0, 0, 0, 0}; - - public int heldItem = 0; - public boolean hasMegaStone; - public boolean hasZCrystal; - public int abilitySlot; - public int forme; - public String formeSuffix = ""; - - 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.moves[0] = moves[0]; - tpk.moves[1] = moves[1]; - tpk.moves[2] = moves[2]; - tpk.moves[3] = moves[3]; - - tpk.forcedGenderFlag = forcedGenderFlag; - tpk.nature = nature; - tpk.IVs = IVs; - tpk.hpEVs = hpEVs; - tpk.atkEVs = atkEVs; - tpk.defEVs = defEVs; - tpk.spatkEVs = spatkEVs; - tpk.spdefEVs = spdefEVs; - tpk.speedEVs = speedEVs; - tpk.strength = strength; - tpk.heldItem = heldItem; - tpk.abilitySlot = abilitySlot; - tpk.forme = forme; - tpk.formeSuffix = formeSuffix; - - tpk.resetMoves = resetMoves; - - return tpk; - } -} diff --git a/src/com/sneed/pkrandom/pokemon/Type.java b/src/com/sneed/pkrandom/pokemon/Type.java deleted file mode 100755 index d919047..0000000 --- a/src/com/sneed/pkrandom/pokemon/Type.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.sneed.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 sneed --*/ -/*-- 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.sneed.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> GEN1 = Collections.unmodifiableList(Arrays.asList(values()).subList(0, ICE.ordinal()+1)); - 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 List<Type> getAllTypes(int generation) { - switch (generation) { - case 1: - return GEN1; - case 2: - case 3: - case 4: - case 5: - return GEN2THROUGH5; - default: - return GEN6PLUS; - } - } - - 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/sneed/pkrandom/pokemon/TypeRelationship.java b/src/com/sneed/pkrandom/pokemon/TypeRelationship.java deleted file mode 100644 index 1b81cbd..0000000 --- a/src/com/sneed/pkrandom/pokemon/TypeRelationship.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.sneed.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; - } -} |