more override descriptions

This commit is contained in:
Matthew Olker 2024-05-09 14:21:43 -04:00
parent 8e925913da
commit 8e451019ad
2 changed files with 65 additions and 18 deletions

View File

@ -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 // we loop through all the modifier name given in the override file
modifierOverride.forEach(item => { modifierOverride.forEach(item => {
const modifierName = item.modifierName; const modifierName = item.name;
const qty = item.count || 1; const qty = item.count || 1;
if (!modifierTypes.hasOwnProperty(modifierName)) return; // if the modifier does not exist, we skip it if (!modifierTypes.hasOwnProperty(modifierName)) return; // if the modifier does not exist, we skip it
const modifierType: ModifierType = modifierTypes[modifierName](); 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 if (!heldItemsOverride || heldItemsOverride.length === 0 || !scene) return; // if no override, do nothing
// we loop through all the itemName given in the override file // we loop through all the itemName given in the override file
heldItemsOverride.forEach(item => { heldItemsOverride.forEach(item => {
const itemName = item.modifierName; const itemName = item.name;
const qty = item.count || 1; const qty = item.count || 1;
if (!modifierTypes.hasOwnProperty(itemName)) return; // if the item does not exist, we skip it 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 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 // 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.pokemonId = pokemon.id; // we assign the created item to the pokemon
itemModifier.stackCount = qty; // we say how many items we want itemModifier.stackCount = qty; // we say how many items we want
if (player) { if (player) {

View File

@ -4,41 +4,83 @@ import { Biome } from "./data/enums/biome";
import { Moves } from "./data/enums/moves"; import { Moves } from "./data/enums/moves";
import { WeatherType } from "./data/weather"; import { WeatherType } from "./data/weather";
import { Variant } from './data/variant'; 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, * OVERALL OVERRIDES
count?: integer */
}
// overall overrides // a specific seed (default: a random string of 24 characters)
export const SEED_OVERRIDE: string = ''; export const SEED_OVERRIDE: string = '';
export const WEATHER_OVERRIDE: WeatherType = WeatherType.NONE; export const WEATHER_OVERRIDE: WeatherType = WeatherType.NONE;
export const DOUBLE_BATTLE_OVERRIDE: boolean = false; export const DOUBLE_BATTLE_OVERRIDE: boolean = false;
export const STARTING_WAVE_OVERRIDE: integer = 0; export const STARTING_WAVE_OVERRIDE: integer = 0;
export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN; export const STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
// default 1000
export const STARTING_MONEY_OVERRIDE: integer = 0; export const STARTING_MONEY_OVERRIDE: integer = 0;
/**
* PLAYER OVERRIDES
*/
// player overrides // forms can be found in pokemon-species.ts
export const STARTER_SPECIES_OVERRIDE: Species | 0 = 0;
export const STARTER_FORM_OVERRIDE: integer = 0; export const STARTER_FORM_OVERRIDE: integer = 0;
// default 5 or 20 for Daily
export const STARTING_LEVEL_OVERRIDE: integer = 0; export const STARTING_LEVEL_OVERRIDE: integer = 0;
export const ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const MOVESET_OVERRIDE: Array<Moves> = []; export const MOVESET_OVERRIDE: Array<Moves> = [];
export const STARTING_MODIFIER_OVERRIDE: Array<ModifierOverride> = [];
export const STARTING_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
// opponent overrides /**
export const OPP_SPECIES_OVERRIDE: Species | 0 = 0; * OPPONENT / ENEMY OVERRIDES
*/
export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE; export const OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE; export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
export const OPP_MOVESET_OVERRIDE: Array<Moves> = []; export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
export const OPP_SHINY_OVERRIDE: boolean = false; export const OPP_SHINY_OVERRIDE: boolean = false;
export const OPP_VARIANT_OVERRIDE: Variant = 0; export const OPP_VARIANT_OVERRIDE: Variant = 0;
export const OPP_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
/**
* 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<ModifierOverride> = [];
export const OPP_MODIFIER_OVERRIDE: Array<ModifierOverride> = []; export const OPP_MODIFIER_OVERRIDE: Array<ModifierOverride> = [];
export const STARTING_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [{name: "LUCKY_EGG"}];
export const OPP_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];