pokerogue/src/overrides.ts

160 lines
6.3 KiB
TypeScript
Raw Normal View History

2024-04-30 11:47:53 +01:00
import { WeatherType } from "./data/weather";
import { Variant } from "./data/variant";
import { TempBattleStat } from "./data/temp-battle-stat";
import { Nature } from "./data/nature";
import { Type } from "./data/type";
import { Stat } from "./data/pokemon-stat";
import { PokeballCounts } from "./battle-scene";
import { PokeballType } from "./data/pokeball";
2024-05-28 04:59:01 +01:00
import { Gender } from "./data/gender";
2024-05-30 17:49:57 +01:00
import { StatusEffect } from "./data/status-effect";
import { SpeciesStatBoosterItem, modifierTypes } from "./modifier/modifier-type";
[Feature] [Same species Egg] Egg class rewrite to enable fully parameterized eggs to generate same species eggs + Egg overrides (#1833) * Create variant-tiers enum * Added variant tier override property to the egg class * Added hasVariants function to pokemon species * Implement variant override logic to egg hatching phase * Delete src/enums/variant-tiers * Create variant-tiers enum * Added egg shiny and variant overrides * fixed egg comment in overrides.ts * Added override logic to egg hatch phase * Added species pool filter logic when global override is set * Added global egg tier override logic * Added global egg tier override * Added global gacha pull count override logic * Added global gacha pull count override * Renamed egg hatch override * Renamed egg hatch override * Added gacha pull without voucher global override * Renamed free gacha pull global override * Added free gacha pull override logic * Gacha pull count override name fix * Bugfix * restored defaults + savegame bugfix * eggOptions added to parameterize eggs. Added option to buy eggs of the same species. * Small Bugfix for same species egg generation * Removed translation from translator * Improved the isManaphyEgg() check * Fixed manaphy egg hatch wave count * Added comments to IEggOptions * Added eggOptions for hidden ability and rare egg move override * Merge Fix: Update egg-hatch-phase.ts * Fixed manaphy rates back to 1/256 like in PR #2182 * Renamed override, same species egg unlocks after passive is bought. Added code as comment for custom shiny, HA and rare egg move rates. * Merge fix. Moved enums. * quick fix for the commented out code * Fixed that you can't buy an egg over the 99 egg limit * Fix that you can't buy eternatus * Use already existing randSeedShuffle instead of my own function * Eternatus buyable again. Changed overrides to be able to set common tier/variants. Moved getGuaranteedEggTierFromPullCount(). * Changed eggOption gachaType to sourceType. Replaced eggOption overrideRareEggMove with eggMoveIndex to exatly specify an egg move. Moved egg move unlock logic into the egg class. Simplified shiny calculation. Added same species egg type descriptor. Moved custom rates for same species egg code into egg.ts. * Added 19 unit tests for eggs * Changed unit test description * Added higher rates for same species eggs * Adjusted same species egg cost for 1-3 cost starters and HA rates * Added legacy egg loading unit test. Fixed gachaType legacy value loaded from DB and legacy tier loading * Legacy egg loading from server DB fixed
2024-06-22 01:19:56 +01:00
import { VariantTier } from "./enums/variant-tiers";
import { EggTier } from "#enums/egg-type";
import { allSpecies } from "./data/pokemon-species"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { Abilities } from "#enums/abilities";
import { BerryType } from "#enums/berry-type";
import { Biome } from "#enums/biome";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { TimeOfDay } from "#enums/time-of-day";
import {MysteryEncounterType} from "#enums/mystery-encounter-type"; // eslint-disable-line @typescript-eslint/no-unused-vars
import {MysteryEncounterTier} from "#app/data/mystery-encounter"; // eslint-disable-line @typescript-eslint/no-unused-vars
2024-04-30 11:47:53 +01:00
/**
* Overrides for testing different in game situations
* if an override name starts with "STARTING", it will apply when a new run begins
*/
/**
* OVERALL OVERRIDES
*/
// a specific seed (default: a random string of 24 characters)
export const SEED_OVERRIDE: string = "";
export const WEATHER_OVERRIDE: WeatherType = WeatherType.NONE;
export const DOUBLE_BATTLE_OVERRIDE: boolean = false;
[Testing] Flexible Testing Wrapper for Phaser-Based Battle-Scenes (#1908) * refactor executed code while importing and initializing all of these in loading-scene * reset to main * fix server url * added rule no-trailing-spaces * made progress * test somme data from a session save is working * trying to launch a battle * added fetch wrapper to load data locally * trying to mockAllSettled * pushPhase & shiftPhase * check integrity of exported session * set toke + loggedInUser in tests * progress on starting new battle * tring to test phase but it's async * mocking fetch * working mock fetch * need to handle pile of data * attempt to use real phaser classes * reorder overrides * refactored to use some real classes from phaser * removed useless things * started to work on some container mock * finished the mockContainer time to add some logic * some more mock containers * removed addMethods since there is the mock classes now * commented issues * attempt to create mockTextureManager * fix tests * mockSprite & mockText * yes but not really * yes but not really * fix tutorial callback * reached mode title * added achievement tests * fix test achievements with current state of mock * correct sequence loading for BattleScene with mockLoader ! * deep dive into next step * working wait until starter selection screen * added newGame method into wrapper * expect to save_slot * trying to manage pokemon sprite for getAll without success yet * added test for egg output * fixed egg test for June * fix tests + locate next issue to fix * we are in battle baby * added new game in one-line * export is working but export only what's in the fetch * fix start game as guest * refactored how we start a battle + cleanup * overrided mewtwo but issue with currentBattle * refactor: rename InitAchievements to initAchievements * added missing mock method * override level and pokemon forms working as intended * bringToTop Obj * remove launch battle in achivement test * fix getIndex when same pokemon * can run all tests * first attack, faint, and shop modifiers, MockClock * on method for container * added doAttack one-liner * one-line export data * removed throw error * feat: Make `scenes` property of `GameWrapper` class public The `scenes` property of the `GameWrapper` class was changed from private to public. This change allows external access to the `scenes` map, which is used to store Phaser scenes. This modification was made to enable easier manipulation and interaction with the scenes in the game. * correction * removed CanvasRenderer * added a param to remove console.log and added a param to preven scene create call * fix encounter wave 30 when it's a trainer * test double-battle * test fight without KO * test double fight no ko * fix crashing texture + added Text wrapper to log fight * fix tests on boss - trainer - rival * chore: Refactor BattleScene initialization and add new phases Refactor the BattleScene initialization code to remove unnecessary delay and improve performance. Also, add new phases for the title and unavailable states to enhance the game experience. * rework of Game tests * skipFn is working * added onNextPrompt and restore Og Start * better newGame * added skipFN in remove * not yet working test but updated interceptors * do attack work but not on PostSummonPhase phase when there is mention of silcoon and wurmple * error located, it's just a double fight, i was not there yet * single OHKO & double no OHKO * added expirationFn into next prompt * all tests are passing * working test on non damaging move from opponent * cleaned a bit * removed phaser initialisation on every tests * renamed test file * added load system data * added some ability support * added onKill & onSummon abilities test * removed useless test + cleanup * removed useless test + cleanup * fixed tests after merge main * added itemHeld endTurn trigger test (toxic orb) * added runFrom..To * added mustRun to assert currentPhase * added no-miss move to test things * cleaner restore mock * fix test * fix moxie test + game speed * improve test speed * added onOurself and onOpponent mvoe test * added onDamage test for tackle * removed timeout in intervals to run tests faster * cleanup * added never crit override + separate file per test + remove randomness in randBattleSeedInt * move folders * better org * renamed itemHeld folder to items * fix deploy.yml * cleanup * simplified the gameManager start battle and allow single pokemon in party * remove the need of mode development * added input handler to test inputs + remove time from phaser into inputController * added keyboard support * added fakeMobile support * added details * removed a console.log + added logUp * move test to folder * fixed canvas issue * added starter select tests * added some more test on starter-select * added battle-order tests * added battle-order tests * fixing Phaser RNG * ordering stats for better reading * fix tests for main * adapt battle-order test to be more readable * fix merge * fix some errors and silent all errors from gameWrapper since it's not possible to avoid them * fix mocks to manage childs & stuffs * added some docs * fix achievement test * removed an unused file * separate misc tests to clean battle.test file * added a basic french lokalization test * added i18n where it needs to be used only * revers extracted method * removed unused method * removed handler fetch since we do not test anything server related * fix test with handlers removed * added intrepid sword test * fix enum exp party --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-06-07 23:33:45 +01:00
export const SINGLE_BATTLE_OVERRIDE: boolean = false;
export const STARTING_WAVE_OVERRIDE: integer = 0;
export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
export const ARENA_TINT_OVERRIDE: TimeOfDay = null;
// Multiplies XP gained by this value including 0. Set to null to ignore the override
export const XP_MULTIPLIER_OVERRIDE: number = null;
// default 1000
export const STARTING_MONEY_OVERRIDE: integer = 0;
[Feature] [Same species Egg] Egg class rewrite to enable fully parameterized eggs to generate same species eggs + Egg overrides (#1833) * Create variant-tiers enum * Added variant tier override property to the egg class * Added hasVariants function to pokemon species * Implement variant override logic to egg hatching phase * Delete src/enums/variant-tiers * Create variant-tiers enum * Added egg shiny and variant overrides * fixed egg comment in overrides.ts * Added override logic to egg hatch phase * Added species pool filter logic when global override is set * Added global egg tier override logic * Added global egg tier override * Added global gacha pull count override logic * Added global gacha pull count override * Renamed egg hatch override * Renamed egg hatch override * Added gacha pull without voucher global override * Renamed free gacha pull global override * Added free gacha pull override logic * Gacha pull count override name fix * Bugfix * restored defaults + savegame bugfix * eggOptions added to parameterize eggs. Added option to buy eggs of the same species. * Small Bugfix for same species egg generation * Removed translation from translator * Improved the isManaphyEgg() check * Fixed manaphy egg hatch wave count * Added comments to IEggOptions * Added eggOptions for hidden ability and rare egg move override * Merge Fix: Update egg-hatch-phase.ts * Fixed manaphy rates back to 1/256 like in PR #2182 * Renamed override, same species egg unlocks after passive is bought. Added code as comment for custom shiny, HA and rare egg move rates. * Merge fix. Moved enums. * quick fix for the commented out code * Fixed that you can't buy an egg over the 99 egg limit * Fix that you can't buy eternatus * Use already existing randSeedShuffle instead of my own function * Eternatus buyable again. Changed overrides to be able to set common tier/variants. Moved getGuaranteedEggTierFromPullCount(). * Changed eggOption gachaType to sourceType. Replaced eggOption overrideRareEggMove with eggMoveIndex to exatly specify an egg move. Moved egg move unlock logic into the egg class. Simplified shiny calculation. Added same species egg type descriptor. Moved custom rates for same species egg code into egg.ts. * Added 19 unit tests for eggs * Changed unit test description * Added higher rates for same species eggs * Adjusted same species egg cost for 1-3 cost starters and HA rates * Added legacy egg loading unit test. Fixed gachaType legacy value loaded from DB and legacy tier loading * Legacy egg loading from server DB fixed
2024-06-22 01:19:56 +01:00
export const FREE_CANDY_UPGRADE_OVERRIDE: boolean = false;
2024-05-13 09:40:53 +01:00
export const POKEBALL_OVERRIDE: { active: boolean, pokeballs: PokeballCounts } = {
active: false,
pokeballs: {
[PokeballType.POKEBALL]: 5,
[PokeballType.GREAT_BALL]: 0,
[PokeballType.ULTRA_BALL]: 0,
[PokeballType.ROGUE_BALL]: 0,
[PokeballType.MASTER_BALL]: 0,
}
};
/**
* PLAYER OVERRIDES
*/
/**
* Set the form index of any starter in the party whose `speciesId` is inside this override
* @see {@link allSpecies} in `src/data/pokemon-species.ts` for form indexes
* @example
* ```
* const STARTER_FORM_OVERRIDES = {
* [Species.DARMANITAN]: 1
* }
* ```
*/
export const STARTER_FORM_OVERRIDES: Partial<Record<Species, number>> = {};
// default 5 or 20 for Daily
export const STARTING_LEVEL_OVERRIDE: integer = 0;
/**
* SPECIES OVERRIDE
* will only apply to the first starter in your party or each enemy pokemon
* default is 0 to not override
* @example SPECIES_OVERRIDE = Species.Bulbasaur;
*/
export const STARTER_SPECIES_OVERRIDE: Species | integer = 0;
export const ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
export const GENDER_OVERRIDE: Gender = null;
export const MOVESET_OVERRIDE: Array<Moves> = [];
export const SHINY_OVERRIDE: boolean = false;
export const VARIANT_OVERRIDE: Variant = 0;
/**
* OPPONENT / ENEMY OVERRIDES
*/
2024-05-16 23:19:32 +01:00
export const OPP_SPECIES_OVERRIDE: Species | integer = 0;
export const OPP_LEVEL_OVERRIDE: number = 0;
export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
2024-05-30 17:49:57 +01:00
export const OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
export const OPP_GENDER_OVERRIDE: Gender = null;
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
export const OPP_SHINY_OVERRIDE: boolean = false;
export const OPP_VARIANT_OVERRIDE: Variant = 0;
export const OPP_IVS_OVERRIDE: integer | integer[] = [];
[Feature] [Same species Egg] Egg class rewrite to enable fully parameterized eggs to generate same species eggs + Egg overrides (#1833) * Create variant-tiers enum * Added variant tier override property to the egg class * Added hasVariants function to pokemon species * Implement variant override logic to egg hatching phase * Delete src/enums/variant-tiers * Create variant-tiers enum * Added egg shiny and variant overrides * fixed egg comment in overrides.ts * Added override logic to egg hatch phase * Added species pool filter logic when global override is set * Added global egg tier override logic * Added global egg tier override * Added global gacha pull count override logic * Added global gacha pull count override * Renamed egg hatch override * Renamed egg hatch override * Added gacha pull without voucher global override * Renamed free gacha pull global override * Added free gacha pull override logic * Gacha pull count override name fix * Bugfix * restored defaults + savegame bugfix * eggOptions added to parameterize eggs. Added option to buy eggs of the same species. * Small Bugfix for same species egg generation * Removed translation from translator * Improved the isManaphyEgg() check * Fixed manaphy egg hatch wave count * Added comments to IEggOptions * Added eggOptions for hidden ability and rare egg move override * Merge Fix: Update egg-hatch-phase.ts * Fixed manaphy rates back to 1/256 like in PR #2182 * Renamed override, same species egg unlocks after passive is bought. Added code as comment for custom shiny, HA and rare egg move rates. * Merge fix. Moved enums. * quick fix for the commented out code * Fixed that you can't buy an egg over the 99 egg limit * Fix that you can't buy eternatus * Use already existing randSeedShuffle instead of my own function * Eternatus buyable again. Changed overrides to be able to set common tier/variants. Moved getGuaranteedEggTierFromPullCount(). * Changed eggOption gachaType to sourceType. Replaced eggOption overrideRareEggMove with eggMoveIndex to exatly specify an egg move. Moved egg move unlock logic into the egg class. Simplified shiny calculation. Added same species egg type descriptor. Moved custom rates for same species egg code into egg.ts. * Added 19 unit tests for eggs * Changed unit test description * Added higher rates for same species eggs * Adjusted same species egg cost for 1-3 cost starters and HA rates * Added legacy egg loading unit test. Fixed gachaType legacy value loaded from DB and legacy tier loading * Legacy egg loading from server DB fixed
2024-06-22 01:19:56 +01:00
/**
* EGG OVERRIDES
*/
export const EGG_IMMEDIATE_HATCH_OVERRIDE: boolean = false;
export const EGG_TIER_OVERRIDE: EggTier = null;
export const EGG_SHINY_OVERRIDE: boolean = false;
export const EGG_VARIANT_OVERRIDE: VariantTier = null;
export const EGG_FREE_GACHA_PULLS_OVERRIDE: boolean = false;
export const EGG_GACHA_PULL_COUNT_OVERRIDE: number = 0;
/**
* MYSTERY ENCOUNTER OVERRIDES
*/
// 1 to 256, set to null to ignore
export const MYSTERY_ENCOUNTER_RATE_OVERRIDE: number = 256;
export const MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier = null;
export const MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType = MysteryEncounterType.SHADY_VITAMIN_DEALER;
/**
* MODIFIER / ITEM OVERRIDES
* if count is not provided, it will default to 1
* @example Modifier Override [{name: "EXP_SHARE", count: 2}]
* @example Held Item Override [{name: "LUCKY_EGG"}]
2024-05-24 00:45:04 +01:00
*
* Some items are generated based on a sub-type (i.e. berries), to override those:
* @example [{name: "BERRY", count: 5, type: BerryType.SITRUS}]
* types are listed in interface below
* - TempBattleStat is for TEMP_STAT_BOOSTER / X Items (Dire hit is separate)
* - Stat is for BASE_STAT_BOOSTER / Vitamin
* - Nature is for MINT
* - Type is for TERA_SHARD or ATTACK_TYPE_BOOSTER (type boosting items i.e Silk Scarf)
* - BerryType is for BERRY
* - SpeciesStatBoosterItem is for SPECIES_STAT_BOOSTER
*/
interface ModifierOverride {
name: keyof typeof modifierTypes & string,
count?: integer
type?: TempBattleStat|Stat|Nature|Type|BerryType|SpeciesStatBoosterItem
}
2024-05-24 00:45:04 +01:00
export const STARTING_MODIFIER_OVERRIDE: Array<ModifierOverride> = [];
export const OPP_MODIFIER_OVERRIDE: Array<ModifierOverride> = [];
2024-04-30 11:47:53 +01:00
2024-05-24 00:45:04 +01:00
export const STARTING_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
export const OPP_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
[Testing] Flexible Testing Wrapper for Phaser-Based Battle-Scenes (#1908) * refactor executed code while importing and initializing all of these in loading-scene * reset to main * fix server url * added rule no-trailing-spaces * made progress * test somme data from a session save is working * trying to launch a battle * added fetch wrapper to load data locally * trying to mockAllSettled * pushPhase & shiftPhase * check integrity of exported session * set toke + loggedInUser in tests * progress on starting new battle * tring to test phase but it's async * mocking fetch * working mock fetch * need to handle pile of data * attempt to use real phaser classes * reorder overrides * refactored to use some real classes from phaser * removed useless things * started to work on some container mock * finished the mockContainer time to add some logic * some more mock containers * removed addMethods since there is the mock classes now * commented issues * attempt to create mockTextureManager * fix tests * mockSprite & mockText * yes but not really * yes but not really * fix tutorial callback * reached mode title * added achievement tests * fix test achievements with current state of mock * correct sequence loading for BattleScene with mockLoader ! * deep dive into next step * working wait until starter selection screen * added newGame method into wrapper * expect to save_slot * trying to manage pokemon sprite for getAll without success yet * added test for egg output * fixed egg test for June * fix tests + locate next issue to fix * we are in battle baby * added new game in one-line * export is working but export only what's in the fetch * fix start game as guest * refactored how we start a battle + cleanup * overrided mewtwo but issue with currentBattle * refactor: rename InitAchievements to initAchievements * added missing mock method * override level and pokemon forms working as intended * bringToTop Obj * remove launch battle in achivement test * fix getIndex when same pokemon * can run all tests * first attack, faint, and shop modifiers, MockClock * on method for container * added doAttack one-liner * one-line export data * removed throw error * feat: Make `scenes` property of `GameWrapper` class public The `scenes` property of the `GameWrapper` class was changed from private to public. This change allows external access to the `scenes` map, which is used to store Phaser scenes. This modification was made to enable easier manipulation and interaction with the scenes in the game. * correction * removed CanvasRenderer * added a param to remove console.log and added a param to preven scene create call * fix encounter wave 30 when it's a trainer * test double-battle * test fight without KO * test double fight no ko * fix crashing texture + added Text wrapper to log fight * fix tests on boss - trainer - rival * chore: Refactor BattleScene initialization and add new phases Refactor the BattleScene initialization code to remove unnecessary delay and improve performance. Also, add new phases for the title and unavailable states to enhance the game experience. * rework of Game tests * skipFn is working * added onNextPrompt and restore Og Start * better newGame * added skipFN in remove * not yet working test but updated interceptors * do attack work but not on PostSummonPhase phase when there is mention of silcoon and wurmple * error located, it's just a double fight, i was not there yet * single OHKO & double no OHKO * added expirationFn into next prompt * all tests are passing * working test on non damaging move from opponent * cleaned a bit * removed phaser initialisation on every tests * renamed test file * added load system data * added some ability support * added onKill & onSummon abilities test * removed useless test + cleanup * removed useless test + cleanup * fixed tests after merge main * added itemHeld endTurn trigger test (toxic orb) * added runFrom..To * added mustRun to assert currentPhase * added no-miss move to test things * cleaner restore mock * fix test * fix moxie test + game speed * improve test speed * added onOurself and onOpponent mvoe test * added onDamage test for tackle * removed timeout in intervals to run tests faster * cleanup * added never crit override + separate file per test + remove randomness in randBattleSeedInt * move folders * better org * renamed itemHeld folder to items * fix deploy.yml * cleanup * simplified the gameManager start battle and allow single pokemon in party * remove the need of mode development * added input handler to test inputs + remove time from phaser into inputController * added keyboard support * added fakeMobile support * added details * removed a console.log + added logUp * move test to folder * fixed canvas issue * added starter select tests * added some more test on starter-select * added battle-order tests * added battle-order tests * fixing Phaser RNG * ordering stats for better reading * fix tests for main * adapt battle-order test to be more readable * fix merge * fix some errors and silent all errors from gameWrapper since it's not possible to avoid them * fix mocks to manage childs & stuffs * added some docs * fix achievement test * removed an unused file * separate misc tests to clean battle.test file * added a basic french lokalization test * added i18n where it needs to be used only * revers extracted method * removed unused method * removed handler fetch since we do not test anything server related * fix test with handlers removed * added intrepid sword test * fix enum exp party --------- Co-authored-by: Frederico Santos <frederico.f.santos@tecnico.ulisboa.pt>
2024-06-07 23:33:45 +01:00
export const NEVER_CRIT_OVERRIDE: boolean = false;
/**
* An array of items by keys as defined in the "modifierTypes" object in the "modifier/modifier-type.ts" file.
* Items listed will replace the normal rolls.
* If less items are listed than rolled, only some items will be replaced
* If more items are listed than rolled, only the first X items will be shown, where X is the number of items rolled.
*/
export const ITEM_REWARD_OVERRIDE: Array<String> = [];