[Dev] Cleanup some opponent overrides + add new opp form override (#3733)

* replace interger types, add opp form override

* move code to EnemyPokemon class

* Update src/field/pokemon.ts

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>

---------

Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
This commit is contained in:
Adrian T. 2024-08-28 08:34:16 +08:00 committed by GitHub
parent 4ba8080333
commit 5f3383ff04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 11 deletions

View File

@ -844,14 +844,13 @@ export default class BattleScene extends SceneBase {
if (Overrides.OPP_SPECIES_OVERRIDE) {
species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE);
}
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
if (Overrides.OPP_LEVEL_OVERRIDE !== 0) {
pokemon.level = Overrides.OPP_LEVEL_OVERRIDE;
level = Overrides.OPP_LEVEL_OVERRIDE;
}
if (Overrides.OPP_GENDER_OVERRIDE !== null) {
pokemon.gender = Overrides.OPP_GENDER_OVERRIDE;
}
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
overrideModifiers(this, false);
overrideHeldItems(this, pokemon, false);
if (boss && !dataSource) {

View File

@ -3758,6 +3758,18 @@ export class EnemyPokemon extends Pokemon {
this.status = new Status(Overrides.OPP_STATUS_OVERRIDE);
}
if (Overrides.OPP_GENDER_OVERRIDE) {
this.gender = Overrides.OPP_GENDER_OVERRIDE;
}
const speciesId = this.species.speciesId;
if (speciesId in Overrides.OPP_FORM_OVERRIDES
&& Overrides.OPP_FORM_OVERRIDES[speciesId]
&& this.species.forms[Overrides.OPP_FORM_OVERRIDES[speciesId]]) {
this.formIndex = Overrides.OPP_FORM_OVERRIDES[speciesId] ?? 0;
}
if (!dataSource) {
this.generateAndPopulateMoveset();

View File

@ -46,14 +46,14 @@ class DefaultOverrides {
readonly SEED_OVERRIDE: string = "";
readonly WEATHER_OVERRIDE: WeatherType = WeatherType.NONE;
readonly BATTLE_TYPE_OVERRIDE: "double" | "single" | null = null;
readonly STARTING_WAVE_OVERRIDE: integer = 0;
readonly STARTING_WAVE_OVERRIDE: number = 0;
readonly STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null;
/** Multiplies XP gained by this value including 0. Set to null to ignore the override */
readonly XP_MULTIPLIER_OVERRIDE: number | null = null;
readonly NEVER_CRIT_OVERRIDE: boolean = false;
/** default 1000 */
readonly STARTING_MONEY_OVERRIDE: integer = 0;
readonly STARTING_MONEY_OVERRIDE: number = 0;
/** Sets all shop item prices to 0 */
readonly WAIVE_SHOP_FEES_OVERRIDE: boolean = false;
/** Sets reroll price to 0 */
@ -86,14 +86,14 @@ class DefaultOverrides {
readonly STARTER_FORM_OVERRIDES: Partial<Record<Species, number>> = {};
/** default 5 or 20 for Daily */
readonly STARTING_LEVEL_OVERRIDE: integer = 0;
readonly STARTING_LEVEL_OVERRIDE: number = 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;
*/
readonly STARTER_SPECIES_OVERRIDE: Species | integer = 0;
readonly STARTER_SPECIES_OVERRIDE: Species | number = 0;
readonly ABILITY_OVERRIDE: Abilities = Abilities.NONE;
readonly PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
readonly STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
@ -105,7 +105,7 @@ class DefaultOverrides {
// --------------------------
// OPPONENT / ENEMY OVERRIDES
// --------------------------
readonly OPP_SPECIES_OVERRIDE: Species | integer = 0;
readonly OPP_SPECIES_OVERRIDE: Species | number = 0;
readonly OPP_LEVEL_OVERRIDE: number = 0;
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
@ -114,7 +114,8 @@ class DefaultOverrides {
readonly OPP_MOVESET_OVERRIDE: Array<Moves> = [];
readonly OPP_SHINY_OVERRIDE: boolean = false;
readonly OPP_VARIANT_OVERRIDE: Variant = 0;
readonly OPP_IVS_OVERRIDE: integer | integer[] = [];
readonly OPP_IVS_OVERRIDE: number | number[] = [];
readonly OPP_FORM_OVERRIDES: Partial<Record<Species, number>> = {};
// -------------
// EGG OVERRIDES