Merge branch 'beta' into deep-sea-items
This commit is contained in:
commit
986cd0d600
|
@ -37,7 +37,7 @@ jobs:
|
|||
- name: Setup Node 22.14.1
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
node-version-file: "pokerogue_docs/.nvmrc"
|
||||
|
||||
- name: Checkout repository for Github Pages
|
||||
if: github.event_name == 'push'
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"src/overrides.ts",
|
||||
// TODO: these files are too big and complex, ignore them until their respective refactors
|
||||
"src/data/moves/move.ts",
|
||||
"src/data/ability.ts",
|
||||
"src/data/abilities/ability.ts",
|
||||
"src/field/pokemon.ts",
|
||||
|
||||
// this file is just too big:
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
|
||||
import type Move from "#app/data/moves/move";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import type { BattleStat } from "#enums/stat";
|
||||
|
||||
export type AbAttrApplyFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => void;
|
||||
export type AbAttrSuccessFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => boolean;
|
||||
export type AbAttrCondition = (pokemon: Pokemon) => boolean;
|
||||
export type PokemonAttackCondition = (user: Pokemon | null, target: Pokemon | null, move: Move) => boolean;
|
||||
export type PokemonDefendCondition = (target: Pokemon, user: Pokemon, move: Move) => boolean;
|
||||
export type PokemonStatStageChangeCondition = (target: Pokemon, statsChanged: BattleStat[], stages: number) => boolean;
|
|
@ -1,7 +1,7 @@
|
|||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
import type { UserInfo } from "#app/@types/UserInfo";
|
||||
import { bypassLogin } from "#app/battle-scene";
|
||||
import { randomString } from "#app/utils";
|
||||
import { bypassLogin } from "./global-vars/bypass-login";
|
||||
import { randomString } from "#app/utils/common";
|
||||
|
||||
export let loggedInUser: UserInfo | null = null;
|
||||
// This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
isNullOrUndefined,
|
||||
BooleanHolder,
|
||||
type Constructor,
|
||||
} from "#app/utils";
|
||||
} from "#app/utils/common";
|
||||
import type { Modifier, ModifierPredicate, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
||||
import {
|
||||
ConsumableModifier,
|
||||
|
@ -67,7 +67,6 @@ import {
|
|||
} from "#app/modifier/modifier-type";
|
||||
import AbilityBar from "#app/ui/ability-bar";
|
||||
import {
|
||||
allAbilities,
|
||||
applyAbAttrs,
|
||||
applyPostBattleInitAbAttrs,
|
||||
applyPostItemLostAbAttrs,
|
||||
|
@ -75,9 +74,11 @@ import {
|
|||
DoubleBattleChanceAbAttr,
|
||||
PostBattleInitAbAttr,
|
||||
PostItemLostAbAttr,
|
||||
} from "#app/data/ability";
|
||||
} from "#app/data/abilities/ability";
|
||||
import { allAbilities } from "./data/data-lists";
|
||||
import type { FixedBattleConfig } from "#app/battle";
|
||||
import Battle, { BattleType } from "#app/battle";
|
||||
import Battle from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import type { GameMode } from "#app/game-mode";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
import FieldSpritePipeline from "#app/pipelines/field-sprite";
|
||||
|
@ -184,8 +185,8 @@ import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
|
|||
import { expSpriteKeys } from "./sprites/sprite-keys";
|
||||
import { hasExpSprite } from "./sprites/sprite-utils";
|
||||
import { timedEventManager } from "./global-event-manager";
|
||||
|
||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||
import { starterColors } from "./global-vars/starter-colors";
|
||||
import { startingWave } from "./starting-wave";
|
||||
|
||||
const DEBUG_RNG = false;
|
||||
|
||||
|
@ -193,13 +194,6 @@ const OPP_IVS_OVERRIDE_VALIDATED: number[] = (
|
|||
Array.isArray(Overrides.OPP_IVS_OVERRIDE) ? Overrides.OPP_IVS_OVERRIDE : new Array(6).fill(Overrides.OPP_IVS_OVERRIDE)
|
||||
).map(iv => (Number.isNaN(iv) || iv === null || iv > 31 ? -1 : iv));
|
||||
|
||||
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
|
||||
|
||||
export let starterColors: StarterColors;
|
||||
interface StarterColors {
|
||||
[key: string]: [string, string];
|
||||
}
|
||||
|
||||
export interface PokeballCounts {
|
||||
[pb: string]: number;
|
||||
}
|
||||
|
@ -809,11 +803,11 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
|
||||
async initStarterColors(): Promise<void> {
|
||||
if (starterColors) {
|
||||
if (Object.keys(starterColors).length > 0) {
|
||||
// already initialized
|
||||
return;
|
||||
}
|
||||
const sc = await this.cachedFetch("./starter-colors.json").then(res => res.json());
|
||||
starterColors = {};
|
||||
for (const key of Object.keys(sc)) {
|
||||
starterColors[key] = sc[key];
|
||||
}
|
||||
|
@ -1338,22 +1332,27 @@ export default class BattleScene extends SceneBase {
|
|||
} else {
|
||||
if (
|
||||
!this.gameMode.hasTrainers ||
|
||||
Overrides.BATTLE_TYPE_OVERRIDE === BattleType.WILD ||
|
||||
(Overrides.DISABLE_STANDARD_TRAINERS_OVERRIDE && isNullOrUndefined(trainerData))
|
||||
) {
|
||||
newBattleType = BattleType.WILD;
|
||||
} else if (battleType === undefined) {
|
||||
newBattleType = this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD;
|
||||
} else {
|
||||
newBattleType = battleType;
|
||||
newBattleType =
|
||||
Overrides.BATTLE_TYPE_OVERRIDE ??
|
||||
battleType ??
|
||||
(this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD);
|
||||
}
|
||||
|
||||
if (newBattleType === BattleType.TRAINER) {
|
||||
const trainerType = this.arena.randomTrainerType(newWaveIndex);
|
||||
const trainerType =
|
||||
Overrides.RANDOM_TRAINER_OVERRIDE?.trainerType ?? this.arena.randomTrainerType(newWaveIndex);
|
||||
let doubleTrainer = false;
|
||||
if (trainerConfigs[trainerType].doubleOnly) {
|
||||
doubleTrainer = true;
|
||||
} else if (trainerConfigs[trainerType].hasDouble) {
|
||||
doubleTrainer = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
|
||||
doubleTrainer =
|
||||
Overrides.RANDOM_TRAINER_OVERRIDE?.alwaysDouble ||
|
||||
!randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
|
||||
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
|
||||
if (
|
||||
trainerConfigs[trainerType].trainerTypeDouble &&
|
||||
|
@ -1373,7 +1372,10 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
// Check for mystery encounter
|
||||
// Can only occur in place of a standard (non-boss) wild battle, waves 10-180
|
||||
if (this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||
if (
|
||||
!Overrides.BATTLE_TYPE_OVERRIDE &&
|
||||
(this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER)
|
||||
) {
|
||||
newBattleType = BattleType.MYSTERY_ENCOUNTER;
|
||||
// Reset to base spawn weight
|
||||
this.mysteryEncounterSaveData.encounterSpawnChance = BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT;
|
||||
|
@ -1383,9 +1385,9 @@ export default class BattleScene extends SceneBase {
|
|||
if (double === undefined && newWaveIndex > 1) {
|
||||
if (newBattleType === BattleType.WILD && !this.gameMode.isWaveFinal(newWaveIndex)) {
|
||||
newDouble = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
|
||||
} else if (newBattleType === BattleType.TRAINER) {
|
||||
newDouble = newTrainer?.variant === TrainerVariant.DOUBLE;
|
||||
}
|
||||
} else if (double === undefined && newBattleType === BattleType.TRAINER) {
|
||||
newDouble = newTrainer?.variant === TrainerVariant.DOUBLE;
|
||||
} else if (!battleConfig) {
|
||||
newDouble = !!double;
|
||||
}
|
||||
|
@ -1395,10 +1397,10 @@ export default class BattleScene extends SceneBase {
|
|||
newDouble = false;
|
||||
}
|
||||
|
||||
if (!isNullOrUndefined(Overrides.BATTLE_TYPE_OVERRIDE)) {
|
||||
if (!isNullOrUndefined(Overrides.BATTLE_STYLE_OVERRIDE)) {
|
||||
let doubleOverrideForWave: "single" | "double" | null = null;
|
||||
|
||||
switch (Overrides.BATTLE_TYPE_OVERRIDE) {
|
||||
switch (Overrides.BATTLE_STYLE_OVERRIDE) {
|
||||
case "double":
|
||||
doubleOverrideForWave = "double";
|
||||
break;
|
||||
|
@ -1418,7 +1420,7 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
/**
|
||||
* Override battles into single only if not fighting with trainers.
|
||||
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 | GitHub Issue #1948}
|
||||
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 GitHub Issue #1948}
|
||||
*/
|
||||
if (newBattleType !== BattleType.TRAINER && doubleOverrideForWave === "single") {
|
||||
newDouble = false;
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
shiftCharCodes,
|
||||
randSeedItem,
|
||||
randInt,
|
||||
} from "#app/utils";
|
||||
} from "#app/utils/common";
|
||||
import Trainer, { TrainerVariant } from "./field/trainer";
|
||||
import type { GameMode } from "./game-mode";
|
||||
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
|
||||
|
@ -30,6 +30,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
|||
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
|
||||
export enum ClassicFixedBossWaves {
|
||||
TOWN_YOUNGSTER = 5,
|
||||
|
@ -54,13 +55,6 @@ export enum ClassicFixedBossWaves {
|
|||
RIVAL_6 = 195,
|
||||
}
|
||||
|
||||
export enum BattleType {
|
||||
WILD,
|
||||
TRAINER,
|
||||
CLEAR,
|
||||
MYSTERY_ENCOUNTER,
|
||||
}
|
||||
|
||||
export enum BattlerIndex {
|
||||
ATTACKER = -1,
|
||||
PLAYER,
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import type { AbAttrCondition } from "#app/@types/ability-types";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import type { BooleanHolder } from "#app/utils/common";
|
||||
|
||||
export abstract class AbAttr {
|
||||
public showAbility: boolean;
|
||||
private extraCondition: AbAttrCondition;
|
||||
|
||||
constructor(showAbility = true) {
|
||||
this.showAbility = showAbility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies ability effects without checking conditions
|
||||
* @param _pokemon - The pokemon to apply this ability to
|
||||
* @param _passive - Whether or not the ability is a passive
|
||||
* @param _simulated - Whether the call is simulated
|
||||
* @param _args - Extra args passed to the function. Handled by child classes.
|
||||
* @see {@linkcode canApply}
|
||||
*/
|
||||
apply(
|
||||
_pokemon: Pokemon,
|
||||
_passive: boolean,
|
||||
_simulated: boolean,
|
||||
_cancelled: BooleanHolder | null,
|
||||
_args: any[],
|
||||
): void {}
|
||||
|
||||
getTriggerMessage(_pokemon: Pokemon, _abilityName: string, ..._args: any[]): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
getCondition(): AbAttrCondition | null {
|
||||
return this.extraCondition || null;
|
||||
}
|
||||
|
||||
addCondition(condition: AbAttrCondition): AbAttr {
|
||||
this.extraCondition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean describing whether the ability can be applied under current conditions
|
||||
* @param _pokemon - The pokemon to apply this ability to
|
||||
* @param _passive - Whether or not the ability is a passive
|
||||
* @param _simulated - Whether the call is simulated
|
||||
* @param _args - Extra args passed to the function. Handled by child classes.
|
||||
* @returns `true` if the ability can be applied, `false` otherwise
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
canApply(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, _args: any[]): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
import { Abilities } from "#enums/abilities";
|
||||
import type { AbAttrCondition } from "#app/@types/ability-types";
|
||||
import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
|
||||
import i18next from "i18next";
|
||||
import type { Localizable } from "#app/interfaces/locales";
|
||||
import type { Constructor } from "#app/utils/common";
|
||||
|
||||
export class Ability implements Localizable {
|
||||
public id: Abilities;
|
||||
|
||||
private nameAppend: string;
|
||||
public name: string;
|
||||
public description: string;
|
||||
public generation: number;
|
||||
public isBypassFaint: boolean;
|
||||
public isIgnorable: boolean;
|
||||
public isSuppressable = true;
|
||||
public isCopiable = true;
|
||||
public isReplaceable = true;
|
||||
public attrs: AbAttr[];
|
||||
public conditions: AbAttrCondition[];
|
||||
|
||||
constructor(id: Abilities, generation: number) {
|
||||
this.id = id;
|
||||
|
||||
this.nameAppend = "";
|
||||
this.generation = generation;
|
||||
this.attrs = [];
|
||||
this.conditions = [];
|
||||
|
||||
this.isSuppressable = true;
|
||||
this.isCopiable = true;
|
||||
this.isReplaceable = true;
|
||||
|
||||
this.localize();
|
||||
}
|
||||
|
||||
public get isSwappable(): boolean {
|
||||
return this.isCopiable && this.isReplaceable;
|
||||
}
|
||||
localize(): void {
|
||||
const i18nKey = Abilities[this.id]
|
||||
.split("_")
|
||||
.filter(f => f)
|
||||
.map((f, i) => (i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()))
|
||||
.join("") as string;
|
||||
|
||||
this.name = this.id ? `${i18next.t(`ability:${i18nKey}.name`) as string}${this.nameAppend}` : "";
|
||||
this.description = this.id ? (i18next.t(`ability:${i18nKey}.description`) as string) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all ability attributes that match `attrType`
|
||||
* @param attrType any attribute that extends {@linkcode AbAttr}
|
||||
* @returns Array of attributes that match `attrType`, Empty Array if none match.
|
||||
*/
|
||||
getAttrs<T extends AbAttr>(attrType: Constructor<T>): T[] {
|
||||
return this.attrs.filter((a): a is T => a instanceof attrType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an ability has an attribute that matches `attrType`
|
||||
* @param attrType any attribute that extends {@linkcode AbAttr}
|
||||
* @returns true if the ability has attribute `attrType`
|
||||
*/
|
||||
hasAttr<T extends AbAttr>(attrType: Constructor<T>): boolean {
|
||||
return this.attrs.some(attr => attr instanceof attrType);
|
||||
}
|
||||
|
||||
attr<T extends Constructor<AbAttr>>(AttrType: T, ...args: ConstructorParameters<T>): Ability {
|
||||
const attr = new AttrType(...args);
|
||||
this.attrs.push(attr);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
conditionalAttr<T extends Constructor<AbAttr>>(
|
||||
condition: AbAttrCondition,
|
||||
AttrType: T,
|
||||
...args: ConstructorParameters<T>
|
||||
): Ability {
|
||||
const attr = new AttrType(...args);
|
||||
attr.addCondition(condition);
|
||||
this.attrs.push(attr);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bypassFaint(): Ability {
|
||||
this.isBypassFaint = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
ignorable(): Ability {
|
||||
this.isIgnorable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
unsuppressable(): Ability {
|
||||
this.isSuppressable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
uncopiable(): Ability {
|
||||
this.isCopiable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
unreplaceable(): Ability {
|
||||
this.isReplaceable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
condition(condition: AbAttrCondition): Ability {
|
||||
this.conditions.push(condition);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
partial(): this {
|
||||
this.nameAppend += " (P)";
|
||||
return this;
|
||||
}
|
||||
|
||||
unimplemented(): this {
|
||||
this.nameAppend += " (N)";
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal flag used for developers to document edge cases. When using this, please be sure to document the edge case.
|
||||
* @returns the ability
|
||||
*/
|
||||
edgeCase(): this {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,228 +1,77 @@
|
|||
import type { EnemyPokemon, PokemonMove } from "../field/pokemon";
|
||||
import type Pokemon from "../field/pokemon";
|
||||
import { HitResult, MoveResult, PlayerPokemon } from "../field/pokemon";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue, isNullOrUndefined, randSeedItem, randSeedInt, type Constructor } from "#app/utils";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import type { Weather } from "#app/data/weather";
|
||||
import type { BattlerTag } from "./battler-tags";
|
||||
import { BattlerTagLapseType, GroundedTag } from "./battler-tags";
|
||||
import { HitResult, MoveResult, PlayerPokemon } from "#app/field/pokemon";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue, isNullOrUndefined, randSeedItem, randSeedInt, type Constructor } from "#app/utils/common";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { BattlerTagLapseType, GroundedTag } from "#app/data/battler-tags";
|
||||
import { getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "#app/data/status-effect";
|
||||
import { Gender } from "./gender";
|
||||
import type Move from "./moves/move";
|
||||
import { AttackMove, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./moves/move";
|
||||
import { MoveFlags } from "#enums/MoveFlags";
|
||||
import { MoveTarget } from "#enums/MoveTarget";
|
||||
import { MoveCategory } from "#enums/MoveCategory";
|
||||
import type { ArenaTrapTag, SuppressAbilitiesTag } from "./arena-tag";
|
||||
import { ArenaTagSide } from "./arena-tag";
|
||||
import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "../modifier/modifier";
|
||||
import { TerrainType } from "./terrain";
|
||||
import { SpeciesFormChangeAbilityTrigger, SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "./pokemon-forms";
|
||||
import { Gender } from "#app/data/gender";
|
||||
import {
|
||||
AttackMove,
|
||||
FlinchAttr,
|
||||
OneHitKOAttr,
|
||||
HitHealAttr,
|
||||
allMoves,
|
||||
StatusMove,
|
||||
SelfStatusMove,
|
||||
VariablePowerAttr,
|
||||
applyMoveAttrs,
|
||||
VariableMoveTypeAttr,
|
||||
RandomMovesetMoveAttr,
|
||||
RandomMoveAttr,
|
||||
NaturePowerAttr,
|
||||
CopyMoveAttr,
|
||||
NeutralDamageAgainstFlyingTypeMultiplierAttr,
|
||||
FixedDamageAttr,
|
||||
} from "#app/data/moves/move";
|
||||
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||
import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { SpeciesFormChangeAbilityTrigger, SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "#app/data/pokemon-forms";
|
||||
import i18next from "i18next";
|
||||
import type { Localizable } from "#app/interfaces/locales";
|
||||
import { Command } from "../ui/command-ui-handler";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { BerryModifierType } from "#app/modifier/modifier-type";
|
||||
import { getPokeballName } from "./pokeball";
|
||||
import type { BattlerIndex } from "#app/battle";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { Stat, type BattleStat, type EffectiveStat, BATTLE_STATS, EFFECTIVE_STATS, getStatKey } from "#app/enums/stat";
|
||||
import { getPokeballName } from "#app/data/pokeball";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { MovePhase } from "#app/phases/move-phase";
|
||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { SwitchType } from "#app/enums/switch-type";
|
||||
import { SwitchPhase } from "#app/phases/switch-phase";
|
||||
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
||||
import { BattleEndPhase } from "#app/phases/battle-end-phase";
|
||||
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||
import { PokemonTransformPhase } from "#app/phases/pokemon-transform-phase";
|
||||
import { allAbilities } from "#app/data/data-lists";
|
||||
import { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
|
||||
import { Ability } from "#app/data/abilities/ability-class";
|
||||
import { TrainerVariant } from "#app/field/trainer";
|
||||
|
||||
// Enum imports
|
||||
import { Stat, type BattleStat , BATTLE_STATS, EFFECTIVE_STATS, getStatKey, type EffectiveStat } from "#enums/stat";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { PokemonTransformPhase } from "#app/phases/pokemon-transform-phase";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { SwitchType } from "#enums/switch-type";
|
||||
import { MoveFlags } from "#enums/MoveFlags";
|
||||
import { MoveTarget } from "#enums/MoveTarget";
|
||||
import { MoveCategory } from "#enums/MoveCategory";
|
||||
|
||||
export class Ability implements Localizable {
|
||||
public id: Abilities;
|
||||
|
||||
private nameAppend: string;
|
||||
public name: string;
|
||||
public description: string;
|
||||
public generation: number;
|
||||
public isBypassFaint: boolean;
|
||||
public isIgnorable: boolean;
|
||||
public isSuppressable = true;
|
||||
public isCopiable = true;
|
||||
public isReplaceable = true;
|
||||
public attrs: AbAttr[];
|
||||
public conditions: AbAttrCondition[];
|
||||
|
||||
constructor(id: Abilities, generation: number) {
|
||||
this.id = id;
|
||||
|
||||
this.nameAppend = "";
|
||||
this.generation = generation;
|
||||
this.attrs = [];
|
||||
this.conditions = [];
|
||||
|
||||
this.isSuppressable = true;
|
||||
this.isCopiable = true;
|
||||
this.isReplaceable = true;
|
||||
|
||||
this.localize();
|
||||
}
|
||||
|
||||
public get isSwappable(): boolean {
|
||||
return this.isCopiable && this.isReplaceable;
|
||||
}
|
||||
localize(): void {
|
||||
const i18nKey = Abilities[this.id].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("") as string;
|
||||
|
||||
this.name = this.id ? `${i18next.t(`ability:${i18nKey}.name`) as string}${this.nameAppend}` : "";
|
||||
this.description = this.id ? i18next.t(`ability:${i18nKey}.description`) as string : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all ability attributes that match `attrType`
|
||||
* @param attrType any attribute that extends {@linkcode AbAttr}
|
||||
* @returns Array of attributes that match `attrType`, Empty Array if none match.
|
||||
*/
|
||||
getAttrs<T extends AbAttr>(attrType: Constructor<T> ): T[] {
|
||||
return this.attrs.filter((a): a is T => a instanceof attrType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an ability has an attribute that matches `attrType`
|
||||
* @param attrType any attribute that extends {@linkcode AbAttr}
|
||||
* @returns true if the ability has attribute `attrType`
|
||||
*/
|
||||
hasAttr<T extends AbAttr>(attrType: Constructor<T>): boolean {
|
||||
return this.attrs.some((attr) => attr instanceof attrType);
|
||||
}
|
||||
|
||||
attr<T extends Constructor<AbAttr>>(AttrType: T, ...args: ConstructorParameters<T>): Ability {
|
||||
const attr = new AttrType(...args);
|
||||
this.attrs.push(attr);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
conditionalAttr<T extends Constructor<AbAttr>>(condition: AbAttrCondition, AttrType: T, ...args: ConstructorParameters<T>): Ability {
|
||||
const attr = new AttrType(...args);
|
||||
attr.addCondition(condition);
|
||||
this.attrs.push(attr);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bypassFaint(): Ability {
|
||||
this.isBypassFaint = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
ignorable(): Ability {
|
||||
this.isIgnorable = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
unsuppressable(): Ability {
|
||||
this.isSuppressable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
uncopiable(): Ability {
|
||||
this.isCopiable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
unreplaceable(): Ability {
|
||||
this.isReplaceable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
condition(condition: AbAttrCondition): Ability {
|
||||
this.conditions.push(condition);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
partial(): this {
|
||||
this.nameAppend += " (P)";
|
||||
return this;
|
||||
}
|
||||
|
||||
unimplemented(): this {
|
||||
this.nameAppend += " (N)";
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal flag used for developers to document edge cases. When using this, please be sure to document the edge case.
|
||||
* @returns the ability
|
||||
*/
|
||||
edgeCase(): this {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
type AbAttrApplyFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => void;
|
||||
type AbAttrSuccessFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => boolean;
|
||||
type AbAttrCondition = (pokemon: Pokemon) => boolean;
|
||||
|
||||
// TODO: Can this be improved?
|
||||
type PokemonAttackCondition = (user: Pokemon | null, target: Pokemon | null, move: Move) => boolean;
|
||||
type PokemonDefendCondition = (target: Pokemon, user: Pokemon, move: Move) => boolean;
|
||||
type PokemonStatStageChangeCondition = (target: Pokemon, statsChanged: BattleStat[], stages: number) => boolean;
|
||||
|
||||
export abstract class AbAttr {
|
||||
public showAbility: boolean;
|
||||
private extraCondition: AbAttrCondition;
|
||||
|
||||
constructor(showAbility = true) {
|
||||
this.showAbility = showAbility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies ability effects without checking conditions
|
||||
* @param pokemon - The pokemon to apply this ability to
|
||||
* @param passive - Whether or not the ability is a passive
|
||||
* @param simulated - Whether the call is simulated
|
||||
* @param args - Extra args passed to the function. Handled by child classes.
|
||||
* @see {@linkcode canApply}
|
||||
*/
|
||||
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: BooleanHolder | null, args: any[]): void {}
|
||||
|
||||
getTriggerMessage(_pokemon: Pokemon, _abilityName: string, ..._args: any[]): string | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
getCondition(): AbAttrCondition | null {
|
||||
return this.extraCondition || null;
|
||||
}
|
||||
|
||||
addCondition(condition: AbAttrCondition): AbAttr {
|
||||
this.extraCondition = condition;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean describing whether the ability can be applied under current conditions
|
||||
* @param pokemon - The pokemon to apply this ability to
|
||||
* @param passive - Whether or not the ability is a passive
|
||||
* @param simulated - Whether the call is simulated
|
||||
* @param args - Extra args passed to the function. Handled by child classes.
|
||||
* @returns `true` if the ability can be applied, `false` otherwise
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Type imports
|
||||
import type { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import type { Weather } from "#app/data/weather";
|
||||
import type { BattlerTag } from "#app/data/battler-tags";
|
||||
import type { AbAttrCondition, PokemonDefendCondition, PokemonStatStageChangeCondition, PokemonAttackCondition, AbAttrApplyFunc, AbAttrSuccessFunc } from "#app/@types/ability-types";
|
||||
import type { BattlerIndex } from "#app/battle";
|
||||
import type Move from "#app/data/moves/move";
|
||||
import type { ArenaTrapTag, SuppressAbilitiesTag } from "#app/data/arena-tag";
|
||||
|
||||
export class BlockRecoilDamageAttr extends AbAttr {
|
||||
constructor() {
|
||||
|
@ -233,7 +82,7 @@ export class BlockRecoilDamageAttr extends AbAttr {
|
|||
cancelled.value = true;
|
||||
}
|
||||
|
||||
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) {
|
||||
getTriggerMessage(pokemon: Pokemon, abilityName: string, ..._args: any[]) {
|
||||
return i18next.t("abilityTriggers:blockRecoilDamage", { pokemonName: getPokemonNameWithAffix(pokemon), abilityName: abilityName });
|
||||
}
|
||||
}
|
||||
|
@ -4186,7 +4035,9 @@ export class PostTurnResetStatusAbAttr extends PostTurnAbAttr {
|
|||
} else {
|
||||
this.target = pokemon;
|
||||
}
|
||||
return !isNullOrUndefined(this.target?.status);
|
||||
|
||||
const effect = this.target?.status?.effect;
|
||||
return !!effect && effect !== StatusEffect.FAINT;
|
||||
}
|
||||
|
||||
override applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): void {
|
||||
|
@ -5677,8 +5528,8 @@ class ForceSwitchOutHelper {
|
|||
|
||||
const party = player ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
||||
return (!player && globalScene.currentBattle.battleType === BattleType.WILD)
|
||||
|| party.filter(p => p.isAllowedInBattle()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > globalScene.currentBattle.getBattlerCount();
|
||||
|| party.filter(p => p.isAllowedInBattle() && !p.isOnField()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6453,10 +6304,9 @@ function getPokemonWithWeatherBasedForms() {
|
|||
);
|
||||
}
|
||||
|
||||
export const allAbilities = [ new Ability(Abilities.NONE, 3) ];
|
||||
|
||||
export function initAbilities() {
|
||||
allAbilities.push(
|
||||
new Ability(Abilities.NONE, 3),
|
||||
new Ability(Abilities.STENCH, 3)
|
||||
.attr(PostAttackApplyBattlerTagAbAttr, false, (user, target, move) => !move.hasAttr(FlinchAttr) && !move.hitsSubstitute(user, target) ? 10 : 0, BattlerTagType.FLINCHED),
|
||||
new Ability(Abilities.DRIZZLE, 3)
|
||||
|
@ -6853,11 +6703,11 @@ export function initAbilities() {
|
|||
new Ability(Abilities.BAD_DREAMS, 4)
|
||||
.attr(PostTurnHurtIfSleepingAbAttr),
|
||||
new Ability(Abilities.PICKPOCKET, 5)
|
||||
.attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT))
|
||||
.attr(PostDefendStealHeldItemAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target}))
|
||||
.condition(getSheerForceHitDisableAbCondition()),
|
||||
new Ability(Abilities.SHEER_FORCE, 5)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.chance >= 1, 5461 / 4096)
|
||||
.attr(MoveEffectChanceMultiplierAbAttr, 0), // Should disable life orb, eject button, red card, kee/maranga berry if they get implemented
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.chance >= 1, 1.3)
|
||||
.attr(MoveEffectChanceMultiplierAbAttr, 0), // This attribute does not seem to function - Should disable life orb, eject button, red card, kee/maranga berry if they get implemented
|
||||
new Ability(Abilities.CONTRARY, 5)
|
||||
.attr(StatStageChangeMultiplierAbAttr, -1)
|
||||
.ignorable(),
|
||||
|
@ -7203,7 +7053,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.BATTERY, 7)
|
||||
.attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL ], 1.3),
|
||||
new Ability(Abilities.FLUFFY, 7)
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), 0.5)
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target}), 0.5)
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => user.getMoveType(move) === PokemonType.FIRE, 2)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.DAZZLING, 7)
|
||||
|
@ -7212,7 +7062,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.SOUL_HEART, 7)
|
||||
.attr(PostKnockOutStatStageChangeAbAttr, Stat.SPATK, 1),
|
||||
new Ability(Abilities.TANGLING_HAIR, 7)
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false),
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.doesFlagEffectApply({flag: MoveFlags.MAKES_CONTACT, user, target}), Stat.SPD, -1, false),
|
||||
new Ability(Abilities.RECEIVER, 7)
|
||||
.attr(CopyFaintedAllyAbilityAbAttr)
|
||||
.uncopiable(),
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { Arena } from "#app/field/arena";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils/common";
|
||||
import { allMoves } from "#app/data/moves/move";
|
||||
import { MoveTarget } from "#enums/MoveTarget";
|
||||
import { MoveCategory } from "#enums/MoveCategory";
|
||||
|
@ -18,7 +18,7 @@ import {
|
|||
applyAbAttrs,
|
||||
applyOnGainAbAttrs,
|
||||
applyOnLoseAbAttrs,
|
||||
} from "#app/data/ability";
|
||||
} from "#app/data/abilities/ability";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { CommonAnim, CommonBattleAnim } from "#app/data/battle-anims";
|
||||
import i18next from "i18next";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { randSeedInt, getEnumValues } from "#app/utils";
|
||||
import { randSeedInt, getEnumValues } from "#app/utils/common";
|
||||
import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import i18next from "i18next";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { allMoves } from "#app/data/moves/move";
|
||||
import { getEnumKeys, getEnumValues } from "#app/utils";
|
||||
import { getEnumKeys, getEnumValues } from "#app/utils/common";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Gender } from "#app/data/gender";
|
|||
import { PokeballType } from "#enums/pokeball";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { Biome } from "#enums/biome";
|
||||
|
@ -15,6 +15,7 @@ import { DamageMoneyRewardModifier, ExtraModifierModifier, MoneyMultiplierModifi
|
|||
import type { SpeciesStatBoosterModifierType } from "#app/modifier/modifier-type";
|
||||
import { speciesStarterCosts } from "./starters";
|
||||
import i18next from "i18next";
|
||||
import { initI18n } from "#app/plugins/i18n";
|
||||
|
||||
export enum SpeciesWildEvolutionDelay {
|
||||
NONE,
|
||||
|
@ -95,6 +96,9 @@ export class SpeciesFormEvolution {
|
|||
public description = "";
|
||||
|
||||
constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: number, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
||||
if (!i18next.isInitialized) {
|
||||
initI18n();
|
||||
}
|
||||
this.speciesId = speciesId;
|
||||
this.preFormKey = preFormKey;
|
||||
this.evoFormKey = evoFormKey;
|
||||
|
|
|
@ -2,11 +2,11 @@ import { globalScene } from "#app/global-scene";
|
|||
import { AttackMove, BeakBlastHeaderAttr, DelayedAttackAttr, SelfStatusMove, allMoves } from "./moves/move";
|
||||
import { MoveFlags } from "#enums/MoveFlags";
|
||||
import type Pokemon from "../field/pokemon";
|
||||
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils";
|
||||
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils/common";
|
||||
import type { BattlerIndex } from "../battle";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { SubstituteTag } from "./battler-tags";
|
||||
import { isNullOrUndefined } from "../utils";
|
||||
import { isNullOrUndefined } from "../utils/common";
|
||||
import Phaser from "phaser";
|
||||
import { EncounterAnim } from "#enums/encounter-anims";
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import {
|
||||
allAbilities,
|
||||
applyAbAttrs,
|
||||
BlockNonDirectDamageAbAttr,
|
||||
FlinchEffectAbAttr,
|
||||
ProtectStatAbAttr,
|
||||
ConditionalUserFieldProtectStatAbAttr,
|
||||
ReverseDrainAbAttr,
|
||||
} from "#app/data/ability";
|
||||
} from "#app/data/abilities/ability";
|
||||
import { allAbilities } from "./data-lists";
|
||||
import { ChargeAnim, CommonAnim, CommonBattleAnim, MoveChargeAnim } from "#app/data/battle-anims";
|
||||
import type Move from "#app/data/moves/move";
|
||||
import {
|
||||
|
@ -33,7 +33,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
|||
import type { StatStageChangeCallback } from "#app/phases/stat-stage-change-phase";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils";
|
||||
import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils/common";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
|
@ -42,7 +42,7 @@ import { Species } from "#enums/species";
|
|||
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
|
||||
export enum BattlerTagLapseType {
|
||||
FAINT,
|
||||
|
@ -52,6 +52,7 @@ export enum BattlerTagLapseType {
|
|||
MOVE_EFFECT,
|
||||
TURN_END,
|
||||
HIT,
|
||||
/** Tag lapses AFTER_HIT, applying its effects even if the user faints */
|
||||
AFTER_HIT,
|
||||
CUSTOM,
|
||||
}
|
||||
|
@ -498,7 +499,13 @@ export class BeakBlastChargingTag extends BattlerTag {
|
|||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
if (lapseType === BattlerTagLapseType.AFTER_HIT) {
|
||||
const phaseData = getMoveEffectPhaseData(pokemon);
|
||||
if (phaseData?.move.hasFlag(MoveFlags.MAKES_CONTACT)) {
|
||||
if (
|
||||
phaseData?.move.doesFlagEffectApply({
|
||||
flag: MoveFlags.MAKES_CONTACT,
|
||||
user: phaseData.attacker,
|
||||
target: pokemon,
|
||||
})
|
||||
) {
|
||||
phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon);
|
||||
}
|
||||
return true;
|
||||
|
@ -1611,19 +1618,50 @@ export class ProtectedTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
/** Base class for `BattlerTag`s that block damaging moves but not status moves */
|
||||
export class DamageProtectedTag extends ProtectedTag {}
|
||||
/** Class for `BattlerTag`s that apply some effect when hit by a contact move */
|
||||
export class ContactProtectedTag extends ProtectedTag {
|
||||
/**
|
||||
* Function to call when a contact move hits the pokemon with this tag.
|
||||
* @param _attacker - The pokemon using the contact move
|
||||
* @param _user - The pokemon that is being attacked and has the tag
|
||||
* @param _move - The move used by the attacker
|
||||
*/
|
||||
onContact(_attacker: Pokemon, _user: Pokemon) {}
|
||||
|
||||
/**
|
||||
* Lapse the tag and apply `onContact` if the move makes contact and
|
||||
* `lapseType` is custom, respecting the move's flags and the pokemon's
|
||||
* abilities, and whether the lapseType is custom.
|
||||
*
|
||||
* @param pokemon - The pokemon with the tag
|
||||
* @param lapseType - The type of lapse to apply. If this is not {@linkcode BattlerTagLapseType.CUSTOM CUSTOM}, no effect will be applied.
|
||||
* @returns Whether the tag continues to exist after the lapse.
|
||||
*/
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = super.lapse(pokemon, lapseType);
|
||||
|
||||
const moveData = getMoveEffectPhaseData(pokemon);
|
||||
if (
|
||||
lapseType === BattlerTagLapseType.CUSTOM &&
|
||||
moveData &&
|
||||
moveData.move.doesFlagEffectApply({ flag: MoveFlags.MAKES_CONTACT, user: moveData.attacker, target: pokemon })
|
||||
) {
|
||||
this.onContact(moveData.attacker, pokemon);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `BattlerTag` class for moves that block damaging moves damage the enemy if the enemy's move makes contact
|
||||
* Used by {@linkcode Moves.SPIKY_SHIELD}
|
||||
*/
|
||||
export class ContactDamageProtectedTag extends ProtectedTag {
|
||||
export class ContactDamageProtectedTag extends ContactProtectedTag {
|
||||
private damageRatio: number;
|
||||
|
||||
constructor(sourceMove: Moves, damageRatio: number) {
|
||||
super(sourceMove, BattlerTagType.SPIKY_SHIELD);
|
||||
|
||||
this.damageRatio = damageRatio;
|
||||
}
|
||||
|
||||
|
@ -1636,22 +1674,46 @@ export class ContactDamageProtectedTag extends ProtectedTag {
|
|||
this.damageRatio = source.damageRatio;
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = super.lapse(pokemon, lapseType);
|
||||
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
const effectPhase = globalScene.getCurrentPhase();
|
||||
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
|
||||
const attacker = effectPhase.getPokemon();
|
||||
if (!attacker.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
|
||||
attacker.damageAndUpdate(toDmgValue(attacker.getMaxHp() * (1 / this.damageRatio)), {
|
||||
result: HitResult.INDIRECT,
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Damage the attacker by `this.damageRatio` of the target's max HP
|
||||
* @param attacker - The pokemon using the contact move
|
||||
* @param user - The pokemon that is being attacked and has the tag
|
||||
*/
|
||||
override onContact(attacker: Pokemon, user: Pokemon): void {
|
||||
const cancelled = new BooleanHolder(false);
|
||||
applyAbAttrs(BlockNonDirectDamageAbAttr, user, cancelled);
|
||||
if (!cancelled.value) {
|
||||
attacker.damageAndUpdate(toDmgValue(attacker.getMaxHp() * (1 / this.damageRatio)), {
|
||||
result: HitResult.INDIRECT,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
/** Base class for `BattlerTag`s that block damaging moves but not status moves */
|
||||
export class DamageProtectedTag extends ContactProtectedTag {}
|
||||
|
||||
export class ContactSetStatusProtectedTag extends DamageProtectedTag {
|
||||
/**
|
||||
* @param sourceMove The move that caused the tag to be applied
|
||||
* @param tagType The type of the tag
|
||||
* @param statusEffect The status effect to apply to the attacker
|
||||
*/
|
||||
constructor(
|
||||
sourceMove: Moves,
|
||||
tagType: BattlerTagType,
|
||||
private statusEffect: StatusEffect,
|
||||
) {
|
||||
super(sourceMove, tagType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the status effect on the attacker
|
||||
* @param attacker - The pokemon using the contact move
|
||||
* @param user - The pokemon that is being attacked and has the tag
|
||||
*/
|
||||
override onContact(attacker: Pokemon, user: Pokemon): void {
|
||||
attacker.trySetStatus(this.statusEffect, true, user);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1674,68 +1736,19 @@ export class ContactStatStageChangeProtectedTag extends DamageProtectedTag {
|
|||
* When given a battler tag or json representing one, load the data for it.
|
||||
* @param {BattlerTag | any} source A battler tag
|
||||
*/
|
||||
loadTag(source: BattlerTag | any): void {
|
||||
override loadTag(source: BattlerTag | any): void {
|
||||
super.loadTag(source);
|
||||
this.stat = source.stat;
|
||||
this.levels = source.levels;
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = super.lapse(pokemon, lapseType);
|
||||
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
const effectPhase = globalScene.getCurrentPhase();
|
||||
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
|
||||
const attacker = effectPhase.getPokemon();
|
||||
globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
export class ContactPoisonProtectedTag extends ProtectedTag {
|
||||
constructor(sourceMove: Moves) {
|
||||
super(sourceMove, BattlerTagType.BANEFUL_BUNKER);
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = super.lapse(pokemon, lapseType);
|
||||
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
const effectPhase = globalScene.getCurrentPhase();
|
||||
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
|
||||
const attacker = effectPhase.getPokemon();
|
||||
attacker.trySetStatus(StatusEffect.POISON, true, pokemon);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `BattlerTag` class for moves that block damaging moves and burn the enemy if the enemy's move makes contact
|
||||
* Used by {@linkcode Moves.BURNING_BULWARK}
|
||||
*/
|
||||
export class ContactBurnProtectedTag extends DamageProtectedTag {
|
||||
constructor(sourceMove: Moves) {
|
||||
super(sourceMove, BattlerTagType.BURNING_BULWARK);
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
const ret = super.lapse(pokemon, lapseType);
|
||||
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
const effectPhase = globalScene.getCurrentPhase();
|
||||
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
|
||||
const attacker = effectPhase.getPokemon();
|
||||
attacker.trySetStatus(StatusEffect.BURN, true);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
/**
|
||||
* Initiate the stat stage change on the attacker
|
||||
* @param attacker - The pokemon using the contact move
|
||||
* @param user - The pokemon that is being attacked and has the tag
|
||||
*/
|
||||
override onContact(attacker: Pokemon, _user: Pokemon): void {
|
||||
globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3518,9 +3531,9 @@ export function getBattlerTag(
|
|||
case BattlerTagType.SILK_TRAP:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.SPD, -1);
|
||||
case BattlerTagType.BANEFUL_BUNKER:
|
||||
return new ContactPoisonProtectedTag(sourceMove);
|
||||
return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.POISON);
|
||||
case BattlerTagType.BURNING_BULWARK:
|
||||
return new ContactBurnProtectedTag(sourceMove);
|
||||
return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.BURN);
|
||||
case BattlerTagType.ENDURING:
|
||||
return new EnduringTag(tagType, BattlerTagLapseType.TURN_END, sourceMove);
|
||||
case BattlerTagType.ENDURE_TOKEN:
|
||||
|
|
|
@ -2,14 +2,14 @@ import { getPokemonNameWithAffix } from "../messages";
|
|||
import type Pokemon from "../field/pokemon";
|
||||
import { HitResult } from "../field/pokemon";
|
||||
import { getStatusEffectHealText } from "./status-effect";
|
||||
import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils";
|
||||
import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils/common";
|
||||
import {
|
||||
DoubleBerryEffectAbAttr,
|
||||
PostItemLostAbAttr,
|
||||
ReduceBerryUseThresholdAbAttr,
|
||||
applyAbAttrs,
|
||||
applyPostItemLostAbAttrs,
|
||||
} from "./ability";
|
||||
} from "./abilities/ability";
|
||||
import i18next from "i18next";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils";
|
||||
import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
import type { DexAttrProps, GameData } from "#app/system/game-data";
|
||||
import { defaultStarterSpecies } from "#app/system/game-data";
|
||||
|
@ -8,7 +8,8 @@ import { speciesStarterCosts } from "#app/data/balance/starters";
|
|||
import type Pokemon from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import type { FixedBattleConfig } from "#app/battle";
|
||||
import { ClassicFixedBossWaves, BattleType, getRandomTrainerFunc } from "#app/battle";
|
||||
import { ClassicFixedBossWaves, getRandomTrainerFunc } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Abilities } from "#enums/abilities";
|
||||
import type { PokemonType } from "#enums/pokemon-type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import type { Nature } from "#enums/nature";
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { Species } from "#enums/species";
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type { Starter } from "#app/ui/starter-select-ui-handler";
|
||||
import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils";
|
||||
import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils/common";
|
||||
import type { PokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import type { Ability } from "./abilities/ability-class";
|
||||
|
||||
export const allAbilities: Ability[] = [];
|
|
@ -4,7 +4,7 @@ import type PokemonSpecies from "#app/data/pokemon-species";
|
|||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { VariantTier } from "#enums/variant-tier";
|
||||
import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils";
|
||||
import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils/common";
|
||||
import Overrides from "#app/overrides";
|
||||
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
|
|
|
@ -29,12 +29,11 @@ import {
|
|||
} from "../status-effect";
|
||||
import { getTypeDamageMultiplier } from "../type";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor } from "#app/utils";
|
||||
import { BooleanHolder, NumberHolder, isNullOrUndefined, toDmgValue, randSeedItem, randSeedInt, getEnumValues, toReadableString, type Constructor } from "#app/utils/common";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import type { ArenaTrapTag } from "../arena-tag";
|
||||
import { ArenaTagSide, WeakenMoveTypeTag } from "../arena-tag";
|
||||
import {
|
||||
allAbilities,
|
||||
AllyMoveCategoryPowerBoostAbAttr,
|
||||
applyAbAttrs,
|
||||
applyPostAttackAbAttrs,
|
||||
|
@ -65,7 +64,8 @@ import {
|
|||
UserFieldMoveTypePowerBoostAbAttr,
|
||||
VariableMovePowerAbAttr,
|
||||
WonderSkinAbAttr,
|
||||
} from "../ability";
|
||||
} from "../abilities/ability";
|
||||
import { allAbilities } from "../data-lists";
|
||||
import {
|
||||
AttackTypeBoosterModifier,
|
||||
BerryModifier,
|
||||
|
@ -75,7 +75,7 @@ import {
|
|||
PreserveBerryModifier,
|
||||
} from "../../modifier/modifier";
|
||||
import type { BattlerIndex } from "../../battle";
|
||||
import { BattleType } from "../../battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { TerrainType } from "../terrain";
|
||||
import { ModifierPoolType } from "#app/modifier/modifier-type";
|
||||
import { Command } from "../../ui/command-ui-handler";
|
||||
|
@ -121,6 +121,7 @@ import { MoveFlags } from "#enums/MoveFlags";
|
|||
import { MoveEffectTrigger } from "#enums/MoveEffectTrigger";
|
||||
import { MultiHitType } from "#enums/MultiHitType";
|
||||
import { invalidAssistMoves, invalidCopycatMoves, invalidMetronomeMoves, invalidMirrorMoveMoves, invalidSleepTalkMoves } from "./invalid-moves";
|
||||
import { TrainerVariant } from "#app/field/trainer";
|
||||
|
||||
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
|
||||
type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean;
|
||||
|
@ -3466,8 +3467,7 @@ export class CutHpStatStageBoostAttr extends StatStageChangeAttr {
|
|||
/**
|
||||
* Attribute implementing the stat boosting effect of {@link https://bulbapedia.bulbagarden.net/wiki/Order_Up_(move) | Order Up}.
|
||||
* If the user has a Pokemon with {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander} in their mouth,
|
||||
* one of the user's stats are increased by 1 stage, depending on the "commanding" Pokemon's form. This effect does not respect
|
||||
* effect chance, but Order Up itself may be boosted by Sheer Force.
|
||||
* one of the user's stats are increased by 1 stage, depending on the "commanding" Pokemon's form.
|
||||
*/
|
||||
export class OrderUpStatBoostAttr extends MoveEffectAttr {
|
||||
constructor() {
|
||||
|
@ -6296,9 +6296,10 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
return false;
|
||||
} else if (globalScene.currentBattle.battleType !== BattleType.WILD) { // Switch out logic for enemy trainers
|
||||
// Find indices of off-field Pokemon that are eligible to be switched into
|
||||
const isPartnerTrainer = globalScene.currentBattle.trainer?.isPartner();
|
||||
const eligibleNewIndices: number[] = [];
|
||||
globalScene.getEnemyParty().forEach((pokemon, index) => {
|
||||
if (pokemon.isAllowedInBattle() && !pokemon.isOnField()) {
|
||||
if (pokemon.isAllowedInBattle() && !pokemon.isOnField() && (!isPartnerTrainer || pokemon.trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)) {
|
||||
eligibleNewIndices.push(index);
|
||||
}
|
||||
});
|
||||
|
@ -6348,15 +6349,6 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
if (globalScene.currentBattle.waveIndex % 10 === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't allow wild mons to flee with U-turn et al.
|
||||
if (this.selfSwitch && !user.isPlayer() && move.category !== MoveCategory.STATUS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const allyPokemon = switchOutTarget.getAlly();
|
||||
|
||||
if (switchOutTarget.hp > 0) {
|
||||
|
@ -6369,13 +6361,12 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
if (!allyPokemon?.isActive(true)) {
|
||||
globalScene.clearEnemyHeldItemModifiers();
|
||||
// clear out enemy held item modifiers of the switch out target
|
||||
globalScene.clearEnemyHeldItemModifiers(switchOutTarget);
|
||||
|
||||
if (switchOutTarget.hp) {
|
||||
if (!allyPokemon?.isActive(true) && switchOutTarget.hp) {
|
||||
globalScene.pushPhase(new BattleEndPhase(false));
|
||||
globalScene.pushPhase(new NewBattlePhase());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6394,6 +6385,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
getSwitchOutCondition(): MoveConditionFunc {
|
||||
return (user, target, move) => {
|
||||
const switchOutTarget = (this.selfSwitch ? user : target);
|
||||
|
@ -6417,23 +6409,23 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||
|
||||
const blockedByAbility = new BooleanHolder(false);
|
||||
applyAbAttrs(ForceSwitchOutImmunityAbAttr, target, blockedByAbility);
|
||||
return !blockedByAbility.value;
|
||||
if (blockedByAbility.value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!player && globalScene.currentBattle.battleType === BattleType.WILD) {
|
||||
if (this.isBatonPass()) {
|
||||
return false;
|
||||
}
|
||||
// Don't allow wild opponents to flee on the boss stage since it can ruin a run early on
|
||||
if (globalScene.currentBattle.waveIndex % 10 === 0) {
|
||||
return false;
|
||||
}
|
||||
// wild pokemon cannot switch out with baton pass.
|
||||
return !this.isBatonPass()
|
||||
&& globalScene.currentBattle.waveIndex % 10 !== 0
|
||||
// Don't allow wild mons to flee with U-turn et al.
|
||||
&& !(this.selfSwitch && MoveCategory.STATUS !== move.category);
|
||||
}
|
||||
|
||||
const party = player ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
||||
return (!player && !globalScene.currentBattle.battleType)
|
||||
|| party.filter(p => p.isAllowedInBattle()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > globalScene.currentBattle.getBattlerCount();
|
||||
return party.filter(p => p.isAllowedInBattle() && !p.isOnField()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8191,7 +8183,7 @@ export type MoveTargetSet = {
|
|||
|
||||
export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveTarget): MoveTargetSet {
|
||||
const variableTarget = new NumberHolder(0);
|
||||
user.getOpponents().forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget));
|
||||
user.getOpponents(false).forEach(p => applyMoveAttrs(VariableTargetAttr, user, p, allMoves[move], variableTarget));
|
||||
|
||||
let moveTarget: MoveTarget | undefined;
|
||||
if (allMoves[move].hasAttr(VariableTargetAttr)) {
|
||||
|
@ -8203,7 +8195,7 @@ export function getMoveTargets(user: Pokemon, move: Moves, replaceTarget?: MoveT
|
|||
} else if (move === undefined) {
|
||||
moveTarget = MoveTarget.NEAR_ENEMY;
|
||||
}
|
||||
const opponents = user.getOpponents();
|
||||
const opponents = user.getOpponents(false);
|
||||
|
||||
let set: Pokemon[] = [];
|
||||
let multiple = false;
|
||||
|
@ -9726,7 +9718,7 @@ export function initMoves() {
|
|||
.ignoresProtect()
|
||||
.target(MoveTarget.BOTH_SIDES)
|
||||
.unimplemented(),
|
||||
new AttackMove(Moves.SMACK_DOWN, PokemonType.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, 100, 0, 5)
|
||||
new AttackMove(Moves.SMACK_DOWN, PokemonType.ROCK, MoveCategory.PHYSICAL, 50, 100, 15, -1, 0, 5)
|
||||
.attr(FallDownAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.INTERRUPTED)
|
||||
.attr(RemoveBattlerTagAttr, [ BattlerTagType.FLYING, BattlerTagType.FLOATING, BattlerTagType.TELEKINESIS ])
|
||||
|
@ -9893,7 +9885,7 @@ export function initMoves() {
|
|||
.attr(MovePowerMultiplierAttr, (user, target, move) => globalScene.arena.getTerrainType() === TerrainType.GRASSY && target.isGrounded() ? 0.5 : 1)
|
||||
.makesContact(false)
|
||||
.target(MoveTarget.ALL_NEAR_OTHERS),
|
||||
new AttackMove(Moves.FROST_BREATH, PokemonType.ICE, MoveCategory.SPECIAL, 60, 90, 10, 100, 0, 5)
|
||||
new AttackMove(Moves.FROST_BREATH, PokemonType.ICE, MoveCategory.SPECIAL, 60, 90, 10, -1, 0, 5)
|
||||
.attr(CritOnlyAttr),
|
||||
new AttackMove(Moves.DRAGON_TAIL, PokemonType.DRAGON, MoveCategory.PHYSICAL, 60, 90, 10, -1, -6, 5)
|
||||
.attr(ForceSwitchOutAttr, false, SwitchType.FORCE_SWITCH)
|
||||
|
@ -10535,7 +10527,7 @@ export function initMoves() {
|
|||
.attr(AddArenaTagAttr, ArenaTagType.LIGHT_SCREEN, 5, false, true),
|
||||
new AttackMove(Moves.BADDY_BAD, PokemonType.DARK, MoveCategory.SPECIAL, 80, 95, 15, -1, 0, 7)
|
||||
.attr(AddArenaTagAttr, ArenaTagType.REFLECT, 5, false, true),
|
||||
new AttackMove(Moves.SAPPY_SEED, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 90, 10, 100, 0, 7)
|
||||
new AttackMove(Moves.SAPPY_SEED, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 90, 10, -1, 0, 7)
|
||||
.attr(LeechSeedAttr)
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.FREEZY_FROST, PokemonType.ICE, MoveCategory.SPECIAL, 100, 90, 10, -1, 0, 7)
|
||||
|
@ -10863,7 +10855,7 @@ export function initMoves() {
|
|||
.attr(StatStageChangeAttr, [ Stat.SPD ], 1, true),
|
||||
new AttackMove(Moves.BITTER_MALICE, PokemonType.GHOST, MoveCategory.SPECIAL, 75, 100, 10, 100, 0, 8)
|
||||
.attr(StatStageChangeAttr, [ Stat.ATK ], -1),
|
||||
new SelfStatusMove(Moves.SHELTER, PokemonType.STEEL, -1, 10, 100, 0, 8)
|
||||
new SelfStatusMove(Moves.SHELTER, PokemonType.STEEL, -1, 10, -1, 0, 8)
|
||||
.attr(StatStageChangeAttr, [ Stat.DEF ], 2, true),
|
||||
new AttackMove(Moves.TRIPLE_ARROWS, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 90, 100, 10, 30, 0, 8)
|
||||
.makesContact(false)
|
||||
|
@ -11018,7 +11010,7 @@ export function initMoves() {
|
|||
.makesContact(false),
|
||||
new AttackMove(Moves.LUMINA_CRASH, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
||||
.attr(StatStageChangeAttr, [ Stat.SPDEF ], -2),
|
||||
new AttackMove(Moves.ORDER_UP, PokemonType.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, 100, 0, 9)
|
||||
new AttackMove(Moves.ORDER_UP, PokemonType.DRAGON, MoveCategory.PHYSICAL, 80, 100, 10, -1, 0, 9)
|
||||
.attr(OrderUpStatBoostAttr)
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.JET_PUNCH, PokemonType.WATER, MoveCategory.PHYSICAL, 60, 100, 15, -1, 1, 9)
|
||||
|
@ -11072,7 +11064,7 @@ export function initMoves() {
|
|||
.attr(CutHpStatStageBoostAttr, [ Stat.ATK, Stat.SPATK, Stat.SPD ], 2, 2),
|
||||
new AttackMove(Moves.KOWTOW_CLEAVE, PokemonType.DARK, MoveCategory.PHYSICAL, 85, -1, 10, -1, 0, 9)
|
||||
.slicingMove(),
|
||||
new AttackMove(Moves.FLOWER_TRICK, PokemonType.GRASS, MoveCategory.PHYSICAL, 70, -1, 10, 100, 0, 9)
|
||||
new AttackMove(Moves.FLOWER_TRICK, PokemonType.GRASS, MoveCategory.PHYSICAL, 70, -1, 10, -1, 0, 9)
|
||||
.attr(CritOnlyAttr)
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.TORCH_SONG, PokemonType.FIRE, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
||||
|
@ -11191,7 +11183,7 @@ export function initMoves() {
|
|||
.attr(StatusEffectAttr, StatusEffect.BURN)
|
||||
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
||||
.triageMove(),
|
||||
new AttackMove(Moves.SYRUP_BOMB, PokemonType.GRASS, MoveCategory.SPECIAL, 60, 85, 10, -1, 0, 9)
|
||||
new AttackMove(Moves.SYRUP_BOMB, PokemonType.GRASS, MoveCategory.SPECIAL, 60, 85, 10, 100, 0, 9)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.SYRUP_BOMB, false, false, 3)
|
||||
.ballBombMove(),
|
||||
new AttackMove(Moves.IVY_CUDGEL, PokemonType.GRASS, MoveCategory.PHYSICAL, 100, 100, 10, -1, 0, 9)
|
||||
|
@ -11205,11 +11197,12 @@ export function initMoves() {
|
|||
new AttackMove(Moves.TERA_STARSTORM, PokemonType.NORMAL, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9)
|
||||
.attr(TeraMoveCategoryAttr)
|
||||
.attr(TeraStarstormTypeAttr)
|
||||
.attr(VariableTargetAttr, (user, target, move) => user.hasSpecies(Species.TERAPAGOS) && user.isTerastallized ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER)
|
||||
.attr(VariableTargetAttr, (user, target, move) => user.hasSpecies(Species.TERAPAGOS) && (user.isTerastallized || globalScene.currentBattle.preTurnCommands[user.getFieldIndex()]?.command === Command.TERA) ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER)
|
||||
.partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */
|
||||
new AttackMove(Moves.FICKLE_BEAM, PokemonType.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9)
|
||||
.attr(PreMoveMessageAttr, doublePowerChanceMessageFunc)
|
||||
.attr(DoublePowerChanceAttr),
|
||||
.attr(DoublePowerChanceAttr)
|
||||
.edgeCase(), // Should not interact with Sheer Force
|
||||
new SelfStatusMove(Moves.BURNING_BULWARK, PokemonType.FIRE, -1, 10, -1, 4, 9)
|
||||
.attr(ProtectAttr, BattlerTagType.BURNING_BULWARK)
|
||||
.condition(failIfLastCondition),
|
||||
|
@ -11232,16 +11225,18 @@ export function initMoves() {
|
|||
new StatusMove(Moves.DRAGON_CHEER, PokemonType.DRAGON, -1, 15, -1, 0, 9)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.DRAGON_CHEER, false, true)
|
||||
.target(MoveTarget.NEAR_ALLY),
|
||||
new AttackMove(Moves.ALLURING_VOICE, PokemonType.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, -1, 0, 9)
|
||||
new AttackMove(Moves.ALLURING_VOICE, PokemonType.FAIRY, MoveCategory.SPECIAL, 80, 100, 10, 100, 0, 9)
|
||||
.attr(AddBattlerTagIfBoostedAttr, BattlerTagType.CONFUSED)
|
||||
.soundBased(),
|
||||
new AttackMove(Moves.TEMPER_FLARE, PokemonType.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result === MoveResult.MISS || user.getLastXMoves(2)[1]?.result === MoveResult.FAIL ? 2 : 1),
|
||||
new AttackMove(Moves.SUPERCELL_SLAM, PokemonType.ELECTRIC, MoveCategory.PHYSICAL, 100, 95, 15, -1, 0, 9)
|
||||
.attr(AlwaysHitMinimizeAttr)
|
||||
.attr(HitsTagForDoubleDamageAttr, BattlerTagType.MINIMIZED)
|
||||
.attr(MissEffectAttr, crashDamageFunc)
|
||||
.attr(NoEffectAttr, crashDamageFunc)
|
||||
.recklessMove(),
|
||||
new AttackMove(Moves.PSYCHIC_NOISE, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, -1, 0, 9)
|
||||
new AttackMove(Moves.PSYCHIC_NOISE, PokemonType.PSYCHIC, MoveCategory.SPECIAL, 75, 100, 10, 100, 0, 9)
|
||||
.soundBased()
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.HEAL_BLOCK, false, false, 2),
|
||||
new AttackMove(Moves.UPPER_HAND, PokemonType.FIGHTING, MoveCategory.PHYSICAL, 65, 100, 15, 100, 3, 9)
|
||||
|
|
|
@ -14,7 +14,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
import type { IEggOptions } from "#app/data/egg";
|
||||
import { EggSourceType } from "#enums/egg-source-types";
|
||||
|
|
|
@ -24,7 +24,7 @@ import { BerryModifier, PokemonInstantReviveModifier } from "#app/modifier/modif
|
|||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { randInt } from "#app/utils";
|
||||
import { randInt } from "#app/utils/common";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import {
|
||||
applyModifierTypeToPlayerPokemon,
|
||||
|
|
|
@ -13,7 +13,7 @@ import type { PlayerPokemon } from "#app/field/pokemon";
|
|||
import type Pokemon from "#app/field/pokemon";
|
||||
import type { BerryModifierType, ModifierTypeOption } from "#app/modifier/modifier-type";
|
||||
import { ModifierPoolType, modifierTypes, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -16,7 +16,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
|
|||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
|
|
@ -31,14 +31,14 @@ import {
|
|||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { randSeedInt, randSeedShuffle } from "#app/utils";
|
||||
import { randSeedInt, randSeedShuffle } from "#app/utils/common";
|
||||
import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import type { OptionSelectConfig } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { Ability } from "#app/data/ability";
|
||||
import { Ability } from "#app/data/abilities/ability-class";
|
||||
import { BerryModifier } from "#app/modifier/modifier";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
|
@ -437,7 +437,7 @@ async function handleSwapAbility() {
|
|||
await showEncounterDialogue(`${namespace}:option.1.apply_ability_dialogue`, `${namespace}:speaker`);
|
||||
await showEncounterText(`${namespace}:option.1.apply_ability_message`);
|
||||
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
displayYesNoOptions(resolve);
|
||||
});
|
||||
});
|
||||
|
@ -467,7 +467,7 @@ function displayYesNoOptions(resolve) {
|
|||
maxOptions: 7,
|
||||
yOffset: 0,
|
||||
};
|
||||
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
|
||||
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
|
||||
}
|
||||
|
||||
function onYesAbilitySwap(resolve) {
|
||||
|
@ -477,11 +477,11 @@ function onYesAbilitySwap(resolve) {
|
|||
|
||||
applyAbilityOverrideToPokemon(pokemon, encounter.misc.ability);
|
||||
encounter.setDialogueToken("chosenPokemon", pokemon.getNameToRender());
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => resolve(true));
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => resolve(true));
|
||||
};
|
||||
|
||||
const onPokemonNotSelected = () => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
displayYesNoOptions(resolve);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { PokemonType } from "#enums/pokemon-type";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -32,7 +32,7 @@ import { modifierTypes } from "#app/modifier/modifier-type";
|
|||
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { randSeedItem } from "#app/utils";
|
||||
import { randSeedItem } from "#app/utils/common";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import type { ModifierTypeFunc } from "#app/modifier/modifier-type";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
|
|
|
@ -30,7 +30,7 @@ import { PokemonMove } from "#app/field/pokemon";
|
|||
import { Moves } from "#enums/moves";
|
||||
import { EncounterBattleAnim } from "#app/data/battle-anims";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import {
|
||||
|
@ -46,7 +46,7 @@ import { Abilities } from "#enums/abilities";
|
|||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { Ability } from "#app/data/ability";
|
||||
import { Ability } from "#app/data/abilities/ability-class";
|
||||
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
|
|
|
@ -31,7 +31,7 @@ import {
|
|||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
|
||||
|
|
|
@ -23,7 +23,14 @@ import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
|
|||
import { getTypeRgb } from "#app/data/type";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { NumberHolder, isNullOrUndefined, randInt, randSeedInt, randSeedShuffle, randSeedItem } from "#app/utils";
|
||||
import {
|
||||
NumberHolder,
|
||||
isNullOrUndefined,
|
||||
randInt,
|
||||
randSeedInt,
|
||||
randSeedShuffle,
|
||||
randSeedItem,
|
||||
} from "#app/utils/common";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
|
|
|
@ -12,7 +12,7 @@ import { modifierTypes } from "#app/modifier/modifier-type";
|
|||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
|
|
@ -18,7 +18,7 @@ import { getPokemonSpecies } from "#app/data/pokemon-species";
|
|||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { GameOverPhase } from "#app/phases/game-over-phase";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
|
|
@ -15,7 +15,7 @@ import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifi
|
|||
import type { EnemyPokemon } from "#app/field/pokemon";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { NumberHolder, randSeedInt } from "#app/utils";
|
||||
import { NumberHolder, randSeedInt } from "#app/utils/common";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
transitionMysteryEncounterIntroVisuals,
|
||||
updatePlayerMoney,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { trainerConfigs } from "#app/data/trainers/trainer-config";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { randSeedShuffle } from "#app/utils";
|
||||
import { randSeedShuffle } from "#app/utils/common";
|
||||
import type MysteryEncounter from "../mystery-encounter";
|
||||
import { MysteryEncounterBuilder } from "../mystery-encounter";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
transitionMysteryEncounterIntroVisuals,
|
||||
updatePlayerMoney,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
|
|
|
@ -24,7 +24,7 @@ import { PokemonType } from "#enums/pokemon-type";
|
|||
import { BerryType } from "#enums/berry-type";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { SpeciesFormChangeAbilityTrigger } from "#app/data/pokemon-forms";
|
||||
import { applyPostBattleInitAbAttrs, PostBattleInitAbAttr } from "#app/data/ability";
|
||||
import { applyPostBattleInitAbAttrs, PostBattleInitAbAttr } from "#app/data/abilities/ability";
|
||||
import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { PartyHealPhase } from "#app/phases/party-heal-phase";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { Ability } from "#app/data/ability";
|
||||
import { allAbilities } from "#app/data/ability";
|
||||
import type { Ability } from "#app/data/abilities/ability-class";
|
||||
import { allAbilities } from "#app/data/data-lists";
|
||||
import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import {
|
||||
initBattleWithEnemyConfig,
|
||||
|
@ -15,7 +15,7 @@ import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
|||
import { AbilityAttr } from "#app/system/game-data";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { isNullOrUndefined, randSeedShuffle } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedShuffle } from "#app/utils/common";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -27,7 +27,7 @@ import { Moves } from "#enums/moves";
|
|||
import { BattlerIndex } from "#app/battle";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
|
||||
/** the i18n namespace for this encounter */
|
||||
const namespace = "mysteryEncounters/trashToTreasure";
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
getSpriteKeysFromPokemon,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import type { Moves } from "#enums/moves";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { SelfStatusMove } from "#app/data/moves/move";
|
||||
|
|
|
@ -17,7 +17,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
|
||||
import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import type { CanLearnMoveRequirementOptions } from "./requirements/can-learn-move-requirement";
|
||||
import { CanLearnMoveRequirement } from "./requirements/can-learn-move-requirement";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
|
||||
// biome-ignore lint/suspicious/noConfusingVoidType: void unions in callbacks are OK
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { allAbilities } from "#app/data/ability";
|
||||
import { allAbilities } from "../data-lists";
|
||||
import { EvolutionItem, pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "#app/data/pokemon-forms";
|
||||
|
@ -9,7 +9,7 @@ import { WeatherType } from "#enums/weather-type";
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { AttackTypeBoosterModifier } from "#app/modifier/modifier";
|
||||
import type { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import type { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/mystery-encounters";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import type { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
||||
export class SeenEncounterData {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import type { PlayerPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils";
|
||||
import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils/common";
|
||||
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import type { MysteryEncounterSpriteConfig } from "#app/field/mystery-encounter-intro";
|
||||
import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import type { StatusEffect } from "#enums/status-effect";
|
||||
import type { OptionTextDisplay } from "./mystery-encounter-dialogue";
|
||||
import type MysteryEncounterDialogue from "./mystery-encounter-dialogue";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { Moves } from "#app/enums/moves";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import { EncounterPokemonRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import type { TextStyle } from "#app/ui/text";
|
||||
import { getTextWithColors } from "#app/ui/text";
|
||||
import { UiTheme } from "#enums/ui-theme";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import type Battle from "#app/battle";
|
||||
import { BattlerIndex, BattleType } from "#app/battle";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { biomeLinks, BiomePoolTier } from "#app/data/balance/biomes";
|
||||
import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import {
|
||||
|
@ -29,8 +30,8 @@ import type PokemonData from "#app/system/pokemon-data";
|
|||
import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils/common";
|
||||
import type { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Biome } from "#enums/biome";
|
||||
import type { TrainerType } from "#enums/trainer-type";
|
||||
|
@ -562,7 +563,7 @@ export function selectPokemonForOption(
|
|||
|
||||
// Open party screen to choose pokemon
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SELECT,
|
||||
-1,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
|
@ -580,7 +581,7 @@ export function selectPokemonForOption(
|
|||
}
|
||||
|
||||
// There is a second option to choose after selecting the Pokemon
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
const displayOptions = () => {
|
||||
// Always appends a cancel option to bottom of options
|
||||
const fullOptions = secondaryOptions
|
||||
|
@ -622,7 +623,7 @@ export function selectPokemonForOption(
|
|||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
|
||||
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
|
||||
};
|
||||
|
||||
const textPromptKey =
|
||||
|
@ -672,20 +673,20 @@ export function selectOptionThenPokemon(
|
|||
const modeToSetOnExit = globalScene.ui.getMode();
|
||||
|
||||
const displayOptions = (config: OptionSelectConfig) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (!optionSelectPromptKey) {
|
||||
// Do hover over the starting selection option
|
||||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
|
||||
} else {
|
||||
showEncounterText(optionSelectPromptKey).then(() => {
|
||||
// Do hover over the starting selection option
|
||||
if (fullOptions[0].onHover) {
|
||||
fullOptions[0].onHover();
|
||||
}
|
||||
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
|
||||
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -694,7 +695,7 @@ export function selectOptionThenPokemon(
|
|||
const selectPokemonAfterOption = (selectedOptionIndex: number) => {
|
||||
// Open party screen to choose a Pokemon
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.SELECT,
|
||||
-1,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import i18next from "i18next";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
|
@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender";
|
|||
import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims";
|
||||
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Species } from "#enums/species";
|
||||
|
@ -714,7 +714,7 @@ export async function catchPokemon(
|
|||
() => {
|
||||
globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const newPokemon = globalScene.addPlayerPokemon(
|
||||
pokemon.species,
|
||||
|
@ -729,12 +729,12 @@ export async function catchPokemon(
|
|||
pokemon,
|
||||
);
|
||||
globalScene.ui.setMode(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
newPokemon,
|
||||
0,
|
||||
SummaryUiMode.DEFAULT,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -749,13 +749,13 @@ export async function catchPokemon(
|
|||
female: pokemon.gender === Gender.FEMALE,
|
||||
};
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.POKEDEX_PAGE,
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
pokemon.formIndex,
|
||||
attributes,
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -763,11 +763,11 @@ export async function catchPokemon(
|
|||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.RELEASE,
|
||||
0,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (slotIndex < 6) {
|
||||
addToParty(slotIndex);
|
||||
} else {
|
||||
|
@ -778,7 +778,7 @@ export async function catchPokemon(
|
|||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
removePokemon();
|
||||
end();
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { getFrameMs } from "#app/utils";
|
||||
import { getFrameMs } from "#app/utils/common";
|
||||
import { cos, sin } from "#app/field/anims";
|
||||
import { getTypeRgb } from "#app/data/type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { toReadableString } from "#app/utils";
|
||||
import { toReadableString } from "#app/utils/common";
|
||||
import { TextStyle, getBBCodeFrag } from "../ui/text";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { UiTheme } from "#enums/ui-theme";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { CriticalCatchChanceBoosterModifier } from "#app/modifier/modifier";
|
||||
import { NumberHolder } from "#app/utils";
|
||||
import { NumberHolder } from "#app/utils/common";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import i18next from "i18next";
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import type Pokemon from "../field/pokemon";
|
|||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { allMoves } from "./moves/move";
|
||||
import { MoveCategory } from "#enums/MoveCategory";
|
||||
import type { Constructor, nil } from "#app/utils";
|
||||
import type { Constructor, nil } from "#app/utils/common";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
|
|
|
@ -8,7 +8,7 @@ import type { AnySound } from "#app/battle-scene";
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { GameMode } from "#app/game-mode";
|
||||
import { DexAttr, type StarterMoveset } from "#app/system/game-data";
|
||||
import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils";
|
||||
import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils/common";
|
||||
import { uncatchableSpecies } from "#app/data/balance/biomes";
|
||||
import { speciesEggMoves } from "#app/data/balance/egg-moves";
|
||||
import { GrowthRate } from "#app/data/exp";
|
||||
|
@ -27,11 +27,12 @@ import {
|
|||
} from "#app/data/balance/pokemon-level-moves";
|
||||
import type { Stat } from "#enums/stat";
|
||||
import type { Variant, VariantSet } from "#app/sprites/variant";
|
||||
import { variantData } from "#app/sprites/variant";
|
||||
import { populateVariantColorCache, variantData } from "#app/sprites/variant";
|
||||
import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
||||
import { loadPokemonVariantAssets } from "#app/sprites/pokemon-sprite";
|
||||
import { hasExpSprite } from "#app/sprites/sprite-utils";
|
||||
|
||||
export enum Region {
|
||||
NORMAL,
|
||||
|
@ -388,8 +389,7 @@ export abstract class PokemonSpeciesForm {
|
|||
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
|
||||
}
|
||||
|
||||
/** Compute the sprite ID of the pokemon form. */
|
||||
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string {
|
||||
getBaseSpriteKey(female: boolean, formIndex?: number): string {
|
||||
if (formIndex === undefined || this instanceof PokemonForm) {
|
||||
formIndex = this.formIndex;
|
||||
}
|
||||
|
@ -400,7 +400,12 @@ export abstract class PokemonSpeciesForm {
|
|||
female &&
|
||||
![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].includes(formSpriteKey as SpeciesFormKey);
|
||||
|
||||
const baseSpriteKey = `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`;
|
||||
return `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`;
|
||||
}
|
||||
|
||||
/** Compute the sprite ID of the pokemon form. */
|
||||
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string {
|
||||
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
||||
|
||||
let config = variantData;
|
||||
`${back ? "back__" : ""}${baseSpriteKey}`.split("__").map(p => (config ? (config = config[p]) : null));
|
||||
|
@ -597,10 +602,19 @@ export abstract class PokemonSpeciesForm {
|
|||
startLoad = false,
|
||||
back = false,
|
||||
): Promise<void> {
|
||||
// We need to populate the color cache for this species' variant
|
||||
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back);
|
||||
globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back));
|
||||
globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`);
|
||||
|
||||
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
|
||||
|
||||
// Force the variant color cache to be loaded for the form
|
||||
await populateVariantColorCache(
|
||||
"pkmn__" + baseSpriteKey,
|
||||
globalScene.experimentalSprites && hasExpSprite(spriteKey),
|
||||
baseSpriteKey,
|
||||
);
|
||||
return new Promise<void>(resolve => {
|
||||
globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
||||
const originalWarn = console.warn;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { randIntRange } from "#app/utils";
|
||||
import { randIntRange } from "#app/utils/common";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import type { ParseKeys } from "i18next";
|
||||
import i18next from "i18next";
|
||||
|
|
|
@ -59,7 +59,7 @@ export class Terrain {
|
|||
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
||||
return (
|
||||
move.getPriority(user) > 0 &&
|
||||
user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
|
||||
user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { toReadableString } from "#app/utils";
|
||||
import { toReadableString } from "#app/utils/common";
|
||||
|
||||
class TrainerNameConfig {
|
||||
public urls: string[];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { startingWave } from "#app/battle-scene";
|
||||
import { startingWave } from "#app/starting-wave";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { PokemonMove } from "#app/field/pokemon";
|
||||
import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils";
|
||||
import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils/common";
|
||||
import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { tmSpecies } from "#app/data/balance/tms";
|
||||
|
|
|
@ -5,8 +5,8 @@ import type Pokemon from "../field/pokemon";
|
|||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import type Move from "./moves/move";
|
||||
import { AttackMove } from "./moves/move";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { SuppressWeatherEffectAbAttr } from "./ability";
|
||||
import { randSeedInt } from "#app/utils/common";
|
||||
import { SuppressWeatherEffectAbAttr } from "./abilities/ability";
|
||||
import { TerrainType, getTerrainName } from "./terrain";
|
||||
import i18next from "i18next";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
export enum BattleType {
|
||||
WILD,
|
||||
TRAINER,
|
||||
CLEAR,
|
||||
MYSTERY_ENCOUNTER
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
export enum UiMode {
|
||||
MESSAGE,
|
||||
TITLE,
|
||||
COMMAND,
|
||||
FIGHT,
|
||||
BALL,
|
||||
TARGET_SELECT,
|
||||
MODIFIER_SELECT,
|
||||
SAVE_SLOT,
|
||||
PARTY,
|
||||
SUMMARY,
|
||||
STARTER_SELECT,
|
||||
EVOLUTION_SCENE,
|
||||
EGG_HATCH_SCENE,
|
||||
EGG_HATCH_SUMMARY,
|
||||
CONFIRM,
|
||||
OPTION_SELECT,
|
||||
MENU,
|
||||
MENU_OPTION_SELECT,
|
||||
SETTINGS,
|
||||
SETTINGS_DISPLAY,
|
||||
SETTINGS_AUDIO,
|
||||
SETTINGS_GAMEPAD,
|
||||
GAMEPAD_BINDING,
|
||||
SETTINGS_KEYBOARD,
|
||||
KEYBOARD_BINDING,
|
||||
ACHIEVEMENTS,
|
||||
GAME_STATS,
|
||||
EGG_LIST,
|
||||
EGG_GACHA,
|
||||
POKEDEX,
|
||||
POKEDEX_SCAN,
|
||||
POKEDEX_PAGE,
|
||||
LOGIN_FORM,
|
||||
REGISTRATION_FORM,
|
||||
LOADING,
|
||||
SESSION_RELOAD,
|
||||
UNAVAILABLE,
|
||||
CHALLENGE_SELECT,
|
||||
RENAME_POKEMON,
|
||||
RUN_HISTORY,
|
||||
RUN_INFO,
|
||||
TEST_DIALOGUE,
|
||||
AUTO_COMPLETE,
|
||||
ADMIN,
|
||||
MYSTERY_ENCOUNTER
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import type { Variant } from "#app/sprites/variant";
|
||||
import { getFrameMs, randGauss } from "#app/utils";
|
||||
import { getFrameMs, randGauss } from "#app/utils/common";
|
||||
|
||||
export function addPokeballOpenParticles(x: number, y: number, pokeballType: PokeballType): void {
|
||||
switch (pokeballType) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { BiomeTierTrainerPools, PokemonPools } from "#app/data/balance/biomes";
|
||||
import { biomePokemonPools, BiomePoolTier, biomeTrainerPools } from "#app/data/balance/biomes";
|
||||
import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from "#app/utils";
|
||||
import { randSeedInt, NumberHolder, isNullOrUndefined, type Constructor } from "#app/utils/common";
|
||||
import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import {
|
||||
|
@ -26,7 +26,7 @@ import {
|
|||
PostTerrainChangeAbAttr,
|
||||
PostWeatherChangeAbAttr,
|
||||
TerrainEventTypeChangeAbAttr,
|
||||
} from "#app/data/ability";
|
||||
} from "#app/data/abilities/ability";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import Overrides from "#app/overrides";
|
||||
import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
|
||||
|
|
|
@ -2,7 +2,7 @@ import { TextStyle, addTextObject } from "../ui/text";
|
|||
import type { DamageResult } from "./pokemon";
|
||||
import type Pokemon from "./pokemon";
|
||||
import { HitResult } from "./pokemon";
|
||||
import { formatStat, fixedInt } from "#app/utils";
|
||||
import { formatStat, fixedInt } from "#app/utils/common";
|
||||
import type { BattlerIndex } from "../battle";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { GameObjects } from "phaser";
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import type { Species } from "#enums/species";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import type { Variant } from "#app/sprites/variant";
|
||||
import { doShinySparkleAnim } from "#app/field/anims";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import Pokemon from "./pokemon";
|
||||
import { fixedInt, randInt } from "#app/utils";
|
||||
import { fixedInt, randInt } from "#app/utils/common";
|
||||
|
||||
export default class PokemonSpriteSparkleHandler {
|
||||
private sprites: Set<Phaser.GameObjects.Sprite>;
|
||||
|
|
|
@ -55,7 +55,7 @@ import {
|
|||
getStarterValueFriendshipCap,
|
||||
speciesStarterCosts,
|
||||
} from "#app/data/balance/starters";
|
||||
import { NumberHolder, randSeedInt, getIvsFromId, BooleanHolder, randSeedItem, isNullOrUndefined, getEnumValues, toDmgValue, fixedInt, rgbaToInt, rgbHexToRgba, rgbToHsv, deltaRgb, isBetween, type nil, type Constructor } from "#app/utils";
|
||||
import { NumberHolder, randSeedInt, getIvsFromId, BooleanHolder, randSeedItem, isNullOrUndefined, getEnumValues, toDmgValue, fixedInt, rgbaToInt, rgbHexToRgba, rgbToHsv, deltaRgb, isBetween, type nil, type Constructor } from "#app/utils/common";
|
||||
import type { TypeDamageMultiplier } from "#app/data/type";
|
||||
import { getTypeDamageMultiplier, getTypeRgb } from "#app/data/type";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
|
@ -128,6 +128,7 @@ import {
|
|||
TarShotTag,
|
||||
AutotomizedTag,
|
||||
PowerTrickTag,
|
||||
type GrudgeTag,
|
||||
} from "../data/battler-tags";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import {
|
||||
|
@ -136,7 +137,8 @@ import {
|
|||
WeakenMoveScreenTag,
|
||||
} from "#app/data/arena-tag";
|
||||
import type { SuppressAbilitiesTag } from "#app/data/arena-tag";
|
||||
import type { Ability, AbAttr } from "#app/data/ability";
|
||||
import type { Ability } from "#app/data/abilities/ability-class";
|
||||
import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
|
||||
import {
|
||||
StatMultiplierAbAttr,
|
||||
BlockCritAbAttr,
|
||||
|
@ -151,7 +153,6 @@ import {
|
|||
StatusEffectImmunityAbAttr,
|
||||
TypeImmunityAbAttr,
|
||||
WeightMultiplierAbAttr,
|
||||
allAbilities,
|
||||
applyAbAttrs,
|
||||
applyStatMultiplierAbAttrs,
|
||||
applyPreApplyBattlerTagAbAttrs,
|
||||
|
@ -188,10 +189,11 @@ import {
|
|||
applyAllyStatMultiplierAbAttrs,
|
||||
AllyStatMultiplierAbAttr,
|
||||
MoveAbilityBypassAbAttr
|
||||
} from "#app/data/ability";
|
||||
} from "#app/data/abilities/ability";
|
||||
import { allAbilities } from "#app/data/data-lists";
|
||||
import type PokemonData from "#app/system/pokemon-data";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
|
@ -839,12 +841,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
|
||||
await Promise.allSettled(loadPromises);
|
||||
|
||||
// Wait for the assets we queued to load to finish loading, then...
|
||||
// This must be initiated before we queue loading, otherwise the load could have finished before
|
||||
// we reach the line of code that adds the listener, causing a deadlock.
|
||||
const waitOnLoadPromise = new Promise<void>(resolve => globalScene.load.once(Phaser.Loader.Events.COMPLETE, resolve));
|
||||
|
||||
if (!globalScene.load.isLoading()) {
|
||||
globalScene.load.start();
|
||||
}
|
||||
|
||||
// Wait for the assets we queued to load to finish loading, then...
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#creating_a_promise_around_an_old_callback_api
|
||||
await new Promise(resolve => globalScene.load.once(Phaser.Loader.Events.COMPLETE, resolve));
|
||||
await waitOnLoadPromise;
|
||||
|
||||
// With the sprites loaded, generate the animation frame information
|
||||
if (this.isPlayer()) {
|
||||
|
@ -1100,7 +1107,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
*/
|
||||
getSpeciesForm(ignoreOverride?: boolean, useIllusion: boolean = false): PokemonSpeciesForm {
|
||||
const species: PokemonSpecies = useIllusion && !!this.summonData?.illusion ? getPokemonSpecies(this.summonData?.illusion.species) : this.species;
|
||||
|
||||
const formIndex: integer = useIllusion && !!this.summonData?.illusion ? this.summonData?.illusion.formIndex : this.formIndex;
|
||||
|
||||
if (!ignoreOverride && this.summonData?.speciesForm) {
|
||||
|
@ -3846,12 +3852,17 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return null;
|
||||
}
|
||||
|
||||
getOpponents(): Pokemon[] {
|
||||
/**
|
||||
* Returns the pokemon that oppose this one and are active
|
||||
*
|
||||
* @param onField - whether to also check if the pokemon is currently on the field (defaults to true)
|
||||
*/
|
||||
getOpponents(onField = true): Pokemon[] {
|
||||
return (
|
||||
(this.isPlayer()
|
||||
? globalScene.getEnemyField()
|
||||
: globalScene.getPlayerField()) as Pokemon[]
|
||||
).filter(p => p.isActive());
|
||||
).filter(p => p.isActive(onField));
|
||||
}
|
||||
|
||||
getOpponentDescriptor(): string {
|
||||
|
@ -4150,6 +4161,62 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return baseDamage;
|
||||
}
|
||||
|
||||
|
||||
/** Determine the STAB multiplier for a move used against this pokemon.
|
||||
*
|
||||
* @param source - The attacking {@linkcode Pokemon}
|
||||
* @param move - The {@linkcode Move} used in the attack
|
||||
* @param ignoreSourceAbility - If `true`, ignores the attacking Pokemon's ability effects
|
||||
* @param simulated - If `true`, suppresses changes to game state during the calculation
|
||||
*
|
||||
* @returns The STAB multiplier for the move used against this Pokemon
|
||||
*/
|
||||
calculateStabMultiplier(source: Pokemon, move: Move, ignoreSourceAbility: boolean, simulated: boolean): number {
|
||||
// If the move has the Typeless attribute, it doesn't get STAB (e.g. struggle)
|
||||
if (move.hasAttr(TypelessAttr)) {
|
||||
return 1;
|
||||
}
|
||||
const sourceTypes = source.getTypes();
|
||||
const sourceTeraType = source.getTeraType();
|
||||
const moveType = source.getMoveType(move);
|
||||
const matchesSourceType = sourceTypes.includes(source.getMoveType(move));
|
||||
const stabMultiplier = new NumberHolder(1);
|
||||
if (matchesSourceType && moveType !== PokemonType.STELLAR) {
|
||||
stabMultiplier.value += 0.5;
|
||||
}
|
||||
|
||||
applyMoveAttrs(
|
||||
CombinedPledgeStabBoostAttr,
|
||||
source,
|
||||
this,
|
||||
move,
|
||||
stabMultiplier,
|
||||
);
|
||||
|
||||
if (!ignoreSourceAbility) {
|
||||
applyAbAttrs(StabBoostAbAttr, source, null, simulated, stabMultiplier);
|
||||
}
|
||||
|
||||
if (
|
||||
source.isTerastallized &&
|
||||
sourceTeraType === moveType &&
|
||||
moveType !== PokemonType.STELLAR
|
||||
) {
|
||||
stabMultiplier.value += 0.5;
|
||||
}
|
||||
|
||||
if (
|
||||
source.isTerastallized &&
|
||||
source.getTeraType() === PokemonType.STELLAR &&
|
||||
(!source.stellarTypesBoosted.includes(moveType) ||
|
||||
source.hasSpecies(Species.TERAPAGOS))
|
||||
) {
|
||||
stabMultiplier.value += matchesSourceType ? 0.5 : 0.2;
|
||||
}
|
||||
|
||||
return Math.min(stabMultiplier.value, 2.25);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the damage of an attack made by another Pokemon against this Pokemon
|
||||
* @param source {@linkcode Pokemon} the attacking Pokemon
|
||||
|
@ -4332,70 +4399,29 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
? 1
|
||||
: this.randSeedIntRange(85, 100) / 100;
|
||||
|
||||
const sourceTypes = source.getTypes();
|
||||
const sourceTeraType = source.getTeraType();
|
||||
const matchesSourceType = sourceTypes.includes(moveType);
|
||||
|
||||
/** A damage multiplier for when the attack is of the attacker's type and/or Tera type. */
|
||||
const stabMultiplier = new NumberHolder(1);
|
||||
if (matchesSourceType && moveType !== PokemonType.STELLAR) {
|
||||
stabMultiplier.value += 0.5;
|
||||
}
|
||||
|
||||
if (!ignoreSourceAbility) {
|
||||
applyAbAttrs(StabBoostAbAttr, source, null, simulated, stabMultiplier);
|
||||
}
|
||||
|
||||
applyMoveAttrs(
|
||||
CombinedPledgeStabBoostAttr,
|
||||
source,
|
||||
this,
|
||||
move,
|
||||
stabMultiplier,
|
||||
);
|
||||
|
||||
if (
|
||||
source.isTerastallized &&
|
||||
sourceTeraType === moveType &&
|
||||
moveType !== PokemonType.STELLAR
|
||||
) {
|
||||
stabMultiplier.value += 0.5;
|
||||
}
|
||||
|
||||
if (
|
||||
source.isTerastallized &&
|
||||
source.getTeraType() === PokemonType.STELLAR &&
|
||||
(!source.stellarTypesBoosted.includes(moveType) ||
|
||||
source.hasSpecies(Species.TERAPAGOS))
|
||||
) {
|
||||
if (matchesSourceType) {
|
||||
stabMultiplier.value += 0.5;
|
||||
} else {
|
||||
stabMultiplier.value += 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
stabMultiplier.value = Math.min(stabMultiplier.value, 2.25);
|
||||
const stabMultiplier = this.calculateStabMultiplier(source, move, ignoreSourceAbility, simulated);
|
||||
|
||||
/** Halves damage if the attacker is using a physical attack while burned */
|
||||
const burnMultiplier = new NumberHolder(1);
|
||||
let burnMultiplier = 1;
|
||||
if (
|
||||
isPhysical &&
|
||||
source.status &&
|
||||
source.status.effect === StatusEffect.BURN
|
||||
source.status.effect === StatusEffect.BURN &&
|
||||
!move.hasAttr(BypassBurnDamageReductionAttr)
|
||||
) {
|
||||
if (!move.hasAttr(BypassBurnDamageReductionAttr)) {
|
||||
const burnDamageReductionCancelled = new BooleanHolder(false);
|
||||
if (!ignoreSourceAbility) {
|
||||
applyAbAttrs(
|
||||
BypassBurnDamageReductionAbAttr,
|
||||
source,
|
||||
burnDamageReductionCancelled,
|
||||
simulated,
|
||||
);
|
||||
}
|
||||
if (!burnDamageReductionCancelled.value) {
|
||||
burnMultiplier.value = 0.5;
|
||||
}
|
||||
const burnDamageReductionCancelled = new BooleanHolder(false);
|
||||
if (!ignoreSourceAbility) {
|
||||
applyAbAttrs(
|
||||
BypassBurnDamageReductionAbAttr,
|
||||
source,
|
||||
burnDamageReductionCancelled,
|
||||
simulated,
|
||||
);
|
||||
}
|
||||
if (!burnDamageReductionCancelled.value) {
|
||||
burnMultiplier = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4446,9 +4472,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
glaiveRushMultiplier.value *
|
||||
criticalMultiplier.value *
|
||||
randomMultiplier *
|
||||
stabMultiplier.value *
|
||||
stabMultiplier *
|
||||
typeMultiplier *
|
||||
burnMultiplier.value *
|
||||
burnMultiplier *
|
||||
screenMultiplier.value *
|
||||
hitsTagMultiplier.value *
|
||||
mistyTerrainMultiplier,
|
||||
|
@ -4733,15 +4759,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
new FaintPhase(
|
||||
this.getBattlerIndex(),
|
||||
false,
|
||||
destinyTag,
|
||||
grudgeTag,
|
||||
source,
|
||||
),
|
||||
);
|
||||
|
||||
this.destroySubstitute();
|
||||
this.lapseTag(BattlerTagType.COMMANDED);
|
||||
this.resetSummonData();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -4803,7 +4826,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
);
|
||||
this.destroySubstitute();
|
||||
this.lapseTag(BattlerTagType.COMMANDED);
|
||||
this.resetSummonData();
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
@ -4971,6 +4993,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**@overload */
|
||||
getTag(tagType: BattlerTagType.GRUDGE): GrudgeTag | nil;
|
||||
|
||||
/** @overload */
|
||||
getTag(tagType: BattlerTagType): BattlerTag | nil;
|
||||
|
||||
|
@ -5261,13 +5286,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
sceneOverride?: BattleScene,
|
||||
): AnySound {
|
||||
const scene = sceneOverride ?? globalScene; // TODO: is `sceneOverride` needed?
|
||||
const cry = this.getSpeciesForm().cry(soundConfig);
|
||||
const cry = this.getSpeciesForm(undefined, true).cry(soundConfig);
|
||||
let duration = cry.totalDuration * 1000;
|
||||
if (
|
||||
this.fusionSpecies &&
|
||||
this.getSpeciesForm() !== this.getFusionSpeciesForm()
|
||||
this.getSpeciesForm(undefined, true) !== this.getFusionSpeciesForm(undefined, true)
|
||||
) {
|
||||
let fusionCry = this.getFusionSpeciesForm().cry(soundConfig, true);
|
||||
let fusionCry = this.getFusionSpeciesForm(undefined, true).cry(soundConfig, true);
|
||||
duration = Math.min(duration, fusionCry.totalDuration * 1000);
|
||||
fusionCry.destroy();
|
||||
scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => {
|
||||
|
@ -5277,7 +5302,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
cry,
|
||||
fixedInt(Math.ceil(duration * 0.2)),
|
||||
);
|
||||
fusionCry = this.getFusionSpeciesForm().cry(
|
||||
fusionCry = this.getFusionSpeciesForm(undefined, true).cry(
|
||||
Object.assign(
|
||||
{ seek: Math.max(fusionCry.totalDuration * 0.4, 0) },
|
||||
soundConfig,
|
||||
|
@ -6561,7 +6586,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
this.leaveField(switchType === SwitchType.SWITCH);
|
||||
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.FAINT_SWITCH,
|
||||
this.getFieldIndex(),
|
||||
(slotIndex: number, option: PartyOption) => {
|
||||
|
@ -6579,7 +6604,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
MoveEndPhase,
|
||||
);
|
||||
}
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(resolve);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(resolve);
|
||||
},
|
||||
PartyUiHandler.FilterNonFainted,
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
|
|||
import { TrainerPoolTier } from "#enums/trainer-pool-tier";
|
||||
import { TeraAIMode } from "#enums/tera-ai-mode";
|
||||
import type { EnemyPokemon } from "#app/field/pokemon";
|
||||
import { randSeedWeightedItem, randSeedItem, randSeedInt } from "#app/utils";
|
||||
import { randSeedWeightedItem, randSeedItem, randSeedInt } from "#app/utils/common";
|
||||
import type { PersistentModifier } from "#app/modifier/modifier";
|
||||
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
|
||||
import { getIsInitialized, initI18n } from "#app/plugins/i18n";
|
||||
|
@ -223,6 +223,13 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
return this.config.doubleOnly || this.variant === TrainerVariant.DOUBLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether the trainer is a duo, like Tate & Liza
|
||||
*/
|
||||
isPartner(): boolean {
|
||||
return this.variant === TrainerVariant.DOUBLE;
|
||||
}
|
||||
|
||||
getMixedBattleBgm(): string {
|
||||
return this.config.mixedBattleBgm;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import type PokemonSpecies from "./data/pokemon-species";
|
|||
import { allSpecies } from "./data/pokemon-species";
|
||||
import type { Arena } from "./field/arena";
|
||||
import Overrides from "#app/overrides";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils/common";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { Species } from "#enums/species";
|
||||
import { Challenges } from "./enums/challenges";
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
|
@ -0,0 +1,4 @@
|
|||
export const starterColors: StarterColors = {};
|
||||
interface StarterColors {
|
||||
[key: string]: [string, string];
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
import Phaser from "phaser";
|
||||
import { deepCopy, getEnumValues } from "#app/utils";
|
||||
import { deepCopy, getEnumValues } from "#app/utils/common";
|
||||
import pad_generic from "./configs/inputs/pad_generic";
|
||||
import pad_unlicensedSNES from "./configs/inputs/pad_unlicensedSNES";
|
||||
import pad_xbox360 from "./configs/inputs/pad_xbox360";
|
||||
import pad_dualshock from "./configs/inputs/pad_dualshock";
|
||||
import pad_procon from "./configs/inputs/pad_procon";
|
||||
import { Mode } from "./ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type SettingsGamepadUiHandler from "./ui/settings/settings-gamepad-ui-handler";
|
||||
import type SettingsKeyboardUiHandler from "./ui/settings/settings-keyboard-ui-handler";
|
||||
import cfg_keyboard_qwerty from "./configs/inputs/cfg_keyboard_qwerty";
|
||||
|
@ -235,7 +235,7 @@ export class InputsController {
|
|||
if (gamepadName) {
|
||||
this.selectedDevice[Device.GAMEPAD] = gamepadName.toLowerCase();
|
||||
}
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
handler?.updateChosenGamepadDisplay();
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ export class InputsController {
|
|||
if (layoutKeyboard) {
|
||||
this.selectedDevice[Device.KEYBOARD] = layoutKeyboard.toLowerCase();
|
||||
}
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_KEYBOARD] as SettingsKeyboardUiHandler;
|
||||
handler?.updateChosenKeyboardDisplay();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ export class InputsController {
|
|||
globalScene.gameData?.saveMappingConfigs(gamepadID, this.configs[gamepadID]);
|
||||
}
|
||||
this.lastSource = "gamepad";
|
||||
const handler = globalScene.ui?.handlers[Mode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
const handler = globalScene.ui?.handlers[UiMode.SETTINGS_GAMEPAD] as SettingsGamepadUiHandler;
|
||||
handler?.updateChosenGamepadDisplay();
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ export class InputsController {
|
|||
this.lastSource = "gamepad";
|
||||
if (
|
||||
!this.selectedDevice[Device.GAMEPAD] ||
|
||||
(globalScene.ui.getMode() !== Mode.GAMEPAD_BINDING &&
|
||||
(globalScene.ui.getMode() !== UiMode.GAMEPAD_BINDING &&
|
||||
this.selectedDevice[Device.GAMEPAD] !== pad.id.toLowerCase())
|
||||
) {
|
||||
this.setChosenGamepad(pad.id);
|
||||
|
|
|
@ -4,14 +4,14 @@ import CacheBustedLoaderPlugin from "#app/plugins/cache-busted-loader-plugin";
|
|||
import { SceneBase } from "#app/scene-base";
|
||||
import { WindowVariant, getWindowVariantSuffix } from "#app/ui/ui-theme";
|
||||
import { isMobile } from "#app/touch-controls";
|
||||
import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils";
|
||||
import { localPing, getEnumValues, hasAllLocalizedSprites, getEnumKeys } from "#app/utils/common";
|
||||
import { initPokemonPrevolutions, initPokemonStarters } from "#app/data/balance/pokemon-evolutions";
|
||||
import { initBiomes } from "#app/data/balance/biomes";
|
||||
import { initEggMoves } from "#app/data/balance/egg-moves";
|
||||
import { initPokemonForms } from "#app/data/pokemon-forms";
|
||||
import { initSpecies } from "#app/data/pokemon-species";
|
||||
import { initMoves } from "#app/data/moves/move";
|
||||
import { initAbilities } from "#app/data/ability";
|
||||
import { initAbilities } from "#app/data/abilities/ability";
|
||||
import { initAchievements } from "#app/system/achv";
|
||||
import { initTrainerTypeDialogue } from "#app/data/dialogue";
|
||||
import { initChallenges } from "#app/data/challenge";
|
||||
|
|
|
@ -114,7 +114,7 @@ import {
|
|||
NumberHolder,
|
||||
padInt,
|
||||
randSeedInt,
|
||||
} from "#app/utils";
|
||||
} from "#app/utils/common";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
|
|
|
@ -15,7 +15,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
|||
import type { VoucherType } from "#app/system/voucher";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { addTextObject, TextStyle } from "#app/ui/text";
|
||||
import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, toDmgValue } from "#app/utils";
|
||||
import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, toDmgValue } from "#app/utils/common";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
import type { Moves } from "#enums/moves";
|
||||
|
@ -47,7 +47,7 @@ import {
|
|||
} from "./modifier-type";
|
||||
import { Color, ShadowColor } from "#enums/color";
|
||||
import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters";
|
||||
import { applyAbAttrs, CommanderAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, CommanderAbAttr } from "#app/data/abilities/ability";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
||||
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
||||
|
|
|
@ -15,11 +15,13 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|||
import { PokeballType } from "#enums/pokeball";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { BATTLE_STATS, Stat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
import { VariantTier } from "#enums/variant-tier";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
|
||||
/**
|
||||
* This comment block exists to prevent IDEs from automatically removing unused imports
|
||||
|
@ -41,7 +43,7 @@ import { WeatherType } from "#enums/weather-type";
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
const overrides = {} satisfies Partial<InstanceType<typeof DefaultOverrides>>;
|
||||
const overrides = {} satisfies Partial<InstanceType<OverridesType>>;
|
||||
|
||||
/**
|
||||
* If you need to add Overrides values for local testing do that inside {@linkcode overrides}
|
||||
|
@ -69,7 +71,7 @@ class DefaultOverrides {
|
|||
*
|
||||
* If `"odd-doubles"`, follow the `"double"` rule on odd wave numbers, and follow the `"single"` rule on even wave numbers.
|
||||
*/
|
||||
readonly BATTLE_TYPE_OVERRIDE: BattleStyle | null = null;
|
||||
readonly BATTLE_STYLE_OVERRIDE: BattleStyle | null = null;
|
||||
readonly STARTING_WAVE_OVERRIDE: number = 0;
|
||||
readonly STARTING_BIOME_OVERRIDE: Biome = Biome.TOWN;
|
||||
readonly ARENA_TINT_OVERRIDE: TimeOfDay | null = null;
|
||||
|
@ -259,6 +261,16 @@ class DefaultOverrides {
|
|||
* If `true`, disable all non-scripted opponent trainer encounters.
|
||||
*/
|
||||
readonly DISABLE_STANDARD_TRAINERS_OVERRIDE: boolean = false;
|
||||
|
||||
/**
|
||||
* Set all non-scripted waves to use the selected battle type.
|
||||
*
|
||||
* Ignored if set to {@linkcode BattleType.TRAINER} and `DISABLE_STANDARD_TRAINERS_OVERRIDE` is `true`.
|
||||
*/
|
||||
readonly BATTLE_TYPE_OVERRIDE: Exclude<BattleType, BattleType.CLEAR> | null = null;
|
||||
|
||||
/** Force all random trainer types to be the provided type. */
|
||||
readonly RANDOM_TRAINER_OVERRIDE: RandomTrainerOverride | null = null;
|
||||
}
|
||||
|
||||
export const defaultOverrides = new DefaultOverrides();
|
||||
|
@ -269,3 +281,13 @@ export default {
|
|||
} satisfies InstanceType<typeof DefaultOverrides>;
|
||||
|
||||
export type BattleStyle = "double" | "single" | "even-doubles" | "odd-doubles";
|
||||
|
||||
export type RandomTrainerOverride = {
|
||||
/** The Type of trainer to force */
|
||||
trainerType: Exclude<TrainerType, TrainerType.UNKNOWN>,
|
||||
/* If the selected trainer type has a double version, it will always use its double version. */
|
||||
alwaysDouble?: boolean
|
||||
}
|
||||
|
||||
/** The type of the {@linkcode DefaultOverrides} class */
|
||||
export type OverridesType = typeof DefaultOverrides;
|
|
@ -19,7 +19,7 @@ import { achvs } from "#app/system/achv";
|
|||
import type { PartyOption } from "#app/ui/party-ui-handler";
|
||||
import { PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { PokeballType } from "#enums/pokeball";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import i18next from "i18next";
|
||||
|
@ -295,7 +295,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
() => {
|
||||
globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
const newPokemon = globalScene.addPlayerPokemon(
|
||||
pokemon.species,
|
||||
|
@ -310,12 +310,12 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
pokemon,
|
||||
);
|
||||
globalScene.ui.setMode(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
newPokemon,
|
||||
0,
|
||||
SummaryUiMode.DEFAULT,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
|
@ -329,19 +329,26 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
form: pokemon.formIndex,
|
||||
female: pokemon.gender === Gender.FEMALE,
|
||||
};
|
||||
globalScene.ui.setOverlayMode(Mode.POKEDEX_PAGE, pokemon.species, attributes, null, null, () => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
});
|
||||
globalScene.ui.setOverlayMode(
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
attributes,
|
||||
null,
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
promptRelease();
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.PARTY,
|
||||
UiMode.PARTY,
|
||||
PartyUiMode.RELEASE,
|
||||
this.fieldIndex,
|
||||
(slotIndex: number, _option: PartyOption) => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (slotIndex < 6) {
|
||||
addToParty(slotIndex);
|
||||
} else {
|
||||
|
@ -352,7 +359,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||
);
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
removePokemon();
|
||||
end();
|
||||
});
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
import { applyAbAttrs, applyPreLeaveFieldAbAttrs, PreLeaveFieldAbAttr, RunSuccessAbAttr } from "#app/data/ability";
|
||||
import {
|
||||
applyAbAttrs,
|
||||
applyPreLeaveFieldAbAttrs,
|
||||
PreLeaveFieldAbAttr,
|
||||
RunSuccessAbAttr,
|
||||
} from "#app/data/abilities/ability";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import type { PlayerPokemon, EnemyPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import i18next from "i18next";
|
||||
import { NumberHolder } from "#app/utils";
|
||||
import { NumberHolder } from "#app/utils/common";
|
||||
import { BattleEndPhase } from "./battle-end-phase";
|
||||
import { NewBattlePhase } from "./new-battle-phase";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { applyPostBattleAbAttrs, PostBattleAbAttr } from "#app/data/ability";
|
||||
import { applyPostBattleAbAttrs, PostBattleAbAttr } from "#app/data/abilities/ability";
|
||||
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import { GameOverPhase } from "./game-over-phase";
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { applyAbAttrs, PreventBerryUseAbAttr, HealFromBerryUseAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, PreventBerryUseAbAttr, HealFromBerryUseAbAttr } from "#app/data/abilities/ability";
|
||||
import { CommonAnim } from "#app/data/battle-anims";
|
||||
import { BerryUsedEvent } from "#app/events/battle-scene";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { BerryModifier } from "#app/modifier/modifier";
|
||||
import i18next from "i18next";
|
||||
import { BooleanHolder } from "#app/utils";
|
||||
import { BooleanHolder } from "#app/utils/common";
|
||||
import { FieldPhase } from "./field-phase";
|
||||
import { CommonAnimPhase } from "./common-anim-phase";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { BattleStyle } from "#app/enums/battle-style";
|
||||
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
import { SummonMissingPhase } from "./summon-missing-phase";
|
||||
|
@ -64,14 +64,14 @@ export class CheckSwitchPhase extends BattlePhase {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.unshiftPhase(new SwitchPhase(SwitchType.INITIAL_SWITCH, this.fieldIndex, false, true));
|
||||
this.end();
|
||||
},
|
||||
() => {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
this.end();
|
||||
},
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import type { TurnCommand } from "#app/battle";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import type { EncoreTag } from "#app/data/battler-tags";
|
||||
import { TrappedTag } from "#app/data/battler-tags";
|
||||
import type { MoveTargetSet } from "#app/data/moves/move";
|
||||
|
@ -15,12 +15,12 @@ import type { PlayerPokemon, TurnMove } from "#app/field/pokemon";
|
|||
import { FieldPosition } from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { Command } from "#app/ui/command-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { FieldPhase } from "./field-phase";
|
||||
import { SelectTargetPhase } from "./select-target-phase";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||
|
||||
|
@ -38,7 +38,7 @@ export class CommandPhase extends FieldPhase {
|
|||
|
||||
globalScene.updateGameInfo();
|
||||
|
||||
const commandUiHandler = globalScene.ui.handlers[Mode.COMMAND];
|
||||
const commandUiHandler = globalScene.ui.handlers[UiMode.COMMAND];
|
||||
|
||||
// If one of these conditions is true, we always reset the cursor to Command.FIGHT
|
||||
const cursorResetEvent =
|
||||
|
@ -127,7 +127,7 @@ export class CommandPhase extends FieldPhase {
|
|||
) {
|
||||
this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, queuedMove);
|
||||
} else {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -136,9 +136,9 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.currentBattle.mysteryEncounter?.skipToFightInput
|
||||
) {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex);
|
||||
} else {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ export class CommandPhase extends FieldPhase {
|
|||
success = true;
|
||||
} else if (cursor < playerPokemon.getMoveset().length) {
|
||||
const move = playerPokemon.getMoveset()[cursor];
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
|
||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||
const errorMessage = playerPokemon.isMoveRestricted(move.moveId, playerPokemon)
|
||||
|
@ -226,7 +226,7 @@ export class CommandPhase extends FieldPhase {
|
|||
null,
|
||||
() => {
|
||||
globalScene.ui.clearText();
|
||||
globalScene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.FIGHT, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -244,27 +244,27 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.arena.biomeType === Biome.END &&
|
||||
(!globalScene.gameMode.isClassic || globalScene.gameMode.isFreshStartChallenge() || notInDex)
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballForce"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
);
|
||||
} else if (globalScene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballTrainer"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -273,14 +273,14 @@ export class CommandPhase extends FieldPhase {
|
|||
globalScene.currentBattle.isBattleMysteryEncounter() &&
|
||||
!globalScene.currentBattle.mysteryEncounter!.catchAllowed
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballMysteryEncounter"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -291,14 +291,14 @@ export class CommandPhase extends FieldPhase {
|
|||
.filter(p => p.isActive(true))
|
||||
.map(p => p.getBattlerIndex());
|
||||
if (targets.length > 1) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballMulti"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -311,14 +311,14 @@ export class CommandPhase extends FieldPhase {
|
|||
!targetPokemon?.hasAbility(Abilities.WONDER_GUARD, false, true) &&
|
||||
cursor < PokeballType.MASTER_BALL
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noPokeballStrong"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -347,14 +347,14 @@ export class CommandPhase extends FieldPhase {
|
|||
(arena.biomeType === Biome.END ||
|
||||
(!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noEscapeForce"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -364,14 +364,14 @@ export class CommandPhase extends FieldPhase {
|
|||
(currentBattle.battleType === BattleType.TRAINER ||
|
||||
currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)
|
||||
) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:noEscapeTrainer"),
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
@ -389,7 +389,7 @@ export class CommandPhase extends FieldPhase {
|
|||
}
|
||||
} else if (trappedAbMessages.length > 0) {
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
}
|
||||
globalScene.ui.showText(
|
||||
trappedAbMessages[0],
|
||||
|
@ -397,7 +397,7 @@ export class CommandPhase extends FieldPhase {
|
|||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
},
|
||||
null,
|
||||
|
@ -412,8 +412,8 @@ export class CommandPhase extends FieldPhase {
|
|||
break;
|
||||
}
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
}
|
||||
const showNoEscapeText = (tag: any) => {
|
||||
globalScene.ui.showText(
|
||||
|
@ -429,7 +429,7 @@ export class CommandPhase extends FieldPhase {
|
|||
() => {
|
||||
globalScene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
globalScene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
},
|
||||
null,
|
||||
|
@ -471,6 +471,6 @@ export class CommandPhase extends FieldPhase {
|
|||
}
|
||||
|
||||
end() {
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => super.end());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import type { BattlerIndex } from "#app/battle";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { type DamageResult, HitResult } from "#app/field/pokemon";
|
||||
import { fixedInt } from "#app/utils";
|
||||
import { fixedInt } from "#app/utils/common";
|
||||
import { PokemonPhase } from "#app/phases/pokemon-phase";
|
||||
|
||||
export class DamageAnimPhase extends PokemonPhase {
|
||||
|
|
|
@ -8,10 +8,10 @@ import { achvs } from "#app/system/achv";
|
|||
import EggCounterContainer from "#app/ui/egg-counter-container";
|
||||
import type EggHatchSceneHandler from "#app/ui/egg-hatch-scene-handler";
|
||||
import PokemonInfoContainer from "#app/ui/pokemon-info-container";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils/common";
|
||||
import type { EggLapsePhase } from "./egg-lapse-phase";
|
||||
import type { EggHatchData } from "#app/data/egg-hatch-data";
|
||||
import { doShinySparkleAnim } from "#app/field/anims";
|
||||
|
@ -76,7 +76,7 @@ export class EggHatchPhase extends Phase {
|
|||
start() {
|
||||
super.start();
|
||||
|
||||
globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SCENE).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SCENE).then(() => {
|
||||
if (!this.egg) {
|
||||
return this.end();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Phase } from "#app/phase";
|
|||
import i18next from "i18next";
|
||||
import Overrides from "#app/overrides";
|
||||
import { EggHatchPhase } from "./egg-hatch-phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { EggSummaryPhase } from "./egg-summary-phase";
|
||||
|
@ -41,7 +41,7 @@ export class EggLapsePhase extends Phase {
|
|||
0,
|
||||
);
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
this.hatchEggsSkipped(eggsToHatch);
|
||||
this.showSummary();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type { EggHatchData } from "#app/data/egg-hatch-data";
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ export class EggSummaryPhase extends Phase {
|
|||
// updates next pokemon once the current update has been completed
|
||||
const updateNextPokemon = (i: number) => {
|
||||
if (i >= this.eggHatchData.length) {
|
||||
globalScene.ui.setModeForceTransition(Mode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.EGG_HATCH_SUMMARY, this.eggHatchData).then(() => {
|
||||
globalScene.fadeOutBgm(undefined, false);
|
||||
});
|
||||
} else {
|
||||
|
@ -39,7 +39,7 @@ export class EggSummaryPhase extends Phase {
|
|||
|
||||
end() {
|
||||
globalScene.time.delayedCall(250, () => globalScene.setModifiersVisible(true));
|
||||
globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => {
|
||||
super.end();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { BattlerIndex, BattleType } from "#app/battle";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
|
||||
import { applyAbAttrs, SyncEncounterNatureAbAttr, applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, SyncEncounterNatureAbAttr, applyPreSummonAbAttrs, PreSummonAbAttr } from "#app/data/abilities/ability";
|
||||
import { initEncounterAnims, loadEncounterAnimAssets } from "#app/data/battle-anims";
|
||||
import { getCharVariantFromDialogue } from "#app/data/dialogue";
|
||||
import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
|
@ -28,8 +29,8 @@ import { SummonPhase } from "#app/phases/summon-phase";
|
|||
import { ToggleDoublePositionPhase } from "#app/phases/toggle-double-position-phase";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { handleTutorial, Tutorial } from "#app/tutorial";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { randSeedInt, randSeedItem } from "#app/utils/common";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
|
@ -297,7 +298,7 @@ export class EncounterPhase extends BattlePhase {
|
|||
globalScene.currentBattle.trainer!.genAI(globalScene.getEnemyParty());
|
||||
}
|
||||
|
||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
if (!this.loaded) {
|
||||
this.trySetWeatherIfNewBiome(); // Set weather before session gets saved
|
||||
// Game syncs to server on waves X1 and X6 (As of 1.2.0)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
||||
export class EndEvolutionPhase extends Phase {
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
globalScene.ui.setModeForceTransition(Mode.MESSAGE).then(() => this.end());
|
||||
globalScene.ui.setModeForceTransition(UiMode.MESSAGE).then(() => this.end());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import { globalScene } from "#app/global-scene";
|
|||
import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import { FusionSpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import type EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { fixedInt, getFrameMs, randInt } from "#app/utils/common";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { cos, sin } from "#app/field/anims";
|
||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
|
@ -53,7 +53,7 @@ export class EvolutionPhase extends Phase {
|
|||
}
|
||||
|
||||
setMode(): Promise<void> {
|
||||
return globalScene.ui.setModeForceTransition(Mode.EVOLUTION_SCENE);
|
||||
return globalScene.ui.setModeForceTransition(UiMode.EVOLUTION_SCENE);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -280,7 +280,7 @@ export class EvolutionPhase extends Phase {
|
|||
this.end();
|
||||
};
|
||||
globalScene.ui.setOverlayMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.revertMode();
|
||||
this.pokemon.pauseEvolutions = true;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
|
|||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { ExpBoosterModifier } from "#app/modifier/modifier";
|
||||
import i18next from "i18next";
|
||||
import { NumberHolder } from "#app/utils";
|
||||
import { NumberHolder } from "#app/utils/common";
|
||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
||||
import { LevelUpPhase } from "./level-up-phase";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { BattlerIndex } from "#app/battle";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import {
|
||||
applyPostFaintAbAttrs,
|
||||
|
@ -8,8 +8,7 @@ import {
|
|||
PostFaintAbAttr,
|
||||
PostKnockOutAbAttr,
|
||||
PostVictoryAbAttr,
|
||||
} from "#app/data/ability";
|
||||
import type { DestinyBondTag, GrudgeTag } from "#app/data/battler-tags";
|
||||
} from "#app/data/abilities/ability";
|
||||
import { BattlerTagLapseType } from "#app/data/battler-tags";
|
||||
import { battleSpecDialogue } from "#app/data/dialogue";
|
||||
import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/moves/move";
|
||||
|
@ -30,8 +29,9 @@ import { SwitchPhase } from "./switch-phase";
|
|||
import { SwitchSummonPhase } from "./switch-summon-phase";
|
||||
import { ToggleDoublePositionPhase } from "./toggle-double-position-phase";
|
||||
import { VictoryPhase } from "./victory-phase";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
|
||||
export class FaintPhase extends PokemonPhase {
|
||||
/**
|
||||
|
@ -39,33 +39,15 @@ export class FaintPhase extends PokemonPhase {
|
|||
*/
|
||||
private preventEndure: boolean;
|
||||
|
||||
/**
|
||||
* Destiny Bond tag belonging to the currently fainting Pokemon, if applicable
|
||||
*/
|
||||
private destinyTag?: DestinyBondTag | null;
|
||||
|
||||
/**
|
||||
* Grudge tag belonging to the currently fainting Pokemon, if applicable
|
||||
*/
|
||||
private grudgeTag?: GrudgeTag | null;
|
||||
|
||||
/**
|
||||
* The source Pokemon that dealt fatal damage
|
||||
*/
|
||||
private source?: Pokemon;
|
||||
|
||||
constructor(
|
||||
battlerIndex: BattlerIndex,
|
||||
preventEndure = false,
|
||||
destinyTag?: DestinyBondTag | null,
|
||||
grudgeTag?: GrudgeTag | null,
|
||||
source?: Pokemon,
|
||||
) {
|
||||
constructor(battlerIndex: BattlerIndex, preventEndure = false, source?: Pokemon) {
|
||||
super(battlerIndex);
|
||||
|
||||
this.preventEndure = preventEndure;
|
||||
this.destinyTag = destinyTag;
|
||||
this.grudgeTag = grudgeTag;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
|
@ -74,13 +56,12 @@ export class FaintPhase extends PokemonPhase {
|
|||
|
||||
const faintPokemon = this.getPokemon();
|
||||
|
||||
if (!isNullOrUndefined(this.destinyTag) && !isNullOrUndefined(this.source)) {
|
||||
this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM);
|
||||
if (this.source) {
|
||||
faintPokemon.getTag(BattlerTagType.DESTINY_BOND)?.lapse(this.source, BattlerTagLapseType.CUSTOM);
|
||||
faintPokemon.getTag(BattlerTagType.GRUDGE)?.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source);
|
||||
}
|
||||
|
||||
if (!isNullOrUndefined(this.grudgeTag) && !isNullOrUndefined(this.source)) {
|
||||
this.grudgeTag.lapse(faintPokemon, BattlerTagLapseType.CUSTOM, this.source);
|
||||
}
|
||||
faintPokemon.resetSummonData();
|
||||
|
||||
if (!this.preventEndure) {
|
||||
const instantReviveModifier = globalScene.applyModifier(
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { fixedInt } from "#app/utils";
|
||||
import { fixedInt } from "#app/utils/common";
|
||||
import { achvs } from "../system/achv";
|
||||
import type { SpeciesFormChange } from "../data/pokemon-forms";
|
||||
import { getSpeciesFormChangeMessage } from "../data/pokemon-forms";
|
||||
import type { PlayerPokemon } from "../field/pokemon";
|
||||
import { Mode } from "../ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import type PartyUiHandler from "../ui/party-ui-handler";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import { EndEvolutionPhase } from "./end-evolution-phase";
|
||||
|
@ -31,7 +31,7 @@ export class FormChangePhase extends EvolutionPhase {
|
|||
if (!this.modal) {
|
||||
return super.setMode();
|
||||
}
|
||||
return globalScene.ui.setOverlayMode(Mode.EVOLUTION_SCENE);
|
||||
return globalScene.ui.setOverlayMode(UiMode.EVOLUTION_SCENE);
|
||||
}
|
||||
|
||||
doEvolution(): void {
|
||||
|
@ -181,7 +181,7 @@ export class FormChangePhase extends EvolutionPhase {
|
|||
this.pokemon.findAndRemoveTags(t => t.tagType === BattlerTagType.AUTOTOMIZED);
|
||||
if (this.modal) {
|
||||
globalScene.ui.revertMode().then(() => {
|
||||
if (globalScene.ui.getMode() === Mode.PARTY) {
|
||||
if (globalScene.ui.getMode() === UiMode.PARTY) {
|
||||
const partyUiHandler = globalScene.ui.getHandler() as PartyUiHandler;
|
||||
partyUiHandler.clearPartySlots();
|
||||
partyUiHandler.populatePartySlots();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { globalScene } from "#app/global-scene";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { ModifierRewardPhase } from "./modifier-reward-phase";
|
||||
|
||||
|
@ -10,7 +10,7 @@ export class GameOverModifierRewardPhase extends ModifierRewardPhase {
|
|||
globalScene.addModifier(newModifier);
|
||||
// Sound loaded into game as is
|
||||
globalScene.playSound("level_up_fanfare");
|
||||
globalScene.ui.setMode(Mode.MESSAGE);
|
||||
globalScene.ui.setMode(UiMode.MESSAGE);
|
||||
globalScene.ui.fadeIn(250).then(() => {
|
||||
globalScene.ui.showText(
|
||||
i18next.t("battle:rewardGain", {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { clientSessionId } from "#app/account";
|
||||
import { BattleType } from "#app/battle";
|
||||
import { BattleType } from "#enums/battle-type";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { getCharVariantFromDialogue } from "#app/data/dialogue";
|
||||
|
@ -19,8 +19,8 @@ import { SummonPhase } from "#app/phases/summon-phase";
|
|||
import { UnlockPhase } from "#app/phases/unlock-phase";
|
||||
import { achvs, ChallengeAchv } from "#app/system/achv";
|
||||
import { Unlockables } from "#app/system/unlockables";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { isLocal, isLocalServerConnected } from "#app/utils";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import { isLocal, isLocalServerConnected } from "#app/utils/common";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import i18next from "i18next";
|
||||
|
@ -78,7 +78,7 @@ export class GameOverPhase extends BattlePhase {
|
|||
} else {
|
||||
globalScene.ui.showText(i18next.t("battle:retryBattle"), null, () => {
|
||||
globalScene.ui.setMode(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.fadeOut(1250).then(() => {
|
||||
globalScene.reset();
|
||||
|
|
|
@ -8,7 +8,7 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||
import Overrides from "#app/overrides";
|
||||
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
import i18next from "i18next";
|
||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
|
@ -25,7 +25,7 @@ export enum LearnMoveType {
|
|||
|
||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
private moveId: Moves;
|
||||
private messageMode: Mode;
|
||||
private messageMode: UiMode;
|
||||
private learnMoveType: LearnMoveType;
|
||||
private cost: number;
|
||||
|
||||
|
@ -55,7 +55,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
}
|
||||
|
||||
this.messageMode =
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? Mode.EVOLUTION_SCENE : Mode.MESSAGE;
|
||||
globalScene.ui.getHandler() instanceof EvolutionSceneHandler ? UiMode.EVOLUTION_SCENE : UiMode.MESSAGE;
|
||||
globalScene.ui.setMode(this.messageMode);
|
||||
// If the Pokemon has less than 4 moves, the new move is added to the largest empty moveset index
|
||||
// If it has 4 moves, the phase then checks if the player wants to replace the move itself.
|
||||
|
@ -90,7 +90,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
await globalScene.ui.showTextPromise(preQText);
|
||||
await globalScene.ui.showTextPromise(shouldReplaceQ, undefined, false);
|
||||
await globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => this.forgetMoveProcess(move, pokemon), // Yes
|
||||
() => {
|
||||
// No
|
||||
|
@ -115,7 +115,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
globalScene.ui.setMode(this.messageMode);
|
||||
await globalScene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
||||
await globalScene.ui.setModeWithoutClear(
|
||||
Mode.SUMMARY,
|
||||
UiMode.SUMMARY,
|
||||
pokemon,
|
||||
SummaryUiMode.LEARN_MOVE,
|
||||
move,
|
||||
|
@ -153,7 +153,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
false,
|
||||
);
|
||||
globalScene.ui.setModeWithoutClear(
|
||||
Mode.CONFIRM,
|
||||
UiMode.CONFIRM,
|
||||
() => {
|
||||
globalScene.ui.setMode(this.messageMode);
|
||||
globalScene.ui
|
||||
|
@ -228,7 +228,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeMoveLearnedTrigger, true);
|
||||
this.end();
|
||||
},
|
||||
this.messageMode === Mode.EVOLUTION_SCENE ? 1000 : undefined,
|
||||
this.messageMode === UiMode.EVOLUTION_SCENE ? 1000 : undefined,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue