Cleanup overrides and imports (#603)
* cleanup overrides and imports * Add GreenLamps Modifier Overrides * added comments * starting money and biome comments * account for overriding empty move * more override descriptions * added generator held item names to override commentpull/692/head
parent
882f9c289c
commit
10cf1cd94f
|
@ -4,7 +4,7 @@ import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePh
|
||||||
import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
|
import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
|
||||||
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species';
|
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species';
|
||||||
import * as Utils from './utils';
|
import * as Utils from './utils';
|
||||||
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier } from './modifier/modifier';
|
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems } from './modifier/modifier';
|
||||||
import { PokeballType } from './data/pokeball';
|
import { PokeballType } from './data/pokeball';
|
||||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
|
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
|
||||||
import { Phase } from './phase';
|
import { Phase } from './phase';
|
||||||
|
@ -59,7 +59,7 @@ import { SceneBase } from './scene-base';
|
||||||
import CandyBar from './ui/candy-bar';
|
import CandyBar from './ui/candy-bar';
|
||||||
import { Variant, variantData } from './data/variant';
|
import { Variant, variantData } from './data/variant';
|
||||||
import { Localizable } from './plugins/i18n';
|
import { Localizable } from './plugins/i18n';
|
||||||
import { STARTING_WAVE_OVERRIDE, OPP_SPECIES_OVERRIDE, SEED_OVERRIDE, STARTING_BIOME_OVERRIDE, DOUBLE_BATTLE_OVERRIDE } from './overrides';
|
import * as Overrides from './overrides';
|
||||||
import {InputsController} from "./inputs-controller";
|
import {InputsController} from "./inputs-controller";
|
||||||
import {UiInputs} from "./ui-inputs";
|
import {UiInputs} from "./ui-inputs";
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||||
|
|
||||||
const DEBUG_RNG = false;
|
const DEBUG_RNG = false;
|
||||||
|
|
||||||
export const startingWave = STARTING_WAVE_OVERRIDE || 1;
|
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
|
||||||
|
|
||||||
const expSpriteKeys: string[] = [];
|
const expSpriteKeys: string[] = [];
|
||||||
|
|
||||||
|
@ -612,9 +612,11 @@ export default class BattleScene extends SceneBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
||||||
if (OPP_SPECIES_OVERRIDE)
|
if (Overrides.OPP_SPECIES_OVERRIDE)
|
||||||
species = getPokemonSpecies(OPP_SPECIES_OVERRIDE);
|
species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE);
|
||||||
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
|
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
|
||||||
|
overrideModifiers(this, false);
|
||||||
|
overrideHeldItems(this, pokemon, false);
|
||||||
if (boss && !dataSource) {
|
if (boss && !dataSource) {
|
||||||
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
|
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
|
||||||
|
|
||||||
|
@ -705,7 +707,7 @@ export default class BattleScene extends SceneBase {
|
||||||
|
|
||||||
this.gameMode = gameModes[GameModes.CLASSIC];
|
this.gameMode = gameModes[GameModes.CLASSIC];
|
||||||
|
|
||||||
this.setSeed(SEED_OVERRIDE || Utils.randomString(24));
|
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
|
||||||
console.log('Seed:', this.seed);
|
console.log('Seed:', this.seed);
|
||||||
|
|
||||||
this.disableMenu = false;
|
this.disableMenu = false;
|
||||||
|
@ -742,7 +744,7 @@ export default class BattleScene extends SceneBase {
|
||||||
|
|
||||||
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
|
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
|
||||||
|
|
||||||
this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN);
|
this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN);
|
||||||
|
|
||||||
this.arenaBgTransition.setPosition(0, 0);
|
this.arenaBgTransition.setPosition(0, 0);
|
||||||
this.arenaPlayer.setPosition(300, 0);
|
this.arenaPlayer.setPosition(300, 0);
|
||||||
|
@ -842,7 +844,7 @@ export default class BattleScene extends SceneBase {
|
||||||
} else if (!battleConfig)
|
} else if (!battleConfig)
|
||||||
newDouble = !!double;
|
newDouble = !!double;
|
||||||
|
|
||||||
if (DOUBLE_BATTLE_OVERRIDE)
|
if (Overrides.DOUBLE_BATTLE_OVERRIDE)
|
||||||
newDouble = true;
|
newDouble = true;
|
||||||
|
|
||||||
const lastBattle = this.currentBattle;
|
const lastBattle = this.currentBattle;
|
||||||
|
@ -1767,6 +1769,19 @@ export default class BattleScene extends SceneBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all modifiers from enemy of PersistentModifier type
|
||||||
|
*/
|
||||||
|
clearEnemyModifiers(): void {
|
||||||
|
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PersistentModifier);
|
||||||
|
for (let m of modifiersToRemove)
|
||||||
|
this.enemyModifiers.splice(this.enemyModifiers.indexOf(m), 1);
|
||||||
|
this.updateModifiers(false).then(() => this.updateUIPositions());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all modifiers from enemy of PokemonHeldItemModifier type
|
||||||
|
*/
|
||||||
clearEnemyHeldItemModifiers(): void {
|
clearEnemyHeldItemModifiers(): void {
|
||||||
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PokemonHeldItemModifier);
|
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PokemonHeldItemModifier);
|
||||||
for (let m of modifiersToRemove)
|
for (let m of modifiersToRemove)
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { TimeOfDay } from "../data/enums/time-of-day";
|
||||||
import { Terrain, TerrainType } from "../data/terrain";
|
import { Terrain, TerrainType } from "../data/terrain";
|
||||||
import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability";
|
import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability";
|
||||||
import Pokemon from "./pokemon";
|
import Pokemon from "./pokemon";
|
||||||
import { WEATHER_OVERRIDE } from '../overrides';
|
import * as Overrides from '../overrides';
|
||||||
|
|
||||||
export class Arena {
|
export class Arena {
|
||||||
public scene: BattleScene;
|
public scene: BattleScene;
|
||||||
|
@ -273,6 +273,11 @@ export class Arena {
|
||||||
return 131 / 180;
|
return 131 / 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets weather to the override specified in overrides.ts
|
||||||
|
* @param weather new weather to set of type WeatherType
|
||||||
|
* @returns true to force trySetWeather to return true
|
||||||
|
*/
|
||||||
trySetWeatherOverride(weather: WeatherType): boolean {
|
trySetWeatherOverride(weather: WeatherType): boolean {
|
||||||
this.weather = new Weather(weather, 0);
|
this.weather = new Weather(weather, 0);
|
||||||
this.scene.unshiftPhase(new CommonAnimPhase(this.scene, undefined, undefined, CommonAnim.SUNNY + (weather - 1)));
|
this.scene.unshiftPhase(new CommonAnimPhase(this.scene, undefined, undefined, CommonAnim.SUNNY + (weather - 1)));
|
||||||
|
@ -280,10 +285,15 @@ export class Arena {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to set a new weather to the battle
|
||||||
|
* @param weather new weather to set of type WeatherType
|
||||||
|
* @param hasPokemonSource is the new weather from a pokemon
|
||||||
|
* @returns true if new weather set, false if no weather provided or attempting to set the same weather as currently in use
|
||||||
|
*/
|
||||||
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
trySetWeather(weather: WeatherType, hasPokemonSource: boolean): boolean {
|
||||||
// override hook for debugging
|
if (Overrides.WEATHER_OVERRIDE)
|
||||||
if (WEATHER_OVERRIDE)
|
return this.trySetWeatherOverride(Overrides.WEATHER_OVERRIDE);
|
||||||
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
|
|
||||||
|
|
||||||
if (this.weather?.weatherType === (weather || undefined))
|
if (this.weather?.weatherType === (weather || undefined))
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -43,7 +43,7 @@ import { Nature, getNatureStatMultiplier } from '../data/nature';
|
||||||
import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms';
|
import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms';
|
||||||
import { TerrainType } from '../data/terrain';
|
import { TerrainType } from '../data/terrain';
|
||||||
import { TrainerSlot } from '../data/trainer-config';
|
import { TrainerSlot } from '../data/trainer-config';
|
||||||
import { ABILITY_OVERRIDE, MOVE_OVERRIDE, MOVE_OVERRIDE_2, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_MOVE_OVERRIDE_2, OPP_PASSIVE_ABILITY_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE, PASSIVE_ABILITY_OVERRIDE } from '../overrides';
|
import * as Overrides from '../overrides';
|
||||||
import { BerryType } from '../data/berry';
|
import { BerryType } from '../data/berry';
|
||||||
import i18next from '../plugins/i18n';
|
import i18next from '../plugins/i18n';
|
||||||
|
|
||||||
|
@ -725,15 +725,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
? this.summonData.moveset
|
? this.summonData.moveset
|
||||||
: this.moveset;
|
: this.moveset;
|
||||||
|
|
||||||
if (MOVE_OVERRIDE && this.isPlayer())
|
// Overrides moveset based on arrays specified in overrides.ts
|
||||||
this.moveset[0] = new PokemonMove(MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[MOVE_OVERRIDE].pp));
|
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
|
||||||
else if (OPP_MOVE_OVERRIDE && !this.isPlayer())
|
if (overrideArray.length > 0) {
|
||||||
this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[OPP_MOVE_OVERRIDE].pp));
|
overrideArray.forEach((move: Moves, index: number) => {
|
||||||
if (MOVE_OVERRIDE_2 && this.isPlayer())
|
const ppUsed = this.moveset[index]?.ppUp || 0;
|
||||||
this.moveset[1] = new PokemonMove(MOVE_OVERRIDE_2, Math.min(this.moveset[1].ppUsed, allMoves[MOVE_OVERRIDE_2].pp));
|
this.moveset[index] = new PokemonMove(move, Math.min(ppUsed, allMoves[move].pp))
|
||||||
else if (OPP_MOVE_OVERRIDE_2 && !this.isPlayer())
|
});
|
||||||
this.moveset[1] = new PokemonMove(OPP_MOVE_OVERRIDE_2, Math.min(this.moveset[1].ppUsed, allMoves[OPP_MOVE_OVERRIDE_2].pp));
|
}
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -798,10 +797,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
getAbility(ignoreOverride?: boolean): Ability {
|
getAbility(ignoreOverride?: boolean): Ability {
|
||||||
if (!ignoreOverride && this.summonData?.ability)
|
if (!ignoreOverride && this.summonData?.ability)
|
||||||
return allAbilities[this.summonData.ability];
|
return allAbilities[this.summonData.ability];
|
||||||
if (ABILITY_OVERRIDE && this.isPlayer())
|
if (Overrides.ABILITY_OVERRIDE && this.isPlayer())
|
||||||
return allAbilities[ABILITY_OVERRIDE];
|
return allAbilities[Overrides.ABILITY_OVERRIDE];
|
||||||
if (OPP_ABILITY_OVERRIDE && !this.isPlayer())
|
if (Overrides.OPP_ABILITY_OVERRIDE && !this.isPlayer())
|
||||||
return allAbilities[OPP_ABILITY_OVERRIDE];
|
return allAbilities[Overrides.OPP_ABILITY_OVERRIDE];
|
||||||
if (this.isFusion())
|
if (this.isFusion())
|
||||||
return allAbilities[this.getFusionSpeciesForm(ignoreOverride).getAbility(this.fusionAbilityIndex)];
|
return allAbilities[this.getFusionSpeciesForm(ignoreOverride).getAbility(this.fusionAbilityIndex)];
|
||||||
let abilityId = this.getSpeciesForm(ignoreOverride).getAbility(this.abilityIndex);
|
let abilityId = this.getSpeciesForm(ignoreOverride).getAbility(this.abilityIndex);
|
||||||
|
@ -811,10 +810,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
getPassiveAbility(): Ability {
|
getPassiveAbility(): Ability {
|
||||||
if (PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
|
if (Overrides.PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
|
||||||
return allAbilities[PASSIVE_ABILITY_OVERRIDE];
|
return allAbilities[Overrides.PASSIVE_ABILITY_OVERRIDE];
|
||||||
if (OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
|
if (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
|
||||||
return allAbilities[OPP_PASSIVE_ABILITY_OVERRIDE];
|
return allAbilities[Overrides.OPP_PASSIVE_ABILITY_OVERRIDE];
|
||||||
|
|
||||||
let starterSpeciesId = this.species.speciesId;
|
let starterSpeciesId = this.species.speciesId;
|
||||||
while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId))
|
while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId))
|
||||||
|
@ -822,8 +821,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
return allAbilities[starterPassiveAbilities[starterSpeciesId]];
|
return allAbilities[starterPassiveAbilities[starterSpeciesId]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a pokemon has a passive either from:
|
||||||
|
* - bought with starter candy
|
||||||
|
* - set by override
|
||||||
|
* - is a boss pokemon
|
||||||
|
* @returns whether or not a pokemon should have a passive
|
||||||
|
*/
|
||||||
hasPassive(): boolean {
|
hasPassive(): boolean {
|
||||||
if ((PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) || (OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer()))
|
// returns override if valid for current case
|
||||||
|
if ((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) ||
|
||||||
|
(Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer()))
|
||||||
return true;
|
return true;
|
||||||
return this.passive || this.isBoss();
|
return this.passive || this.isBoss();
|
||||||
}
|
}
|
||||||
|
@ -2692,14 +2700,14 @@ export class EnemyPokemon extends Pokemon {
|
||||||
this.generateAndPopulateMoveset();
|
this.generateAndPopulateMoveset();
|
||||||
|
|
||||||
this.trySetShiny();
|
this.trySetShiny();
|
||||||
if (OPP_SHINY_OVERRIDE) {
|
if (Overrides.OPP_SHINY_OVERRIDE) {
|
||||||
this.shiny = true;
|
this.shiny = true;
|
||||||
this.initShinySparkle();
|
this.initShinySparkle();
|
||||||
}
|
}
|
||||||
if (this.shiny) {
|
if (this.shiny) {
|
||||||
this.variant = this.generateVariant();
|
this.variant = this.generateVariant();
|
||||||
if (OPP_VARIANT_OVERRIDE)
|
if (Overrides.OPP_VARIANT_OVERRIDE)
|
||||||
this.variant = OPP_VARIANT_OVERRIDE;
|
this.variant = Overrides.OPP_VARIANT_OVERRIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
|
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Species } from "./data/enums/species";
|
||||||
import PokemonSpecies, { allSpecies } from "./data/pokemon-species";
|
import PokemonSpecies, { allSpecies } from "./data/pokemon-species";
|
||||||
import { Arena } from "./field/arena";
|
import { Arena } from "./field/arena";
|
||||||
import * as Utils from "./utils";
|
import * as Utils from "./utils";
|
||||||
import { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from './overrides';
|
import * as Overrides from './overrides';
|
||||||
|
|
||||||
export enum GameModes {
|
export enum GameModes {
|
||||||
CLASSIC,
|
CLASSIC,
|
||||||
|
@ -45,9 +45,15 @@ export class GameMode implements GameModeConfig {
|
||||||
Object.assign(this, config);
|
Object.assign(this, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns either:
|
||||||
|
* - override from overrides.ts
|
||||||
|
* - 20 for Daily Runs
|
||||||
|
* - 5 for all other modes
|
||||||
|
*/
|
||||||
getStartingLevel(): integer {
|
getStartingLevel(): integer {
|
||||||
if (STARTING_LEVEL_OVERRIDE)
|
if (Overrides.STARTING_LEVEL_OVERRIDE)
|
||||||
return STARTING_LEVEL_OVERRIDE;
|
return Overrides.STARTING_LEVEL_OVERRIDE;
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.DAILY:
|
case GameModes.DAILY:
|
||||||
return 20;
|
return 20;
|
||||||
|
@ -56,16 +62,28 @@ export class GameMode implements GameModeConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns either:
|
||||||
|
* - override from overrides.ts
|
||||||
|
* - 1000
|
||||||
|
*/
|
||||||
getStartingMoney(): integer {
|
getStartingMoney(): integer {
|
||||||
return STARTING_MONEY_OVERRIDE || 1000;
|
return Overrides.STARTING_MONEY_OVERRIDE || 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scene current BattleScene
|
||||||
|
* @returns either:
|
||||||
|
* - random biome for Daily mode
|
||||||
|
* - override from overrides.ts
|
||||||
|
* - Town
|
||||||
|
*/
|
||||||
getStartingBiome(scene: BattleScene): Biome {
|
getStartingBiome(scene: BattleScene): Biome {
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.DAILY:
|
case GameModes.DAILY:
|
||||||
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
|
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
|
||||||
default:
|
default:
|
||||||
return STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@ import { VoucherType } from '../system/voucher';
|
||||||
import { FormChangeItem, SpeciesFormChangeItemTrigger } from '../data/pokemon-forms';
|
import { FormChangeItem, SpeciesFormChangeItemTrigger } from '../data/pokemon-forms';
|
||||||
import { Nature } from '#app/data/nature';
|
import { Nature } from '#app/data/nature';
|
||||||
import { BattlerTagType } from '#app/data/enums/battler-tag-type';
|
import { BattlerTagType } from '#app/data/enums/battler-tag-type';
|
||||||
|
import * as Overrides from '../overrides';
|
||||||
|
import { ModifierType, modifierTypes } from './modifier-type';
|
||||||
|
|
||||||
type ModifierType = ModifierTypes.ModifierType;
|
|
||||||
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
||||||
|
|
||||||
const iconOverflowIndex = 24;
|
const iconOverflowIndex = 24;
|
||||||
|
@ -2176,3 +2177,62 @@ export class EnemyFusionChanceModifier extends EnemyPersistentModifier {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses override from overrides.ts to set PersistentModifiers for starting a new game
|
||||||
|
* @param scene current BattleScene
|
||||||
|
* @param player is this for player for enemy
|
||||||
|
*/
|
||||||
|
export function overrideModifiers(scene: BattleScene, player: boolean = true): void {
|
||||||
|
const modifierOverride = player ? Overrides.STARTING_MODIFIER_OVERRIDE : Overrides.OPP_MODIFIER_OVERRIDE;
|
||||||
|
if (!modifierOverride || modifierOverride.length === 0 || !scene) return; // if no override, do nothing
|
||||||
|
// if it's the opponent, we clear all his current modifiers to avoid stacking
|
||||||
|
if (!player) {
|
||||||
|
scene.clearEnemyModifiers();
|
||||||
|
}
|
||||||
|
// we loop through all the modifier name given in the override file
|
||||||
|
modifierOverride.forEach(item => {
|
||||||
|
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]();
|
||||||
|
const modifier: PersistentModifier = modifierType.withIdFromFunc(modifierTypes[modifierName]).newModifier() as PersistentModifier;
|
||||||
|
modifier.stackCount = qty;
|
||||||
|
if (player) {
|
||||||
|
scene.addModifier(modifier, true, false, false, true);
|
||||||
|
} else {
|
||||||
|
scene.addEnemyModifier(modifier, true, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses override from overrides.ts to set PokemonHeldItemModifiers for starting a new game
|
||||||
|
* @param scene current BattleScene
|
||||||
|
* @param player is this for player for enemy
|
||||||
|
*/
|
||||||
|
export function overrideHeldItems(scene: BattleScene, pokemon: Pokemon, player: boolean = true): void {
|
||||||
|
const heldItemsOverride = player ? Overrides.STARTING_HELD_ITEMS_OVERRIDE : Overrides.OPP_HELD_ITEMS_OVERRIDE;
|
||||||
|
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.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
|
||||||
|
itemModifier.pokemonId = pokemon.id; // we assign the created item to the pokemon
|
||||||
|
itemModifier.stackCount = qty; // we say how many items we want
|
||||||
|
if (player) {
|
||||||
|
scene.addModifier(itemModifier, true, false, false, true);
|
||||||
|
} else {
|
||||||
|
scene.addEnemyModifier(itemModifier, true, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -3,26 +3,84 @@ import { Abilities } from "./data/enums/abilities";
|
||||||
import { Biome } from "./data/enums/biome";
|
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 { 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';
|
||||||
|
|
||||||
export const SEED_OVERRIDE = '';
|
/**
|
||||||
export const STARTER_SPECIES_OVERRIDE = 0;
|
* Overrides for testing different in game situations
|
||||||
export const STARTER_FORM_OVERRIDE = 0;
|
* if an override name starts with "STARTING", it will apply when a new run begins
|
||||||
export const STARTING_LEVEL_OVERRIDE = 0;
|
*/
|
||||||
export const STARTING_WAVE_OVERRIDE = 0;
|
|
||||||
export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
|
|
||||||
export const STARTING_MONEY_OVERRIDE = 0;
|
|
||||||
export const WEATHER_OVERRIDE = WeatherType.NONE;
|
|
||||||
export const DOUBLE_BATTLE_OVERRIDE = false;
|
|
||||||
|
|
||||||
export const ABILITY_OVERRIDE = Abilities.NONE;
|
/**
|
||||||
export const PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
|
* OVERALL OVERRIDES
|
||||||
export const MOVE_OVERRIDE = Moves.NONE;
|
*/
|
||||||
export const MOVE_OVERRIDE_2 = Moves.NONE;
|
|
||||||
export const OPP_SPECIES_OVERRIDE = 0;
|
// a specific seed (default: a random string of 24 characters)
|
||||||
export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
|
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
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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<Moves> = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OPPONENT / ENEMY OVERRIDES
|
||||||
|
*/
|
||||||
|
|
||||||
|
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_MOVE_OVERRIDE = Moves.NONE;
|
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
|
||||||
export const OPP_MOVE_OVERRIDE_2 = Moves.NONE;
|
export const OPP_SHINY_OVERRIDE: boolean = false;
|
||||||
|
export const OPP_VARIANT_OVERRIDE: Variant = 0;
|
||||||
|
|
||||||
export const OPP_SHINY_OVERRIDE = false;
|
/**
|
||||||
export const OPP_VARIANT_OVERRIDE = 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 TEMP_STAT_BOOSTER / X Items (Dire hit is separate)
|
||||||
|
* - Stat is for BASE_STAT_BOOSTER / Vitamin
|
||||||
|
* - Nature is for MINT
|
||||||
|
* - Type is for TERA_SHARD or ATTACK_TYPE_BOOSTER (type boosting items i.e Silk Scarf)
|
||||||
|
* - BerryType is for BERRY
|
||||||
|
*/
|
||||||
|
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 STARTING_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
|
||||||
|
export const OPP_HELD_ITEMS_OVERRIDE: Array<ModifierOverride> = [];
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMov
|
||||||
import { Mode } from './ui/ui';
|
import { Mode } from './ui/ui';
|
||||||
import { Command } from "./ui/command-ui-handler";
|
import { Command } from "./ui/command-ui-handler";
|
||||||
import { Stat } from "./data/pokemon-stat";
|
import { Stat } from "./data/pokemon-stat";
|
||||||
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, FusePokemonModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier } from "./modifier/modifier";
|
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, FusePokemonModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems } from "./modifier/modifier";
|
||||||
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
|
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
|
||||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
|
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
|
||||||
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
|
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
|
||||||
|
@ -58,7 +58,7 @@ import { GameModes, gameModes } from "./game-mode";
|
||||||
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm, speciesStarters } from "./data/pokemon-species";
|
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm, speciesStarters } from "./data/pokemon-species";
|
||||||
import i18next from './plugins/i18n';
|
import i18next from './plugins/i18n';
|
||||||
import { Abilities } from "./data/enums/abilities";
|
import { Abilities } from "./data/enums/abilities";
|
||||||
import { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE } from './overrides';
|
import * as Overrides from './overrides';
|
||||||
|
|
||||||
export class LoginPhase extends Phase {
|
export class LoginPhase extends Phase {
|
||||||
private showText: boolean;
|
private showText: boolean;
|
||||||
|
@ -487,12 +487,12 @@ export class SelectStarterPhase extends Phase {
|
||||||
const party = this.scene.getParty();
|
const party = this.scene.getParty();
|
||||||
const loadPokemonAssets: Promise<void>[] = [];
|
const loadPokemonAssets: Promise<void>[] = [];
|
||||||
starters.forEach((starter: Starter, i: integer) => {
|
starters.forEach((starter: Starter, i: integer) => {
|
||||||
if (!i && STARTER_SPECIES_OVERRIDE)
|
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
|
||||||
starter.species = getPokemonSpecies(STARTER_SPECIES_OVERRIDE as Species);
|
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
||||||
const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr);
|
const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr);
|
||||||
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
|
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
|
||||||
if (!i && STARTER_SPECIES_OVERRIDE)
|
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
|
||||||
starterFormIndex = STARTER_FORM_OVERRIDE;
|
starterFormIndex = Overrides.STARTER_FORM_OVERRIDE;
|
||||||
const starterGender = starter.species.malePercent !== null
|
const starterGender = starter.species.malePercent !== null
|
||||||
? !starterProps.female ? Gender.MALE : Gender.FEMALE
|
? !starterProps.female ? Gender.MALE : Gender.FEMALE
|
||||||
: Gender.GENDERLESS;
|
: Gender.GENDERLESS;
|
||||||
|
@ -510,6 +510,8 @@ export class SelectStarterPhase extends Phase {
|
||||||
party.push(starterPokemon);
|
party.push(starterPokemon);
|
||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
});
|
});
|
||||||
|
overrideModifiers(this.scene);
|
||||||
|
overrideHeldItems(this.scene, party[0]);
|
||||||
Promise.all(loadPokemonAssets).then(() => {
|
Promise.all(loadPokemonAssets).then(() => {
|
||||||
SoundFade.fadeOut(this.scene, this.scene.sound.get('menu'), 500, true);
|
SoundFade.fadeOut(this.scene, this.scene.sound.get('menu'), 500, true);
|
||||||
this.scene.time.delayedCall(500, () => this.scene.playBgm());
|
this.scene.time.delayedCall(500, () => this.scene.playBgm());
|
||||||
|
|
Loading…
Reference in New Issue