package com.sneed.pkrandom.romhandlers;
/*----------------------------------------------------------------------------*/
/*-- RomHandler.java - defines the functionality that each randomization --*/
/*-- handler must implement. --*/
/*-- --*/
/*-- 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 . --*/
/*----------------------------------------------------------------------------*/
import java.awt.image.BufferedImage;
import java.io.PrintStream;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import com.sneed.pkrandom.MiscTweak;
import com.sneed.pkrandom.Settings;
import com.sneed.pkrandom.pokemon.*;
public interface RomHandler {
abstract class Factory {
public RomHandler create(Random random) {
return create(random, null);
}
public abstract RomHandler create(Random random, PrintStream log);
public abstract boolean isLoadable(String filename);
}
// =======================
// Basic load/save methods
// =======================
boolean loadRom(String filename);
boolean saveRomFile(String filename, long seed);
boolean saveRomDirectory(String filename);
String loadedFilename();
// =============================================================
// Methods relating to game updates for the 3DS and Switch games
// =============================================================
boolean hasGameUpdateLoaded();
boolean loadGameUpdate(String filename);
void removeGameUpdate();
String getGameUpdateVersion();
// ===========
// Log methods
// ===========
void setLog(PrintStream logStream);
void printRomDiagnostics(PrintStream logStream);
boolean isRomValid();
// ======================================================
// Methods for retrieving a list of Pokemon objects.
// Note that for many of these lists, index 0 is null.
// Instead, you use index on the species' National Dex ID
// ======================================================
List getPokemon();
List getPokemonInclFormes();
List getAltFormes();
List getMegaEvolutions();
Pokemon getAltFormeOfPokemon(Pokemon pk, int forme);
List getIrregularFormes();
// ==================================
// Methods to set up Gen Restrictions
// ==================================
void setPokemonPool(Settings settings);
void removeEvosForPokemonPool();
// ===============
// Starter Pokemon
// ===============
List getStarters();
boolean setStarters(List newStarters);
boolean hasStarterAltFormes();
int starterCount();
void customStarters(Settings settings);
void randomizeStarters(Settings settings);
void randomizeBasicTwoEvosStarters(Settings settings);
List getPickedStarters();
boolean supportsStarterHeldItems();
List getStarterHeldItems();
void setStarterHeldItems(List items);
void randomizeStarterHeldItems(Settings settings);
// =======================
// Pokemon Base Statistics
// =======================
// Run the stats shuffler on each Pokemon.
void shufflePokemonStats(Settings settings);
// Randomize stats following evolutions for proportions or not (see
// tooltips)
void randomizePokemonStats(Settings settings);
// Update base stats to specified generation
void updatePokemonStats(Settings settings);
Map getUpdatedPokemonStats(int generation);
void standardizeEXPCurves(Settings settings);
// ====================================
// Methods for selecting random Pokemon
// ====================================
// Give a random Pokemon who's in this game
Pokemon randomPokemon();
Pokemon randomPokemonInclFormes();
// Give a random non-legendary Pokemon who's in this game
// Business rules for who's legendary are in Pokemon class
Pokemon randomNonLegendaryPokemon();
// Give a random legendary Pokemon who's in this game
// Business rules for who's legendary are in Pokemon class
Pokemon randomLegendaryPokemon();
// Give a random Pokemon who has 2 evolution stages
// Should make a good starter Pokemon
Pokemon random2EvosPokemon(boolean allowAltFormes);
// =============
// Pokemon Types
// =============
// return a random type valid in this game.
Type randomType();
boolean typeInGame(Type type);
// randomize Pokemon types, with a switch on whether evolutions
// should follow the same types or not.
// some evolutions dont anyway, e.g. Eeveelutions, Hitmons
void randomizePokemonTypes(Settings settings);
// =================
// Pokemon Abilities
// =================
int abilitiesPerPokemon();
int highestAbilityIndex();
String abilityName(int number);
void randomizeAbilities(Settings settings);
Map> getAbilityVariations();
List getUselessAbilities();
int getAbilityForTrainerPokemon(TrainerPokemon tp);
boolean hasMegaEvolutions();
// ============
// Wild Pokemon
// ============
List getEncounters(boolean useTimeOfDay);
void setEncounters(boolean useTimeOfDay, List encounters);
void randomEncounters(Settings settings);
void area1to1Encounters(Settings settings);
void game1to1Encounters(Settings settings);
void onlyChangeWildLevels(Settings settings);
boolean hasTimeBasedEncounters();
boolean hasWildAltFormes();
List bannedForWildEncounters();
void randomizeWildHeldItems(Settings settings);
void changeCatchRates(Settings settings);
void minimumCatchRate(int rateNonLegendary, int rateLegendary);
void enableGuaranteedPokemonCatching();
// ===============
// Trainer Pokemon
// ===============
List getTrainers();
List getMainPlaythroughTrainers();
List getEliteFourTrainers(boolean isChallengeMode);
void setTrainers(List trainerData, boolean doubleBattleMode);
void randomizeTrainerPokes(Settings settings);
void randomizeTrainerHeldItems(Settings settings);
List getSensibleHeldItemsFor(TrainerPokemon tp, boolean consumableOnly, List moves, int[] pokeMoves);
List getAllConsumableHeldItems();
List getAllHeldItems();
void rivalCarriesStarter();
boolean hasRivalFinalBattle();
void forceFullyEvolvedTrainerPokes(Settings settings);
void onlyChangeTrainerLevels(Settings settings);
void addTrainerPokemon(Settings settings);
void doubleBattleMode();
List getMoveSelectionPoolAtLevel(TrainerPokemon tp, boolean cyclicEvolutions);
void pickTrainerMovesets(Settings settings);
// =========
// Move Data
// =========
void randomizeMovePowers();
void randomizeMovePPs();
void randomizeMoveAccuracies();
void randomizeMoveTypes();
boolean hasPhysicalSpecialSplit();
void randomizeMoveCategory();
void updateMoves(Settings settings);
// stuff for printing move changes
void initMoveUpdates();
Map getMoveUpdates();
// return all the moves valid in this game.
List getMoves();
// ================
// Pokemon Movesets
// ================
Map> getMovesLearnt();
void setMovesLearnt(Map> movesets);
List getMovesBannedFromLevelup();
Map> getEggMoves();
void setEggMoves(Map> eggMoves);
void randomizeMovesLearnt(Settings settings);
void randomizeEggMoves(Settings settings);
void orderDamagingMovesByDamage();
void metronomeOnlyMode();
boolean supportsFourStartingMoves();
// ==============
// Static Pokemon
// ==============
List getStaticPokemon();
boolean setStaticPokemon(List staticPokemon);
void randomizeStaticPokemon(Settings settings);
boolean canChangeStaticPokemon();
boolean hasStaticAltFormes();
List bannedForStaticPokemon();
boolean forceSwapStaticMegaEvos();
void onlyChangeStaticLevels(Settings settings);
boolean hasMainGameLegendaries();
List getMainGameLegendaries();
List getSpecialMusicStatics();
void applyCorrectStaticMusic(Map specialMusicStaticChanges);
boolean hasStaticMusicFix();
// =============
// Totem Pokemon
// =============
List getTotemPokemon();
void setTotemPokemon(List totemPokemon);
void randomizeTotemPokemon(Settings settings);
// =========
// TMs & HMs
// =========
List getTMMoves();
List getHMMoves();
void setTMMoves(List moveIndexes);
void randomizeTMMoves(Settings settings);
int getTMCount();
int getHMCount();
/**
* Get TM/HM compatibility data from this rom. The result should contain a
* boolean array for each Pokemon indexed as such:
*
* 0: blank (false) / 1 - (getTMCount()) : TM compatibility /
* (getTMCount()+1) - (getTMCount()+getHMCount()) - HM compatibility
*
* @return Map of TM/HM compatibility
*/
Map getTMHMCompatibility();
void setTMHMCompatibility(Map compatData);
void randomizeTMHMCompatibility(Settings settings);
void fullTMHMCompatibility();
void ensureTMCompatSanity();
void ensureTMEvolutionSanity();
void fullHMCompatibility();
// ===========
// Move Tutors
// ===========
void copyTMCompatibilityToCosmeticFormes();
boolean hasMoveTutors();
List getMoveTutorMoves();
void setMoveTutorMoves(List moves);
void randomizeMoveTutorMoves(Settings settings);
Map getMoveTutorCompatibility();
void setMoveTutorCompatibility(Map compatData);
void randomizeMoveTutorCompatibility(Settings settings);
void fullMoveTutorCompatibility();
void ensureMoveTutorCompatSanity();
void ensureMoveTutorEvolutionSanity();
// =============
// Trainer Names
// =============
void copyMoveTutorCompatibilityToCosmeticFormes();
boolean canChangeTrainerText();
List getTrainerNames();
void setTrainerNames(List trainerNames);
enum TrainerNameMode {
SAME_LENGTH, MAX_LENGTH, MAX_LENGTH_WITH_CLASS
}
TrainerNameMode trainerNameMode();
// Returns this with or without the class
int maxTrainerNameLength();
// Only relevant for gen2, which has fluid trainer name length but
// only a certain amount of space in the ROM bank.
int maxSumOfTrainerNameLengths();
// Only needed if above mode is "MAX LENGTH WITH CLASS"
List getTCNameLengthsByTrainer();
void randomizeTrainerNames(Settings settings);
// ===============
// Trainer Classes
// ===============
List getTrainerClassNames();
void setTrainerClassNames(List trainerClassNames);
boolean fixedTrainerClassNamesLength();
int maxTrainerClassNameLength();
void randomizeTrainerClassNames(Settings settings);
List getDoublesTrainerClasses();
// =====
// Items
// =====
ItemList getAllowedItems();
ItemList getNonBadItems();
List getEvolutionItems();
List getXItems();
List getUniqueNoSellItems();
List getRegularShopItems();
List getOPShopItems();
String[] getItemNames();
// ===========
// Field Items
// ===========
// TMs on the field
List getRequiredFieldTMs();
List getCurrentFieldTMs();
void setFieldTMs(List fieldTMs);
// Everything else
List getRegularFieldItems();
void setRegularFieldItems(List items);
// Randomizer methods
void shuffleFieldItems();
void randomizeFieldItems(Settings settings);
// ============
// Special Shops
// =============
boolean hasShopRandomization();
void shuffleShopItems();
void randomizeShopItems(Settings settings);
Map getShopItems();
void setShopItems(Map shopItems);
void setShopPrices();
// ============
// Pickup Items
// ============
List getPickupItems();
void setPickupItems(List pickupItems);
void randomizePickupItems(Settings settings);
// ==============
// In-Game Trades
// ==============
List getIngameTrades();
void setIngameTrades(List trades);
void randomizeIngameTrades(Settings settings);
boolean hasDVs();
int maxTradeNicknameLength();
int maxTradeOTNameLength();
// ==================
// Pokemon Evolutions
// ==================
void removeImpossibleEvolutions(Settings settings);
void condenseLevelEvolutions(int maxLevel, int maxIntermediateLevel);
void makeEvolutionsEasier(Settings settings);
void removeTimeBasedEvolutions();
Set getImpossibleEvoUpdates();
Set getEasierEvoUpdates();
Set getTimeBasedEvoUpdates();
void randomizeEvolutions(Settings settings);
void randomizeEvolutionsEveryLevel(Settings settings);
// In the earlier games, alt formes use the same evolutions as the base forme.
// In later games, this was changed so that alt formes can have unique evolutions
// compared to the base forme.
boolean altFormesCanHaveDifferentEvolutions();
// ==================================
// (Mostly) unchanging lists of moves
// ==================================
List getGameBreakingMoves();
List getIllegalMoves();
// includes game or gen-specific moves like Secret Power
// but NOT healing moves (Softboiled, Milk Drink)
List getFieldMoves();
// any HMs required to obtain 4 badges
// (excluding Gameshark codes or early drink in RBY)
List getEarlyRequiredHMMoves();
// ====
// Misc
// ====
boolean isYellow();
String getROMName();
String getROMCode();
String getSupportLevel();
String getDefaultExtension();
int internalStringLength(String string);
void randomizeIntroPokemon();
BufferedImage getMascotImage();
int generationOfPokemon();
void writeCheckValueToROM(int value);
// ===========
// code tweaks
// ===========
int miscTweaksAvailable();
void applyMiscTweaks(Settings settings);
void applyMiscTweak(MiscTweak tweak);
boolean isEffectivenessUpdated();
void renderPlacementHistory();
// ==========================
// Misc forme-related methods
// ==========================
boolean hasFunctionalFormes();
List getAbilityDependentFormes();
List getBannedFormesForPlayerPokemon();
List getBannedFormesForTrainerPokemon();
}