From 8e451019ad3d60c485e0797eeb73227a74d53a4d Mon Sep 17 00:00:00 2001 From: Matthew Olker Date: Thu, 9 May 2024 14:21:43 -0400 Subject: [PATCH] more override descriptions --- src/modifier/modifier.ts | 11 ++++-- src/overrides.ts | 72 +++++++++++++++++++++++++++++++--------- 2 files changed, 65 insertions(+), 18 deletions(-) diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index 0bb6c1e0f75..ba009cb7a8d 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -2192,7 +2192,7 @@ export function overrideModifiers(scene: BattleScene, player: boolean = true): v } // we loop through all the modifier name given in the override file modifierOverride.forEach(item => { - const modifierName = item.modifierName; + const modifierName = item.name; const qty = item.count || 1; if (!modifierTypes.hasOwnProperty(modifierName)) return; // if the modifier does not exist, we skip it const modifierType: ModifierType = modifierTypes[modifierName](); @@ -2216,12 +2216,17 @@ export function overrideHeldItems(scene: BattleScene, pokemon: Pokemon, player: if (!heldItemsOverride || heldItemsOverride.length === 0 || !scene) return; // if no override, do nothing // we loop through all the itemName given in the override file heldItemsOverride.forEach(item => { - const itemName = item.modifierName; + const itemName = item.name; const qty = item.count || 1; if (!modifierTypes.hasOwnProperty(itemName)) return; // if the item does not exist, we skip it const modifierType: ModifierType = modifierTypes[itemName](); // we retrieve the item in the list + var itemModifier: PokemonHeldItemModifier; + if (modifierType instanceof ModifierTypes.ModifierTypeGenerator) { + itemModifier = modifierType.generateType(null, [item.type]).withIdFromFunc(modifierTypes[itemName]).newModifier(pokemon) as PokemonHeldItemModifier; + } else { + itemModifier = modifierType.withIdFromFunc(modifierTypes[itemName]).newModifier(pokemon) as PokemonHeldItemModifier; + } // we create the item - const itemModifier: PokemonHeldItemModifier = modifierType.withIdFromFunc(modifierTypes[itemName]).newModifier(pokemon) as PokemonHeldItemModifier; itemModifier.pokemonId = pokemon.id; // we assign the created item to the pokemon itemModifier.stackCount = qty; // we say how many items we want if (player) { diff --git a/src/overrides.ts b/src/overrides.ts index a04b9ee19fa..c8ecaed054f 100644 --- a/src/overrides.ts +++ b/src/overrides.ts @@ -4,41 +4,83 @@ import { Biome } from "./data/enums/biome"; import { Moves } from "./data/enums/moves"; import { WeatherType } from "./data/weather"; import { Variant } from './data/variant'; +import { BerryType } from './data/berry'; +import { TempBattleStat } from './data/temp-battle-stat'; +import { Nature } from './data/nature'; +import { Type } from './data/type'; +import { Stat } from './data/pokemon-stat'; -/* -* Overrides for testing different in game situations -*/ +/** + * Overrides for testing different in game situations + * if an override name starts with "STARTING", it will apply when a new run begins + */ -interface ModifierOverride { - modifierName: string, - count?: integer -} +/** + * OVERALL OVERRIDES + */ -// 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; export const STARTING_WAVE_OVERRIDE: integer = 0; export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN; +// default 1000 export const STARTING_MONEY_OVERRIDE: integer = 0; +/** + * PLAYER OVERRIDES + */ -// player overrides -export const STARTER_SPECIES_OVERRIDE: Species | 0 = 0; +// forms can be found in pokemon-species.ts export const STARTER_FORM_OVERRIDE: integer = 0; +// default 5 or 20 for Daily export const STARTING_LEVEL_OVERRIDE: integer = 0; export const ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const MOVESET_OVERRIDE: Array = []; -export const STARTING_MODIFIER_OVERRIDE: Array = []; -export const STARTING_HELD_ITEMS_OVERRIDE: Array = []; -// opponent overrides -export const OPP_SPECIES_OVERRIDE: Species | 0 = 0; +/** + * OPPONENT / ENEMY OVERRIDES + */ + export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE; export const OPP_MOVESET_OVERRIDE: Array = []; export const OPP_SHINY_OVERRIDE: boolean = false; export const OPP_VARIANT_OVERRIDE: Variant = 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 OPP_SPECIES_OVERRIDE: Species | integer = 0; + +/** + * 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"}] + * + * 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 X items (Dire hit is separate) + * - Stat is for vitamins + * - Nature is for mints + * - Type is for Tera Shard + * - BerryType is for Berries + */ +interface ModifierOverride { + name: string, + count?: integer + type?: TempBattleStat|Stat|Nature|Type|BerryType +} +export const STARTING_MODIFIER_OVERRIDE: Array = []; +export const OPP_MODIFIER_OVERRIDE: Array = []; + +export const STARTING_HELD_ITEMS_OVERRIDE: Array = [{name: "LUCKY_EGG"}]; export const OPP_HELD_ITEMS_OVERRIDE: Array = []; -export const OPP_MODIFIER_OVERRIDE: Array = []; \ No newline at end of file