Compare commits

..

No commits in common. "10cf1cd94f08ab00437b9e221ce03d2c2bd983d8" and "7f0362e124b629e509722fbea4e544dfb27dd3d3" have entirely different histories.

11 changed files with 79 additions and 322 deletions

View File

@ -4,7 +4,7 @@ import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePh
import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species';
import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems } from './modifier/modifier';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier } from './modifier/modifier';
import { PokeballType } from './data/pokeball';
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
import { Phase } from './phase';
@ -59,7 +59,7 @@ import { SceneBase } from './scene-base';
import CandyBar from './ui/candy-bar';
import { Variant, variantData } from './data/variant';
import { Localizable } from './plugins/i18n';
import * as Overrides from './overrides';
import { STARTING_WAVE_OVERRIDE, OPP_SPECIES_OVERRIDE, SEED_OVERRIDE, STARTING_BIOME_OVERRIDE, DOUBLE_BATTLE_OVERRIDE } from './overrides';
import {InputsController} from "./inputs-controller";
import {UiInputs} from "./ui-inputs";
@ -67,7 +67,7 @@ export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
const DEBUG_RNG = false;
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
export const startingWave = STARTING_WAVE_OVERRIDE || 1;
const expSpriteKeys: string[] = [];
@ -612,11 +612,9 @@ export default class BattleScene extends SceneBase {
}
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
if (Overrides.OPP_SPECIES_OVERRIDE)
species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE);
if (OPP_SPECIES_OVERRIDE)
species = getPokemonSpecies(OPP_SPECIES_OVERRIDE);
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);
overrideModifiers(this, false);
overrideHeldItems(this, pokemon, false);
if (boss && !dataSource) {
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
@ -707,7 +705,7 @@ export default class BattleScene extends SceneBase {
this.gameMode = gameModes[GameModes.CLASSIC];
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
this.setSeed(SEED_OVERRIDE || Utils.randomString(24));
console.log('Seed:', this.seed);
this.disableMenu = false;
@ -744,7 +742,7 @@ export default class BattleScene extends SceneBase {
[ this.luckLabelText, this.luckText ].map(t => t.setVisible(false));
this.newArena(Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN);
this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN);
this.arenaBgTransition.setPosition(0, 0);
this.arenaPlayer.setPosition(300, 0);
@ -844,7 +842,7 @@ export default class BattleScene extends SceneBase {
} else if (!battleConfig)
newDouble = !!double;
if (Overrides.DOUBLE_BATTLE_OVERRIDE)
if (DOUBLE_BATTLE_OVERRIDE)
newDouble = true;
const lastBattle = this.currentBattle;
@ -1769,19 +1767,6 @@ 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 {
const modifiersToRemove = this.enemyModifiers.filter(m => m instanceof PokemonHeldItemModifier);
for (let m of modifiersToRemove)

View File

@ -985,7 +985,7 @@ export class HighestStatBoostTag extends AbilityBattlerTag {
loadTag(source: BattlerTag | any): void {
super.loadTag(source);
this.stat = source.stat as Stat;
this.multiplier = source.multiplier;
this.multiplier = this.multiplier;
}
onAdd(pokemon: Pokemon): void {

View File

@ -1,6 +1,6 @@
import { Moves } from "./enums/moves";
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
import { BattleEndPhase, MovePhase, NewBattlePhase, PartyEffectPhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases";
import { BattleEndPhase, MovePhase, NewBattlePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases";
import { BattleStat, getBattleStatName } from "./battle-stat";
import { EncoreTag } from "./battler-tags";
import { BattlerTagType } from "./enums/battler-tag-type";
@ -50,8 +50,7 @@ export enum MoveTarget {
ALL,
USER_SIDE,
ENEMY_SIDE,
BOTH_SIDES,
PARTY
BOTH_SIDES
}
export enum MoveFlags {
@ -833,34 +832,6 @@ export class HealAttr extends MoveEffectAttr {
}
}
/**
* Cures the user's party of non-volatile status conditions, ie. Heal Bell, Aromatherapy
* @param {string} message Message to display after using move
* @param {Abilities} abilityCondition Skips mons with this ability, ie. Soundproof
*/
export class PartyStatusCureAttr extends MoveEffectAttr {
private message: string;
private abilityCondition: Abilities;
constructor(message: string, abilityCondition: Abilities) {
super();
this.message = message;
this.abilityCondition = abilityCondition;
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args))
return false;
this.addPartyCurePhase(user);
}
addPartyCurePhase(user: Pokemon) {
user.scene.unshiftPhase(new PartyStatusCurePhase(user.scene, user, this.message, this.abilityCondition));
}
}
export class SacrificialFullRestoreAttr extends SacrificialAttr {
constructor() {
super();
@ -4032,7 +4003,6 @@ export function getMoveTargets(user: Pokemon, move: Moves): MoveTargetSet {
switch (moveTarget) {
case MoveTarget.USER:
case MoveTarget.PARTY:
set = [ user];
break;
case MoveTarget.NEAR_OTHER:
@ -4658,9 +4628,9 @@ export function initMoves() {
.condition((user, target, move) => user.status?.effect === StatusEffect.SLEEP)
.ignoresVirtual(),
new StatusMove(Moves.HEAL_BELL, Type.NORMAL, -1, 5, -1, 0, 2)
.attr(PartyStatusCureAttr, "A bell chimed!", Abilities.SOUNDPROOF)
.soundBased()
.target(MoveTarget.PARTY),
.target(MoveTarget.USER_AND_ALLIES)
.unimplemented(),
new AttackMove(Moves.RETURN, Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, -1, 0, 2)
.attr(FriendshipPowerAttr),
new AttackMove(Moves.PRESENT, Type.NORMAL, MoveCategory.PHYSICAL, -1, 90, 15, -1, 0, 2)
@ -4931,8 +4901,8 @@ export function initMoves() {
.attr(MovePowerMultiplierAttr, (user, target, move) => [WeatherType.SUNNY, WeatherType.RAIN, WeatherType.SANDSTORM, WeatherType.HAIL, WeatherType.SNOW, WeatherType.FOG, WeatherType.HEAVY_RAIN, WeatherType.HARSH_SUN].includes(user.scene.arena.weather?.weatherType) && !user.scene.arena.weather?.isEffectSuppressed(user.scene) ? 2 : 1)
.ballBombMove(),
new StatusMove(Moves.AROMATHERAPY, Type.GRASS, -1, 5, -1, 0, 3)
.attr(PartyStatusCureAttr, "A soothing aroma wafted through the area!", Abilities.SAP_SIPPER)
.target(MoveTarget.PARTY),
.target(MoveTarget.USER_AND_ALLIES)
.unimplemented(),
new StatusMove(Moves.FAKE_TEARS, Type.DARK, 100, 20, -1, 0, 3)
.attr(StatChangeAttr, BattleStat.SPDEF, -2),
new AttackMove(Moves.AIR_CUTTER, Type.FLYING, MoveCategory.SPECIAL, 60, 95, 25, -1, 0, 3)

View File

@ -2313,7 +2313,7 @@ export function initSpecies() {
new PokemonSpecies(Species.QUAXWELL, 9, false, false, false, "Practicing Pokémon", Type.WATER, null, 1.2, 21.5, Abilities.TORRENT, Abilities.NONE, Abilities.MOXIE, 410, 70, 85, 65, 65, 60, 65, 45, 50, 144, GrowthRate.MEDIUM_SLOW, 87.5, false),
new PokemonSpecies(Species.QUAQUAVAL, 9, false, false, false, "Dancer Pokémon", Type.WATER, Type.FIGHTING, 1.8, 61.9, Abilities.TORRENT, Abilities.NONE, Abilities.MOXIE, 530, 85, 120, 80, 85, 75, 85, 45, 50, 265, GrowthRate.MEDIUM_SLOW, 87.5, false),
new PokemonSpecies(Species.LECHONK, 9, false, false, false, "Hog Pokémon", Type.NORMAL, null, 0.5, 10.2, Abilities.AROMA_VEIL, Abilities.GLUTTONY, Abilities.THICK_FAT, 254, 54, 45, 40, 35, 45, 35, 255, 50, 51, GrowthRate.MEDIUM_FAST, 50, false),
new PokemonSpecies(Species.OINKOLOGNE, 9, false, false, false, "Hog Pokémon", Type.NORMAL, null, 1, 120, Abilities.LINGERING_AROMA, Abilities.GLUTTONY, Abilities.THICK_FAT, 489, 110, 100, 75, 59, 80, 65, 100, 50, 171, GrowthRate.MEDIUM_FAST, 50, false, false,
new PokemonSpecies(Species.OINKOLOGNE, 9, false, false, false, "Hog Pokémon", Type.NORMAL, null, 1, 120, Abilities.LINGERING_AROMA, Abilities.GLUTTONY, Abilities.THICK_FAT, 489, 110, 100, 75, 59, 80, 65, 100, 50, 171, GrowthRate.MEDIUM_FAST, 100, false, false,
new PokemonForm("Male", "male", Type.NORMAL, null, 1, 120, Abilities.LINGERING_AROMA, Abilities.GLUTTONY, Abilities.THICK_FAT, 489, 110, 100, 75, 59, 80, 65, 100, 50, 171, false, ""),
new PokemonForm("Female", "female", Type.NORMAL, null, 1, 120, Abilities.AROMA_VEIL, Abilities.GLUTTONY, Abilities.THICK_FAT, 489, 115, 90, 70, 59, 90, 65, 100, 50, 171),
),

View File

@ -18,7 +18,7 @@ import { TimeOfDay } from "../data/enums/time-of-day";
import { Terrain, TerrainType } from "../data/terrain";
import { PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs } from "../data/ability";
import Pokemon from "./pokemon";
import * as Overrides from '../overrides';
import { WEATHER_OVERRIDE } from '../overrides';
export class Arena {
public scene: BattleScene;
@ -273,11 +273,6 @@ export class Arena {
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 {
this.weather = new Weather(weather, 0);
this.scene.unshiftPhase(new CommonAnimPhase(this.scene, undefined, undefined, CommonAnim.SUNNY + (weather - 1)));
@ -285,15 +280,10 @@ export class Arena {
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 {
if (Overrides.WEATHER_OVERRIDE)
return this.trySetWeatherOverride(Overrides.WEATHER_OVERRIDE);
// override hook for debugging
if (WEATHER_OVERRIDE)
return this.trySetWeatherOverride(WEATHER_OVERRIDE);
if (this.weather?.weatherType === (weather || undefined))
return false;

View File

@ -43,7 +43,7 @@ import { Nature, getNatureStatMultiplier } from '../data/nature';
import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms';
import { TerrainType } from '../data/terrain';
import { TrainerSlot } from '../data/trainer-config';
import * as Overrides from '../overrides';
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 { BerryType } from '../data/berry';
import i18next from '../plugins/i18n';
@ -725,14 +725,15 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
? this.summonData.moveset
: this.moveset;
// Overrides moveset based on arrays specified in overrides.ts
const overrideArray: Array<Moves> = this.isPlayer() ? Overrides.MOVESET_OVERRIDE : Overrides.OPP_MOVESET_OVERRIDE;
if (overrideArray.length > 0) {
overrideArray.forEach((move: Moves, index: number) => {
const ppUsed = this.moveset[index]?.ppUp || 0;
this.moveset[index] = new PokemonMove(move, Math.min(ppUsed, allMoves[move].pp))
});
}
if (MOVE_OVERRIDE && this.isPlayer())
this.moveset[0] = new PokemonMove(MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[MOVE_OVERRIDE].pp));
else if (OPP_MOVE_OVERRIDE && !this.isPlayer())
this.moveset[0] = new PokemonMove(OPP_MOVE_OVERRIDE, Math.min(this.moveset[0].ppUsed, allMoves[OPP_MOVE_OVERRIDE].pp));
if (MOVE_OVERRIDE_2 && this.isPlayer())
this.moveset[1] = new PokemonMove(MOVE_OVERRIDE_2, Math.min(this.moveset[1].ppUsed, allMoves[MOVE_OVERRIDE_2].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;
}
@ -797,10 +798,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
getAbility(ignoreOverride?: boolean): Ability {
if (!ignoreOverride && this.summonData?.ability)
return allAbilities[this.summonData.ability];
if (Overrides.ABILITY_OVERRIDE && this.isPlayer())
return allAbilities[Overrides.ABILITY_OVERRIDE];
if (Overrides.OPP_ABILITY_OVERRIDE && !this.isPlayer())
return allAbilities[Overrides.OPP_ABILITY_OVERRIDE];
if (ABILITY_OVERRIDE && this.isPlayer())
return allAbilities[ABILITY_OVERRIDE];
if (OPP_ABILITY_OVERRIDE && !this.isPlayer())
return allAbilities[OPP_ABILITY_OVERRIDE];
if (this.isFusion())
return allAbilities[this.getFusionSpeciesForm(ignoreOverride).getAbility(this.fusionAbilityIndex)];
let abilityId = this.getSpeciesForm(ignoreOverride).getAbility(this.abilityIndex);
@ -810,10 +811,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
getPassiveAbility(): Ability {
if (Overrides.PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
return allAbilities[Overrides.PASSIVE_ABILITY_OVERRIDE];
if (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
return allAbilities[Overrides.OPP_PASSIVE_ABILITY_OVERRIDE];
if (PASSIVE_ABILITY_OVERRIDE && this.isPlayer())
return allAbilities[PASSIVE_ABILITY_OVERRIDE];
if (OPP_PASSIVE_ABILITY_OVERRIDE && !this.isPlayer())
return allAbilities[OPP_PASSIVE_ABILITY_OVERRIDE];
let starterSpeciesId = this.species.speciesId;
while (pokemonPrevolutions.hasOwnProperty(starterSpeciesId))
@ -821,17 +822,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
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 {
// 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()))
if ((PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer()) || (OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer()))
return true;
return this.passive || this.isBoss();
}
@ -2700,14 +2692,14 @@ export class EnemyPokemon extends Pokemon {
this.generateAndPopulateMoveset();
this.trySetShiny();
if (Overrides.OPP_SHINY_OVERRIDE) {
if (OPP_SHINY_OVERRIDE) {
this.shiny = true;
this.initShinySparkle();
}
if (this.shiny) {
this.variant = this.generateVariant();
if (Overrides.OPP_VARIANT_OVERRIDE)
this.variant = Overrides.OPP_VARIANT_OVERRIDE;
if (OPP_VARIANT_OVERRIDE)
this.variant = OPP_VARIANT_OVERRIDE;
}
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);

View File

@ -5,7 +5,7 @@ import { Species } from "./data/enums/species";
import PokemonSpecies, { allSpecies } from "./data/pokemon-species";
import { Arena } from "./field/arena";
import * as Utils from "./utils";
import * as Overrides from './overrides';
import { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from './overrides';
export enum GameModes {
CLASSIC,
@ -45,15 +45,9 @@ export class GameMode implements GameModeConfig {
Object.assign(this, config);
}
/**
* @returns either:
* - override from overrides.ts
* - 20 for Daily Runs
* - 5 for all other modes
*/
getStartingLevel(): integer {
if (Overrides.STARTING_LEVEL_OVERRIDE)
return Overrides.STARTING_LEVEL_OVERRIDE;
if (STARTING_LEVEL_OVERRIDE)
return STARTING_LEVEL_OVERRIDE;
switch (this.modeId) {
case GameModes.DAILY:
return 20;
@ -62,28 +56,16 @@ export class GameMode implements GameModeConfig {
}
}
/**
* @returns either:
* - override from overrides.ts
* - 1000
*/
getStartingMoney(): integer {
return Overrides.STARTING_MONEY_OVERRIDE || 1000;
return STARTING_MONEY_OVERRIDE || 1000;
}
/**
* @param scene current BattleScene
* @returns either:
* - random biome for Daily mode
* - override from overrides.ts
* - Town
*/
getStartingBiome(scene: BattleScene): Biome {
switch (this.modeId) {
case GameModes.DAILY:
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
default:
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
return STARTING_BIOME_OVERRIDE || Biome.TOWN;
}
}

View File

@ -482,7 +482,7 @@ export const move: MoveTranslationEntries = {
effect: "Le lanceur explose en blessant tous les Pokémon autour de lui. Le lanceur tombe K.O."
},
"eggBomb": {
name: "Bombe Œuf",
name: "Bombe Oeuf",
effect: "De toutes ses forces, le lanceur jette un gros œuf sur lennemi pour lui infliger des dégâts."
},
"lick": {
@ -1426,7 +1426,7 @@ export const move: MoveTranslationEntries = {
effect: "Pendant cinq tours, les Pokémon Vol ou qui ont Lévitation deviennent sensibles aux capacités Sol, et les capacités volantes deviennent inutilisables."
},
"miracleEye": {
name: "Œil Miracle",
name: "Oeil Miracle",
effect: "Permet de toucher un Pokémon Ténèbres avec les capacités de type Psy ou de toucher un ennemi ayant beaucoup desquive."
},
"wakeUpSlap": {
@ -1562,8 +1562,8 @@ export const move: MoveTranslationEntries = {
effect: "Le lanceur éparpille des pics autour de la cible, ce qui empoisonne les Pokémon entrant au combat de ce côté."
},
"heartSwap": {
name: "Permucœur",
effect: "Le lanceur utilise un pouvoir psychique pour échanger ses changements de stats avec la cible."
name: "Permucoeur",
effect: "Cette capacité ne peut pas être utilisée. Il est recommandé de loublier, même sil sera impossible de se la remémorer une fois oubliée."
},
"aquaRing": {
name: "Anneau Hydro",
@ -2122,7 +2122,7 @@ export const move: MoveTranslationEntries = {
effect: "Le lanceur frappe lennemi deux fois daffilée avec les parties les plus robustes de son corps."
},
"heartStamp": {
name: "Crève-Cœur",
name: "Crève-Coeur",
effect: "Déconcentre lennemi avec des mouvements mignons avant de le frapper violemment. Peut aussi lapeurer (30% de chances)."
},
"hornLeech": {
@ -3742,7 +3742,7 @@ export const move: MoveTranslationEntries = {
effect: "Le lanceur remue son thé et en bombarde la cible. La moitié des dégâts infligés sont convertis en PV pour le lanceur. Cette capacité peut aussi brûler la cible."
},
"syrupBomb": {
name: "Bombe au Sirop",
name: "Bombe au sirop",
effect: "Le lanceur jette une bombe qui recouvre la cible de sirop gluant et fait progressivement baisser la Vitesse de la cible pendant trois tours."
},
"ivyCudgel": {

View File

@ -19,9 +19,8 @@ import { VoucherType } from '../system/voucher';
import { FormChangeItem, SpeciesFormChangeItemTrigger } from '../data/pokemon-forms';
import { Nature } from '#app/data/nature';
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;
const iconOverflowIndex = 24;
@ -2177,62 +2176,3 @@ export class EnemyFusionChanceModifier extends EnemyPersistentModifier {
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);
}
});
}

View File

@ -3,84 +3,26 @@ import { Abilities } from "./data/enums/abilities";
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
* if an override name starts with "STARTING", it will apply when a new run begins
*/
export const SEED_OVERRIDE = '';
export const STARTER_SPECIES_OVERRIDE = 0;
export const STARTER_FORM_OVERRIDE = 0;
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;
/**
* 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
*/
// 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 ABILITY_OVERRIDE = Abilities.NONE;
export const PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
export const MOVE_OVERRIDE = Moves.NONE;
export const MOVE_OVERRIDE_2 = Moves.NONE;
export const OPP_SPECIES_OVERRIDE = 0;
export const OPP_ABILITY_OVERRIDE = Abilities.NONE;
export const OPP_PASSIVE_ABILITY_OVERRIDE = Abilities.NONE;
export const OPP_MOVESET_OVERRIDE: Array<Moves> = [];
export const OPP_SHINY_OVERRIDE: boolean = false;
export const OPP_VARIANT_OVERRIDE: Variant = 0;
export const OPP_MOVE_OVERRIDE = Moves.NONE;
export const OPP_MOVE_OVERRIDE_2 = Moves.NONE;
/**
* 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> = [];
export const OPP_SHINY_OVERRIDE = false;
export const OPP_VARIANT_OVERRIDE = 0;

View File

@ -6,7 +6,7 @@ import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMov
import { Mode } from './ui/ui';
import { Command } from "./ui/command-ui-handler";
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, overrideModifiers, overrideHeldItems } 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 } from "./modifier/modifier";
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
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 i18next from './plugins/i18n';
import { Abilities } from "./data/enums/abilities";
import * as Overrides from './overrides';
import { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE } from './overrides';
export class LoginPhase extends Phase {
private showText: boolean;
@ -487,12 +487,12 @@ export class SelectStarterPhase extends Phase {
const party = this.scene.getParty();
const loadPokemonAssets: Promise<void>[] = [];
starters.forEach((starter: Starter, i: integer) => {
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
if (!i && STARTER_SPECIES_OVERRIDE)
starter.species = getPokemonSpecies(STARTER_SPECIES_OVERRIDE as Species);
const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr);
let starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0));
if (!i && Overrides.STARTER_SPECIES_OVERRIDE)
starterFormIndex = Overrides.STARTER_FORM_OVERRIDE;
if (!i && STARTER_SPECIES_OVERRIDE)
starterFormIndex = STARTER_FORM_OVERRIDE;
const starterGender = starter.species.malePercent !== null
? !starterProps.female ? Gender.MALE : Gender.FEMALE
: Gender.GENDERLESS;
@ -510,8 +510,6 @@ export class SelectStarterPhase extends Phase {
party.push(starterPokemon);
loadPokemonAssets.push(starterPokemon.loadAssets());
});
overrideModifiers(this.scene);
overrideHeldItems(this.scene, party[0]);
Promise.all(loadPokemonAssets).then(() => {
SoundFade.fadeOut(this.scene, this.scene.sound.get('menu'), 500, true);
this.scene.time.delayedCall(500, () => this.scene.playBgm());
@ -4546,48 +4544,6 @@ export class AddEnemyBuffModifierPhase extends Phase {
}
}
/**
* Cures the party of all non-volatile status conditions, shows a message
* @param {BattleScene} scene The current scene
* @param {Pokemon} user The user of the move that cures the party
* @param {string} message The message that should be displayed
* @param {Abilities} abilityCondition Pokemon with this ability will not be affected ie. Soundproof
*/
export class PartyStatusCurePhase extends BattlePhase {
private user: Pokemon;
private message: string;
private abilityCondition: Abilities;
constructor(scene: BattleScene, user: Pokemon, message: string, abilityCondition: Abilities) {
super(scene);
this.user = user;
this.message = message;
this.abilityCondition = abilityCondition;
}
start() {
super.start();
for (let pokemon of this.scene.getParty()) {
if (!pokemon.isOnField() || pokemon === this.user) {
pokemon.resetStatus(false);
pokemon.updateInfo(true);
} else {
if (!pokemon.hasAbility(this.abilityCondition)) {
pokemon.resetStatus();
pokemon.updateInfo(true);
} else {
// Manually show ability bar, since we're not hooked into the targeting system
pokemon.scene.unshiftPhase(new ShowAbilityPhase(pokemon.scene, pokemon.id, pokemon.getPassiveAbility()?.id === this.abilityCondition));
}
}
}
if (this.message)
this.scene.queueMessage(this.message);
this.end();
}
}
export class PartyHealPhase extends BattlePhase {
private resumeBgm: boolean;