From 21a0a0276dea506589d93e5b0fce171af497428f Mon Sep 17 00:00:00 2001 From: Matthew Date: Mon, 13 May 2024 04:40:53 -0400 Subject: [PATCH] add pokeball override (#793) --- src/battle-scene.ts | 3 +++ src/overrides.ts | 12 ++++++++++++ src/system/game-data.ts | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 47de99401..111e5439b 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -741,6 +741,9 @@ export default class BattleScene extends SceneBase { this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ])); this.pokeballCounts[PokeballType.POKEBALL] += 5; + if (Overrides.POKEBALL_OVERRIDE.active) { + this.pokeballCounts = Overrides.POKEBALL_OVERRIDE.pokeballs; + } this.modifiers = []; this.enemyModifiers = []; diff --git a/src/overrides.ts b/src/overrides.ts index 7b7b24635..704019a1d 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -9,6 +9,8 @@ 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'; /** * Overrides for testing different in game situations @@ -27,6 +29,16 @@ export const STARTING_WAVE_OVERRIDE: integer = 0; export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN; // default 1000 export const STARTING_MONEY_OVERRIDE: integer = 0; +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 diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 5fc564626..7f6e1475b 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -4,6 +4,7 @@ import { pokemonEvolutions, pokemonPrevolutions } from "../data/pokemon-evolutio import PokemonSpecies, { allSpecies, getPokemonSpecies, noStarterFormKeys, speciesStarters } from "../data/pokemon-species"; import { Species, defaultStarterSpecies } from "../data/enums/species"; import * as Utils from "../utils"; +import * as Overrides from '../overrides'; import PokemonData from "./pokemon-data"; import PersistentModifierData from "./modifier-data"; import ArenaData from "./arena-data"; @@ -655,6 +656,9 @@ export class GameData { Object.keys(scene.pokeballCounts).forEach((key: string) => { scene.pokeballCounts[key] = sessionData.pokeballCounts[key] || 0; }); + if (Overrides.POKEBALL_OVERRIDE.active) { + scene.pokeballCounts = Overrides.POKEBALL_OVERRIDE.pokeballs; + } scene.money = sessionData.money || 0; scene.updateMoneyText();