add pokeball override (#793)

pull/281/merge
Matthew 2024-05-13 04:40:53 -04:00 committed by GitHub
parent 8d96ec7666
commit 21a0a0276d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 0 deletions

View File

@ -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 = [];

View File

@ -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

View File

@ -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();