diff options
Diffstat (limited to 'src/com/dabomstew')
20 files changed, 280 insertions, 424 deletions
diff --git a/src/com/dabomstew/pkrandom/CustomNamesSet.java b/src/com/dabomstew/pkrandom/CustomNamesSet.java index 7ebdde6..a13543b 100644 --- a/src/com/dabomstew/pkrandom/CustomNamesSet.java +++ b/src/com/dabomstew/pkrandom/CustomNamesSet.java @@ -38,11 +38,11 @@ public class CustomNamesSet { // Alternate constructor: blank all lists // Used for importing old names and on the editor dialog. public CustomNamesSet() { - trainerNames = new ArrayList<String>(); - trainerClasses = new ArrayList<String>(); - doublesTrainerNames = new ArrayList<String>(); - doublesTrainerClasses = new ArrayList<String>(); - pokemonNicknames = new ArrayList<String>(); + trainerNames = new ArrayList<>(); + trainerClasses = new ArrayList<>(); + doublesTrainerNames = new ArrayList<>(); + doublesTrainerClasses = new ArrayList<>(); + pokemonNicknames = new ArrayList<>(); } private List<String> readNamesBlock(InputStream in) throws IOException { @@ -55,7 +55,7 @@ public class CustomNamesSet { // Read the block and translate it into a list of names. byte[] namesData = FileFunctions.readFullyIntoBuffer(in, size); - List<String> names = new ArrayList<String>(); + List<String> names = new ArrayList<>(); Scanner sc = new Scanner(new ByteArrayInputStream(namesData), "UTF-8"); while (sc.hasNextLine()) { String name = sc.nextLine().trim(); @@ -84,7 +84,7 @@ public class CustomNamesSet { private void writeNamesBlock(OutputStream out, List<String> names) throws IOException { String newln = SysConstants.LINE_SEP; - StringBuffer outNames = new StringBuffer(); + StringBuilder outNames = new StringBuilder(); boolean first = true; for (String name : names) { if (!first) { diff --git a/src/com/dabomstew/pkrandom/FileFunctions.java b/src/com/dabomstew/pkrandom/FileFunctions.java index 402070e..b7483d4 100755 --- a/src/com/dabomstew/pkrandom/FileFunctions.java +++ b/src/com/dabomstew/pkrandom/FileFunctions.java @@ -67,8 +67,8 @@ public class FileFunctions { return new File(original.getAbsolutePath().replace(original.getName(), "") + filename); } - private static List<String> overrideFiles = Arrays.asList(new String[] { SysConstants.customNamesFile, - SysConstants.tclassesFile, SysConstants.tnamesFile, SysConstants.nnamesFile }); + private static List<String> overrideFiles = Arrays.asList(SysConstants.customNamesFile, + SysConstants.tclassesFile, SysConstants.tnamesFile, SysConstants.nnamesFile); public static boolean configExists(String filename) { if (overrideFiles.contains(filename)) { @@ -141,8 +141,8 @@ public class FileFunctions { return buf; } - public static void readFully(InputStream in, byte[] buf, int offset, int length) throws IOException { - int offs = 0, read = 0; + private static void readFully(InputStream in, byte[] buf, int offset, int length) throws IOException { + int offs = 0, read; while (offs < length && (read = in.read(buf, offs + offset, length - offs)) != -1) { offs += read; } @@ -169,7 +169,7 @@ public class FileFunctions { } } - public static int getFileChecksum(InputStream stream) { + private static int getFileChecksum(InputStream stream) { try { Scanner sc = new Scanner(stream, "UTF-8"); CRC32 checksum = new CRC32(); @@ -197,14 +197,12 @@ public class FileFunctions { // have to check the CRC int crc = readFullInt(data, offsetInData); - if (getFileChecksum(filename) != crc) { - return false; - } + return getFileChecksum(filename) == crc; } return true; } - public static byte[] getCodeTweakFile(String filename) throws IOException { + private static byte[] getCodeTweakFile(String filename) throws IOException { InputStream is = FileFunctions.class.getResourceAsStream("/com/dabomstew/pkrandom/patches/" + filename); byte[] buf = readFullyIntoBuffer(is, is.available()); is.close(); @@ -220,8 +218,7 @@ public class FileFunctions { out.write(buf, 0, count); } in.close(); - byte[] output = out.toByteArray(); - return output; + return out.toByteArray(); } public static void applyPatch(byte[] rom, String patchName) throws IOException { diff --git a/src/com/dabomstew/pkrandom/GFXFunctions.java b/src/com/dabomstew/pkrandom/GFXFunctions.java index e44b365..dda768f 100644 --- a/src/com/dabomstew/pkrandom/GFXFunctions.java +++ b/src/com/dabomstew/pkrandom/GFXFunctions.java @@ -38,8 +38,8 @@ public class GFXFunctions { return drawTiledImage(data, palette, offset, width, height, 8, 8, bpp); } - public static BufferedImage drawTiledImage(byte[] data, int[] palette, int offset, int width, int height, - int tileWidth, int tileHeight, int bpp) { + private static BufferedImage drawTiledImage(byte[] data, int[] palette, int offset, int width, int height, + int tileWidth, int tileHeight, int bpp) { if (bpp != 1 && bpp != 2 && bpp != 4 && bpp != 8) { throw new IllegalArgumentException("Bits per pixel must be a multiple of 2."); } @@ -81,7 +81,7 @@ public class GFXFunctions { public static void pseudoTransparency(BufferedImage img, int transColor) { int width = img.getWidth(); int height = img.getHeight(); - Queue<Integer> visitPixels = new LinkedList<Integer>(); + Queue<Integer> visitPixels = new LinkedList<>(); boolean[][] queued = new boolean[width][height]; for (int x = 0; x < width; x++) { diff --git a/src/com/dabomstew/pkrandom/MiscTweak.java b/src/com/dabomstew/pkrandom/MiscTweak.java index ef8096e..4f288b2 100755 --- a/src/com/dabomstew/pkrandom/MiscTweak.java +++ b/src/com/dabomstew/pkrandom/MiscTweak.java @@ -32,25 +32,25 @@ public class MiscTweak implements Comparable<MiscTweak> { private static final ResourceBundle bundle = ResourceBundle.getBundle("com/dabomstew/pkrandom/gui/Bundle"); - public static List<MiscTweak> allTweaks = new ArrayList<MiscTweak>(); + public static List<MiscTweak> allTweaks = new ArrayList<>(); /* @formatter:off */ // Higher priority value (third argument) = run first public static final MiscTweak BW_EXP_PATCH = new MiscTweak(1, "bwPatch", 0); - public static final MiscTweak NERF_X_ACCURACY = new MiscTweak(2, "nerfXAcc", 0); - public static final MiscTweak FIX_CRIT_RATE = new MiscTweak(4, "critRateFix", 0); - public static final MiscTweak FASTEST_TEXT = new MiscTweak(8, "fastestText", 0); - public static final MiscTweak RUNNING_SHOES_INDOORS = new MiscTweak(16, "runningShoes", 0); - public static final MiscTweak RANDOMIZE_PC_POTION = new MiscTweak(32, "pcPotion", 0); - public static final MiscTweak ALLOW_PIKACHU_EVOLUTION = new MiscTweak(64, "pikachuEvo", 0); - public static final MiscTweak NATIONAL_DEX_AT_START = new MiscTweak(128, "nationalDex", 0); - public static final MiscTweak UPDATE_TYPE_EFFECTIVENESS = new MiscTweak(256, "typeEffectiveness", 0); - public static final MiscTweak RANDOMIZE_HIDDEN_HOLLOWS = new MiscTweak(512, "hiddenHollows", 0); - public static final MiscTweak LOWER_CASE_POKEMON_NAMES = new MiscTweak(1024, "lowerCaseNames", 0); - public static final MiscTweak RANDOMIZE_CATCHING_TUTORIAL = new MiscTweak(2048, "catchingTutorial", 0); - public static final MiscTweak BAN_LUCKY_EGG = new MiscTweak(4096, "luckyEgg", 1); - public static final MiscTweak NO_FREE_LUCKY_EGG = new MiscTweak(8192,"freeLuckyEgg",0); - public static final MiscTweak BAN_BIG_MANIAC_ITEMS = new MiscTweak(16384, "maniacItems",1); + public static final MiscTweak NERF_X_ACCURACY = new MiscTweak(1 << 1, "nerfXAcc", 0); + public static final MiscTweak FIX_CRIT_RATE = new MiscTweak(1 << 2, "critRateFix", 0); + public static final MiscTweak FASTEST_TEXT = new MiscTweak(1 << 3, "fastestText", 0); + public static final MiscTweak RUNNING_SHOES_INDOORS = new MiscTweak(1 << 4, "runningShoes", 0); + public static final MiscTweak RANDOMIZE_PC_POTION = new MiscTweak(1 << 5, "pcPotion", 0); + public static final MiscTweak ALLOW_PIKACHU_EVOLUTION = new MiscTweak(1 << 6, "pikachuEvo", 0); + public static final MiscTweak NATIONAL_DEX_AT_START = new MiscTweak(1 << 7, "nationalDex", 0); + public static final MiscTweak UPDATE_TYPE_EFFECTIVENESS = new MiscTweak(1 << 8, "typeEffectiveness", 0); + public static final MiscTweak RANDOMIZE_HIDDEN_HOLLOWS = new MiscTweak(1 << 9, "hiddenHollows", 0); + public static final MiscTweak LOWER_CASE_POKEMON_NAMES = new MiscTweak(1 << 10, "lowerCaseNames", 0); + public static final MiscTweak RANDOMIZE_CATCHING_TUTORIAL = new MiscTweak(1 << 11, "catchingTutorial", 0); + public static final MiscTweak BAN_LUCKY_EGG = new MiscTweak(1 << 12, "luckyEgg", 1); + public static final MiscTweak NO_FREE_LUCKY_EGG = new MiscTweak(1 << 13,"freeLuckyEgg",0); + public static final MiscTweak BAN_BIG_MANIAC_ITEMS = new MiscTweak(1 << 14, "maniacItems",1); /* @formatter:on */ private final int value; diff --git a/src/com/dabomstew/pkrandom/Randomizer.java b/src/com/dabomstew/pkrandom/Randomizer.java index 0e2e4d5..7686b57 100644 --- a/src/com/dabomstew/pkrandom/Randomizer.java +++ b/src/com/dabomstew/pkrandom/Randomizer.java @@ -29,7 +29,6 @@ import java.io.PrintStream; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -78,7 +77,6 @@ public class Randomizer { // long seed2 = 123456789; // TESTING
// RandomSource.seed(seed2); // TESTING
RandomSource.seed(seed);
- final boolean raceMode = settings.isRaceMode();
int checkValue = 0;
@@ -128,7 +126,7 @@ public class Randomizer { int currentMiscTweaks = settings.getCurrentMiscTweaks();
if (romHandler.miscTweaksAvailable() != 0) {
int codeTweaksAvailable = romHandler.miscTweaksAvailable();
- List<MiscTweak> tweaksToApply = new ArrayList<MiscTweak>();
+ List<MiscTweak> tweaksToApply = new ArrayList<>();
for (MiscTweak mt : MiscTweak.allTweaks) {
if ((codeTweaksAvailable & mt.getValue()) > 0 && (currentMiscTweaks & mt.getValue()) > 0) {
@@ -186,9 +184,9 @@ public class Randomizer { StringBuilder evoStr = new StringBuilder(pk.evolutionsFrom.get(0).to.fullName());
for (int i = 1; i < numEvos; i++) {
if (i == numEvos - 1) {
- evoStr.append(" and " + pk.evolutionsFrom.get(i).to.fullName());
+ evoStr.append(" and ").append(pk.evolutionsFrom.get(i).to.fullName());
} else {
- evoStr.append(", " + pk.evolutionsFrom.get(i).to.fullName());
+ evoStr.append(", ").append(pk.evolutionsFrom.get(i).to.fullName());
}
}
// log.println(pk.fullName() + " now evolves into " + evoStr.toString());
@@ -293,17 +291,12 @@ public class Randomizer { List<MoveLearnt> data = moveData.get(pkmn.number);
- boolean first = true;
for (MoveLearnt ml : data) {
- // if (!first) {
- // sb.append(", ");
- // }
try {
sb.append("Level ").append(String.format("%-2d", ml.level)).append(": ").append(moves.get(ml.move).name).append(System.getProperty("line.separator"));
} catch (NullPointerException ex) {
- sb.append("invalid move at level" + ml.level);
+ sb.append("invalid move at level").append(ml.level);
}
- first = false;
}
movesets.add(sb.toString());
}
@@ -371,7 +364,7 @@ public class Randomizer { }
// Static Pokemon
- checkValue = maybeChangeAndLogStaticPokemon(log, romHandler, raceMode, checkValue);
+ checkValue = maybeChangeAndLogStaticPokemon(log, romHandler, checkValue);
// Wild Pokemon
if (settings.isUseMinimumCatchRate()) {
@@ -653,7 +646,6 @@ public class Randomizer { if (itemCount > 0) {
log.print(", ");
}
- itemCount++;
log.print(itemNames[pkmn.darkGrassHeldItem] + " (dark grass only)");
}
}
@@ -692,7 +684,7 @@ public class Randomizer { if (romHandler.isYellow()) {
starterCount = 2;
}
- List<Pokemon> starters = new ArrayList<Pokemon>();
+ List<Pokemon> starters = new ArrayList<>();
for (int i = 0; i < starterCount; i++) {
Pokemon pkmn = romHandler.randomPokemon();
while (starters.contains(pkmn)) {
@@ -710,7 +702,7 @@ public class Randomizer { if (romHandler.isYellow()) {
starterCount = 2;
}
- List<Pokemon> starters = new ArrayList<Pokemon>();
+ List<Pokemon> starters = new ArrayList<>();
for (int i = 0; i < starterCount; i++) {
Pokemon pkmn = romHandler.random2EvosPokemon();
while (starters.contains(pkmn)) {
@@ -743,18 +735,13 @@ public class Randomizer { }
log.print("(rate=" + es.rate + ")");
log.println();
- boolean first = true;
for (Encounter e : es.encounters) {
- // if (!first) {
- // log.print(", ");
- // }
-
// sb.append(String.format("%03d %s", pkmn.number, pkmn.fullName())).append(System.getProperty("line.separator")).append(String.format("HP %d ATK %-3d DEF %-3d SPATK %-3d SPDEF %-3d SPD %-3d", pkmn.hp, pkmn.attack, pkmn.defense, pkmn.speed, pkmn.spatk, pkmn.spdef)).append(System.getProperty("line.separator"));
StringBuilder sb = new StringBuilder();
- sb.append(e.pokemon.fullName() + " Lv");
+ sb.append(e.pokemon.fullName()).append(" Lv");
if (e.maxLevel > 0 && e.maxLevel != e.level) {
- sb.append("s " + e.level + "-" + e.maxLevel);
+ sb.append("s ").append(e.level).append("-").append(e.maxLevel);
} else {
sb.append(e.level);
}
@@ -762,7 +749,6 @@ public class Randomizer { StringBuilder sb2 = new StringBuilder();
sb2.append(String.format("HP %-3d ATK %-3d DEF %-3d SPATK %-3d SPDEF %-3d SPEED %-3d", e.pokemon.hp, e.pokemon.attack, e.pokemon.defense, e.pokemon.spatk, e.pokemon.spdef, e.pokemon.speed));
log.print(sb2);
- first = false;
log.println();
}
log.println();
@@ -804,8 +790,7 @@ public class Randomizer { }
}
- private int maybeChangeAndLogStaticPokemon(final PrintStream log, final RomHandler romHandler, boolean raceMode,
- int checkValue) {
+ private int maybeChangeAndLogStaticPokemon(final PrintStream log, final RomHandler romHandler, int checkValue) {
if (romHandler.canChangeStaticPokemon()) {
List<Pokemon> oldStatics = romHandler.getStaticPokemon();
if (settings.getStaticPokemonMod() == Settings.StaticPokemonMod.RANDOM_MATCHING) { // Legendary for L
@@ -823,7 +808,7 @@ public class Randomizer { log.println("Static Pokemon: Unchanged." + NEWLINE);
} else {
log.println("--Static Pokemon--");
- Map<Pokemon, Integer> seenPokemon = new TreeMap<Pokemon, Integer>();
+ Map<Pokemon, Integer> seenPokemon = new TreeMap<>();
for (int i = 0; i < oldStatics.size(); i++) {
Pokemon oldP = oldStatics.get(i);
Pokemon newP = newStatics.get(i);
diff --git a/src/com/dabomstew/pkrandom/RomFunctions.java b/src/com/dabomstew/pkrandom/RomFunctions.java index c219f2b..ef6e2ec 100755 --- a/src/com/dabomstew/pkrandom/RomFunctions.java +++ b/src/com/dabomstew/pkrandom/RomFunctions.java @@ -39,7 +39,7 @@ public class RomFunctions { public static Set<Pokemon> getBasicOrNoCopyPokemon(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemonInclFormes(); - Set<Pokemon> dontCopyPokes = new TreeSet<Pokemon>(); + Set<Pokemon> dontCopyPokes = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() < 1) { @@ -57,7 +57,7 @@ public class RomFunctions { public static Set<Pokemon> getMiddleEvolutions(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemon(); - Set<Pokemon> middleEvolutions = new TreeSet<Pokemon>(); + Set<Pokemon> middleEvolutions = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() > 0) { @@ -73,7 +73,7 @@ public class RomFunctions { public static Set<Pokemon> getFinalEvolutions(RomHandler baseRom) { List<Pokemon> allPokes = baseRom.getPokemon(); - Set<Pokemon> finalEvolutions = new TreeSet<Pokemon>(); + Set<Pokemon> finalEvolutions = new TreeSet<>(); for (Pokemon pkmn : allPokes) { if (pkmn != null) { if (pkmn.evolutionsTo.size() == 1 && pkmn.evolutionsFrom.size() == 0) { @@ -90,10 +90,10 @@ public class RomFunctions { /** * Get the 4 moves known by a Pokemon at a particular level. * - * @param pkmn - * @param movesets - * @param level - * @return + * @param pkmn Pokemon index to get moves for. + * @param movesets Map of Pokemon indices mapped to movesets. + * @param level Level to get at. + * @return Array with move indices. */ public static int[] getMovesAtLevel(int pkmn, Map<Integer, List<MoveLearnt>> movesets, int level) { return getMovesAtLevel(pkmn, movesets, level, 0); @@ -126,9 +126,7 @@ public class RomFunctions { // add this move to the moveset if (moveCount == 4) { // shift moves up and add to last slot - for (int i = 0; i < 3; i++) { - curMoves[i] = curMoves[i + 1]; - } + System.arraycopy(curMoves, 1, curMoves, 0, 3); curMoves[3] = ml.move; } else { // add to next available slot @@ -197,13 +195,12 @@ public class RomFunctions { int currentMatchStart = beginOffset; int currentCharacterPosition = 0; - int docSize = endOffset; int needleSize = needle.length; int[] toFillTable = buildKMPSearchTable(needle); - List<Integer> results = new ArrayList<Integer>(); + List<Integer> results = new ArrayList<>(); - while ((currentMatchStart + currentCharacterPosition) < docSize) { + while ((currentMatchStart + currentCharacterPosition) < endOffset) { if (needle[currentCharacterPosition] == (haystack[currentCharacterPosition + currentMatchStart])) { currentCharacterPosition = currentCharacterPosition + 1; @@ -233,7 +230,7 @@ public class RomFunctions { return results; } - public static int searchForFirst(byte[] haystack, int beginOffset, byte[] needle) { + private static int searchForFirst(byte[] haystack, int beginOffset, byte[] needle) { int currentMatchStart = beginOffset; int currentCharacterPosition = 0; @@ -345,7 +342,6 @@ public class RomFunctions { fullDesc.append(newline); } fullDesc.append(thisLine.toString()); - linesWritten++; } return fullDesc.toString(); @@ -387,14 +383,14 @@ public class RomFunctions { int currLineCC = 0; int linesWritten = 0; char currLineLastChar = 0; - for (int i = 0; i < words.length; i++) { - int reqLength = ssd.lengthFor(words[i]); + for (String word : words) { + int reqLength = ssd.lengthFor(word); if (currLineWC > 0) { reqLength++; } if ((currLineCC + reqLength > maxLineLength) || (currLineCC >= sentenceNewLineSize && (currLineLastChar == '.' || currLineLastChar == '?' - || currLineLastChar == '!' || currLineLastChar == '…' || currLineLastChar == ','))) { + || currLineLastChar == '!' || currLineLastChar == '…' || currLineLastChar == ','))) { // new line // Save current line, if applicable if (currLineWC > 0) { @@ -408,26 +404,26 @@ public class RomFunctions { thisLine = new StringBuilder(); } // Start the new line - thisLine.append(words[i]); + thisLine.append(word); currLineWC = 1; - currLineCC = ssd.lengthFor(words[i]); - if (words[i].length() == 0) { + currLineCC = ssd.lengthFor(word); + if (word.length() == 0) { currLineLastChar = 0; } else { - currLineLastChar = words[i].charAt(words[i].length() - 1); + currLineLastChar = word.charAt(word.length() - 1); } } else { // add to current line if (currLineWC > 0) { thisLine.append(' '); } - thisLine.append(words[i]); + thisLine.append(word); currLineWC++; currLineCC += reqLength; - if (words[i].length() == 0) { + if (word.length() == 0) { currLineLastChar = 0; } else { - currLineLastChar = words[i].charAt(words[i].length() - 1); + currLineLastChar = word.charAt(word.length() - 1); } } } @@ -440,7 +436,6 @@ public class RomFunctions { fullPara.append(newline); } fullPara.append(thisLine.toString()); - linesWritten++; } if (para > 0) { finalResult.append(newpara); @@ -454,7 +449,7 @@ public class RomFunctions { } public interface StringSizeDeterminer { - public int lengthFor(String encodedText); + int lengthFor(String encodedText); } public static class StringLengthSD implements StringSizeDeterminer { diff --git a/src/com/dabomstew/pkrandom/Settings.java b/src/com/dabomstew/pkrandom/Settings.java index 1d720cb..56ea15e 100644 --- a/src/com/dabomstew/pkrandom/Settings.java +++ b/src/com/dabomstew/pkrandom/Settings.java @@ -425,6 +425,7 @@ public class Settings { writeFullInt(out, 0);
}
} catch (IOException e) {
+ e.printStackTrace(); // better than nothing
}
@@ -433,7 +434,7 @@ public class Settings { try {
writeFullInt(out, currentMiscTweaks);
} catch (IOException e) {
-
+ e.printStackTrace(); // better than nothing
}
// @ 35 trainer pokemon level modifier
@@ -453,8 +454,6 @@ public class Settings { byte[] romName = this.romName.getBytes("US-ASCII");
out.write(romName.length);
out.write(romName);
- } catch (UnsupportedEncodingException e) {
- out.write(0);
} catch (IOException e) {
out.write(0);
}
@@ -467,6 +466,7 @@ public class Settings { writeFullInt(out, (int) checksum.getValue());
writeFullInt(out, FileFunctions.getFileChecksum(SysConstants.customNamesFile));
} catch (IOException e) {
+ e.printStackTrace(); // better than nothing
}
return Base64.getEncoder().encodeToString(out.toByteArray());
@@ -815,479 +815,432 @@ public class Settings { return romName;
}
- public Settings setRomName(String romName) {
+ public void setRomName(String romName) {
this.romName = romName;
- return this;
}
public boolean isUpdatedFromOldVersion() {
return updatedFromOldVersion;
}
- public Settings setUpdatedFromOldVersion(boolean updatedFromOldVersion) {
+ private void setUpdatedFromOldVersion(boolean updatedFromOldVersion) {
this.updatedFromOldVersion = updatedFromOldVersion;
- return this;
}
public GenRestrictions getCurrentRestrictions() {
return currentRestrictions;
}
- public Settings setCurrentRestrictions(GenRestrictions currentRestrictions) {
+ public void setCurrentRestrictions(GenRestrictions currentRestrictions) {
this.currentRestrictions = currentRestrictions;
- return this;
}
public int getCurrentMiscTweaks() {
return currentMiscTweaks;
}
- public Settings setCurrentMiscTweaks(int currentMiscTweaks) {
+ public void setCurrentMiscTweaks(int currentMiscTweaks) {
this.currentMiscTweaks = currentMiscTweaks;
- return this;
}
public boolean isUpdateMoves() {
return updateMoves;
}
- public Settings setUpdateMoves(boolean updateMoves) {
+ public void setUpdateMoves(boolean updateMoves) {
this.updateMoves = updateMoves;
- return this;
}
public boolean isUpdateMovesLegacy() {
return updateMovesLegacy;
}
- public Settings setUpdateMovesLegacy(boolean updateMovesLegacy) {
+ public void setUpdateMovesLegacy(boolean updateMovesLegacy) {
this.updateMovesLegacy = updateMovesLegacy;
- return this;
}
public boolean isChangeImpossibleEvolutions() {
return changeImpossibleEvolutions;
}
- public Settings setChangeImpossibleEvolutions(boolean changeImpossibleEvolutions) {
+ public void setChangeImpossibleEvolutions(boolean changeImpossibleEvolutions) {
this.changeImpossibleEvolutions = changeImpossibleEvolutions;
- return this;
}
public boolean isMakeEvolutionsEasier() {
return makeEvolutionsEasier;
}
- public Settings setMakeEvolutionsEasier(boolean makeEvolutionsEasier) {
+ public void setMakeEvolutionsEasier(boolean makeEvolutionsEasier) {
this.makeEvolutionsEasier = makeEvolutionsEasier;
- return this;
}
public boolean isRaceMode() {
return raceMode;
}
- public Settings setRaceMode(boolean raceMode) {
+ public void setRaceMode(boolean raceMode) {
this.raceMode = raceMode;
- return this;
}
public boolean doBlockBrokenMoves() {
return blockBrokenMoves;
}
- public Settings setBlockBrokenMoves(boolean blockBrokenMoves) {
+ public void setBlockBrokenMoves(boolean blockBrokenMoves) {
this.blockBrokenMoves = blockBrokenMoves;
- return this;
}
public boolean isLimitPokemon() {
return limitPokemon;
}
- public Settings setLimitPokemon(boolean limitPokemon) {
+ public void setLimitPokemon(boolean limitPokemon) {
this.limitPokemon = limitPokemon;
- return this;
}
public BaseStatisticsMod getBaseStatisticsMod() {
return baseStatisticsMod;
}
- public Settings setBaseStatisticsMod(BaseStatisticsMod baseStatisticsMod) {
- this.baseStatisticsMod = baseStatisticsMod;
- return this;
+ public void setBaseStatisticsMod(boolean... bools) {
+ setBaseStatisticsMod(getEnum(BaseStatisticsMod.class, bools));
}
- public Settings setBaseStatisticsMod(boolean... bools) {
- return setBaseStatisticsMod(getEnum(BaseStatisticsMod.class, bools));
+ private void setBaseStatisticsMod(BaseStatisticsMod baseStatisticsMod) {
+ this.baseStatisticsMod = baseStatisticsMod;
}
public boolean isBaseStatsFollowEvolutions() {
return baseStatsFollowEvolutions;
}
- public Settings setBaseStatsFollowEvolutions(boolean baseStatsFollowEvolutions) {
+ public void setBaseStatsFollowEvolutions(boolean baseStatsFollowEvolutions) {
this.baseStatsFollowEvolutions = baseStatsFollowEvolutions;
- return this;
}
public boolean isStandardizeEXPCurves() {
return standardizeEXPCurves;
}
- public Settings setStandardizeEXPCurves(boolean standardizeEXPCurves) {
+ public void setStandardizeEXPCurves(boolean standardizeEXPCurves) {
this.standardizeEXPCurves = standardizeEXPCurves;
- return this;
}
public ExpCurveMod getExpCurveMod() {
return expCurveMod;
}
- public Settings setExpCurveMod(ExpCurveMod expCurveMod) {
- this.expCurveMod = expCurveMod;
- return this;
+ public void setExpCurveMod(boolean... bools) {
+ setExpCurveMod(getEnum(ExpCurveMod.class, bools));
}
- public Settings setExpCurveMod(boolean... bools) {
- return setExpCurveMod(getEnum(ExpCurveMod.class, bools));
+ private void setExpCurveMod(ExpCurveMod expCurveMod) {
+ this.expCurveMod = expCurveMod;
}
public boolean isUpdateBaseStats() {
return updateBaseStats;
}
- public Settings setUpdateBaseStats(boolean updateBaseStats) {
+ public void setUpdateBaseStats(boolean updateBaseStats) {
this.updateBaseStats = updateBaseStats;
- return this;
}
public AbilitiesMod getAbilitiesMod() {
return abilitiesMod;
}
- public Settings setAbilitiesMod(AbilitiesMod abilitiesMod) {
- this.abilitiesMod = abilitiesMod;
- return this;
+ public void setAbilitiesMod(boolean... bools) {
+ setAbilitiesMod(getEnum(AbilitiesMod.class, bools));
}
- public Settings setAbilitiesMod(boolean... bools) {
- return setAbilitiesMod(getEnum(AbilitiesMod.class, bools));
+ private void setAbilitiesMod(AbilitiesMod abilitiesMod) {
+ this.abilitiesMod = abilitiesMod;
}
public boolean isAllowWonderGuard() {
return allowWonderGuard;
}
- public Settings setAllowWonderGuard(boolean allowWonderGuard) {
+ public void setAllowWonderGuard(boolean allowWonderGuard) {
this.allowWonderGuard = allowWonderGuard;
- return this;
}
public boolean isAbilitiesFollowEvolutions() {
return abilitiesFollowEvolutions;
}
- public Settings setAbilitiesFollowEvolutions(boolean abilitiesFollowEvolutions) {
+ public void setAbilitiesFollowEvolutions(boolean abilitiesFollowEvolutions) {
this.abilitiesFollowEvolutions = abilitiesFollowEvolutions;
- return this;
}
public boolean isBanTrappingAbilities() {
return banTrappingAbilities;
}
- public Settings setBanTrappingAbilities(boolean banTrappingAbilities) {
+ public void setBanTrappingAbilities(boolean banTrappingAbilities) {
this.banTrappingAbilities = banTrappingAbilities;
- return this;
}
public boolean isBanNegativeAbilities() {
return banNegativeAbilities;
}
- public Settings setBanNegativeAbilities(boolean banNegativeAbilities) {
+ public void setBanNegativeAbilities(boolean banNegativeAbilities) {
this.banNegativeAbilities = banNegativeAbilities;
- return this;
}
public boolean isBanBadAbilities() {
return banBadAbilities;
}
- public Settings setBanBadAbilities(boolean banBadAbilities) {
+ public void setBanBadAbilities(boolean banBadAbilities) {
this.banBadAbilities = banBadAbilities;
- return this;
}
public StartersMod getStartersMod() {
return startersMod;
}
- public Settings setStartersMod(StartersMod startersMod) {
- this.startersMod = startersMod;
- return this;
+ public void setStartersMod(boolean... bools) {
+ setStartersMod(getEnum(StartersMod.class, bools));
}
- public Settings setStartersMod(boolean... bools) {
- return setStartersMod(getEnum(StartersMod.class, bools));
+ private void setStartersMod(StartersMod startersMod) {
+ this.startersMod = startersMod;
}
public int[] getCustomStarters() {
return customStarters;
}
- public Settings setCustomStarters(int[] customStarters) {
+ public void setCustomStarters(int[] customStarters) {
this.customStarters = customStarters;
- return this;
}
public boolean isRandomizeStartersHeldItems() {
return randomizeStartersHeldItems;
}
- public Settings setRandomizeStartersHeldItems(boolean randomizeStartersHeldItems) {
+ public void setRandomizeStartersHeldItems(boolean randomizeStartersHeldItems) {
this.randomizeStartersHeldItems = randomizeStartersHeldItems;
- return this;
}
public boolean isBanBadRandomStarterHeldItems() {
return banBadRandomStarterHeldItems;
}
- public Settings setBanBadRandomStarterHeldItems(boolean banBadRandomStarterHeldItems) {
+ public void setBanBadRandomStarterHeldItems(boolean banBadRandomStarterHeldItems) {
this.banBadRandomStarterHeldItems = banBadRandomStarterHeldItems;
- return this;
}
public boolean isLimitMusketeers() {
return limitMusketeers;
}
- public Settings setLimitMusketeers(boolean limitMusketeers) {
+
+ public void setLimitMusketeers(boolean limitMusketeers) {
this.limitMusketeers = limitMusketeers;
- return this;
}
public boolean isLimit600() {
return limit600;
}
- public Settings setLimit600(boolean limit600) {
+
+ public void setLimit600(boolean limit600) {
this.limit600 = limit600;
- return this;
}
public TypesMod getTypesMod() {
return typesMod;
}
- public Settings setTypesMod(TypesMod typesMod) {
- this.typesMod = typesMod;
- return this;
+ public void setTypesMod(boolean... bools) {
+ setTypesMod(getEnum(TypesMod.class, bools));
}
- public Settings setTypesMod(boolean... bools) {
- return setTypesMod(getEnum(TypesMod.class, bools));
+ private void setTypesMod(TypesMod typesMod) {
+ this.typesMod = typesMod;
}
public EvolutionsMod getEvolutionsMod() {
return evolutionsMod;
}
- public Settings setEvolutionsMod(EvolutionsMod evolutionsMod) {
- this.evolutionsMod = evolutionsMod;
- return this;
+ public void setEvolutionsMod(boolean... bools) {
+ setEvolutionsMod(getEnum(EvolutionsMod.class, bools));
}
- public Settings setEvolutionsMod(boolean... bools) {
- return setEvolutionsMod(getEnum(EvolutionsMod.class, bools));
+ private void setEvolutionsMod(EvolutionsMod evolutionsMod) {
+ this.evolutionsMod = evolutionsMod;
}
public boolean isEvosSimilarStrength() {
return evosSimilarStrength;
}
- public Settings setEvosSimilarStrength(boolean evosSimilarStrength) {
+ public void setEvosSimilarStrength(boolean evosSimilarStrength) {
this.evosSimilarStrength = evosSimilarStrength;
- return this;
}
public boolean isEvosSameTyping() {
return evosSameTyping;
}
- public Settings setEvosSameTyping(boolean evosSameTyping) {
+ public void setEvosSameTyping(boolean evosSameTyping) {
this.evosSameTyping = evosSameTyping;
- return this;
}
public boolean isEvosMaxThreeStages() {
return evosMaxThreeStages;
}
- public Settings setEvosMaxThreeStages(boolean evosMaxThreeStages) {
+ public void setEvosMaxThreeStages(boolean evosMaxThreeStages) {
this.evosMaxThreeStages = evosMaxThreeStages;
- return this;
}
public boolean isEvosForceChange() {
return evosForceChange;
}
- public Settings setEvosForceChange(boolean evosForceChange) {
+ public void setEvosForceChange(boolean evosForceChange) {
this.evosForceChange = evosForceChange;
- return this;
}
public boolean isRandomizeMovePowers() {
return randomizeMovePowers;
}
- public Settings setRandomizeMovePowers(boolean randomizeMovePowers) {
+ public void setRandomizeMovePowers(boolean randomizeMovePowers) {
this.randomizeMovePowers = randomizeMovePowers;
- return this;
}
public boolean isRandomizeMoveAccuracies() {
return randomizeMoveAccuracies;
}
- public Settings setRandomizeMoveAccuracies(boolean randomizeMoveAccuracies) {
+ public void setRandomizeMoveAccuracies(boolean randomizeMoveAccuracies) {
this.randomizeMoveAccuracies = randomizeMoveAccuracies;
- return this;
}
public boolean isRandomizeMovePPs() {
return randomizeMovePPs;
}
- public Settings setRandomizeMovePPs(boolean randomizeMovePPs) {
+ public void setRandomizeMovePPs(boolean randomizeMovePPs) {
this.randomizeMovePPs = randomizeMovePPs;
- return this;
}
public boolean isRandomizeMoveTypes() {
return randomizeMoveTypes;
}
- public Settings setRandomizeMoveTypes(boolean randomizeMoveTypes) {
+ public void setRandomizeMoveTypes(boolean randomizeMoveTypes) {
this.randomizeMoveTypes = randomizeMoveTypes;
- return this;
}
public boolean isRandomizeMoveCategory() {
return randomizeMoveCategory;
}
- public Settings setRandomizeMoveCategory(boolean randomizeMoveCategory) {
+ public void setRandomizeMoveCategory(boolean randomizeMoveCategory) {
this.randomizeMoveCategory = randomizeMoveCategory;
- return this;
}
public MovesetsMod getMovesetsMod() {
return movesetsMod;
}
- public Settings setMovesetsMod(MovesetsMod movesetsMod) {
- this.movesetsMod = movesetsMod;
- return this;
+ public void setMovesetsMod(boolean... bools) {
+ setMovesetsMod(getEnum(MovesetsMod.class, bools));
}
- public Settings setMovesetsMod(boolean... bools) {
- return setMovesetsMod(getEnum(MovesetsMod.class, bools));
+ private void setMovesetsMod(MovesetsMod movesetsMod) {
+ this.movesetsMod = movesetsMod;
}
public boolean isStartWithGuaranteedMoves() {
return startWithGuaranteedMoves;
}
- public Settings setStartWithGuaranteedMoves(boolean startWithGuaranteedMoves) {
+ public void setStartWithGuaranteedMoves(boolean startWithGuaranteedMoves) {
this.startWithGuaranteedMoves = startWithGuaranteedMoves;
- return this;
}
public int getGuaranteedMoveCount() {
return guaranteedMoveCount;
}
- public Settings setGuaranteedMoveCount(int guaranteedMoveCount) {
+
+ public void setGuaranteedMoveCount(int guaranteedMoveCount) {
this.guaranteedMoveCount = guaranteedMoveCount;
- return this;
}
public boolean isReorderDamagingMoves() {
return reorderDamagingMoves;
}
- public Settings setReorderDamagingMoves(boolean reorderDamagingMoves) {
+ public void setReorderDamagingMoves(boolean reorderDamagingMoves) {
this.reorderDamagingMoves = reorderDamagingMoves;
- return this;
}
public boolean isMovesetsForceGoodDamaging() {
return movesetsForceGoodDamaging;
}
- public Settings setMovesetsForceGoodDamaging(boolean movesetsForceGoodDamaging) {
+ public void setMovesetsForceGoodDamaging(boolean movesetsForceGoodDamaging) {
this.movesetsForceGoodDamaging = movesetsForceGoodDamaging;
- return this;
}
public int getMovesetsGoodDamagingPercent() {
return movesetsGoodDamagingPercent;
}
- public Settings setMovesetsGoodDamagingPercent(int movesetsGoodDamagingPercent) {
+ public void setMovesetsGoodDamagingPercent(int movesetsGoodDamagingPercent) {
this.movesetsGoodDamagingPercent = movesetsGoodDamagingPercent;
- return this;
}
public TrainersMod getTrainersMod() {
return trainersMod;
}
- public Settings setTrainersMod(TrainersMod trainersMod) {
- this.trainersMod = trainersMod;
- return this;
+ public void setTrainersMod(boolean... bools) {
+ setTrainersMod(getEnum(TrainersMod.class, bools));
}
- public Settings setTrainersMod(boolean... bools) {
- return setTrainersMod(getEnum(TrainersMod.class, bools));
+ private void setTrainersMod(TrainersMod trainersMod) {
+ this.trainersMod = trainersMod;
}
public boolean isRivalCarriesStarterThroughout() {
return rivalCarriesStarterThroughout;
}
- public Settings setRivalCarriesStarterThroughout(boolean rivalCarriesStarterThroughout) {
+ public void setRivalCarriesStarterThroughout(boolean rivalCarriesStarterThroughout) {
this.rivalCarriesStarterThroughout = rivalCarriesStarterThroughout;
- return this;
}
public boolean isTrainersUsePokemonOfSimilarStrength() {
return trainersUsePokemonOfSimilarStrength;
}
- public Settings setTrainersUsePokemonOfSimilarStrength(boolean trainersUsePokemonOfSimilarStrength) {
+ public void setTrainersUsePokemonOfSimilarStrength(boolean trainersUsePokemonOfSimilarStrength) {
this.trainersUsePokemonOfSimilarStrength = trainersUsePokemonOfSimilarStrength;
- return this;
}
public boolean isTrainersMatchTypingDistribution() {
return trainersMatchTypingDistribution;
}
- public Settings setTrainersMatchTypingDistribution(boolean trainersMatchTypingDistribution) {
+ public void setTrainersMatchTypingDistribution(boolean trainersMatchTypingDistribution) {
this.trainersMatchTypingDistribution = trainersMatchTypingDistribution;
- return this;
}
public boolean isTrainersBlockLegendaries() {
return trainersBlockLegendaries;
}
- public Settings setTrainersBlockLegendaries(boolean trainersBlockLegendaries) {
+ public void setTrainersBlockLegendaries(boolean trainersBlockLegendaries) {
this.trainersBlockLegendaries = trainersBlockLegendaries;
- return this;
}
public boolean isTrainersEnforceDistribution() {
@@ -1313,378 +1266,340 @@ public class Settings { return trainersBlockEarlyWonderGuard;
}
- public Settings setTrainersBlockEarlyWonderGuard(boolean trainersBlockEarlyWonderGuard) {
+ public void setTrainersBlockEarlyWonderGuard(boolean trainersBlockEarlyWonderGuard) {
this.trainersBlockEarlyWonderGuard = trainersBlockEarlyWonderGuard;
- return this;
}
public boolean isRandomizeTrainerNames() {
return randomizeTrainerNames;
}
- public Settings setRandomizeTrainerNames(boolean randomizeTrainerNames) {
+ public void setRandomizeTrainerNames(boolean randomizeTrainerNames) {
this.randomizeTrainerNames = randomizeTrainerNames;
- return this;
}
public boolean isRandomizeTrainerClassNames() {
return randomizeTrainerClassNames;
}
- public Settings setRandomizeTrainerClassNames(boolean randomizeTrainerClassNames) {
+ public void setRandomizeTrainerClassNames(boolean randomizeTrainerClassNames) {
this.randomizeTrainerClassNames = randomizeTrainerClassNames;
- return this;
}
public boolean isTrainersForceFullyEvolved() {
return trainersForceFullyEvolved;
}
- public Settings setTrainersForceFullyEvolved(boolean trainersForceFullyEvolved) {
+ public void setTrainersForceFullyEvolved(boolean trainersForceFullyEvolved) {
this.trainersForceFullyEvolved = trainersForceFullyEvolved;
- return this;
}
public int getTrainersForceFullyEvolvedLevel() {
return trainersForceFullyEvolvedLevel;
}
- public Settings setTrainersForceFullyEvolvedLevel(int trainersForceFullyEvolvedLevel) {
+ public void setTrainersForceFullyEvolvedLevel(int trainersForceFullyEvolvedLevel) {
this.trainersForceFullyEvolvedLevel = trainersForceFullyEvolvedLevel;
- return this;
}
public boolean isTrainersLevelModified() {
return trainersLevelModified;
}
- public Settings setTrainersLevelModified(boolean trainersLevelModified) {
+ public void setTrainersLevelModified(boolean trainersLevelModified) {
this.trainersLevelModified = trainersLevelModified;
- return this;
}
public int getTrainersLevelModifier() {
return trainersLevelModifier;
}
- public Settings setTrainersLevelModifier(int trainersLevelModifier) {
+ public void setTrainersLevelModifier(int trainersLevelModifier) {
this.trainersLevelModifier = trainersLevelModifier;
- return this;
}
public WildPokemonMod getWildPokemonMod() {
return wildPokemonMod;
}
- public Settings setWildPokemonMod(WildPokemonMod wildPokemonMod) {
- this.wildPokemonMod = wildPokemonMod;
- return this;
+ public void setWildPokemonMod(boolean... bools) {
+ setWildPokemonMod(getEnum(WildPokemonMod.class, bools));
}
- public Settings setWildPokemonMod(boolean... bools) {
- return setWildPokemonMod(getEnum(WildPokemonMod.class, bools));
+ private void setWildPokemonMod(WildPokemonMod wildPokemonMod) {
+ this.wildPokemonMod = wildPokemonMod;
}
public WildPokemonRestrictionMod getWildPokemonRestrictionMod() {
return wildPokemonRestrictionMod;
}
- public Settings setWildPokemonRestrictionMod(WildPokemonRestrictionMod wildPokemonRestrictionMod) {
- this.wildPokemonRestrictionMod = wildPokemonRestrictionMod;
- return this;
+ public void setWildPokemonRestrictionMod(boolean... bools) {
+ setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, bools));
}
- public Settings setWildPokemonRestrictionMod(boolean... bools) {
- return setWildPokemonRestrictionMod(getEnum(WildPokemonRestrictionMod.class, bools));
+ private void setWildPokemonRestrictionMod(WildPokemonRestrictionMod wildPokemonRestrictionMod) {
+ this.wildPokemonRestrictionMod = wildPokemonRestrictionMod;
}
public boolean isUseTimeBasedEncounters() {
return useTimeBasedEncounters;
}
- public Settings setUseTimeBasedEncounters(boolean useTimeBasedEncounters) {
+ public void setUseTimeBasedEncounters(boolean useTimeBasedEncounters) {
this.useTimeBasedEncounters = useTimeBasedEncounters;
- return this;
}
public boolean isBlockWildLegendaries() {
return blockWildLegendaries;
}
- public Settings setBlockWildLegendaries(boolean blockWildLegendaries) {
+ public void setBlockWildLegendaries(boolean blockWildLegendaries) {
this.blockWildLegendaries = blockWildLegendaries;
- return this;
}
public boolean isUseMinimumCatchRate() {
return useMinimumCatchRate;
}
- public Settings setUseMinimumCatchRate(boolean useMinimumCatchRate) {
+ public void setUseMinimumCatchRate(boolean useMinimumCatchRate) {
this.useMinimumCatchRate = useMinimumCatchRate;
- return this;
}
public int getMinimumCatchRateLevel() {
return minimumCatchRateLevel;
}
- public Settings setMinimumCatchRateLevel(int minimumCatchRateLevel) {
+ public void setMinimumCatchRateLevel(int minimumCatchRateLevel) {
this.minimumCatchRateLevel = minimumCatchRateLevel;
- return this;
}
public boolean isRandomizeWildPokemonHeldItems() {
return randomizeWildPokemonHeldItems;
}
- public Settings setRandomizeWildPokemonHeldItems(boolean randomizeWildPokemonHeldItems) {
+ public void setRandomizeWildPokemonHeldItems(boolean randomizeWildPokemonHeldItems) {
this.randomizeWildPokemonHeldItems = randomizeWildPokemonHeldItems;
- return this;
}
public boolean isBanBadRandomWildPokemonHeldItems() {
return banBadRandomWildPokemonHeldItems;
}
- public Settings setBanBadRandomWildPokemonHeldItems(boolean banBadRandomWildPokemonHeldItems) {
+ public void setBanBadRandomWildPokemonHeldItems(boolean banBadRandomWildPokemonHeldItems) {
this.banBadRandomWildPokemonHeldItems = banBadRandomWildPokemonHeldItems;
- return this;
}
public boolean isBalanceShakingGrass() {
return balanceShakingGrass;
}
- public Settings setBalanceShakingGrass(boolean balanceShakingGrass) {
+ public void setBalanceShakingGrass(boolean balanceShakingGrass) {
this.balanceShakingGrass = balanceShakingGrass;
- return this;
}
public boolean isWildLevelsModified() {
return wildLevelsModified;
}
- public Settings setWildLevelsModified(boolean wildLevelsModified) {
+ public void setWildLevelsModified(boolean wildLevelsModified) {
this.wildLevelsModified = wildLevelsModified;
- return this;
}
public int getWildLevelModifier() {
return wildLevelModifier;
}
- public Settings setWildLevelModifier(int wildLevelModifier) {
+ public void setWildLevelModifier(int wildLevelModifier) {
this.wildLevelModifier = wildLevelModifier;
- return this;
}
public StaticPokemonMod getStaticPokemonMod() {
return staticPokemonMod;
}
- public Settings setStaticPokemonMod(StaticPokemonMod staticPokemonMod) {
- this.staticPokemonMod = staticPokemonMod;
- return this;
+ public void setStaticPokemonMod(boolean... bools) {
+ setStaticPokemonMod(getEnum(StaticPokemonMod.class, bools));
}
- public Settings setStaticPokemonMod(boolean... bools) {
- return setStaticPokemonMod(getEnum(StaticPokemonMod.class, bools));
+ private void setStaticPokemonMod(StaticPokemonMod staticPokemonMod) {
+ this.staticPokemonMod = staticPokemonMod;
}
public TMsMod getTmsMod() {
return tmsMod;
}
- public Settings setTmsMod(TMsMod tmsMod) {
- this.tmsMod = tmsMod;
- return this;
+ public void setTmsMod(boolean... bools) {
+ setTmsMod(getEnum(TMsMod.class, bools));
}
- public Settings setTmsMod(boolean... bools) {
- return setTmsMod(getEnum(TMsMod.class, bools));
+ private void setTmsMod(TMsMod tmsMod) {
+ this.tmsMod = tmsMod;
}
public boolean isTmLevelUpMoveSanity() {
return tmLevelUpMoveSanity;
}
- public Settings setTmLevelUpMoveSanity(boolean tmLevelUpMoveSanity) {
+ public void setTmLevelUpMoveSanity(boolean tmLevelUpMoveSanity) {
this.tmLevelUpMoveSanity = tmLevelUpMoveSanity;
- return this;
}
public boolean isKeepFieldMoveTMs() {
return keepFieldMoveTMs;
}
- public Settings setKeepFieldMoveTMs(boolean keepFieldMoveTMs) {
+ public void setKeepFieldMoveTMs(boolean keepFieldMoveTMs) {
this.keepFieldMoveTMs = keepFieldMoveTMs;
- return this;
}
public boolean isFullHMCompat() {
return fullHMCompat;
}
- public Settings setFullHMCompat(boolean fullHMCompat) {
+ public void setFullHMCompat(boolean fullHMCompat) {
this.fullHMCompat = fullHMCompat;
- return this;
}
public boolean isTmsForceGoodDamaging() {
return tmsForceGoodDamaging;
}
- public Settings setTmsForceGoodDamaging(boolean tmsForceGoodDamaging) {
+ public void setTmsForceGoodDamaging(boolean tmsForceGoodDamaging) {
this.tmsForceGoodDamaging = tmsForceGoodDamaging;
- return this;
}
public int getTmsGoodDamagingPercent() {
return tmsGoodDamagingPercent;
}
- public Settings setTmsGoodDamagingPercent(int tmsGoodDamagingPercent) {
+ public void setTmsGoodDamagingPercent(int tmsGoodDamagingPercent) {
this.tmsGoodDamagingPercent = tmsGoodDamagingPercent;
- return this;
}
public TMsHMsCompatibilityMod getTmsHmsCompatibilityMod() {
return tmsHmsCompatibilityMod;
}
- public Settings setTmsHmsCompatibilityMod(TMsHMsCompatibilityMod tmsHmsCompatibilityMod) {
- this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
- return this;
+ public void setTmsHmsCompatibilityMod(boolean... bools) {
+ setTmsHmsCompatibilityMod(getEnum(TMsHMsCompatibilityMod.class, bools));
}
- public Settings setTmsHmsCompatibilityMod(boolean... bools) {
- return setTmsHmsCompatibilityMod(getEnum(TMsHMsCompatibilityMod.class, bools));
+ private void setTmsHmsCompatibilityMod(TMsHMsCompatibilityMod tmsHmsCompatibilityMod) {
+ this.tmsHmsCompatibilityMod = tmsHmsCompatibilityMod;
}
public MoveTutorMovesMod getMoveTutorMovesMod() {
return moveTutorMovesMod;
}
- public Settings setMoveTutorMovesMod(MoveTutorMovesMod moveTutorMovesMod) {
- this.moveTutorMovesMod = moveTutorMovesMod;
- return this;
+ public void setMoveTutorMovesMod(boolean... bools) {
+ setMoveTutorMovesMod(getEnum(MoveTutorMovesMod.class, bools));
}
- public Settings setMoveTutorMovesMod(boolean... bools) {
- return setMoveTutorMovesMod(getEnum(MoveTutorMovesMod.class, bools));
+ private void setMoveTutorMovesMod(MoveTutorMovesMod moveTutorMovesMod) {
+ this.moveTutorMovesMod = moveTutorMovesMod;
}
public boolean isTutorLevelUpMoveSanity() {
return tutorLevelUpMoveSanity;
}
- public Settings setTutorLevelUpMoveSanity(boolean tutorLevelUpMoveSanity) {
+ public void setTutorLevelUpMoveSanity(boolean tutorLevelUpMoveSanity) {
this.tutorLevelUpMoveSanity = tutorLevelUpMoveSanity;
- return this;
}
public boolean isKeepFieldMoveTutors() {
return keepFieldMoveTutors;
}
- public Settings setKeepFieldMoveTutors(boolean keepFieldMoveTutors) {
+ public void setKeepFieldMoveTutors(boolean keepFieldMoveTutors) {
this.keepFieldMoveTutors = keepFieldMoveTutors;
- return this;
}
public boolean isTutorsForceGoodDamaging() {
return tutorsForceGoodDamaging;
}
- public Settings setTutorsForceGoodDamaging(boolean tutorsForceGoodDamaging) {
+ public void setTutorsForceGoodDamaging(boolean tutorsForceGoodDamaging) {
this.tutorsForceGoodDamaging = tutorsForceGoodDamaging;
- return this;
}
public int getTutorsGoodDamagingPercent() {
return tutorsGoodDamagingPercent;
}
- public Settings setTutorsGoodDamagingPercent(int tutorsGoodDamagingPercent) {
+ public void setTutorsGoodDamagingPercent(int tutorsGoodDamagingPercent) {
this.tutorsGoodDamagingPercent = tutorsGoodDamagingPercent;
- return this;
}
public MoveTutorsCompatibilityMod getMoveTutorsCompatibilityMod() {
return moveTutorsCompatibilityMod;
}
- public Settings setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod moveTutorsCompatibilityMod) {
- this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
- return this;
+ public void setMoveTutorsCompatibilityMod(boolean... bools) {
+ setMoveTutorsCompatibilityMod(getEnum(MoveTutorsCompatibilityMod.class, bools));
}
- public Settings setMoveTutorsCompatibilityMod(boolean... bools) {
- return setMoveTutorsCompatibilityMod(getEnum(MoveTutorsCompatibilityMod.class, bools));
+ private void setMoveTutorsCompatibilityMod(MoveTutorsCompatibilityMod moveTutorsCompatibilityMod) {
+ this.moveTutorsCompatibilityMod = moveTutorsCompatibilityMod;
}
public InGameTradesMod getInGameTradesMod() {
return inGameTradesMod;
}
- public Settings setInGameTradesMod(InGameTradesMod inGameTradesMod) {
- this.inGameTradesMod = inGameTradesMod;
- return this;
+ public void setInGameTradesMod(boolean... bools) {
+ setInGameTradesMod(getEnum(InGameTradesMod.class, bools));
}
- public Settings setInGameTradesMod(boolean... bools) {
- return setInGameTradesMod(getEnum(InGameTradesMod.class, bools));
+ private void setInGameTradesMod(InGameTradesMod inGameTradesMod) {
+ this.inGameTradesMod = inGameTradesMod;
}
public boolean isRandomizeInGameTradesNicknames() {
return randomizeInGameTradesNicknames;
}
- public Settings setRandomizeInGameTradesNicknames(boolean randomizeInGameTradesNicknames) {
+ public void setRandomizeInGameTradesNicknames(boolean randomizeInGameTradesNicknames) {
this.randomizeInGameTradesNicknames = randomizeInGameTradesNicknames;
- return this;
}
public boolean isRandomizeInGameTradesOTs() {
return randomizeInGameTradesOTs;
}
- public Settings setRandomizeInGameTradesOTs(boolean randomizeInGameTradesOTs) {
+ public void setRandomizeInGameTradesOTs(boolean randomizeInGameTradesOTs) {
this.randomizeInGameTradesOTs = randomizeInGameTradesOTs;
- return this;
}
public boolean isRandomizeInGameTradesIVs() {
return randomizeInGameTradesIVs;
}
- public Settings setRandomizeInGameTradesIVs(boolean randomizeInGameTradesIVs) {
+ public void setRandomizeInGameTradesIVs(boolean randomizeInGameTradesIVs) {
this.randomizeInGameTradesIVs = randomizeInGameTradesIVs;
- return this;
}
public boolean isRandomizeInGameTradesItems() {
return randomizeInGameTradesItems;
}
- public Settings setRandomizeInGameTradesItems(boolean randomizeInGameTradesItems) {
+ public void setRandomizeInGameTradesItems(boolean randomizeInGameTradesItems) {
this.randomizeInGameTradesItems = randomizeInGameTradesItems;
- return this;
}
public FieldItemsMod getFieldItemsMod() {
return fieldItemsMod;
}
- public Settings setFieldItemsMod(FieldItemsMod fieldItemsMod) {
- this.fieldItemsMod = fieldItemsMod;
- return this;
+ public void setFieldItemsMod(boolean... bools) {
+ setFieldItemsMod(getEnum(FieldItemsMod.class, bools));
}
- public Settings setFieldItemsMod(boolean... bools) {
- return setFieldItemsMod(getEnum(FieldItemsMod.class, bools));
+ private void setFieldItemsMod(FieldItemsMod fieldItemsMod) {
+ this.fieldItemsMod = fieldItemsMod;
}
public boolean isBanBadRandomFieldItems() {
@@ -1692,66 +1607,60 @@ public class Settings { }
- public Settings setBanBadRandomFieldItems(boolean banBadRandomFieldItems) {
+ public void setBanBadRandomFieldItems(boolean banBadRandomFieldItems) {
this.banBadRandomFieldItems = banBadRandomFieldItems;
- return this;
}
public ShopItemsMod getShopItemsMod() {
return shopItemsMod;
}
- public Settings setShopItemsMod(ShopItemsMod shopItemsMod) {
- this.shopItemsMod = shopItemsMod;
- return this;
+ public void setShopItemsMod(boolean... bools) {
+ setShopItemsMod(getEnum(ShopItemsMod.class, bools));
}
- public Settings setShopItemsMod(boolean... bools) {
- return setShopItemsMod(getEnum(ShopItemsMod.class, bools));
+ private void setShopItemsMod(ShopItemsMod shopItemsMod) {
+ this.shopItemsMod = shopItemsMod;
}
public boolean isBanBadRandomShopItems() {
return banBadRandomShopItems;
}
- public Settings setBanBadRandomShopItems(boolean banBadRandomShopItems) {
+ public void setBanBadRandomShopItems(boolean banBadRandomShopItems) {
this.banBadRandomShopItems = banBadRandomShopItems;
- return this;
}
public boolean isBanRegularShopItems() {
return banRegularShopItems;
}
- public Settings setBanRegularShopItems(boolean banRegularShopItems) {
+ public void setBanRegularShopItems(boolean banRegularShopItems) {
this.banRegularShopItems = banRegularShopItems;
- return this;
}
public boolean isBanOPShopItems() {
return banOPShopItems;
}
- public Settings setBanOPShopItems(boolean banOPShopItems) {
+ public void setBanOPShopItems(boolean banOPShopItems) {
this.banOPShopItems = banOPShopItems;
- return this;
}
public boolean isBalanceShopPrices() {
return balanceShopPrices;
}
- public Settings setBalanceShopPrices(boolean balanceShopPrices) {
+ public void setBalanceShopPrices(boolean balanceShopPrices) {
this.balanceShopPrices = balanceShopPrices;
- return this;
}
public boolean isGuaranteeEvolutionItems() {
return guaranteeEvolutionItems;
}
- public Settings setGuaranteeEvolutionItems(boolean guaranteeEvolutionItems) {
+
+ public void setGuaranteeEvolutionItems(boolean guaranteeEvolutionItems) {
this.guaranteeEvolutionItems = guaranteeEvolutionItems;
- return this;
}
private static int makeByteSelected(boolean... bools) {
@@ -1787,7 +1696,7 @@ public class Settings { out.write((value >> 8) & 0xFF);
}
- public static <E extends Enum<E>> E restoreEnum(Class<E> clazz, byte b, int... indices) {
+ private static <E extends Enum<E>> E restoreEnum(Class<E> clazz, byte b, int... indices) {
boolean[] bools = new boolean[indices.length];
int i = 0;
for (int idx : indices) {
@@ -1798,7 +1707,7 @@ public class Settings { }
@SuppressWarnings("unchecked")
- public static <E extends Enum<E>> E getEnum(Class<E> clazz, boolean... bools) {
+ private static <E extends Enum<E>> E getEnum(Class<E> clazz, boolean... bools) {
int index = getSetEnum(clazz.getSimpleName(), bools);
try {
return ((E[]) clazz.getMethod("values").invoke(null))[index];
diff --git a/src/com/dabomstew/pkrandom/Utils.java b/src/com/dabomstew/pkrandom/Utils.java index 1825802..616917e 100644 --- a/src/com/dabomstew/pkrandom/Utils.java +++ b/src/com/dabomstew/pkrandom/Utils.java @@ -88,7 +88,7 @@ public class Utils { } public static void validatePresetSupplementFiles(String config, CustomNamesSet customNames) - throws UnsupportedEncodingException, InvalidSupplementFilesException { + throws InvalidSupplementFilesException { byte[] data = DatatypeConverter.parseBase64Binary(config); if (data.length < Settings.LENGTH_OF_SETTINGS_DATA + 9) { @@ -116,8 +116,7 @@ public class Utils { public static File getExecutionLocation() throws UnsupportedEncodingException { URL location = RandomizerGUI.class.getProtectionDomain().getCodeSource().getLocation(); - File fh = new File(java.net.URLDecoder.decode(location.getFile(), "UTF-8")); - return fh; + return new File(java.net.URLDecoder.decode(location.getFile(), "UTF-8")); } public static class InvalidROMException extends Exception { diff --git a/src/com/dabomstew/pkrandom/newnds/NARCArchive.java b/src/com/dabomstew/pkrandom/newnds/NARCArchive.java index 9b92f72..8a029d1 100644 --- a/src/com/dabomstew/pkrandom/newnds/NARCArchive.java +++ b/src/com/dabomstew/pkrandom/newnds/NARCArchive.java @@ -8,10 +8,10 @@ import java.util.TreeMap; public class NARCArchive { - public List<String> filenames = new ArrayList<String>(); - public List<byte[]> files = new ArrayList<byte[]>(); + private List<String> filenames = new ArrayList<>(); + public List<byte[]> files = new ArrayList<>(); - public boolean hasFilenames = false; + private boolean hasFilenames = false; public NARCArchive() { // creates a new empty NARC with no filenames by default @@ -155,7 +155,7 @@ public class NARCArchive { // each frame int offset = 0x10; - Map<String, byte[]> frames = new TreeMap<String, byte[]>(); + Map<String, byte[]> frames = new TreeMap<>(); for (int i = 0; i < frameCount; i++) { byte[] magic = new byte[] { data[offset + 3], data[offset + 2], data[offset + 1], data[offset] }; String magicS = new String(magic, "US-ASCII"); diff --git a/src/com/dabomstew/pkrandom/newnds/NDSFile.java b/src/com/dabomstew/pkrandom/newnds/NDSFile.java index dace672..4442554 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSFile.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSFile.java @@ -34,8 +34,8 @@ public class NDSFile { public int offset, size; public int fileID; public String fullPath; - public Extracted status = Extracted.NOT; - public String extFilename; + private Extracted status = Extracted.NOT; + private String extFilename; public byte[] data; public NDSFile(NDSRom parent) { @@ -53,8 +53,7 @@ public class NDSFile { if (parent.isWritingEnabled()) { // make a file String tmpDir = parent.getTmpFolder(); - String tmpFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); - this.extFilename = tmpFilename; + this.extFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); File tmpFile = new File(tmpDir + extFilename); FileOutputStream fos = new FileOutputStream(tmpFile); fos.write(buf); @@ -76,8 +75,7 @@ public class NDSFile { return newcopy; } else { String tmpDir = parent.getTmpFolder(); - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); } } @@ -113,7 +111,7 @@ public class NDSFile { } private enum Extracted { - NOT, TO_FILE, TO_RAM; + NOT, TO_FILE, TO_RAM } } diff --git a/src/com/dabomstew/pkrandom/newnds/NDSRom.java b/src/com/dabomstew/pkrandom/newnds/NDSRom.java index c0fe637..d0951c9 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSRom.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSRom.java @@ -117,11 +117,11 @@ public class NDSRom { fat = new byte[fatSize]; baseRom.readFully(fat); - Map<Integer, String> directoryPaths = new HashMap<Integer, String>(); + Map<Integer, String> directoryPaths = new HashMap<>(); directoryPaths.put(0xF000, ""); int dircount = readFromFile(baseRom, fntOffset + 0x6, 2); - files = new HashMap<String, NDSFile>(); - filesByID = new HashMap<Integer, NDSFile>(); + files = new HashMap<>(); + filesByID = new HashMap<>(); // read fnt table baseRom.seek(fntOffset); @@ -136,8 +136,8 @@ public class NDSRom { // get dirnames String[] directoryNames = new String[dircount]; - Map<Integer, String> filenames = new TreeMap<Integer, String>(); - Map<Integer, Integer> fileDirectories = new HashMap<Integer, Integer>(); + Map<Integer, String> filenames = new TreeMap<>(); + Map<Integer, Integer> fileDirectories = new HashMap<>(); for (int i = 0; i < dircount && i < 0x1000; i++) { firstPassDirectory(i, subTableOffsets[i], firstFileIDs[i], directoryNames, filenames, fileDirectories); } @@ -146,13 +146,13 @@ public class NDSRom { for (int i = 1; i < dircount && i < 0x1000; i++) { String dirname = directoryNames[i]; if (dirname != null) { - String fullDirName = ""; + StringBuilder fullDirName = new StringBuilder(); int curDir = i; while (dirname != null && !dirname.isEmpty()) { - if (!fullDirName.isEmpty()) { - fullDirName = "/" + fullDirName; + if (fullDirName.length() > 0) { + fullDirName.insert(0, "/"); } - fullDirName = dirname + fullDirName; + fullDirName.insert(0, dirname); int parentDir = parentDirIDs[curDir]; if (parentDir >= 0xF001 && parentDir <= 0xFFFF) { curDir = parentDir - 0xF000; @@ -161,7 +161,7 @@ public class NDSRom { break; } } - directoryPaths.put(i + 0xF000, fullDirName); + directoryPaths.put(i + 0xF000, fullDirName.toString()); } else { directoryPaths.put(i + 0xF000, ""); } @@ -193,7 +193,7 @@ public class NDSRom { int arm9_ovl_count = arm9_ovl_table_size / 32; byte[] y9table = new byte[arm9_ovl_table_size]; arm9overlays = new NDSY9Entry[arm9_ovl_count]; - arm9overlaysByFileID = new HashMap<Integer, NDSY9Entry>(); + arm9overlaysByFileID = new HashMap<>(); baseRom.seek(arm9_ovl_table_offset); baseRom.readFully(y9table); @@ -267,7 +267,7 @@ public class NDSRom { // don't actually write arm9 ovl yet // arm7 - int arm7_offset = ((int) (arm9_ovl_offset + arm9_ovl_size + arm7_align)) & (~arm7_align); + int arm7_offset = arm9_ovl_offset + arm9_ovl_size + arm7_align & (~arm7_align); int old_arm7_offset = readFromFile(this.baseRom, 0x30, 4); int arm7_size = readFromFile(this.baseRom, 0x3C, 4); // copy arm7 @@ -436,7 +436,6 @@ public class NDSRom { to.write(copybuf, 0, read); bytes -= read; } - copybuf = null; } // get rom code for opened rom @@ -526,7 +525,6 @@ public class NDSRom { if (foundOffsets2.size() == 1) { arm9_szmode = 2; arm9_szoffset = foundOffsets2.get(0); - } else { } } } @@ -553,8 +551,7 @@ public class NDSRom { } } else { if (writingEnabled) { - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpFolder + "arm9.bin"); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpFolder + "arm9.bin"); } else { byte[] newcopy = new byte[this.arm9_ramstored.length]; System.arraycopy(this.arm9_ramstored, 0, newcopy, 0, this.arm9_ramstored.length); @@ -638,7 +635,7 @@ public class NDSRom { return writingEnabled; } - public int readFromByteArr(byte[] data, int offset, int size) { + private int readFromByteArr(byte[] data, int offset, int size) { int result = 0; for (int i = 0; i < size; i++) { result |= (data[i + offset] & 0xFF) << (i * 8); @@ -646,19 +643,19 @@ public class NDSRom { return result; } - public void writeToByteArr(byte[] data, int offset, int size, int value) { + private void writeToByteArr(byte[] data, int offset, int size, int value) { for (int i = 0; i < size; i++) { data[offset + i] = (byte) ((value >> (i * 8)) & 0xFF); } } - public int readFromFile(RandomAccessFile file, int size) throws IOException { + private int readFromFile(RandomAccessFile file, int size) throws IOException { return readFromFile(file, -1, size); } // use -1 offset to read from current position // useful if you want to read blocks - public int readFromFile(RandomAccessFile file, int offset, int size) throws IOException { + private int readFromFile(RandomAccessFile file, int offset, int size) throws IOException { byte[] buf = new byte[size]; if (offset >= 0) file.seek(offset); @@ -674,7 +671,7 @@ public class NDSRom { writeToFile(file, -1, size, value); } - public void writeToFile(RandomAccessFile file, int offset, int size, int value) throws IOException { + private void writeToFile(RandomAccessFile file, int offset, int size, int value) throws IOException { byte[] buf = new byte[size]; for (int i = 0; i < size; i++) { buf[i] = (byte) ((value >> (i * 8)) & 0xFF); diff --git a/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java b/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java index a307ac8..07d8963 100755 --- a/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java +++ b/src/com/dabomstew/pkrandom/newnds/NDSY9Entry.java @@ -41,8 +41,8 @@ public class NDSY9Entry { public int static_start, static_end; public int compressed_size; public int compress_flag; - public Extracted status = Extracted.NOT; - public String extFilename; + private Extracted status = Extracted.NOT; + private String extFilename; public byte[] data; private boolean decompressed_data = false; @@ -67,8 +67,7 @@ public class NDSY9Entry { // make a file String tmpDir = parent.getTmpFolder(); String fullPath = String.format("overlay_%04d", overlay_id); - String tmpFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); - this.extFilename = tmpFilename; + this.extFilename = fullPath.replaceAll("[^A-Za-z0-9_]+", ""); File tmpFile = new File(tmpDir + extFilename); FileOutputStream fos = new FileOutputStream(tmpFile); fos.write(buf); @@ -90,8 +89,7 @@ public class NDSY9Entry { return newcopy; } else { String tmpDir = parent.getTmpFolder(); - byte[] file = FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); - return file; + return FileFunctions.readFileFullyIntoBuffer(tmpDir + this.extFilename); } } @@ -134,7 +132,7 @@ public class NDSY9Entry { } private enum Extracted { - NOT, TO_FILE, TO_RAM; + NOT, TO_FILE, TO_RAM } } diff --git a/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java b/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java index 7e57616..12dd011 100755 --- a/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java +++ b/src/com/dabomstew/pkrandom/pokemon/EncounterSet.java @@ -31,8 +31,8 @@ import java.util.Set; public class EncounterSet { public int rate; - public List<Encounter> encounters = new ArrayList<Encounter>(); - public Set<Pokemon> bannedPokemon = new HashSet<Pokemon>(); + public List<Encounter> encounters = new ArrayList<>(); + public Set<Pokemon> bannedPokemon = new HashSet<>(); public String displayName; public int offset; diff --git a/src/com/dabomstew/pkrandom/pokemon/Evolution.java b/src/com/dabomstew/pkrandom/pokemon/Evolution.java index 5f54f6d..f913e4a 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Evolution.java +++ b/src/com/dabomstew/pkrandom/pokemon/Evolution.java @@ -58,13 +58,7 @@ public class Evolution implements Comparable<Evolution> { if (getClass() != obj.getClass()) return false; Evolution other = (Evolution) obj; - if (from != other.from) - return false; - if (to != other.to) - return false; - if (type != other.type) - return false; - return true; + return from == other.from && to == other.to && type == other.type; } @Override @@ -77,13 +71,7 @@ public class Evolution implements Comparable<Evolution> { return -1; } else if (this.to.number > o.to.number) { return 1; - } else if (this.type.ordinal() < o.type.ordinal()) { - return -1; - } else if (this.type.ordinal() > o.type.ordinal()) { - return 1; - } else { - return 0; - } + } else return Integer.compare(this.type.ordinal(), o.type.ordinal()); } } diff --git a/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java b/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java index 3ddf21b..039143f 100755 --- a/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java +++ b/src/com/dabomstew/pkrandom/pokemon/EvolutionType.java @@ -45,7 +45,7 @@ public enum EvolutionType { } } - private EvolutionType(int... indexes) { + EvolutionType(int... indexes) { this.indexNumbers = indexes; } diff --git a/src/com/dabomstew/pkrandom/pokemon/ItemList.java b/src/com/dabomstew/pkrandom/pokemon/ItemList.java index 6ae7dc8..636c677 100755 --- a/src/com/dabomstew/pkrandom/pokemon/ItemList.java +++ b/src/com/dabomstew/pkrandom/pokemon/ItemList.java @@ -16,17 +16,11 @@ public class ItemList { } public boolean isTM(int index) { - if (index < 0 || index >= tms.length) { - return false; - } - return tms[index]; + return index >= 0 && index < tms.length && tms[index]; } public boolean isAllowed(int index) { - if (index < 0 || index >= tms.length) { - return false; - } - return items[index]; + return index >= 0 && index < tms.length && items[index]; } public void banSingles(int... indexes) { diff --git a/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java b/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java index 9035409..70d42bf 100644 --- a/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java +++ b/src/com/dabomstew/pkrandom/pokemon/MoveCategory.java @@ -24,5 +24,5 @@ package com.dabomstew.pkrandom.pokemon; /*----------------------------------------------------------------------------*/ public enum MoveCategory { - PHYSICAL, SPECIAL, STATUS; + PHYSICAL, SPECIAL, STATUS } diff --git a/src/com/dabomstew/pkrandom/pokemon/Pokemon.java b/src/com/dabomstew/pkrandom/pokemon/Pokemon.java index 7b81e21..cc7fb36 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Pokemon.java +++ b/src/com/dabomstew/pkrandom/pokemon/Pokemon.java @@ -55,10 +55,10 @@ public class Pokemon implements Comparable<Pokemon> { public ExpCurve growthCurve; - public List<Evolution> evolutionsFrom = new ArrayList<Evolution>(); - public List<Evolution> evolutionsTo = new ArrayList<Evolution>(); + public List<Evolution> evolutionsFrom = new ArrayList<>(); + public List<Evolution> evolutionsTo = new ArrayList<>(); - public List<Integer> shuffledStatsOrder = null; + private 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. @@ -159,7 +159,7 @@ public class Pokemon implements Comparable<Pokemon> { special = (int) Math.ceil((spatk + spdef) / 2.0f); } - public int bst() { + private int bst() { return hp + attack + defense + spatk + spdef + speed; } @@ -206,9 +206,7 @@ public class Pokemon implements Comparable<Pokemon> { if (getClass() != obj.getClass()) return false; Pokemon other = (Pokemon) obj; - if (number != other.number) - return false; - return true; + return number == other.number; } @Override diff --git a/src/com/dabomstew/pkrandom/pokemon/Trainer.java b/src/com/dabomstew/pkrandom/pokemon/Trainer.java index 0fedbbf..6f6df33 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Trainer.java +++ b/src/com/dabomstew/pkrandom/pokemon/Trainer.java @@ -28,7 +28,7 @@ import java.util.List; public class Trainer implements Comparable<Trainer> { public int offset; - public List<TrainerPokemon> pokemon = new ArrayList<TrainerPokemon>(); + public List<TrainerPokemon> pokemon = new ArrayList<>(); public String tag; public boolean importantTrainer; public int poketype; @@ -39,12 +39,12 @@ public class Trainer implements Comparable<Trainer> { public String toString() { StringBuilder sb = new StringBuilder("["); if (fullDisplayName != null) { - sb.append(fullDisplayName + " "); + sb.append(fullDisplayName).append(" "); } else if (name != null) { - sb.append(name + " "); + sb.append(name).append(" "); } if (trainerclass != 0) { - sb.append("(" + trainerclass + ") - "); + sb.append("(").append(trainerclass).append(") - "); } sb.append(String.format("%x", offset)); sb.append(" => "); @@ -53,12 +53,12 @@ public class Trainer implements Comparable<Trainer> { if (!first) { sb.append(','); } - sb.append(p.pokemon.name + " Lv" + p.level); + sb.append(p.pokemon.name).append(" Lv").append(p.level); first = false; } sb.append(']'); if (tag != null) { - sb.append(" (" + tag + ")"); + sb.append(" (").append(tag).append(")"); } return sb.toString(); } @@ -80,9 +80,7 @@ public class Trainer implements Comparable<Trainer> { if (getClass() != obj.getClass()) return false; Trainer other = (Trainer) obj; - if (offset != other.offset) - return false; - return true; + return offset == other.offset; } @Override diff --git a/src/com/dabomstew/pkrandom/pokemon/Type.java b/src/com/dabomstew/pkrandom/pokemon/Type.java index 1f244dc..2023db1 100755 --- a/src/com/dabomstew/pkrandom/pokemon/Type.java +++ b/src/com/dabomstew/pkrandom/pokemon/Type.java @@ -37,11 +37,11 @@ public enum Type { public boolean isHackOnly; - private Type() { + Type() { this.isHackOnly = false; } - private Type(boolean isHackOnly) { + Type(boolean isHackOnly) { this.isHackOnly = isHackOnly; } |