mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 10:42:25 +02:00
Merge branch 'beta' of https://github.com/pagefaultgames/pokerogue into valevent
This commit is contained in:
commit
d6fe30d2fb
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[src/*.{js,ts}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
42
CREDITS.md
42
CREDITS.md
@ -343,34 +343,39 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki.
|
|||||||
|
|
||||||
# 💻 Development
|
# 💻 Development
|
||||||
|
|
||||||
## Server Owner/Administrator
|
## Server Developers
|
||||||
- pancakes aka patapancakes
|
- pancakes aka patapancakes
|
||||||
|
|
||||||
## Senior Developers
|
## Current and former Development Team members
|
||||||
- Walker
|
- bennybroseph
|
||||||
- NightKev
|
- Brain Frog
|
||||||
- Moka
|
|
||||||
- Temp aka Tempo-anon
|
|
||||||
- Madmadness65
|
|
||||||
|
|
||||||
## Developers
|
|
||||||
- CodeTappert
|
- CodeTappert
|
||||||
|
- Dakurei
|
||||||
- flx-sta
|
- flx-sta
|
||||||
- innerthunder
|
|
||||||
- frutescens
|
- frutescens
|
||||||
|
- Greenlamp
|
||||||
|
- ImperialSympathizer
|
||||||
|
- innerthunder
|
||||||
|
- KimJeongSun
|
||||||
|
- Madmadness65
|
||||||
|
- Moka
|
||||||
|
- Navori
|
||||||
|
- NightKev
|
||||||
- Opaquer
|
- Opaquer
|
||||||
|
- OrangeRed
|
||||||
|
- Sam aka Flashfyre (initial developer, started PokéRogue)
|
||||||
|
- sirzento
|
||||||
- SN34KZ
|
- SN34KZ
|
||||||
- Swain aka torranx
|
- Swain aka torranx
|
||||||
|
- Temp aka Tempo-anon
|
||||||
## Junior Developers
|
- Walker
|
||||||
- KimJeongSun
|
- Xavion
|
||||||
- ImperialSympathizer
|
|
||||||
|
|
||||||
## Bug/Issue Managers
|
## Bug/Issue Managers
|
||||||
- Snailman
|
|
||||||
- Daleks
|
- Daleks
|
||||||
- Lily
|
- Lily
|
||||||
- PigeonBar
|
- PigeonBar
|
||||||
|
- Snailman
|
||||||
|
|
||||||
## Other Code Contributors
|
## Other Code Contributors
|
||||||
- Admiral-Billy
|
- Admiral-Billy
|
||||||
@ -378,10 +383,7 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki.
|
|||||||
- arColm
|
- arColm
|
||||||
- Arxalc
|
- Arxalc
|
||||||
- AsdarDevelops
|
- AsdarDevelops
|
||||||
- bennybroseph
|
|
||||||
- Brain Frog
|
|
||||||
- Corrade
|
- Corrade
|
||||||
- Dakurei
|
|
||||||
- DustinLin
|
- DustinLin
|
||||||
- ElizaAlex
|
- ElizaAlex
|
||||||
- EmberCM
|
- EmberCM
|
||||||
@ -391,7 +393,6 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki.
|
|||||||
- francktrouillez
|
- francktrouillez
|
||||||
- FredeX
|
- FredeX
|
||||||
- geeilhan
|
- geeilhan
|
||||||
- Greenlamp
|
|
||||||
- happinyz
|
- happinyz
|
||||||
- hayuna
|
- hayuna
|
||||||
- InfernoVulpix
|
- InfernoVulpix
|
||||||
@ -411,7 +412,6 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki.
|
|||||||
- Neverblade
|
- Neverblade
|
||||||
- NxKarim
|
- NxKarim
|
||||||
- okimin
|
- okimin
|
||||||
- OrangeRed
|
|
||||||
- PigeonBar
|
- PigeonBar
|
||||||
- PrabbyDD
|
- PrabbyDD
|
||||||
- prateau
|
- prateau
|
||||||
@ -421,10 +421,8 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki.
|
|||||||
- RedstonewolfX
|
- RedstonewolfX
|
||||||
- ReneGV
|
- ReneGV
|
||||||
- rnicar245
|
- rnicar245
|
||||||
- Sam aka Flashfyre (initial developer, started PokéRogue)
|
|
||||||
- schmidtc1
|
- schmidtc1
|
||||||
- shayebeadling
|
- shayebeadling
|
||||||
- sirzento
|
|
||||||
- snoozbuster
|
- snoozbuster
|
||||||
- sodaMelon
|
- sodaMelon
|
||||||
- td76099
|
- td76099
|
||||||
|
@ -80,8 +80,8 @@ As part of the move selection process, the enemy Pokémon must compute a **targe
|
|||||||
A move's UBS and TBS are computed with the respective functions in the `Move` class:
|
A move's UBS and TBS are computed with the respective functions in the `Move` class:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer;
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number;
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer;
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number;
|
||||||
```
|
```
|
||||||
|
|
||||||
Logically, these functions are very similar – they add up their respective benefit scores from each of the move's attributes (as determined by `attr.getUserBenefitScore`, and `attr.getTargetBenefitScore`, respectively) and return the total benefit score. However, there are two key functional differences in how the UBS and TBS of a move are handled:
|
Logically, these functions are very similar – they add up their respective benefit scores from each of the move's attributes (as determined by `attr.getUserBenefitScore`, and `attr.getTargetBenefitScore`, respectively) and return the total benefit score. However, there are two key functional differences in how the UBS and TBS of a move are handled:
|
||||||
|
@ -64,11 +64,5 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.0.0"
|
"node": ">=20.0.0"
|
||||||
},
|
|
||||||
"imports": {
|
|
||||||
"#enums/*": "./enums/*",
|
|
||||||
"#app": "./src/main.js",
|
|
||||||
"#app/*": "./src/*",
|
|
||||||
"#test/*": "./src/test/*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ export function initLoggedInUser(): void {
|
|||||||
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
|
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateUserInfo(): Promise<[boolean, integer]> {
|
export function updateUserInfo(): Promise<[boolean, number]> {
|
||||||
return new Promise<[boolean, integer]>(resolve => {
|
return new Promise<[boolean, number]>(resolve => {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
|
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
|
||||||
let lastSessionSlot = -1;
|
let lastSessionSlot = -1;
|
||||||
|
@ -118,7 +118,7 @@ export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
|||||||
|
|
||||||
const DEBUG_RNG = false;
|
const DEBUG_RNG = false;
|
||||||
|
|
||||||
const OPP_IVS_OVERRIDE_VALIDATED : integer[] = (
|
const OPP_IVS_OVERRIDE_VALIDATED : number[] = (
|
||||||
Array.isArray(Overrides.OPP_IVS_OVERRIDE) ?
|
Array.isArray(Overrides.OPP_IVS_OVERRIDE) ?
|
||||||
Overrides.OPP_IVS_OVERRIDE :
|
Overrides.OPP_IVS_OVERRIDE :
|
||||||
new Array(6).fill(Overrides.OPP_IVS_OVERRIDE)
|
new Array(6).fill(Overrides.OPP_IVS_OVERRIDE)
|
||||||
@ -134,7 +134,7 @@ interface StarterColors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface PokeballCounts {
|
export interface PokeballCounts {
|
||||||
[pb: string]: integer;
|
[pb: string]: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AnySound = Phaser.Sound.WebAudioSound | Phaser.Sound.HTML5AudioSound | Phaser.Sound.NoAudioSound;
|
export type AnySound = Phaser.Sound.WebAudioSound | Phaser.Sound.HTML5AudioSound | Phaser.Sound.NoAudioSound;
|
||||||
@ -149,15 +149,15 @@ export default class BattleScene extends SceneBase {
|
|||||||
public inputController: InputsController;
|
public inputController: InputsController;
|
||||||
public uiInputs: UiInputs;
|
public uiInputs: UiInputs;
|
||||||
|
|
||||||
public sessionPlayTime: integer | null = null;
|
public sessionPlayTime: number | null = null;
|
||||||
public lastSavePlayTime: integer | null = null;
|
public lastSavePlayTime: number | null = null;
|
||||||
public masterVolume: number = 0.5;
|
public masterVolume: number = 0.5;
|
||||||
public bgmVolume: number = 1;
|
public bgmVolume: number = 1;
|
||||||
public fieldVolume: number = 1;
|
public fieldVolume: number = 1;
|
||||||
public seVolume: number = 1;
|
public seVolume: number = 1;
|
||||||
public uiVolume: number = 1;
|
public uiVolume: number = 1;
|
||||||
public gameSpeed: integer = 1;
|
public gameSpeed: number = 1;
|
||||||
public damageNumbersMode: integer = 0;
|
public damageNumbersMode: number = 0;
|
||||||
public reroll: boolean = false;
|
public reroll: boolean = false;
|
||||||
public shopCursorTarget: number = ShopCursorTarget.REWARDS;
|
public shopCursorTarget: number = ShopCursorTarget.REWARDS;
|
||||||
public commandCursorMemory: boolean = false;
|
public commandCursorMemory: boolean = false;
|
||||||
@ -176,16 +176,16 @@ export default class BattleScene extends SceneBase {
|
|||||||
* - 1 = 'Passives Only'
|
* - 1 = 'Passives Only'
|
||||||
* - 2 = 'On'
|
* - 2 = 'On'
|
||||||
*/
|
*/
|
||||||
public candyUpgradeNotification: integer = 0;
|
public candyUpgradeNotification: number = 0;
|
||||||
/**
|
/**
|
||||||
* Determines what type of notification is used for Candy Upgrades
|
* Determines what type of notification is used for Candy Upgrades
|
||||||
* - 0 = 'Icon'
|
* - 0 = 'Icon'
|
||||||
* - 1 = 'Animation'
|
* - 1 = 'Animation'
|
||||||
*/
|
*/
|
||||||
public candyUpgradeDisplay: integer = 0;
|
public candyUpgradeDisplay: number = 0;
|
||||||
public moneyFormat: MoneyFormat = MoneyFormat.NORMAL;
|
public moneyFormat: MoneyFormat = MoneyFormat.NORMAL;
|
||||||
public uiTheme: UiTheme = UiTheme.DEFAULT;
|
public uiTheme: UiTheme = UiTheme.DEFAULT;
|
||||||
public windowType: integer = 0;
|
public windowType: number = 0;
|
||||||
public experimentalSprites: boolean = false;
|
public experimentalSprites: boolean = false;
|
||||||
public musicPreference: number = MusicPreference.ALLGENS;
|
public musicPreference: number = MusicPreference.ALLGENS;
|
||||||
public moveAnimations: boolean = true;
|
public moveAnimations: boolean = true;
|
||||||
@ -212,7 +212,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
* @default 0 - Uses the default normal experience gain display.
|
* @default 0 - Uses the default normal experience gain display.
|
||||||
*/
|
*/
|
||||||
public expParty: ExpNotification = 0;
|
public expParty: ExpNotification = 0;
|
||||||
public hpBarSpeed: integer = 0;
|
public hpBarSpeed: number = 0;
|
||||||
public fusionPaletteSwaps: boolean = true;
|
public fusionPaletteSwaps: boolean = true;
|
||||||
public enableTouchControls: boolean = false;
|
public enableTouchControls: boolean = false;
|
||||||
public enableVibration: boolean = false;
|
public enableVibration: boolean = false;
|
||||||
@ -223,7 +223,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
* - 0 = 'Switch'
|
* - 0 = 'Switch'
|
||||||
* - 1 = 'Set' - The option to switch the active pokemon at the start of a battle will not display.
|
* - 1 = 'Set' - The option to switch the active pokemon at the start of a battle will not display.
|
||||||
*/
|
*/
|
||||||
public battleStyle: integer = BattleStyle.SWITCH;
|
public battleStyle: number = BattleStyle.SWITCH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines whether or not to show type effectiveness hints
|
* Defines whether or not to show type effectiveness hints
|
||||||
@ -235,7 +235,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
public disableMenu: boolean = false;
|
public disableMenu: boolean = false;
|
||||||
|
|
||||||
public gameData: GameData;
|
public gameData: GameData;
|
||||||
public sessionSlotId: integer;
|
public sessionSlotId: number;
|
||||||
|
|
||||||
/** PhaseQueue: dequeue/remove the first element to get the next phase */
|
/** PhaseQueue: dequeue/remove the first element to get the next phase */
|
||||||
public phaseQueue: Phase[];
|
public phaseQueue: Phase[];
|
||||||
@ -244,7 +244,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
private phaseQueuePrepend: Phase[];
|
private phaseQueuePrepend: Phase[];
|
||||||
|
|
||||||
/** overrides default of inserting phases to end of phaseQueuePrepend array, useful or inserting Phases "out of order" */
|
/** overrides default of inserting phases to end of phaseQueuePrepend array, useful or inserting Phases "out of order" */
|
||||||
private phaseQueuePrependSpliceIndex: integer;
|
private phaseQueuePrependSpliceIndex: number;
|
||||||
private nextCommandPhaseQueue: Phase[];
|
private nextCommandPhaseQueue: Phase[];
|
||||||
|
|
||||||
private currentPhase: Phase | null;
|
private currentPhase: Phase | null;
|
||||||
@ -265,13 +265,13 @@ export default class BattleScene extends SceneBase {
|
|||||||
public arenaNextEnemy: ArenaBase;
|
public arenaNextEnemy: ArenaBase;
|
||||||
public arena: Arena;
|
public arena: Arena;
|
||||||
public gameMode: GameMode;
|
public gameMode: GameMode;
|
||||||
public score: integer;
|
public score: number;
|
||||||
public lockModifierTiers: boolean;
|
public lockModifierTiers: boolean;
|
||||||
public trainer: Phaser.GameObjects.Sprite;
|
public trainer: Phaser.GameObjects.Sprite;
|
||||||
public lastEnemyTrainer: Trainer | null;
|
public lastEnemyTrainer: Trainer | null;
|
||||||
public currentBattle: Battle;
|
public currentBattle: Battle;
|
||||||
public pokeballCounts: PokeballCounts;
|
public pokeballCounts: PokeballCounts;
|
||||||
public money: integer;
|
public money: number;
|
||||||
public pokemonInfoContainer: PokemonInfoContainer;
|
public pokemonInfoContainer: PokemonInfoContainer;
|
||||||
private party: PlayerPokemon[];
|
private party: PlayerPokemon[];
|
||||||
/** Session save data that pertains to Mystery Encounters */
|
/** Session save data that pertains to Mystery Encounters */
|
||||||
@ -300,7 +300,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
public seed: string;
|
public seed: string;
|
||||||
public waveSeed: string;
|
public waveSeed: string;
|
||||||
public waveCycleOffset: integer;
|
public waveCycleOffset: number;
|
||||||
public offsetGym: boolean;
|
public offsetGym: boolean;
|
||||||
|
|
||||||
public damageNumberHandler: DamageNumberHandler;
|
public damageNumberHandler: DamageNumberHandler;
|
||||||
@ -314,9 +314,9 @@ export default class BattleScene extends SceneBase {
|
|||||||
private bgmCache: Set<string> = new Set();
|
private bgmCache: Set<string> = new Set();
|
||||||
private playTimeTimer: Phaser.Time.TimerEvent;
|
private playTimeTimer: Phaser.Time.TimerEvent;
|
||||||
|
|
||||||
public rngCounter: integer = 0;
|
public rngCounter: number = 0;
|
||||||
public rngSeedOverride: string = "";
|
public rngSeedOverride: string = "";
|
||||||
public rngOffset: integer = 0;
|
public rngOffset: number = 0;
|
||||||
|
|
||||||
public inputMethod: string;
|
public inputMethod: string;
|
||||||
private infoToggles: InfoToggle[] = [];
|
private infoToggles: InfoToggle[] = [];
|
||||||
@ -717,7 +717,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
const traverseVariantData = (keys: string[]) => {
|
const traverseVariantData = (keys: string[]) => {
|
||||||
let variantTree = variantData;
|
let variantTree = variantData;
|
||||||
let expTree = expVariantData;
|
let expTree = expVariantData;
|
||||||
keys.map((k: string, i: integer) => {
|
keys.map((k: string, i: number) => {
|
||||||
if (i < keys.length - 1) {
|
if (i < keys.length - 1) {
|
||||||
variantTree = variantTree[k];
|
variantTree = variantTree[k];
|
||||||
expTree = expTree[k];
|
expTree = expTree[k];
|
||||||
@ -926,12 +926,12 @@ export default class BattleScene extends SceneBase {
|
|||||||
return activeOnly ? this.infoToggles.filter(t => t?.isActive()) : this.infoToggles;
|
return activeOnly ? this.infoToggles.filter(t => t?.isActive()) : this.infoToggles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPokemonById(pokemonId: integer): Pokemon | null {
|
getPokemonById(pokemonId: number): Pokemon | null {
|
||||||
const findInParty = (party: Pokemon[]) => party.find(p => p.id === pokemonId);
|
const findInParty = (party: Pokemon[]) => party.find(p => p.id === pokemonId);
|
||||||
return (findInParty(this.getPlayerParty()) || findInParty(this.getEnemyParty())) ?? null;
|
return (findInParty(this.getPlayerParty()) || findInParty(this.getEnemyParty())) ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlayerPokemon(species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData, postProcess?: (playerPokemon: PlayerPokemon) => void): PlayerPokemon {
|
addPlayerPokemon(species: PokemonSpecies, level: number, abilityIndex?: number, formIndex?: number, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: number[], nature?: Nature, dataSource?: Pokemon | PokemonData, postProcess?: (playerPokemon: PlayerPokemon) => void): PlayerPokemon {
|
||||||
const pokemon = new PlayerPokemon(species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
|
const pokemon = new PlayerPokemon(species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
|
||||||
if (postProcess) {
|
if (postProcess) {
|
||||||
postProcess(pokemon);
|
postProcess(pokemon);
|
||||||
@ -940,7 +940,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return pokemon;
|
return pokemon;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEnemyPokemon(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean = false, shinyLock: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
addEnemyPokemon(species: PokemonSpecies, level: number, trainerSlot: TrainerSlot, boss: boolean = false, shinyLock: boolean = false, dataSource?: PokemonData, postProcess?: (enemyPokemon: EnemyPokemon) => void): EnemyPokemon {
|
||||||
if (Overrides.OPP_LEVEL_OVERRIDE > 0) {
|
if (Overrides.OPP_LEVEL_OVERRIDE > 0) {
|
||||||
level = Overrides.OPP_LEVEL_OVERRIDE;
|
level = Overrides.OPP_LEVEL_OVERRIDE;
|
||||||
}
|
}
|
||||||
@ -1092,7 +1092,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
* @param min The minimum integer to pick, default `0`
|
* @param min The minimum integer to pick, default `0`
|
||||||
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
|
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
|
||||||
*/
|
*/
|
||||||
randBattleSeedInt(range: integer, min: integer = 0): integer {
|
randBattleSeedInt(range: number, min: number = 0): number {
|
||||||
return this.currentBattle?.randSeedInt(range, min);
|
return this.currentBattle?.randSeedInt(range, min);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,7 +1217,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return Math.max(doubleChance.value, 1);
|
return Math.max(doubleChance.value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
newBattle(waveIndex?: integer, battleType?: BattleType, trainerData?: TrainerData, double?: boolean, mysteryEncounterType?: MysteryEncounterType): Battle | null {
|
newBattle(waveIndex?: number, battleType?: BattleType, trainerData?: TrainerData, double?: boolean, mysteryEncounterType?: MysteryEncounterType): Battle | null {
|
||||||
const _startingWave = Overrides.STARTING_WAVE_OVERRIDE || startingWave;
|
const _startingWave = Overrides.STARTING_WAVE_OVERRIDE || startingWave;
|
||||||
const newWaveIndex = waveIndex || ((this.currentBattle?.waveIndex || (_startingWave - 1)) + 1);
|
const newWaveIndex = waveIndex || ((this.currentBattle?.waveIndex || (_startingWave - 1)) + 1);
|
||||||
let newDouble: boolean | undefined;
|
let newDouble: boolean | undefined;
|
||||||
@ -1443,7 +1443,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeciesFormIndex(species: PokemonSpecies, gender?: Gender, nature?: Nature, ignoreArena?: boolean): integer {
|
getSpeciesFormIndex(species: PokemonSpecies, gender?: Gender, nature?: Nature, ignoreArena?: boolean): number {
|
||||||
if (!species.forms?.length) {
|
if (!species.forms?.length) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1540,7 +1540,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getGeneratedWaveCycleOffset(): integer {
|
private getGeneratedWaveCycleOffset(): number {
|
||||||
let ret = 0;
|
let ret = 0;
|
||||||
this.executeWithSeedOffset(() => {
|
this.executeWithSeedOffset(() => {
|
||||||
ret = Utils.randSeedInt(8) * 5;
|
ret = Utils.randSeedInt(8) * 5;
|
||||||
@ -1548,7 +1548,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
getEncounterBossSegments(waveIndex: integer, level: integer, species?: PokemonSpecies, forceBoss: boolean = false): integer {
|
getEncounterBossSegments(waveIndex: number, level: number, species?: PokemonSpecies, forceBoss: boolean = false): number {
|
||||||
if (Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE > 1) {
|
if (Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE > 1) {
|
||||||
return Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE;
|
return Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE;
|
||||||
} else if (Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE === 1) {
|
} else if (Overrides.OPP_HEALTH_SEGMENTS_OVERRIDE === 1) {
|
||||||
@ -1572,7 +1572,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret: integer = 2;
|
let ret: number = 2;
|
||||||
|
|
||||||
if (level >= 100) {
|
if (level >= 100) {
|
||||||
ret++;
|
ret++;
|
||||||
@ -1589,7 +1589,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
|
|
||||||
trySpreadPokerus(): void {
|
trySpreadPokerus(): void {
|
||||||
const party = this.getPlayerParty();
|
const party = this.getPlayerParty();
|
||||||
const infectedIndexes: integer[] = [];
|
const infectedIndexes: number[] = [];
|
||||||
const spread = (index: number, spreadTo: number) => {
|
const spread = (index: number, spreadTo: number) => {
|
||||||
const partyMember = party[index + spreadTo];
|
const partyMember = party[index + spreadTo];
|
||||||
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
|
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
|
||||||
@ -1613,7 +1613,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSeed(waveIndex?: integer): void {
|
resetSeed(waveIndex?: number): void {
|
||||||
const wave = waveIndex || this.currentBattle?.waveIndex || 0;
|
const wave = waveIndex || this.currentBattle?.waveIndex || 0;
|
||||||
this.waveSeed = Utils.shiftCharCodes(this.seed, wave);
|
this.waveSeed = Utils.shiftCharCodes(this.seed, wave);
|
||||||
Phaser.Math.RND.sow([ this.waveSeed ]);
|
Phaser.Math.RND.sow([ this.waveSeed ]);
|
||||||
@ -1621,7 +1621,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.rngCounter = 0;
|
this.rngCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeWithSeedOffset(func: Function, offset: integer, seedOverride?: string): void {
|
executeWithSeedOffset(func: Function, offset: number, seedOverride?: string): void {
|
||||||
if (!func) {
|
if (!func) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1669,7 +1669,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.arenaFlyout.toggleFlyout(pressed);
|
this.arenaFlyout.toggleFlyout(pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
showFieldOverlay(duration: integer): Promise<void> {
|
showFieldOverlay(duration: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
targets: this.fieldOverlay,
|
targets: this.fieldOverlay,
|
||||||
@ -1681,7 +1681,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hideFieldOverlay(duration: integer): Promise<void> {
|
hideFieldOverlay(duration: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
targets: this.fieldOverlay,
|
targets: this.fieldOverlay,
|
||||||
@ -1701,7 +1701,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
showShopOverlay(duration: integer): Promise<void> {
|
showShopOverlay(duration: number): Promise<void> {
|
||||||
this.shopOverlayShown = true;
|
this.shopOverlayShown = true;
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
@ -1714,7 +1714,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hideShopOverlay(duration: integer): Promise<void> {
|
hideShopOverlay(duration: number): Promise<void> {
|
||||||
this.shopOverlayShown = false;
|
this.shopOverlayShown = false;
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
@ -1803,7 +1803,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLuckText(duration: integer): void {
|
hideLuckText(duration: number): void {
|
||||||
if (this.reroll) {
|
if (this.reroll) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1843,7 +1843,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addFaintedEnemyScore(enemy: EnemyPokemon): void {
|
addFaintedEnemyScore(enemy: EnemyPokemon): void {
|
||||||
let scoreIncrease = enemy.getSpeciesForm().getBaseExp() * (enemy.level / this.getMaxExpLevel()) * ((enemy.ivs.reduce((iv: integer, total: integer) => total += iv, 0) / 93) * 0.2 + 0.8);
|
let scoreIncrease = enemy.getSpeciesForm().getBaseExp() * (enemy.level / this.getMaxExpLevel()) * ((enemy.ivs.reduce((iv: number, total: number) => total += iv, 0) / 93) * 0.2 + 0.8);
|
||||||
this.findModifiers(m => m instanceof PokemonHeldItemModifier && m.pokemonId === enemy.id, false).map(m => scoreIncrease *= (m as PokemonHeldItemModifier).getScoreMultiplier());
|
this.findModifiers(m => m instanceof PokemonHeldItemModifier && m.pokemonId === enemy.id, false).map(m => scoreIncrease *= (m as PokemonHeldItemModifier).getScoreMultiplier());
|
||||||
if (enemy.isBoss()) {
|
if (enemy.isBoss()) {
|
||||||
scoreIncrease *= Math.sqrt(enemy.bossSegments);
|
scoreIncrease *= Math.sqrt(enemy.bossSegments);
|
||||||
@ -1851,7 +1851,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.currentBattle.battleScore += Math.ceil(scoreIncrease);
|
this.currentBattle.battleScore += Math.ceil(scoreIncrease);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxExpLevel(ignoreLevelCap: boolean = false): integer {
|
getMaxExpLevel(ignoreLevelCap: boolean = false): number {
|
||||||
if (Overrides.LEVEL_CAP_OVERRIDE > 0) {
|
if (Overrides.LEVEL_CAP_OVERRIDE > 0) {
|
||||||
return Overrides.LEVEL_CAP_OVERRIDE;
|
return Overrides.LEVEL_CAP_OVERRIDE;
|
||||||
} else if (ignoreLevelCap || Overrides.LEVEL_CAP_OVERRIDE < 0) {
|
} else if (ignoreLevelCap || Overrides.LEVEL_CAP_OVERRIDE < 0) {
|
||||||
@ -1863,7 +1863,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
return Math.ceil(baseLevel / 2) * 2 + 2;
|
return Math.ceil(baseLevel / 2) * 2 + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
randomSpecies(waveIndex: integer, level: integer, fromArenaPool?: boolean, speciesFilter?: PokemonSpeciesFilter, filterAllEvolutions?: boolean): PokemonSpecies {
|
randomSpecies(waveIndex: number, level: number, fromArenaPool?: boolean, speciesFilter?: PokemonSpeciesFilter, filterAllEvolutions?: boolean): PokemonSpecies {
|
||||||
if (fromArenaPool) {
|
if (fromArenaPool) {
|
||||||
return this.arena.randomSpecies(waveIndex, level, undefined, getPartyLuckValue(this.party));
|
return this.arena.randomSpecies(waveIndex, level, undefined, getPartyLuckValue(this.party));
|
||||||
}
|
}
|
||||||
@ -1878,13 +1878,13 @@ export default class BattleScene extends SceneBase {
|
|||||||
return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)];
|
return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
generateRandomBiome(waveIndex: integer): Biome {
|
generateRandomBiome(waveIndex: number): Biome {
|
||||||
const relWave = waveIndex % 250;
|
const relWave = waveIndex % 250;
|
||||||
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
|
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
|
||||||
const maxDepth = biomeDepths[Biome.END][0] - 2;
|
const maxDepth = biomeDepths[Biome.END][0] - 2;
|
||||||
const depthWeights = new Array(maxDepth + 1).fill(null)
|
const depthWeights = new Array(maxDepth + 1).fill(null)
|
||||||
.map((_, i: integer) => ((1 - Math.min(Math.abs((i / (maxDepth - 1)) - (relWave / 250)) + 0.25, 1)) / 0.75) * 250);
|
.map((_, i: number) => ((1 - Math.min(Math.abs((i / (maxDepth - 1)) - (relWave / 250)) + 0.25, 1)) / 0.75) * 250);
|
||||||
const biomeThresholds: integer[] = [];
|
const biomeThresholds: number[] = [];
|
||||||
let totalWeight = 0;
|
let totalWeight = 0;
|
||||||
for (const biome of biomes) {
|
for (const biome of biomes) {
|
||||||
totalWeight += Math.ceil(depthWeights[biomeDepths[biome][0] - 1] / biomeDepths[biome][1]);
|
totalWeight += Math.ceil(depthWeights[biomeDepths[biome][0] - 1] / biomeDepths[biome][1]);
|
||||||
@ -2008,7 +2008,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fadeOutBgm(duration: integer = 500, destroy: boolean = true): boolean {
|
fadeOutBgm(duration: number = 500, destroy: boolean = true): boolean {
|
||||||
if (!this.bgm) {
|
if (!this.bgm) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2075,7 +2075,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playSoundWithoutBgm(soundName: string, pauseDuration?: integer): AnySound {
|
playSoundWithoutBgm(soundName: string, pauseDuration?: number): AnySound {
|
||||||
this.bgmCache.add(soundName);
|
this.bgmCache.add(soundName);
|
||||||
const resumeBgm = this.pauseBgm();
|
const resumeBgm = this.pauseBgm();
|
||||||
this.playSound(soundName);
|
this.playSound(soundName);
|
||||||
@ -2535,7 +2535,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
* @param promptDelay optional param for MessagePhase constructor
|
* @param promptDelay optional param for MessagePhase constructor
|
||||||
* @param defer boolean for which queue to add it to, false -> add to PhaseQueuePrepend, true -> nextCommandPhaseQueue
|
* @param defer boolean for which queue to add it to, false -> add to PhaseQueuePrepend, true -> nextCommandPhaseQueue
|
||||||
*/
|
*/
|
||||||
queueMessage(message: string, callbackDelay?: integer | null, prompt?: boolean | null, promptDelay?: integer | null, defer?: boolean | null) {
|
queueMessage(message: string, callbackDelay?: number | null, prompt?: boolean | null, promptDelay?: number | null, defer?: boolean | null) {
|
||||||
const phase = new MessagePhase(message, callbackDelay, prompt, promptDelay);
|
const phase = new MessagePhase(message, callbackDelay, prompt, promptDelay);
|
||||||
if (!defer) {
|
if (!defer) {
|
||||||
// adds to the end of PhaseQueuePrepend
|
// adds to the end of PhaseQueuePrepend
|
||||||
@ -2557,14 +2557,14 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.phaseQueue.push(new TurnInitPhase());
|
this.phaseQueue.push(new TurnInitPhase());
|
||||||
}
|
}
|
||||||
|
|
||||||
addMoney(amount: integer): void {
|
addMoney(amount: number): void {
|
||||||
this.money = Math.min(this.money + amount, Number.MAX_SAFE_INTEGER);
|
this.money = Math.min(this.money + amount, Number.MAX_SAFE_INTEGER);
|
||||||
this.updateMoneyText();
|
this.updateMoneyText();
|
||||||
this.animateMoneyChanged(true);
|
this.animateMoneyChanged(true);
|
||||||
this.validateAchvs(MoneyAchv);
|
this.validateAchvs(MoneyAchv);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWaveMoneyAmount(moneyMultiplier: number): integer {
|
getWaveMoneyAmount(moneyMultiplier: number): number {
|
||||||
const waveIndex = this.currentBattle.waveIndex;
|
const waveIndex = this.currentBattle.waveIndex;
|
||||||
const waveSetIndex = Math.ceil(waveIndex / 10) - 1;
|
const waveSetIndex = Math.ceil(waveIndex / 10) - 1;
|
||||||
const moneyValue = Math.pow((waveSetIndex + 1 + (0.75 + (((waveIndex - 1) % 10) + 1) / 10)) * 100, 1 + 0.005 * waveSetIndex) * moneyMultiplier;
|
const moneyValue = Math.pow((waveSetIndex + 1 + (0.75 + (((waveIndex - 1) % 10) + 1) / 10)) * 100, 1 + 0.005 * waveSetIndex) * moneyMultiplier;
|
||||||
@ -2761,7 +2761,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removePartyMemberModifiers(partyMemberIndex: integer): Promise<void> {
|
removePartyMemberModifiers(partyMemberIndex: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const pokemonId = this.getPlayerParty()[partyMemberIndex].id;
|
const pokemonId = this.getPlayerParty()[partyMemberIndex].id;
|
||||||
const modifiersToRemove = this.modifiers.filter(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).pokemonId === pokemonId);
|
const modifiersToRemove = this.modifiers.filter(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).pokemonId === pokemonId);
|
||||||
@ -2793,7 +2793,7 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
party.forEach((enemyPokemon: EnemyPokemon, i: integer) => {
|
party.forEach((enemyPokemon: EnemyPokemon, i: number) => {
|
||||||
if (heldModifiersConfigs && i < heldModifiersConfigs.length && heldModifiersConfigs[i]) {
|
if (heldModifiersConfigs && i < heldModifiersConfigs.length && heldModifiersConfigs[i]) {
|
||||||
heldModifiersConfigs[i].forEach(mt => {
|
heldModifiersConfigs[i].forEach(mt => {
|
||||||
let modifier: PokemonHeldItemModifier;
|
let modifier: PokemonHeldItemModifier;
|
||||||
|
@ -51,13 +51,13 @@ export class Ability implements Localizable {
|
|||||||
private nameAppend: string;
|
private nameAppend: string;
|
||||||
public name: string;
|
public name: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public generation: integer;
|
public generation: number;
|
||||||
public isBypassFaint: boolean;
|
public isBypassFaint: boolean;
|
||||||
public isIgnorable: boolean;
|
public isIgnorable: boolean;
|
||||||
public attrs: AbAttr[];
|
public attrs: AbAttr[];
|
||||||
public conditions: AbAttrCondition[];
|
public conditions: AbAttrCondition[];
|
||||||
|
|
||||||
constructor(id: Abilities, generation: integer) {
|
constructor(id: Abilities, generation: number) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
this.nameAppend = "";
|
this.nameAppend = "";
|
||||||
@ -221,9 +221,9 @@ export class PostBattleInitAbAttr extends AbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostBattleInitFormChangeAbAttr extends PostBattleInitAbAttr {
|
export class PostBattleInitFormChangeAbAttr extends PostBattleInitAbAttr {
|
||||||
private formFunc: (p: Pokemon) => integer;
|
private formFunc: (p: Pokemon) => number;
|
||||||
|
|
||||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
constructor(formFunc: ((p: Pokemon) => number)) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.formFunc = formFunc;
|
this.formFunc = formFunc;
|
||||||
@ -491,9 +491,9 @@ class TypeImmunityStatStageChangeAbAttr extends TypeImmunityAbAttr {
|
|||||||
|
|
||||||
class TypeImmunityAddBattlerTagAbAttr extends TypeImmunityAbAttr {
|
class TypeImmunityAddBattlerTagAbAttr extends TypeImmunityAbAttr {
|
||||||
private tagType: BattlerTagType;
|
private tagType: BattlerTagType;
|
||||||
private turnCount: integer;
|
private turnCount: number;
|
||||||
|
|
||||||
constructor(immuneType: Type, tagType: BattlerTagType, turnCount: integer, condition?: AbAttrCondition) {
|
constructor(immuneType: Type, tagType: BattlerTagType, turnCount: number, condition?: AbAttrCondition) {
|
||||||
super(immuneType, condition);
|
super(immuneType, condition);
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -605,7 +605,7 @@ export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostStatStageChangeAbAttr extends AbAttr {
|
export class PostStatStageChangeAbAttr extends AbAttr {
|
||||||
applyPostStatStageChange(pokemon: Pokemon, simulated: boolean, statsChanged: BattleStat[], stagesChanged: integer, selfTarget: boolean, args: any[]): boolean | Promise<boolean> {
|
applyPostStatStageChange(pokemon: Pokemon, simulated: boolean, statsChanged: BattleStat[], stagesChanged: number, selfTarget: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,10 +866,10 @@ export class PostDefendTerrainChangeAbAttr extends PostDefendAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
|
export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
|
||||||
public chance: integer;
|
public chance: number;
|
||||||
private effects: StatusEffect[];
|
private effects: StatusEffect[];
|
||||||
|
|
||||||
constructor(chance: integer, ...effects: StatusEffect[]) {
|
constructor(chance: number, ...effects: StatusEffect[]) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
@ -905,11 +905,11 @@ export class EffectSporeAbAttr extends PostDefendContactApplyStatusEffectAbAttr
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostDefendContactApplyTagChanceAbAttr extends PostDefendAbAttr {
|
export class PostDefendContactApplyTagChanceAbAttr extends PostDefendAbAttr {
|
||||||
private chance: integer;
|
private chance: number;
|
||||||
private tagType: BattlerTagType;
|
private tagType: BattlerTagType;
|
||||||
private turnCount: integer | undefined;
|
private turnCount: number | undefined;
|
||||||
|
|
||||||
constructor(chance: integer, tagType: BattlerTagType, turnCount?: integer) {
|
constructor(chance: number, tagType: BattlerTagType, turnCount?: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -959,9 +959,9 @@ export class PostDefendCritStatStageChangeAbAttr extends PostDefendAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostDefendContactDamageAbAttr extends PostDefendAbAttr {
|
export class PostDefendContactDamageAbAttr extends PostDefendAbAttr {
|
||||||
private damageRatio: integer;
|
private damageRatio: number;
|
||||||
|
|
||||||
constructor(damageRatio: integer) {
|
constructor(damageRatio: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.damageRatio = damageRatio;
|
this.damageRatio = damageRatio;
|
||||||
@ -993,9 +993,9 @@ export class PostDefendContactDamageAbAttr extends PostDefendAbAttr {
|
|||||||
* @extends {PostDefendAbAttr}
|
* @extends {PostDefendAbAttr}
|
||||||
*/
|
*/
|
||||||
export class PostDefendPerishSongAbAttr extends PostDefendAbAttr {
|
export class PostDefendPerishSongAbAttr extends PostDefendAbAttr {
|
||||||
private turns: integer;
|
private turns: number;
|
||||||
|
|
||||||
constructor(turns: integer) {
|
constructor(turns: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.turns = turns;
|
this.turns = turns;
|
||||||
@ -1101,11 +1101,11 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr {
|
export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr {
|
||||||
private chance: integer;
|
private chance: number;
|
||||||
private attacker: Pokemon;
|
private attacker: Pokemon;
|
||||||
private move: Move;
|
private move: Move;
|
||||||
|
|
||||||
constructor(chance: integer) {
|
constructor(chance: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
@ -1688,10 +1688,10 @@ export class PostAttackStealHeldItemAbAttr extends PostAttackAbAttr {
|
|||||||
|
|
||||||
export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
|
export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
|
||||||
private contactRequired: boolean;
|
private contactRequired: boolean;
|
||||||
private chance: integer;
|
private chance: number;
|
||||||
private effects: StatusEffect[];
|
private effects: StatusEffect[];
|
||||||
|
|
||||||
constructor(contactRequired: boolean, chance: integer, ...effects: StatusEffect[]) {
|
constructor(contactRequired: boolean, chance: number, ...effects: StatusEffect[]) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.contactRequired = contactRequired;
|
this.contactRequired = contactRequired;
|
||||||
@ -1715,18 +1715,18 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostAttackContactApplyStatusEffectAbAttr extends PostAttackApplyStatusEffectAbAttr {
|
export class PostAttackContactApplyStatusEffectAbAttr extends PostAttackApplyStatusEffectAbAttr {
|
||||||
constructor(chance: integer, ...effects: StatusEffect[]) {
|
constructor(chance: number, ...effects: StatusEffect[]) {
|
||||||
super(true, chance, ...effects);
|
super(true, chance, ...effects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
|
export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
|
||||||
private contactRequired: boolean;
|
private contactRequired: boolean;
|
||||||
private chance: (user: Pokemon, target: Pokemon, move: Move) => integer;
|
private chance: (user: Pokemon, target: Pokemon, move: Move) => number;
|
||||||
private effects: BattlerTagType[];
|
private effects: BattlerTagType[];
|
||||||
|
|
||||||
|
|
||||||
constructor(contactRequired: boolean, chance: (user: Pokemon, target: Pokemon, move: Move) => integer, ...effects: BattlerTagType[]) {
|
constructor(contactRequired: boolean, chance: (user: Pokemon, target: Pokemon, move: Move) => number, ...effects: BattlerTagType[]) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.contactRequired = contactRequired;
|
this.contactRequired = contactRequired;
|
||||||
@ -1863,9 +1863,9 @@ class PostVictoryStatStageChangeAbAttr extends PostVictoryAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostVictoryFormChangeAbAttr extends PostVictoryAbAttr {
|
export class PostVictoryFormChangeAbAttr extends PostVictoryAbAttr {
|
||||||
private formFunc: (p: Pokemon) => integer;
|
private formFunc: (p: Pokemon) => number;
|
||||||
|
|
||||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
constructor(formFunc: ((p: Pokemon) => number)) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.formFunc = formFunc;
|
this.formFunc = formFunc;
|
||||||
@ -2081,9 +2081,9 @@ export class PostSummonUnnamedMessageAbAttr extends PostSummonAbAttr {
|
|||||||
|
|
||||||
export class PostSummonAddBattlerTagAbAttr extends PostSummonAbAttr {
|
export class PostSummonAddBattlerTagAbAttr extends PostSummonAbAttr {
|
||||||
private tagType: BattlerTagType;
|
private tagType: BattlerTagType;
|
||||||
private turnCount: integer;
|
private turnCount: number;
|
||||||
|
|
||||||
constructor(tagType: BattlerTagType, turnCount: integer, showAbility?: boolean) {
|
constructor(tagType: BattlerTagType, turnCount: number, showAbility?: boolean) {
|
||||||
super(showAbility);
|
super(showAbility);
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -2209,9 +2209,9 @@ export class PostSummonClearAllyStatStagesAbAttr extends PostSummonAbAttr {
|
|||||||
* @see {applyPostSummon}
|
* @see {applyPostSummon}
|
||||||
*/
|
*/
|
||||||
export class DownloadAbAttr extends PostSummonAbAttr {
|
export class DownloadAbAttr extends PostSummonAbAttr {
|
||||||
private enemyDef: integer;
|
private enemyDef: number;
|
||||||
private enemySpDef: integer;
|
private enemySpDef: number;
|
||||||
private enemyCountTally: integer;
|
private enemyCountTally: number;
|
||||||
private stats: BattleStat[];
|
private stats: BattleStat[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2295,9 +2295,9 @@ export class PostSummonTerrainChangeAbAttr extends PostSummonAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostSummonFormChangeAbAttr extends PostSummonAbAttr {
|
export class PostSummonFormChangeAbAttr extends PostSummonAbAttr {
|
||||||
private formFunc: (p: Pokemon) => integer;
|
private formFunc: (p: Pokemon) => number;
|
||||||
|
|
||||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
constructor(formFunc: ((p: Pokemon) => number)) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.formFunc = formFunc;
|
this.formFunc = formFunc;
|
||||||
@ -2643,18 +2643,75 @@ export class PreSwitchOutResetStatusAbAttr extends PreSwitchOutAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export class PreSwitchOutHealAbAttr extends PreSwitchOutAbAttr {
|
||||||
|
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
|
if (!pokemon.isFullHp()) {
|
||||||
|
if (!simulated) {
|
||||||
|
const healAmount = Utils.toDmgValue(pokemon.getMaxHp() * 0.33);
|
||||||
|
pokemon.heal(healAmount);
|
||||||
|
pokemon.updateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attribute for form changes that occur on switching out
|
||||||
|
* @extends PreSwitchOutAbAttr
|
||||||
|
* @see {@linkcode applyPreSwitchOut}
|
||||||
|
*/
|
||||||
|
export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
|
||||||
|
private formFunc: (p: Pokemon) => number;
|
||||||
|
|
||||||
|
constructor(formFunc: ((p: Pokemon) => number)) {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.formFunc = formFunc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On switch out, trigger the form change to the one defined in the ability
|
||||||
|
* @param pokemon The pokemon switching out and changing form {@linkcode Pokemon}
|
||||||
|
* @param passive N/A
|
||||||
|
* @param args N/A
|
||||||
|
* @returns true if the form change was successful
|
||||||
|
*/
|
||||||
|
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
|
const formIndex = this.formFunc(pokemon);
|
||||||
|
if (formIndex !== pokemon.formIndex) {
|
||||||
|
if (!simulated) {
|
||||||
|
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PreLeaveFieldAbAttr extends AbAttr {
|
||||||
|
applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears Desolate Land/Primordial Sea/Delta Stream upon the Pokemon switching out.
|
* Clears Desolate Land/Primordial Sea/Delta Stream upon the Pokemon switching out.
|
||||||
*/
|
*/
|
||||||
export class PreSwitchOutClearWeatherAbAttr extends PreSwitchOutAbAttr {
|
export class PreLeaveFieldClearWeatherAbAttr extends PreLeaveFieldAbAttr {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pokemon The {@linkcode Pokemon} with the ability
|
* @param pokemon The {@linkcode Pokemon} with the ability
|
||||||
* @param passive N/A
|
* @param passive N/A
|
||||||
* @param args N/A
|
* @param args N/A
|
||||||
* @returns {boolean} Returns true if the weather clears, otherwise false.
|
* @returns Returns `true` if the weather clears, otherwise `false`.
|
||||||
*/
|
*/
|
||||||
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
applyPreLeaveField(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
const weatherType = globalScene.arena.weather?.weatherType;
|
const weatherType = globalScene.arena.weather?.weatherType;
|
||||||
let turnOffWeather = false;
|
let turnOffWeather = false;
|
||||||
|
|
||||||
@ -2693,57 +2750,6 @@ export class PreSwitchOutClearWeatherAbAttr extends PreSwitchOutAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PreSwitchOutHealAbAttr extends PreSwitchOutAbAttr {
|
|
||||||
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
|
||||||
if (!pokemon.isFullHp()) {
|
|
||||||
if (!simulated) {
|
|
||||||
const healAmount = Utils.toDmgValue(pokemon.getMaxHp() * 0.33);
|
|
||||||
pokemon.heal(healAmount);
|
|
||||||
pokemon.updateInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attribute for form changes that occur on switching out
|
|
||||||
* @extends PreSwitchOutAbAttr
|
|
||||||
* @see {@linkcode applyPreSwitchOut}
|
|
||||||
*/
|
|
||||||
export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
|
|
||||||
private formFunc: (p: Pokemon) => integer;
|
|
||||||
|
|
||||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.formFunc = formFunc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On switch out, trigger the form change to the one defined in the ability
|
|
||||||
* @param pokemon The pokemon switching out and changing form {@linkcode Pokemon}
|
|
||||||
* @param passive N/A
|
|
||||||
* @param args N/A
|
|
||||||
* @returns true if the form change was successful
|
|
||||||
*/
|
|
||||||
applyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
|
||||||
const formIndex = this.formFunc(pokemon);
|
|
||||||
if (formIndex !== pokemon.formIndex) {
|
|
||||||
if (!simulated) {
|
|
||||||
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeAbilityTrigger, false);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PreStatStageChangeAbAttr extends AbAttr {
|
export class PreStatStageChangeAbAttr extends AbAttr {
|
||||||
applyPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
applyPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
@ -2861,7 +2867,7 @@ export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
|
|||||||
* @returns A boolean indicating the result of the status application.
|
* @returns A boolean indicating the result of the status application.
|
||||||
*/
|
*/
|
||||||
applyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
applyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
if (this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) {
|
if (effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) {
|
||||||
cancelled.value = true;
|
cancelled.value = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3338,10 +3344,10 @@ export class PostWeatherChangeFormChangeAbAttr extends PostWeatherChangeAbAttr {
|
|||||||
|
|
||||||
export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr {
|
export class PostWeatherChangeAddBattlerTagAttr extends PostWeatherChangeAbAttr {
|
||||||
private tagType: BattlerTagType;
|
private tagType: BattlerTagType;
|
||||||
private turnCount: integer;
|
private turnCount: number;
|
||||||
private weatherTypes: WeatherType[];
|
private weatherTypes: WeatherType[];
|
||||||
|
|
||||||
constructor(tagType: BattlerTagType, turnCount: integer, ...weatherTypes: WeatherType[]) {
|
constructor(tagType: BattlerTagType, turnCount: number, ...weatherTypes: WeatherType[]) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -3382,9 +3388,9 @@ export class PostWeatherLapseAbAttr extends AbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
|
export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
|
||||||
private healFactor: integer;
|
private healFactor: number;
|
||||||
|
|
||||||
constructor(healFactor: integer, ...weatherTypes: WeatherType[]) {
|
constructor(healFactor: number, ...weatherTypes: WeatherType[]) {
|
||||||
super(...weatherTypes);
|
super(...weatherTypes);
|
||||||
|
|
||||||
this.healFactor = healFactor;
|
this.healFactor = healFactor;
|
||||||
@ -3405,9 +3411,9 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
|
export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr {
|
||||||
private damageFactor: integer;
|
private damageFactor: number;
|
||||||
|
|
||||||
constructor(damageFactor: integer, ...weatherTypes: WeatherType[]) {
|
constructor(damageFactor: number, ...weatherTypes: WeatherType[]) {
|
||||||
super(...weatherTypes);
|
super(...weatherTypes);
|
||||||
|
|
||||||
this.damageFactor = damageFactor;
|
this.damageFactor = damageFactor;
|
||||||
@ -3436,10 +3442,10 @@ export class PostTerrainChangeAbAttr extends AbAttr {
|
|||||||
|
|
||||||
export class PostTerrainChangeAddBattlerTagAttr extends PostTerrainChangeAbAttr {
|
export class PostTerrainChangeAddBattlerTagAttr extends PostTerrainChangeAbAttr {
|
||||||
private tagType: BattlerTagType;
|
private tagType: BattlerTagType;
|
||||||
private turnCount: integer;
|
private turnCount: number;
|
||||||
private terrainTypes: TerrainType[];
|
private terrainTypes: TerrainType[];
|
||||||
|
|
||||||
constructor(tagType: BattlerTagType, turnCount: integer, ...terrainTypes: TerrainType[]) {
|
constructor(tagType: BattlerTagType, turnCount: number, ...terrainTypes: TerrainType[]) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -3692,9 +3698,9 @@ export class PostTurnHealAbAttr extends PostTurnAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
|
export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
|
||||||
private formFunc: (p: Pokemon) => integer;
|
private formFunc: (p: Pokemon) => number;
|
||||||
|
|
||||||
constructor(formFunc: ((p: Pokemon) => integer)) {
|
constructor(formFunc: ((p: Pokemon) => number)) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.formFunc = formFunc;
|
this.formFunc = formFunc;
|
||||||
@ -3916,9 +3922,9 @@ export class PostItemLostApplyBattlerTagAbAttr extends PostItemLostAbAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class StatStageChangeMultiplierAbAttr extends AbAttr {
|
export class StatStageChangeMultiplierAbAttr extends AbAttr {
|
||||||
private multiplier: integer;
|
private multiplier: number;
|
||||||
|
|
||||||
constructor(multiplier: integer) {
|
constructor(multiplier: number) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.multiplier = multiplier;
|
this.multiplier = multiplier;
|
||||||
@ -4171,63 +4177,10 @@ export class PostFaintUnsuppressedWeatherFormChangeAbAttr extends PostFaintAbAtt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears Desolate Land/Primordial Sea/Delta Stream upon the Pokemon fainting
|
|
||||||
*/
|
|
||||||
export class PostFaintClearWeatherAbAttr extends PostFaintAbAttr {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param pokemon The {@linkcode Pokemon} with the ability
|
|
||||||
* @param passive N/A
|
|
||||||
* @param attacker N/A
|
|
||||||
* @param move N/A
|
|
||||||
* @param hitResult N/A
|
|
||||||
* @param args N/A
|
|
||||||
* @returns {boolean} Returns true if the weather clears, otherwise false.
|
|
||||||
*/
|
|
||||||
applyPostFaint(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker?: Pokemon, move?: Move, hitResult?: HitResult, ...args: any[]): boolean {
|
|
||||||
const weatherType = globalScene.arena.weather?.weatherType;
|
|
||||||
let turnOffWeather = false;
|
|
||||||
|
|
||||||
// Clear weather only if user's ability matches the weather and no other pokemon has the ability.
|
|
||||||
switch (weatherType) {
|
|
||||||
case (WeatherType.HARSH_SUN):
|
|
||||||
if (pokemon.hasAbility(Abilities.DESOLATE_LAND)
|
|
||||||
&& globalScene.getField(true).filter(p => p.hasAbility(Abilities.DESOLATE_LAND)).length === 0) {
|
|
||||||
turnOffWeather = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case (WeatherType.HEAVY_RAIN):
|
|
||||||
if (pokemon.hasAbility(Abilities.PRIMORDIAL_SEA)
|
|
||||||
&& globalScene.getField(true).filter(p => p.hasAbility(Abilities.PRIMORDIAL_SEA)).length === 0) {
|
|
||||||
turnOffWeather = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case (WeatherType.STRONG_WINDS):
|
|
||||||
if (pokemon.hasAbility(Abilities.DELTA_STREAM)
|
|
||||||
&& globalScene.getField(true).filter(p => p.hasAbility(Abilities.DELTA_STREAM)).length === 0) {
|
|
||||||
turnOffWeather = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (simulated) {
|
|
||||||
return turnOffWeather;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (turnOffWeather) {
|
|
||||||
globalScene.arena.trySetWeather(WeatherType.NONE, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
|
export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
|
||||||
private damageRatio: integer;
|
private damageRatio: number;
|
||||||
|
|
||||||
constructor(damageRatio: integer) {
|
constructor(damageRatio: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.damageRatio = damageRatio;
|
this.damageRatio = damageRatio;
|
||||||
@ -4404,9 +4357,9 @@ export class ReduceBerryUseThresholdAbAttr extends AbAttr {
|
|||||||
* Used for Heavy Metal (doubling weight) and Light Metal (halving weight)
|
* Used for Heavy Metal (doubling weight) and Light Metal (halving weight)
|
||||||
*/
|
*/
|
||||||
export class WeightMultiplierAbAttr extends AbAttr {
|
export class WeightMultiplierAbAttr extends AbAttr {
|
||||||
private multiplier: integer;
|
private multiplier: number;
|
||||||
|
|
||||||
constructor(multiplier: integer) {
|
constructor(multiplier: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.multiplier = multiplier;
|
this.multiplier = multiplier;
|
||||||
@ -4700,12 +4653,12 @@ export class FormBlockDamageAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
|
|||||||
* @extends AbAttr
|
* @extends AbAttr
|
||||||
*/
|
*/
|
||||||
export class BypassSpeedChanceAbAttr extends AbAttr {
|
export class BypassSpeedChanceAbAttr extends AbAttr {
|
||||||
public chance: integer;
|
public chance: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {integer} chance probability of ability being active.
|
* @param {number} chance probability of ability being active.
|
||||||
*/
|
*/
|
||||||
constructor(chance: integer) {
|
constructor(chance: number) {
|
||||||
super(true);
|
super(true);
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
}
|
}
|
||||||
@ -5229,13 +5182,18 @@ export function applyPreSwitchOutAbAttrs(attrType: Constructor<PreSwitchOutAbAtt
|
|||||||
return applyAbAttrsInternal<PreSwitchOutAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreSwitchOut(pokemon, passive, simulated, args), args, true, simulated);
|
return applyAbAttrsInternal<PreSwitchOutAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreSwitchOut(pokemon, passive, simulated, args), args, true, simulated);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function applyPreLeaveFieldAbAttrs(attrType: Constructor<PreLeaveFieldAbAttr>,
|
||||||
|
pokemon: Pokemon, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||||
|
return applyAbAttrsInternal<PreLeaveFieldAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreLeaveField(pokemon, passive, simulated, args), args, true, simulated);
|
||||||
|
}
|
||||||
|
|
||||||
export function applyPreStatStageChangeAbAttrs(attrType: Constructor<PreStatStageChangeAbAttr>,
|
export function applyPreStatStageChangeAbAttrs(attrType: Constructor<PreStatStageChangeAbAttr>,
|
||||||
pokemon: Pokemon | null, stat: BattleStat, cancelled: Utils.BooleanHolder, simulated: boolean = false, ...args: any[]): Promise<void> {
|
pokemon: Pokemon | null, stat: BattleStat, cancelled: Utils.BooleanHolder, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||||
return applyAbAttrsInternal<PreStatStageChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), args, false, simulated);
|
return applyAbAttrsInternal<PreStatStageChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), args, false, simulated);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyPostStatStageChangeAbAttrs(attrType: Constructor<PostStatStageChangeAbAttr>,
|
export function applyPostStatStageChangeAbAttrs(attrType: Constructor<PostStatStageChangeAbAttr>,
|
||||||
pokemon: Pokemon, stats: BattleStat[], stages: integer, selfTarget: boolean, simulated: boolean = false, ...args: any[]): Promise<void> {
|
pokemon: Pokemon, stats: BattleStat[], stages: number, selfTarget: boolean, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||||
return applyAbAttrsInternal<PostStatStageChangeAbAttr>(attrType, pokemon, (attr, _passive) => attr.applyPostStatStageChange(pokemon, simulated, stats, stages, selfTarget, args), args, false, simulated);
|
return applyAbAttrsInternal<PostStatStageChangeAbAttr>(attrType, pokemon, (attr, _passive) => attr.applyPostStatStageChange(pokemon, simulated, stats, stages, selfTarget, args), args, false, simulated);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5912,20 +5870,17 @@ export function initAbilities() {
|
|||||||
new Ability(Abilities.PRIMORDIAL_SEA, 6)
|
new Ability(Abilities.PRIMORDIAL_SEA, 6)
|
||||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HEAVY_RAIN)
|
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HEAVY_RAIN)
|
||||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HEAVY_RAIN)
|
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HEAVY_RAIN)
|
||||||
.attr(PreSwitchOutClearWeatherAbAttr)
|
.attr(PreLeaveFieldClearWeatherAbAttr)
|
||||||
.attr(PostFaintClearWeatherAbAttr)
|
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.DESOLATE_LAND, 6)
|
new Ability(Abilities.DESOLATE_LAND, 6)
|
||||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HARSH_SUN)
|
.attr(PostSummonWeatherChangeAbAttr, WeatherType.HARSH_SUN)
|
||||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HARSH_SUN)
|
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.HARSH_SUN)
|
||||||
.attr(PreSwitchOutClearWeatherAbAttr)
|
.attr(PreLeaveFieldClearWeatherAbAttr)
|
||||||
.attr(PostFaintClearWeatherAbAttr)
|
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.DELTA_STREAM, 6)
|
new Ability(Abilities.DELTA_STREAM, 6)
|
||||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.STRONG_WINDS)
|
.attr(PostSummonWeatherChangeAbAttr, WeatherType.STRONG_WINDS)
|
||||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.STRONG_WINDS)
|
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.STRONG_WINDS)
|
||||||
.attr(PreSwitchOutClearWeatherAbAttr)
|
.attr(PreLeaveFieldClearWeatherAbAttr)
|
||||||
.attr(PostFaintClearWeatherAbAttr)
|
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
new Ability(Abilities.STAMINA, 7)
|
new Ability(Abilities.STAMINA, 7)
|
||||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, Stat.DEF, 1),
|
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, Stat.DEF, 1),
|
||||||
@ -6289,9 +6244,8 @@ export function initAbilities() {
|
|||||||
.attr(NoTransformAbilityAbAttr)
|
.attr(NoTransformAbilityAbAttr)
|
||||||
.partial(), // While setting the tag, the getbattlestat should ignore all modifiers to stats except stat stages
|
.partial(), // While setting the tag, the getbattlestat should ignore all modifiers to stats except stat stages
|
||||||
new Ability(Abilities.GOOD_AS_GOLD, 9)
|
new Ability(Abilities.GOOD_AS_GOLD, 9)
|
||||||
.attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.category === MoveCategory.STATUS)
|
.attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.category === MoveCategory.STATUS && ![ MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES, MoveTarget.USER_SIDE ].includes(move.moveTarget))
|
||||||
.ignorable()
|
.ignorable(),
|
||||||
.partial(), // Lots of weird interactions with moves and abilities such as negating status moves that target the field
|
|
||||||
new Ability(Abilities.VESSEL_OF_RUIN, 9)
|
new Ability(Abilities.VESSEL_OF_RUIN, 9)
|
||||||
.attr(FieldMultiplyStatAbAttr, Stat.SPATK, 0.75)
|
.attr(FieldMultiplyStatAbAttr, Stat.SPATK, 0.75)
|
||||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonVesselOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.SPATK)) }))
|
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonVesselOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.SPATK)) }))
|
||||||
|
@ -26,11 +26,11 @@ export function getBiomeName(biome: Biome | -1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface BiomeLinks {
|
interface BiomeLinks {
|
||||||
[key: integer]: Biome | (Biome | [Biome, integer])[]
|
[key: number]: Biome | (Biome | [Biome, number])[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BiomeDepths {
|
interface BiomeDepths {
|
||||||
[key: integer]: [integer, integer]
|
[key: number]: [number, number]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const biomeLinks: BiomeLinks = {
|
export const biomeLinks: BiomeLinks = {
|
||||||
@ -87,27 +87,39 @@ export enum BiomePoolTier {
|
|||||||
export const uncatchableSpecies: Species[] = [];
|
export const uncatchableSpecies: Species[] = [];
|
||||||
|
|
||||||
export interface SpeciesTree {
|
export interface SpeciesTree {
|
||||||
[key: integer]: Species[]
|
[key: number]: Species[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PokemonPools {
|
export interface PokemonPools {
|
||||||
[key: integer]: (Species | SpeciesTree)[]
|
[key: number]: (Species | SpeciesTree)[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BiomeTierPokemonPools {
|
export interface BiomeTierPokemonPools {
|
||||||
[key: integer]: PokemonPools
|
[key: number]: PokemonPools
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BiomePokemonPools {
|
export interface BiomePokemonPools {
|
||||||
[key: integer]: BiomeTierPokemonPools
|
[key: number]: BiomeTierPokemonPools
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BiomeTierTod {
|
||||||
|
biome: Biome,
|
||||||
|
tier: BiomePoolTier,
|
||||||
|
tod: TimeOfDay[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CatchableSpecies{
|
||||||
|
[key: number]: BiomeTierTod[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export const catchableSpecies: CatchableSpecies = {};
|
||||||
|
|
||||||
export interface BiomeTierTrainerPools {
|
export interface BiomeTierTrainerPools {
|
||||||
[key: integer]: TrainerType[]
|
[key: number]: TrainerType[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BiomeTrainerPools {
|
export interface BiomeTrainerPools {
|
||||||
[key: integer]: BiomeTierTrainerPools
|
[key: number]: BiomeTierTrainerPools
|
||||||
}
|
}
|
||||||
|
|
||||||
export const biomePokemonPools: BiomePokemonPools = {
|
export const biomePokemonPools: BiomePokemonPools = {
|
||||||
@ -7663,15 +7675,15 @@ export function initBiomes() {
|
|||||||
|
|
||||||
biomeDepths[Biome.TOWN] = [ 0, 1 ];
|
biomeDepths[Biome.TOWN] = [ 0, 1 ];
|
||||||
|
|
||||||
const traverseBiome = (biome: Biome, depth: integer) => {
|
const traverseBiome = (biome: Biome, depth: number) => {
|
||||||
if (biome === Biome.END) {
|
if (biome === Biome.END) {
|
||||||
const biomeList = Object.keys(Biome).filter(key => !isNaN(Number(key)));
|
const biomeList = Object.keys(Biome).filter(key => !isNaN(Number(key)));
|
||||||
biomeList.pop(); // Removes Biome.END from the list
|
biomeList.pop(); // Removes Biome.END from the list
|
||||||
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
|
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
|
||||||
biome = Biome[biomeList[randIndex]];
|
biome = Biome[biomeList[randIndex]];
|
||||||
}
|
}
|
||||||
const linkedBiomes: (Biome | [ Biome, integer ])[] = Array.isArray(biomeLinks[biome])
|
const linkedBiomes: (Biome | [ Biome, number ])[] = Array.isArray(biomeLinks[biome])
|
||||||
? biomeLinks[biome] as (Biome | [ Biome, integer ])[]
|
? biomeLinks[biome] as (Biome | [ Biome, number ])[]
|
||||||
: [ biomeLinks[biome] as Biome ];
|
: [ biomeLinks[biome] as Biome ];
|
||||||
for (const linkedBiomeEntry of linkedBiomes) {
|
for (const linkedBiomeEntry of linkedBiomes) {
|
||||||
const linkedBiome = !Array.isArray(linkedBiomeEntry)
|
const linkedBiome = !Array.isArray(linkedBiomeEntry)
|
||||||
@ -7688,7 +7700,7 @@ export function initBiomes() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
traverseBiome(Biome.TOWN, 0);
|
traverseBiome(Biome.TOWN, 0);
|
||||||
biomeDepths[Biome.END] = [ Object.values(biomeDepths).map(d => d[0]).reduce((max: integer, value: integer) => Math.max(max, value), 0) + 1, 1 ];
|
biomeDepths[Biome.END] = [ Object.values(biomeDepths).map(d => d[0]).reduce((max: number, value: number) => Math.max(max, value), 0) + 1, 1 ];
|
||||||
|
|
||||||
for (const biome of Utils.getEnumValues(Biome)) {
|
for (const biome of Utils.getEnumValues(Biome)) {
|
||||||
biomePokemonPools[biome] = {};
|
biomePokemonPools[biome] = {};
|
||||||
@ -7716,6 +7728,9 @@ export function initBiomes() {
|
|||||||
uncatchableSpecies.push(speciesId);
|
uncatchableSpecies.push(speciesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// array of biome options for the current species
|
||||||
|
catchableSpecies[speciesId] = [];
|
||||||
|
|
||||||
for (const b of biomeEntries) {
|
for (const b of biomeEntries) {
|
||||||
const biome = b[0];
|
const biome = b[0];
|
||||||
const tier = b[1];
|
const tier = b[1];
|
||||||
@ -7725,6 +7740,12 @@ export function initBiomes() {
|
|||||||
: [ b[2] ]
|
: [ b[2] ]
|
||||||
: [ TimeOfDay.ALL ];
|
: [ TimeOfDay.ALL ];
|
||||||
|
|
||||||
|
catchableSpecies[speciesId].push({
|
||||||
|
biome: biome as Biome,
|
||||||
|
tier: tier as BiomePoolTier,
|
||||||
|
tod: timesOfDay as TimeOfDay[]
|
||||||
|
});
|
||||||
|
|
||||||
for (const tod of timesOfDay) {
|
for (const tod of timesOfDay) {
|
||||||
if (!biomePokemonPools.hasOwnProperty(biome) || !biomePokemonPools[biome].hasOwnProperty(tier) || !biomePokemonPools[biome][tier].hasOwnProperty(tod)) {
|
if (!biomePokemonPools.hasOwnProperty(biome) || !biomePokemonPools[biome].hasOwnProperty(tier) || !biomePokemonPools[biome][tier].hasOwnProperty(tod)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
import { Abilities } from "#app/enums/abilities";
|
import { Abilities } from "#app/enums/abilities";
|
||||||
import { Species } from "#app/enums/species";
|
import { Species } from "#app/enums/species";
|
||||||
|
|
||||||
export const starterPassiveAbilities = {
|
export interface PassiveAbilities {
|
||||||
|
[key: number]: Abilities
|
||||||
|
}
|
||||||
|
|
||||||
|
interface StarterPassiveAbilities {
|
||||||
|
[key: number]: PassiveAbilities
|
||||||
|
}
|
||||||
|
|
||||||
|
export const starterPassiveAbilities: StarterPassiveAbilities = {
|
||||||
[Species.BULBASAUR]: { 0: Abilities.GRASSY_SURGE },
|
[Species.BULBASAUR]: { 0: Abilities.GRASSY_SURGE },
|
||||||
[Species.CHARMANDER]: { 0: Abilities.BEAST_BOOST },
|
[Species.CHARMANDER]: { 0: Abilities.BEAST_BOOST },
|
||||||
[Species.SQUIRTLE]: { 0: Abilities.STURDY },
|
[Species.SQUIRTLE]: { 0: Abilities.STURDY },
|
||||||
|
@ -77,9 +77,9 @@ export enum EvolutionItem {
|
|||||||
/**
|
/**
|
||||||
* Pokemon Evolution tuple type consisting of:
|
* Pokemon Evolution tuple type consisting of:
|
||||||
* @property 0 {@linkcode Species} The species of the Pokemon.
|
* @property 0 {@linkcode Species} The species of the Pokemon.
|
||||||
* @property 1 {@linkcode integer} The level at which the Pokemon evolves.
|
* @property 1 {@linkcode number} The level at which the Pokemon evolves.
|
||||||
*/
|
*/
|
||||||
export type EvolutionLevel = [species: Species, level: integer];
|
export type EvolutionLevel = [species: Species, level: number];
|
||||||
|
|
||||||
export type EvolutionConditionPredicate = (p: Pokemon) => boolean;
|
export type EvolutionConditionPredicate = (p: Pokemon) => boolean;
|
||||||
export type EvolutionConditionEnforceFunc = (p: Pokemon) => void;
|
export type EvolutionConditionEnforceFunc = (p: Pokemon) => void;
|
||||||
@ -88,12 +88,12 @@ export class SpeciesFormEvolution {
|
|||||||
public speciesId: Species;
|
public speciesId: Species;
|
||||||
public preFormKey: string | null;
|
public preFormKey: string | null;
|
||||||
public evoFormKey: string | null;
|
public evoFormKey: string | null;
|
||||||
public level: integer;
|
public level: number;
|
||||||
public item: EvolutionItem | null;
|
public item: EvolutionItem | null;
|
||||||
public condition: SpeciesEvolutionCondition | null;
|
public condition: SpeciesEvolutionCondition | null;
|
||||||
public wildDelay: SpeciesWildEvolutionDelay;
|
public wildDelay: SpeciesWildEvolutionDelay;
|
||||||
|
|
||||||
constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: integer, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: number, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
||||||
this.speciesId = speciesId;
|
this.speciesId = speciesId;
|
||||||
this.preFormKey = preFormKey;
|
this.preFormKey = preFormKey;
|
||||||
this.evoFormKey = evoFormKey;
|
this.evoFormKey = evoFormKey;
|
||||||
@ -105,7 +105,7 @@ export class SpeciesFormEvolution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SpeciesEvolution extends SpeciesFormEvolution {
|
export class SpeciesEvolution extends SpeciesFormEvolution {
|
||||||
constructor(speciesId: Species, level: integer, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
constructor(speciesId: Species, level: number, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
|
||||||
super(speciesId, null, null, level, item, condition, wildDelay);
|
super(speciesId, null, null, level, item, condition, wildDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ class MoveEvolutionCondition extends SpeciesEvolutionCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FriendshipEvolutionCondition extends SpeciesEvolutionCondition {
|
class FriendshipEvolutionCondition extends SpeciesEvolutionCondition {
|
||||||
public amount: integer;
|
public amount: number;
|
||||||
constructor(amount: number) {
|
constructor(amount: number) {
|
||||||
super(p => p.friendship >= amount);
|
super(p => p.friendship >= amount);
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
@ -178,7 +178,7 @@ class FriendshipEvolutionCondition extends SpeciesEvolutionCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FriendshipTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
class FriendshipTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
||||||
public amount: integer;
|
public amount: number;
|
||||||
public timesOfDay: TimeOfDay[];
|
public timesOfDay: TimeOfDay[];
|
||||||
constructor(amount: number, tod: "day" | "night") {
|
constructor(amount: number, tod: "day" | "night") {
|
||||||
if (tod === "day") {
|
if (tod === "day") {
|
||||||
@ -197,7 +197,7 @@ class FriendshipTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FriendshipMoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
|
class FriendshipMoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
|
||||||
public amount: integer;
|
public amount: number;
|
||||||
public type: Type;
|
public type: Type;
|
||||||
constructor(amount: number, type: Type) {
|
constructor(amount: number, type: Type) {
|
||||||
super(p => p.friendship >= amount && !!p.getMoveset().find(m => m?.getMove().type === type));
|
super(p => p.friendship >= amount && !!p.getMoveset().find(m => m?.getMove().type === type));
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import { Moves } from "#enums/moves";
|
import { Moves } from "#enums/moves";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
|
|
||||||
export type LevelMoves = ([integer, Moves])[];
|
export type LevelMoves = ([number, Moves])[];
|
||||||
|
|
||||||
interface PokemonSpeciesLevelMoves {
|
interface PokemonSpeciesLevelMoves {
|
||||||
[key: integer]: LevelMoves
|
[key: number]: LevelMoves
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PokemonFormLevelMoves {
|
interface PokemonFormLevelMoves {
|
||||||
[key: integer]: LevelMoves
|
[key: number]: LevelMoves
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PokemonSpeciesFormLevelMoves {
|
interface PokemonSpeciesFormLevelMoves {
|
||||||
[key: integer]: PokemonFormLevelMoves
|
[key: number]: PokemonFormLevelMoves
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Moves that can only be learned with a memory-mushroom */
|
/** Moves that can only be learned with a memory-mushroom */
|
||||||
|
@ -3,7 +3,7 @@ import { Moves } from "#enums/moves";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
|
|
||||||
interface TmSpecies {
|
interface TmSpecies {
|
||||||
[key: integer]: Array<Species | Array<Species | string>>
|
[key: number]: Array<Species | Array<Species | string>>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const reverseCompatibleTms: Moves[] = [];/*[
|
export const reverseCompatibleTms: Moves[] = [];/*[
|
||||||
@ -68433,8 +68433,48 @@ export const tmSpecies: TmSpecies = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface SpeciesTmMoves {
|
||||||
|
[key: number]: (Moves | [string | Species, Moves])[];
|
||||||
|
}
|
||||||
|
|
||||||
|
function transposeTmSpecies(): SpeciesTmMoves {
|
||||||
|
const flipped: SpeciesTmMoves = {};
|
||||||
|
|
||||||
|
for (const move in tmSpecies) {
|
||||||
|
const moveKey = Number(move);
|
||||||
|
const speciesList = tmSpecies[move];
|
||||||
|
|
||||||
|
for (const species of speciesList) {
|
||||||
|
|
||||||
|
if (Array.isArray(species)) {
|
||||||
|
// Extract base species and all associated forms
|
||||||
|
const [ baseSpecies, ...forms ] = species;
|
||||||
|
const speciesKey = Number(baseSpecies);
|
||||||
|
|
||||||
|
if (!flipped[speciesKey]) {
|
||||||
|
flipped[speciesKey] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const form of forms) {
|
||||||
|
flipped[speciesKey].push([ form, moveKey ]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const speciesKey = Number(species);
|
||||||
|
if (!flipped[speciesKey]) {
|
||||||
|
flipped[speciesKey] = [];
|
||||||
|
}
|
||||||
|
flipped[speciesKey].push(moveKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flipped;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const speciesTmMoves: SpeciesTmMoves = transposeTmSpecies();
|
||||||
|
|
||||||
interface TmPoolTiers {
|
interface TmPoolTiers {
|
||||||
[key: integer]: ModifierTier
|
[key: number]: ModifierTier
|
||||||
}
|
}
|
||||||
|
|
||||||
export const tmPoolTiers: TmPoolTiers = {
|
export const tmPoolTiers: TmPoolTiers = {
|
||||||
|
@ -106,15 +106,15 @@ export enum CommonAnim {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AnimConfig {
|
export class AnimConfig {
|
||||||
public id: integer;
|
public id: number;
|
||||||
public graphic: string;
|
public graphic: string;
|
||||||
public frames: AnimFrame[][];
|
public frames: AnimFrame[][];
|
||||||
public frameTimedEvents: Map<integer, AnimTimedEvent[]>;
|
public frameTimedEvents: Map<number, AnimTimedEvent[]>;
|
||||||
public position: integer;
|
public position: number;
|
||||||
public hue: integer;
|
public hue: number;
|
||||||
|
|
||||||
constructor(source?: any) {
|
constructor(source?: any) {
|
||||||
this.frameTimedEvents = new Map<integer, AnimTimedEvent[]>;
|
this.frameTimedEvents = new Map<number, AnimTimedEvent[]>;
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
this.id = source.id;
|
this.id = source.id;
|
||||||
@ -195,18 +195,18 @@ class AnimFrame {
|
|||||||
public visible: boolean;
|
public visible: boolean;
|
||||||
public blendType: AnimBlendType;
|
public blendType: AnimBlendType;
|
||||||
public target: AnimFrameTarget;
|
public target: AnimFrameTarget;
|
||||||
public graphicFrame: integer;
|
public graphicFrame: number;
|
||||||
public opacity: integer;
|
public opacity: number;
|
||||||
public color: integer[];
|
public color: number[];
|
||||||
public tone: integer[];
|
public tone: number[];
|
||||||
public flash: integer[];
|
public flash: number[];
|
||||||
public locked: boolean;
|
public locked: boolean;
|
||||||
public priority: integer;
|
public priority: number;
|
||||||
public focus: AnimFocus;
|
public focus: AnimFocus;
|
||||||
|
|
||||||
constructor(x: number, y: number, zoomX: number, zoomY: number, angle: number, mirror: boolean, visible: boolean, blendType: AnimBlendType, pattern: integer,
|
constructor(x: number, y: number, zoomX: number, zoomY: number, angle: number, mirror: boolean, visible: boolean, blendType: AnimBlendType, pattern: number,
|
||||||
opacity: integer, colorR: integer, colorG: integer, colorB: integer, colorA: integer, toneR: integer, toneG: integer, toneB: integer, toneA: integer,
|
opacity: number, colorR: number, colorG: number, colorB: number, colorA: number, toneR: number, toneG: number, toneB: number, toneA: number,
|
||||||
flashR: integer, flashG: integer, flashB: integer, flashA: integer, locked: boolean, priority: integer, focus: AnimFocus, init?: boolean) {
|
flashR: number, flashG: number, flashB: number, flashA: number, locked: boolean, priority: number, focus: AnimFocus, init?: boolean) {
|
||||||
this.x = !init ? ((x || 0) - 128) * 0.5 : x;
|
this.x = !init ? ((x || 0) - 128) * 0.5 : x;
|
||||||
this.y = !init ? ((y || 0) - 224) * 0.5 : y;
|
this.y = !init ? ((y || 0) - 224) * 0.5 : y;
|
||||||
if (zoomX) {
|
if (zoomX) {
|
||||||
@ -288,9 +288,9 @@ class AnimFrame {
|
|||||||
|
|
||||||
class ImportedAnimFrame extends AnimFrame {
|
class ImportedAnimFrame extends AnimFrame {
|
||||||
constructor(source: any) {
|
constructor(source: any) {
|
||||||
const color: integer[] = source.color || [ 0, 0, 0, 0 ];
|
const color: number[] = source.color || [ 0, 0, 0, 0 ];
|
||||||
const tone: integer[] = source.tone || [ 0, 0, 0, 0 ];
|
const tone: number[] = source.tone || [ 0, 0, 0, 0 ];
|
||||||
const flash: integer[] = source.flash || [ 0, 0, 0, 0 ];
|
const flash: number[] = source.flash || [ 0, 0, 0, 0 ];
|
||||||
super(source.x, source.y, source.zoomX, source.zoomY, source.angle, source.mirror, source.visible, source.blendType, source.graphicFrame, source.opacity, color[0], color[1], color[2], color[3], tone[0], tone[1], tone[2], tone[3], flash[0], flash[1], flash[2], flash[3], source.locked, source.priority, source.focus, true);
|
super(source.x, source.y, source.zoomX, source.zoomY, source.angle, source.mirror, source.visible, source.blendType, source.graphicFrame, source.opacity, color[0], color[1], color[2], color[3], tone[0], tone[1], tone[2], tone[3], flash[0], flash[1], flash[2], flash[3], source.locked, source.priority, source.focus, true);
|
||||||
this.target = source.target;
|
this.target = source.target;
|
||||||
this.graphicFrame = source.graphicFrame;
|
this.graphicFrame = source.graphicFrame;
|
||||||
@ -298,15 +298,15 @@ class ImportedAnimFrame extends AnimFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class AnimTimedEvent {
|
abstract class AnimTimedEvent {
|
||||||
public frameIndex: integer;
|
public frameIndex: number;
|
||||||
public resourceName: string;
|
public resourceName: string;
|
||||||
|
|
||||||
constructor(frameIndex: integer, resourceName: string) {
|
constructor(frameIndex: number, resourceName: string) {
|
||||||
this.frameIndex = frameIndex;
|
this.frameIndex = frameIndex;
|
||||||
this.resourceName = resourceName;
|
this.resourceName = resourceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract execute(battleAnim: BattleAnim, priority?: number): integer;
|
abstract execute(battleAnim: BattleAnim, priority?: number): number;
|
||||||
|
|
||||||
abstract getEventType(): string;
|
abstract getEventType(): string;
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ class AnimTimedSoundEvent extends AnimTimedEvent {
|
|||||||
public volume: number = 100;
|
public volume: number = 100;
|
||||||
public pitch: number = 100;
|
public pitch: number = 100;
|
||||||
|
|
||||||
constructor(frameIndex: integer, resourceName: string, source?: any) {
|
constructor(frameIndex: number, resourceName: string, source?: any) {
|
||||||
super(frameIndex, resourceName);
|
super(frameIndex, resourceName);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
@ -324,7 +324,7 @@ class AnimTimedSoundEvent extends AnimTimedEvent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(battleAnim: BattleAnim, priority?: number): integer {
|
execute(battleAnim: BattleAnim, priority?: number): number {
|
||||||
const soundConfig = { rate: (this.pitch * 0.01), volume: (this.volume * 0.01) };
|
const soundConfig = { rate: (this.pitch * 0.01), volume: (this.volume * 0.01) };
|
||||||
if (this.resourceName) {
|
if (this.resourceName) {
|
||||||
try {
|
try {
|
||||||
@ -346,20 +346,20 @@ class AnimTimedSoundEvent extends AnimTimedEvent {
|
|||||||
abstract class AnimTimedBgEvent extends AnimTimedEvent {
|
abstract class AnimTimedBgEvent extends AnimTimedEvent {
|
||||||
public bgX: number = 0;
|
public bgX: number = 0;
|
||||||
public bgY: number = 0;
|
public bgY: number = 0;
|
||||||
public opacity: integer = 0;
|
public opacity: number = 0;
|
||||||
/*public colorRed: integer = 0;
|
/*public colorRed: number = 0;
|
||||||
public colorGreen: integer = 0;
|
public colorGreen: number = 0;
|
||||||
public colorBlue: integer = 0;
|
public colorBlue: number = 0;
|
||||||
public colorAlpha: integer = 0;*/
|
public colorAlpha: number = 0;*/
|
||||||
public duration: integer = 0;
|
public duration: number = 0;
|
||||||
/*public flashScope: integer = 0;
|
/*public flashScope: number = 0;
|
||||||
public flashRed: integer = 0;
|
public flashRed: number = 0;
|
||||||
public flashGreen: integer = 0;
|
public flashGreen: number = 0;
|
||||||
public flashBlue: integer = 0;
|
public flashBlue: number = 0;
|
||||||
public flashAlpha: integer = 0;
|
public flashAlpha: number = 0;
|
||||||
public flashDuration: integer = 0;*/
|
public flashDuration: number = 0;*/
|
||||||
|
|
||||||
constructor(frameIndex: integer, resourceName: string, source: any) {
|
constructor(frameIndex: number, resourceName: string, source: any) {
|
||||||
super(frameIndex, resourceName);
|
super(frameIndex, resourceName);
|
||||||
|
|
||||||
if (source) {
|
if (source) {
|
||||||
@ -382,11 +382,11 @@ abstract class AnimTimedBgEvent extends AnimTimedEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AnimTimedUpdateBgEvent extends AnimTimedBgEvent {
|
class AnimTimedUpdateBgEvent extends AnimTimedBgEvent {
|
||||||
constructor(frameIndex: integer, resourceName: string, source?: any) {
|
constructor(frameIndex: number, resourceName: string, source?: any) {
|
||||||
super(frameIndex, resourceName, source);
|
super(frameIndex, resourceName, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(moveAnim: MoveAnim, priority?: number): integer {
|
execute(moveAnim: MoveAnim, priority?: number): number {
|
||||||
const tweenProps = {};
|
const tweenProps = {};
|
||||||
if (this.bgX !== undefined) {
|
if (this.bgX !== undefined) {
|
||||||
tweenProps["x"] = (this.bgX * 0.5) - 320;
|
tweenProps["x"] = (this.bgX * 0.5) - 320;
|
||||||
@ -412,11 +412,11 @@ class AnimTimedUpdateBgEvent extends AnimTimedBgEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AnimTimedAddBgEvent extends AnimTimedBgEvent {
|
class AnimTimedAddBgEvent extends AnimTimedBgEvent {
|
||||||
constructor(frameIndex: integer, resourceName: string, source?: any) {
|
constructor(frameIndex: number, resourceName: string, source?: any) {
|
||||||
super(frameIndex, resourceName, source);
|
super(frameIndex, resourceName, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(moveAnim: MoveAnim, priority?: number): integer {
|
execute(moveAnim: MoveAnim, priority?: number): number {
|
||||||
if (moveAnim.bgSprite) {
|
if (moveAnim.bgSprite) {
|
||||||
moveAnim.bgSprite.destroy();
|
moveAnim.bgSprite.destroy();
|
||||||
}
|
}
|
||||||
@ -737,7 +737,7 @@ function isReversed(src1: number, src2: number, dst1: number, dst2: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface SpriteCache {
|
interface SpriteCache {
|
||||||
[key: integer]: Phaser.GameObjects.Sprite[]
|
[key: number]: Phaser.GameObjects.Sprite[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class BattleAnim {
|
export abstract class BattleAnim {
|
||||||
@ -774,8 +774,8 @@ export abstract class BattleAnim {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getGraphicFrameData(frames: AnimFrame[], onSubstitute?: boolean): Map<integer, Map<AnimFrameTarget, GraphicFrameData>> {
|
private getGraphicFrameData(frames: AnimFrame[], onSubstitute?: boolean): Map<number, Map<AnimFrameTarget, GraphicFrameData>> {
|
||||||
const ret: Map<integer, Map<AnimFrameTarget, GraphicFrameData>> = new Map([
|
const ret: Map<number, Map<AnimFrameTarget, GraphicFrameData>> = new Map([
|
||||||
[ AnimFrameTarget.GRAPHIC, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
[ AnimFrameTarget.GRAPHIC, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
||||||
[ AnimFrameTarget.USER, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
[ AnimFrameTarget.USER, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
||||||
[ AnimFrameTarget.TARGET, new Map<AnimFrameTarget, GraphicFrameData>() ]
|
[ AnimFrameTarget.TARGET, new Map<AnimFrameTarget, GraphicFrameData>() ]
|
||||||
@ -853,7 +853,7 @@ export abstract class BattleAnim {
|
|||||||
[AnimFrameTarget.USER]: [],
|
[AnimFrameTarget.USER]: [],
|
||||||
[AnimFrameTarget.TARGET]: []
|
[AnimFrameTarget.TARGET]: []
|
||||||
};
|
};
|
||||||
const spritePriorities: integer[] = [];
|
const spritePriorities: number[] = [];
|
||||||
|
|
||||||
const cleanUpAndComplete = () => {
|
const cleanUpAndComplete = () => {
|
||||||
userSprite.setPosition(0, 0);
|
userSprite.setPosition(0, 0);
|
||||||
@ -993,7 +993,7 @@ export abstract class BattleAnim {
|
|||||||
const moveSprite = sprites[graphicIndex];
|
const moveSprite = sprites[graphicIndex];
|
||||||
if (spritePriorities[graphicIndex] !== frame.priority) {
|
if (spritePriorities[graphicIndex] !== frame.priority) {
|
||||||
spritePriorities[graphicIndex] = frame.priority;
|
spritePriorities[graphicIndex] = frame.priority;
|
||||||
const setSpritePriority = (priority: integer) => {
|
const setSpritePriority = (priority: number) => {
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
case 0:
|
case 0:
|
||||||
globalScene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, globalScene.getEnemyPokemon(false) ?? globalScene.getPlayerPokemon(false)!); // TODO: is this bang correct?
|
globalScene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, globalScene.getEnemyPokemon(false) ?? globalScene.getPlayerPokemon(false)!); // TODO: is this bang correct?
|
||||||
@ -1093,8 +1093,8 @@ export abstract class BattleAnim {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getGraphicFrameDataWithoutTarget(frames: AnimFrame[], targetInitialX: number, targetInitialY: number): Map<integer, Map<AnimFrameTarget, GraphicFrameData>> {
|
private getGraphicFrameDataWithoutTarget(frames: AnimFrame[], targetInitialX: number, targetInitialY: number): Map<number, Map<AnimFrameTarget, GraphicFrameData>> {
|
||||||
const ret: Map<integer, Map<AnimFrameTarget, GraphicFrameData>> = new Map([
|
const ret: Map<number, Map<AnimFrameTarget, GraphicFrameData>> = new Map([
|
||||||
[ AnimFrameTarget.GRAPHIC, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
[ AnimFrameTarget.GRAPHIC, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
||||||
[ AnimFrameTarget.USER, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
[ AnimFrameTarget.USER, new Map<AnimFrameTarget, GraphicFrameData>() ],
|
||||||
[ AnimFrameTarget.TARGET, new Map<AnimFrameTarget, GraphicFrameData>() ]
|
[ AnimFrameTarget.TARGET, new Map<AnimFrameTarget, GraphicFrameData>() ]
|
||||||
@ -1188,7 +1188,7 @@ export abstract class BattleAnim {
|
|||||||
const graphicIndex = graphicFrameCount++;
|
const graphicIndex = graphicFrameCount++;
|
||||||
const moveSprite = sprites[graphicIndex];
|
const moveSprite = sprites[graphicIndex];
|
||||||
if (!isNullOrUndefined(frame.priority)) {
|
if (!isNullOrUndefined(frame.priority)) {
|
||||||
const setSpritePriority = (priority: integer) => {
|
const setSpritePriority = (priority: number) => {
|
||||||
if (existingFieldSprites.length > priority) {
|
if (existingFieldSprites.length > priority) {
|
||||||
// Move to specified priority index
|
// Move to specified priority index
|
||||||
const index = globalScene.field.getIndex(existingFieldSprites[priority]);
|
const index = globalScene.field.getIndex(existingFieldSprites[priority]);
|
||||||
|
@ -137,7 +137,7 @@ export interface TerrainBattlerTag {
|
|||||||
* to select restricted moves.
|
* to select restricted moves.
|
||||||
*/
|
*/
|
||||||
export abstract class MoveRestrictionBattlerTag extends BattlerTag {
|
export abstract class MoveRestrictionBattlerTag extends BattlerTag {
|
||||||
constructor(tagType: BattlerTagType, lapseType: BattlerTagLapseType | BattlerTagLapseType[], turnCount: integer, sourceMove?: Moves, sourceId?: integer) {
|
constructor(tagType: BattlerTagType, lapseType: BattlerTagLapseType | BattlerTagLapseType[], turnCount: number, sourceMove?: Moves, sourceId?: number) {
|
||||||
super(tagType, lapseType, turnCount, sourceMove, sourceId);
|
super(tagType, lapseType, turnCount, sourceMove, sourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2559,7 +2559,7 @@ export class SubstituteTag extends BattlerTag {
|
|||||||
/** Is the source Pokemon "in focus," i.e. is it fully visible on the field? */
|
/** Is the source Pokemon "in focus," i.e. is it fully visible on the field? */
|
||||||
public sourceInFocus: boolean;
|
public sourceInFocus: boolean;
|
||||||
|
|
||||||
constructor(sourceMove: Moves, sourceId: integer) {
|
constructor(sourceMove: Moves, sourceId: number) {
|
||||||
super(BattlerTagType.SUBSTITUTE, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.AFTER_MOVE, BattlerTagLapseType.HIT ], 0, sourceMove, sourceId, true);
|
super(BattlerTagType.SUBSTITUTE, [ BattlerTagLapseType.PRE_MOVE, BattlerTagLapseType.AFTER_MOVE, BattlerTagLapseType.HIT ], 0, sourceMove, sourceId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,17 +115,17 @@ export enum MoveSourceType {
|
|||||||
export abstract class Challenge {
|
export abstract class Challenge {
|
||||||
public id: Challenges; // The id of the challenge
|
public id: Challenges; // The id of the challenge
|
||||||
|
|
||||||
public value: integer; // The "strength" of the challenge, all challenges have a numerical value.
|
public value: number; // The "strength" of the challenge, all challenges have a numerical value.
|
||||||
public maxValue: integer; // The maximum strength of the challenge.
|
public maxValue: number; // The maximum strength of the challenge.
|
||||||
public severity: integer; // The current severity of the challenge. Some challenges have multiple severities in addition to strength.
|
public severity: number; // The current severity of the challenge. Some challenges have multiple severities in addition to strength.
|
||||||
public maxSeverity: integer; // The maximum severity of the challenge.
|
public maxSeverity: number; // The maximum severity of the challenge.
|
||||||
|
|
||||||
public conditions: ChallengeCondition[];
|
public conditions: ChallengeCondition[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id {@link Challenges} The enum value for the challenge
|
* @param id {@link Challenges} The enum value for the challenge
|
||||||
*/
|
*/
|
||||||
constructor(id: Challenges, maxValue: integer = Number.MAX_SAFE_INTEGER) {
|
constructor(id: Challenges, maxValue: number = Number.MAX_SAFE_INTEGER) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
this.value = 0;
|
this.value = 0;
|
||||||
@ -180,7 +180,7 @@ export abstract class Challenge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the textual representation of a challenge's current value.
|
* Returns the textual representation of a challenge's current value.
|
||||||
* @param overrideValue {@link integer} The value to check for. If undefined, gets the current value.
|
* @param overrideValue {@link number} The value to check for. If undefined, gets the current value.
|
||||||
* @returns {@link string} The localised name for the current value.
|
* @returns {@link string} The localised name for the current value.
|
||||||
*/
|
*/
|
||||||
getValue(overrideValue?: number): string {
|
getValue(overrideValue?: number): string {
|
||||||
@ -190,7 +190,7 @@ export abstract class Challenge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the description of a challenge's current value.
|
* Returns the description of a challenge's current value.
|
||||||
* @param overrideValue {@link integer} The value to check for. If undefined, gets the current value.
|
* @param overrideValue {@link number} The value to check for. If undefined, gets the current value.
|
||||||
* @returns {@link string} The localised description for the current value.
|
* @returns {@link string} The localised description for the current value.
|
||||||
*/
|
*/
|
||||||
getDescription(overrideValue?: number): string {
|
getDescription(overrideValue?: number): string {
|
||||||
@ -257,7 +257,7 @@ export abstract class Challenge {
|
|||||||
* Gets the "difficulty" value of this challenge.
|
* Gets the "difficulty" value of this challenge.
|
||||||
* @returns {@link integer} The difficulty value.
|
* @returns {@link integer} The difficulty value.
|
||||||
*/
|
*/
|
||||||
getDifficulty(): integer {
|
getDifficulty(): number {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ export abstract class Challenge {
|
|||||||
* Gets the minimum difficulty added by this challenge.
|
* Gets the minimum difficulty added by this challenge.
|
||||||
* @returns {@link integer} The difficulty value.
|
* @returns {@link integer} The difficulty value.
|
||||||
*/
|
*/
|
||||||
getMinDifficulty(): integer {
|
getMinDifficulty(): number {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +643,7 @@ export class SingleTypeChallenge extends Challenge {
|
|||||||
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||||
* @returns {string} The localised name for the current value.
|
* @returns {string} The localised name for the current value.
|
||||||
*/
|
*/
|
||||||
getValue(overrideValue?: integer): string {
|
getValue(overrideValue?: number): string {
|
||||||
if (overrideValue === undefined) {
|
if (overrideValue === undefined) {
|
||||||
overrideValue = this.value;
|
overrideValue = this.value;
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ export class SingleTypeChallenge extends Challenge {
|
|||||||
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
* @param {value} overrideValue The value to check for. If undefined, gets the current value.
|
||||||
* @returns {string} The localised description for the current value.
|
* @returns {string} The localised description for the current value.
|
||||||
*/
|
*/
|
||||||
getDescription(overrideValue?: integer): string {
|
getDescription(overrideValue?: number): string {
|
||||||
if (overrideValue === undefined) {
|
if (overrideValue === undefined) {
|
||||||
overrideValue = this.value;
|
overrideValue = this.value;
|
||||||
}
|
}
|
||||||
@ -793,7 +793,7 @@ export class LowerStarterMaxCostChallenge extends Challenge {
|
|||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getValue(overrideValue?: integer): string {
|
getValue(overrideValue?: number): string {
|
||||||
if (overrideValue === undefined) {
|
if (overrideValue === undefined) {
|
||||||
overrideValue = this.value;
|
overrideValue = this.value;
|
||||||
}
|
}
|
||||||
@ -827,7 +827,7 @@ export class LowerStarterPointsChallenge extends Challenge {
|
|||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
getValue(overrideValue?: integer): string {
|
getValue(overrideValue?: number): string {
|
||||||
if (overrideValue === undefined) {
|
if (overrideValue === undefined) {
|
||||||
overrideValue = this.value;
|
overrideValue = this.value;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
|||||||
import { Biome } from "#app/enums/biome";
|
import { Biome } from "#app/enums/biome";
|
||||||
|
|
||||||
export interface DailyRunConfig {
|
export interface DailyRunConfig {
|
||||||
seed: integer;
|
seed: number;
|
||||||
starters: Starter;
|
starters: Starter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ export function getDailyRunStarters(seed: string): Starter[] {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const starterCosts: integer[] = [];
|
const starterCosts: number[] = [];
|
||||||
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(Utils.randSeedGauss(1))), 8));
|
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(Utils.randSeedGauss(1))), 8));
|
||||||
starterCosts.push(Utils.randSeedInt(9 - starterCosts[0], 1));
|
starterCosts.push(Utils.randSeedInt(9 - starterCosts[0], 1));
|
||||||
starterCosts.push(10 - (starterCosts[0] + starterCosts[1]));
|
starterCosts.push(10 - (starterCosts[0] + starterCosts[1]));
|
||||||
@ -57,7 +57,7 @@ export function getDailyRunStarters(seed: string): Starter[] {
|
|||||||
return starters;
|
return starters;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDailyRunStarter(starterSpeciesForm: PokemonSpeciesForm, startingLevel: integer): Starter {
|
function getDailyRunStarter(starterSpeciesForm: PokemonSpeciesForm, startingLevel: number): Starter {
|
||||||
const starterSpecies = starterSpeciesForm instanceof PokemonSpecies ? starterSpeciesForm : getPokemonSpecies(starterSpeciesForm.speciesId);
|
const starterSpecies = starterSpeciesForm instanceof PokemonSpecies ? starterSpeciesForm : getPokemonSpecies(starterSpeciesForm.speciesId);
|
||||||
const formIndex = starterSpeciesForm instanceof PokemonSpecies ? undefined : starterSpeciesForm.formIndex;
|
const formIndex = starterSpeciesForm instanceof PokemonSpecies ? undefined : starterSpeciesForm.formIndex;
|
||||||
const pokemon = new PlayerPokemon(starterSpecies, startingLevel, undefined, formIndex, undefined, undefined, undefined, undefined, undefined, undefined);
|
const pokemon = new PlayerPokemon(starterSpecies, startingLevel, undefined, formIndex, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||||
@ -74,7 +74,7 @@ function getDailyRunStarter(starterSpeciesForm: PokemonSpeciesForm, startingLeve
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface BiomeWeights {
|
interface BiomeWeights {
|
||||||
[key: integer]: integer
|
[key: number]: number
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initially weighted by amount of exits each biome has
|
// Initially weighted by amount of exits each biome has
|
||||||
@ -125,7 +125,7 @@ export function getDailyStartingBiome(): Biome {
|
|||||||
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
|
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
|
||||||
|
|
||||||
let totalWeight = 0;
|
let totalWeight = 0;
|
||||||
const biomeThresholds: integer[] = [];
|
const biomeThresholds: number[] = [];
|
||||||
for (const biome of biomes) {
|
for (const biome of biomes) {
|
||||||
// Keep track of the total weight
|
// Keep track of the total weight
|
||||||
totalWeight += dailyBiomeWeights[biome];
|
totalWeight += dailyBiomeWeights[biome];
|
||||||
|
@ -9,7 +9,7 @@ export interface TrainerTypeMessages {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TrainerTypeDialogue {
|
export interface TrainerTypeDialogue {
|
||||||
[key: integer]: TrainerTypeMessages | Array<TrainerTypeMessages>
|
[key: number]: TrainerTypeMessages | Array<TrainerTypeMessages>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTrainerTypeDialogue(): TrainerTypeDialogue {
|
export function getTrainerTypeDialogue(): TrainerTypeDialogue {
|
||||||
|
@ -373,8 +373,8 @@ export class Egg {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let minStarterValue: integer;
|
let minStarterValue: number;
|
||||||
let maxStarterValue: integer;
|
let maxStarterValue: number;
|
||||||
|
|
||||||
switch (this.tier) {
|
switch (this.tier) {
|
||||||
case EggTier.RARE:
|
case EggTier.RARE:
|
||||||
|
@ -16,7 +16,7 @@ const expLevels = [
|
|||||||
[ 0, 4, 13, 32, 65, 112, 178, 276, 393, 540, 745, 967, 1230, 1591, 1957, 2457, 3046, 3732, 4526, 5440, 6482, 7666, 9003, 10506, 12187, 14060, 16140, 18439, 20974, 23760, 26811, 30146, 33780, 37731, 42017, 46656, 50653, 55969, 60505, 66560, 71677, 78533, 84277, 91998, 98415, 107069, 114205, 123863, 131766, 142500, 151222, 163105, 172697, 185807, 196322, 210739, 222231, 238036, 250562, 267840, 281456, 300293, 315059, 335544, 351520, 373744, 390991, 415050, 433631, 459620, 479600, 507617, 529063, 559209, 582187, 614566, 639146, 673863, 700115, 737280, 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000 ]
|
[ 0, 4, 13, 32, 65, 112, 178, 276, 393, 540, 745, 967, 1230, 1591, 1957, 2457, 3046, 3732, 4526, 5440, 6482, 7666, 9003, 10506, 12187, 14060, 16140, 18439, 20974, 23760, 26811, 30146, 33780, 37731, 42017, 46656, 50653, 55969, 60505, 66560, 71677, 78533, 84277, 91998, 98415, 107069, 114205, 123863, 131766, 142500, 151222, 163105, 172697, 185807, 196322, 210739, 222231, 238036, 250562, 267840, 281456, 300293, 315059, 335544, 351520, 373744, 390991, 415050, 433631, 459620, 479600, 507617, 529063, 559209, 582187, 614566, 639146, 673863, 700115, 737280, 765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660, 1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000 ]
|
||||||
];
|
];
|
||||||
|
|
||||||
export function getLevelTotalExp(level: integer, growthRate: GrowthRate): integer {
|
export function getLevelTotalExp(level: number, growthRate: GrowthRate): number {
|
||||||
if (level < 100) {
|
if (level < 100) {
|
||||||
const levelExp = expLevels[growthRate][level - 1];
|
const levelExp = expLevels[growthRate][level - 1];
|
||||||
if (growthRate !== GrowthRate.MEDIUM_FAST) {
|
if (growthRate !== GrowthRate.MEDIUM_FAST) {
|
||||||
@ -25,7 +25,7 @@ export function getLevelTotalExp(level: integer, growthRate: GrowthRate): intege
|
|||||||
return levelExp;
|
return levelExp;
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret: integer;
|
let ret: number;
|
||||||
|
|
||||||
switch (growthRate) {
|
switch (growthRate) {
|
||||||
case GrowthRate.ERRATIC:
|
case GrowthRate.ERRATIC:
|
||||||
@ -55,7 +55,7 @@ export function getLevelTotalExp(level: integer, growthRate: GrowthRate): intege
|
|||||||
return Math.floor(ret);
|
return Math.floor(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLevelRelExp(level: integer, growthRate: GrowthRate): number {
|
export function getLevelRelExp(level: number, growthRate: GrowthRate): number {
|
||||||
return getLevelTotalExp(level, growthRate) - getLevelTotalExp(level - 1, growthRate);
|
return getLevelTotalExp(level, growthRate) - getLevelTotalExp(level - 1, growthRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
120
src/data/move.ts
120
src/data/move.ts
@ -44,7 +44,7 @@ import { SpeciesFormChangeRevertWeatherFormTrigger } from "./pokemon-forms";
|
|||||||
import type { GameMode } from "#app/game-mode";
|
import type { GameMode } from "#app/game-mode";
|
||||||
import { applyChallenges, ChallengeType } from "./challenge";
|
import { applyChallenges, ChallengeType } from "./challenge";
|
||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
import { StatusEffect } from "enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
|
||||||
export enum MoveCategory {
|
export enum MoveCategory {
|
||||||
@ -687,7 +687,7 @@ export default class Move implements Localizable {
|
|||||||
* @param move {@linkcode Move} using the move
|
* @param move {@linkcode Move} using the move
|
||||||
* @returns integer representing the total benefitScore
|
* @returns integer representing the total benefitScore
|
||||||
*/
|
*/
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
let score = 0;
|
let score = 0;
|
||||||
|
|
||||||
for (const attr of this.attrs) {
|
for (const attr of this.attrs) {
|
||||||
@ -708,7 +708,7 @@ export default class Move implements Localizable {
|
|||||||
* @param move {@linkcode Move} using the move
|
* @param move {@linkcode Move} using the move
|
||||||
* @returns integer representing the total benefitScore
|
* @returns integer representing the total benefitScore
|
||||||
*/
|
*/
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
let score = 0;
|
let score = 0;
|
||||||
|
|
||||||
if (target.getAlly()?.getTag(BattlerTagType.COMMANDED)?.getSourcePokemon() === target) {
|
if (target.getAlly()?.getTag(BattlerTagType.COMMANDED)?.getSourcePokemon() === target) {
|
||||||
@ -875,7 +875,7 @@ export default class Move implements Localizable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AttackMove extends Move {
|
export class AttackMove extends Move {
|
||||||
constructor(id: Moves, type: Type, category: MoveCategory, power: integer, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
|
constructor(id: Moves, type: Type, category: MoveCategory, power: number, accuracy: number, pp: number, chance: number, priority: number, generation: number) {
|
||||||
super(id, type, category, MoveTarget.NEAR_OTHER, power, accuracy, pp, chance, priority, generation);
|
super(id, type, category, MoveTarget.NEAR_OTHER, power, accuracy, pp, chance, priority, generation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -887,7 +887,7 @@ export class AttackMove extends Move {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
let ret = super.getTargetBenefitScore(user, target, move);
|
let ret = super.getTargetBenefitScore(user, target, move);
|
||||||
|
|
||||||
let attackScore = 0;
|
let attackScore = 0;
|
||||||
@ -932,13 +932,13 @@ export class AttackMove extends Move {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class StatusMove extends Move {
|
export class StatusMove extends Move {
|
||||||
constructor(id: Moves, type: Type, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
|
constructor(id: Moves, type: Type, accuracy: number, pp: number, chance: number, priority: number, generation: number) {
|
||||||
super(id, type, MoveCategory.STATUS, MoveTarget.NEAR_OTHER, -1, accuracy, pp, chance, priority, generation);
|
super(id, type, MoveCategory.STATUS, MoveTarget.NEAR_OTHER, -1, accuracy, pp, chance, priority, generation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelfStatusMove extends Move {
|
export class SelfStatusMove extends Move {
|
||||||
constructor(id: Moves, type: Type, accuracy: integer, pp: integer, chance: integer, priority: integer, generation: integer) {
|
constructor(id: Moves, type: Type, accuracy: number, pp: number, chance: number, priority: number, generation: number) {
|
||||||
super(id, type, MoveCategory.STATUS, MoveTarget.USER, -1, accuracy, pp, chance, priority, generation);
|
super(id, type, MoveCategory.STATUS, MoveTarget.USER, -1, accuracy, pp, chance, priority, generation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1074,7 +1074,7 @@ export abstract class MoveAttr {
|
|||||||
* @see {@linkcode EnemyPokemon.getNextMove}
|
* @see {@linkcode EnemyPokemon.getNextMove}
|
||||||
* @virtual
|
* @virtual
|
||||||
*/
|
*/
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,7 +1083,7 @@ export abstract class MoveAttr {
|
|||||||
* @see {@linkcode EnemyPokemon.getNextMove}
|
* @see {@linkcode EnemyPokemon.getNextMove}
|
||||||
* @virtual
|
* @virtual
|
||||||
*/
|
*/
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1201,7 +1201,7 @@ export class MoveEffectAttr extends MoveAttr {
|
|||||||
* @param selfEffect `true` if move targets user.
|
* @param selfEffect `true` if move targets user.
|
||||||
* @returns Move effect chance value.
|
* @returns Move effect chance value.
|
||||||
*/
|
*/
|
||||||
getMoveChance(user: Pokemon, target: Pokemon, move: Move, selfEffect?: Boolean, showAbility?: Boolean): integer {
|
getMoveChance(user: Pokemon, target: Pokemon, move: Move, selfEffect?: Boolean, showAbility?: Boolean): number {
|
||||||
const moveChance = new Utils.NumberHolder(this.effectChanceOverride ?? move.chance);
|
const moveChance = new Utils.NumberHolder(this.effectChanceOverride ?? move.chance);
|
||||||
|
|
||||||
applyAbAttrs(MoveEffectChanceMultiplierAbAttr, user, null, false, moveChance, move, target, selfEffect, showAbility);
|
applyAbAttrs(MoveEffectChanceMultiplierAbAttr, user, null, false, moveChance, move, target, selfEffect, showAbility);
|
||||||
@ -1330,7 +1330,7 @@ export class HighCritAttr extends MoveAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1342,15 +1342,15 @@ export class CritOnlyAttr extends MoveAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FixedDamageAttr extends MoveAttr {
|
export class FixedDamageAttr extends MoveAttr {
|
||||||
private damage: integer;
|
private damage: number;
|
||||||
|
|
||||||
constructor(damage: integer) {
|
constructor(damage: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
@ -1362,7 +1362,7 @@ export class FixedDamageAttr extends MoveAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDamage(user: Pokemon, target: Pokemon, move: Move): integer {
|
getDamage(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return this.damage;
|
return this.damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1435,7 +1435,7 @@ export class MatchHpAttr extends FixedDamageAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
/*getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
/*getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
@ -1446,7 +1446,7 @@ export class CounterDamageAttr extends FixedDamageAttr {
|
|||||||
private moveFilter: MoveFilter;
|
private moveFilter: MoveFilter;
|
||||||
private multiplier: number;
|
private multiplier: number;
|
||||||
|
|
||||||
constructor(moveFilter: MoveFilter, multiplier: integer) {
|
constructor(moveFilter: MoveFilter, multiplier: number) {
|
||||||
super(0);
|
super(0);
|
||||||
|
|
||||||
this.moveFilter = moveFilter;
|
this.moveFilter = moveFilter;
|
||||||
@ -1454,7 +1454,7 @@ export class CounterDamageAttr extends FixedDamageAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
const damage = user.turnData.attacksReceived.filter(ar => this.moveFilter(allMoves[ar.move])).reduce((total: integer, ar: AttackMoveResult) => total + ar.damage, 0);
|
const damage = user.turnData.attacksReceived.filter(ar => this.moveFilter(allMoves[ar.move])).reduce((total: number, ar: AttackMoveResult) => total + ar.damage, 0);
|
||||||
(args[0] as Utils.IntegerHolder).value = Utils.toDmgValue(damage * this.multiplier);
|
(args[0] as Utils.IntegerHolder).value = Utils.toDmgValue(damage * this.multiplier);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1493,7 +1493,7 @@ export class ModifiedDamageAttr extends MoveAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getModifiedDamage(user: Pokemon, target: Pokemon, move: Move, damage: integer): integer {
|
getModifiedDamage(user: Pokemon, target: Pokemon, move: Move, damage: number): number {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1507,7 +1507,7 @@ export class SurviveDamageAttr extends ModifiedDamageAttr {
|
|||||||
return (user, target, move) => target.hp > 1;
|
return (user, target, move) => target.hp > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return target.hp > 1 ? 0 : -20;
|
return target.hp > 1 ? 0 : -20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1563,7 +1563,7 @@ export class RecoilAttr extends MoveEffectAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return Math.floor((move.power / 5) / -4);
|
return Math.floor((move.power / 5) / -4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1594,7 +1594,7 @@ export class SacrificialAttr extends MoveEffectAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (user.isBoss()) {
|
if (user.isBoss()) {
|
||||||
return -20;
|
return -20;
|
||||||
}
|
}
|
||||||
@ -1632,7 +1632,7 @@ export class SacrificialAttrOnHit extends MoveEffectAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (user.isBoss()) {
|
if (user.isBoss()) {
|
||||||
return -20;
|
return -20;
|
||||||
}
|
}
|
||||||
@ -1674,7 +1674,7 @@ export class HalfSacrificialAttr extends MoveEffectAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (user.isBoss()) {
|
if (user.isBoss()) {
|
||||||
return -10;
|
return -10;
|
||||||
}
|
}
|
||||||
@ -1778,7 +1778,7 @@ export class HealAttr extends MoveEffectAttr {
|
|||||||
Utils.toDmgValue(target.getMaxHp() * healRatio), i18next.t("moveTriggers:healHp", { pokemonName: getPokemonNameWithAffix(target) }), true, !this.showAnim));
|
Utils.toDmgValue(target.getMaxHp() * healRatio), i18next.t("moveTriggers:healHp", { pokemonName: getPokemonNameWithAffix(target) }), true, !this.showAnim));
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
const score = ((1 - (this.selfTarget ? user : target).getHpRatio()) * 20) - this.healRatio * 10;
|
const score = ((1 - (this.selfTarget ? user : target).getHpRatio()) * 20) - this.healRatio * 10;
|
||||||
return Math.round(score / (1 - this.healRatio / 2));
|
return Math.round(score / (1 - this.healRatio / 2));
|
||||||
}
|
}
|
||||||
@ -1870,7 +1870,7 @@ export class FlameBurstAttr extends MoveEffectAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return target.getAlly() ? -5 : 0;
|
return target.getAlly() ? -5 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1893,7 +1893,7 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
|||||||
|
|
||||||
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
// We don't know which party member will be chosen, so pick the highest max HP in the party
|
||||||
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
const party = user.isPlayer() ? globalScene.getPlayerParty() : globalScene.getEnemyParty();
|
||||||
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: integer, hp: integer) => Math.max(hp, maxHp), 0);
|
const maxPartyMemberHp = party.map(p => p.getMaxHp()).reduce((maxHp: number, hp: number) => Math.max(hp, maxHp), 0);
|
||||||
|
|
||||||
globalScene.pushPhase(
|
globalScene.pushPhase(
|
||||||
new PokemonHealPhase(
|
new PokemonHealPhase(
|
||||||
@ -1911,7 +1911,7 @@ export class SacrificialFullRestoreAttr extends SacrificialAttr {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return -20;
|
return -20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2118,7 +2118,7 @@ export class HitHealAttr extends MoveEffectAttr {
|
|||||||
* @param move {@linkcode Move} being used
|
* @param move {@linkcode Move} being used
|
||||||
* @returns an integer. Higher means enemy is more likely to use that move.
|
* @returns an integer. Higher means enemy is more likely to use that move.
|
||||||
*/
|
*/
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (this.healStat) {
|
if (this.healStat) {
|
||||||
const healAmount = target.getEffectiveStat(this.healStat);
|
const healAmount = target.getEffectiveStat(this.healStat);
|
||||||
return Math.floor(Math.max(0, (Math.min(1, (healAmount + user.hp) / user.getMaxHp() - 0.33))) / user.getHpRatio());
|
return Math.floor(Math.max(0, (Math.min(1, (healAmount + user.hp) / user.getMaxHp() - 0.33))) / user.getHpRatio());
|
||||||
@ -2138,7 +2138,7 @@ export class IncrementMovePriorityAttr extends MoveAttr {
|
|||||||
/** The condition for a move's priority being incremented */
|
/** The condition for a move's priority being incremented */
|
||||||
private moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean;
|
private moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean;
|
||||||
/** The amount to increment priority by, if condition passes. */
|
/** The amount to increment priority by, if condition passes. */
|
||||||
private increaseAmount: integer;
|
private increaseAmount: number;
|
||||||
|
|
||||||
constructor(moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean, increaseAmount = 1) {
|
constructor(moveIncrementFunc: (pokemon: Pokemon, target:Pokemon, move: Move) => boolean, increaseAmount = 1) {
|
||||||
super();
|
super();
|
||||||
@ -2222,7 +2222,7 @@ export class MultiHitAttr extends MoveAttr {
|
|||||||
* @param target {@linkcode Pokemon} targeted by the attack
|
* @param target {@linkcode Pokemon} targeted by the attack
|
||||||
* @returns The number of hits this attack should deal
|
* @returns The number of hits this attack should deal
|
||||||
*/
|
*/
|
||||||
getHitCount(user: Pokemon, target: Pokemon): integer {
|
getHitCount(user: Pokemon, target: Pokemon): number {
|
||||||
switch (this.multiHitType) {
|
switch (this.multiHitType) {
|
||||||
case MultiHitType._2_TO_5:
|
case MultiHitType._2_TO_5:
|
||||||
{
|
{
|
||||||
@ -2669,7 +2669,7 @@ export class HealStatusEffectAttr extends MoveEffectAttr {
|
|||||||
return this.effects.includes(effect);
|
return this.effects.includes(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return user.status ? 10 : 0;
|
return user.status ? 10 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2690,7 +2690,7 @@ export class BypassSleepAttr extends MoveAttr {
|
|||||||
* @param target
|
* @param target
|
||||||
* @param move
|
* @param move
|
||||||
*/
|
*/
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return user.status && user.status.effect === StatusEffect.SLEEP ? 200 : -10;
|
return user.status && user.status.effect === StatusEffect.SLEEP ? 200 : -10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3060,11 +3060,11 @@ export class StatStageChangeAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLevels(_user: Pokemon): integer {
|
getLevels(_user: Pokemon): number {
|
||||||
return this.stages;
|
return this.stages;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
let ret = 0;
|
let ret = 0;
|
||||||
const moveLevels = this.getLevels(user);
|
const moveLevels = this.getLevels(user);
|
||||||
for (const stat of this.stats) {
|
for (const stat of this.stats) {
|
||||||
@ -3302,10 +3302,10 @@ export class GrowthStatStageChangeAttr extends StatStageChangeAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class CutHpStatStageBoostAttr extends StatStageChangeAttr {
|
export class CutHpStatStageBoostAttr extends StatStageChangeAttr {
|
||||||
private cutRatio: integer;
|
private cutRatio: number;
|
||||||
private messageCallback: ((user: Pokemon) => void) | undefined;
|
private messageCallback: ((user: Pokemon) => void) | undefined;
|
||||||
|
|
||||||
constructor(stat: BattleStat[], levels: integer, cutRatio: integer, messageCallback?: ((user: Pokemon) => void) | undefined) {
|
constructor(stat: BattleStat[], levels: number, cutRatio: number, messageCallback?: ((user: Pokemon) => void) | undefined) {
|
||||||
super(stat, levels, true);
|
super(stat, levels, true);
|
||||||
|
|
||||||
this.cutRatio = cutRatio;
|
this.cutRatio = cutRatio;
|
||||||
@ -3655,7 +3655,7 @@ const doublePowerChanceMessageFunc = (user: Pokemon, target: Pokemon, move: Move
|
|||||||
|
|
||||||
export class DoublePowerChanceAttr extends VariablePowerAttr {
|
export class DoublePowerChanceAttr extends VariablePowerAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
let rand: integer;
|
let rand: number;
|
||||||
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(100), globalScene.currentBattle.turn << 6, globalScene.waveSeed);
|
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(100), globalScene.currentBattle.turn << 6, globalScene.waveSeed);
|
||||||
if (rand! < move.chance) {
|
if (rand! < move.chance) {
|
||||||
const power = args[0] as Utils.NumberHolder;
|
const power = args[0] as Utils.NumberHolder;
|
||||||
@ -3668,7 +3668,7 @@ export class DoublePowerChanceAttr extends VariablePowerAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export abstract class ConsecutiveUsePowerMultiplierAttr extends MovePowerMultiplierAttr {
|
export abstract class ConsecutiveUsePowerMultiplierAttr extends MovePowerMultiplierAttr {
|
||||||
constructor(limit: integer, resetOnFail: boolean, resetOnLimit?: boolean, ...comboMoves: Moves[]) {
|
constructor(limit: number, resetOnFail: boolean, resetOnLimit?: boolean, ...comboMoves: Moves[]) {
|
||||||
super((user: Pokemon, target: Pokemon, move: Move): number => {
|
super((user: Pokemon, target: Pokemon, move: Move): number => {
|
||||||
const moveHistory = user.getLastXMoves(limit + 1).slice(1);
|
const moveHistory = user.getLastXMoves(limit + 1).slice(1);
|
||||||
|
|
||||||
@ -3689,7 +3689,7 @@ export abstract class ConsecutiveUsePowerMultiplierAttr extends MovePowerMultipl
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract getMultiplier(count: integer): number;
|
abstract getMultiplier(count: number): number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ConsecutiveUseDoublePowerAttr extends ConsecutiveUsePowerMultiplierAttr {
|
export class ConsecutiveUseDoublePowerAttr extends ConsecutiveUsePowerMultiplierAttr {
|
||||||
@ -3938,7 +3938,7 @@ export class MagnitudePowerAttr extends VariablePowerAttr {
|
|||||||
const magnitudeThresholds = [ 5, 15, 35, 65, 75, 95 ];
|
const magnitudeThresholds = [ 5, 15, 35, 65, 75, 95 ];
|
||||||
const magnitudePowers = [ 10, 30, 50, 70, 90, 100, 110, 150 ];
|
const magnitudePowers = [ 10, 30, 50, 70, 90, 100, 110, 150 ];
|
||||||
|
|
||||||
let rand: integer;
|
let rand: number;
|
||||||
|
|
||||||
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(100), globalScene.currentBattle.turn << 6, globalScene.waveSeed);
|
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(100), globalScene.currentBattle.turn << 6, globalScene.waveSeed);
|
||||||
|
|
||||||
@ -4180,9 +4180,9 @@ const hasStockpileStacksCondition: MoveConditionFunc = (user) => {
|
|||||||
*/
|
*/
|
||||||
export class MultiHitPowerIncrementAttr extends VariablePowerAttr {
|
export class MultiHitPowerIncrementAttr extends VariablePowerAttr {
|
||||||
/** The max number of base power increments allowed for this move */
|
/** The max number of base power increments allowed for this move */
|
||||||
private maxHits: integer;
|
private maxHits: number;
|
||||||
|
|
||||||
constructor(maxHits: integer) {
|
constructor(maxHits: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.maxHits = maxHits;
|
this.maxHits = maxHits;
|
||||||
@ -5251,12 +5251,12 @@ export class SemiInvulnerableAttr extends MoveEffectAttr {
|
|||||||
|
|
||||||
export class AddBattlerTagAttr extends MoveEffectAttr {
|
export class AddBattlerTagAttr extends MoveEffectAttr {
|
||||||
public tagType: BattlerTagType;
|
public tagType: BattlerTagType;
|
||||||
public turnCountMin: integer;
|
public turnCountMin: number;
|
||||||
public turnCountMax: integer;
|
public turnCountMax: number;
|
||||||
protected cancelOnFail: boolean;
|
protected cancelOnFail: boolean;
|
||||||
private failOnOverlap: boolean;
|
private failOnOverlap: boolean;
|
||||||
|
|
||||||
constructor(tagType: BattlerTagType, selfTarget: boolean = false, failOnOverlap: boolean = false, turnCountMin: integer = 0, turnCountMax?: integer, lastHitOnly: boolean = false, cancelOnFail: boolean = false) {
|
constructor(tagType: BattlerTagType, selfTarget: boolean = false, failOnOverlap: boolean = false, turnCountMin: number = 0, turnCountMax?: number, lastHitOnly: boolean = false, cancelOnFail: boolean = false) {
|
||||||
super(selfTarget, { lastHitOnly: lastHitOnly });
|
super(selfTarget, { lastHitOnly: lastHitOnly });
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -5293,7 +5293,7 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
|
|||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTagTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer | void {
|
getTagTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number | void {
|
||||||
switch (this.tagType) {
|
switch (this.tagType) {
|
||||||
case BattlerTagType.RECHARGING:
|
case BattlerTagType.RECHARGING:
|
||||||
case BattlerTagType.PERISH_SONG:
|
case BattlerTagType.PERISH_SONG:
|
||||||
@ -5340,7 +5340,7 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
let moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
|
let moveChance = this.getMoveChance(user, target, move, this.selfTarget, false);
|
||||||
if (moveChance < 0) {
|
if (moveChance < 0) {
|
||||||
moveChance = 100;
|
moveChance = 100;
|
||||||
@ -5407,7 +5407,7 @@ export class GulpMissileTagAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
const isCramorant = user.hasAbility(Abilities.GULP_MISSILE) && user.species.speciesId === Species.CRAMORANT;
|
const isCramorant = user.hasAbility(Abilities.GULP_MISSILE) && user.species.speciesId === Species.CRAMORANT;
|
||||||
return isCramorant && !user.getTag(GulpMissileTag) ? 10 : 0;
|
return isCramorant && !user.getTag(GulpMissileTag) ? 10 : 0;
|
||||||
}
|
}
|
||||||
@ -5669,7 +5669,7 @@ export class HitsTagAttr extends MoveAttr {
|
|||||||
this.doubleDamage = !!doubleDamage;
|
this.doubleDamage = !!doubleDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return target.getTag(this.tagType) ? this.doubleDamage ? 10 : 5 : 0;
|
return target.getTag(this.tagType) ? this.doubleDamage ? 10 : 5 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5687,11 +5687,11 @@ export class HitsTagForDoubleDamageAttr extends HitsTagAttr {
|
|||||||
|
|
||||||
export class AddArenaTagAttr extends MoveEffectAttr {
|
export class AddArenaTagAttr extends MoveEffectAttr {
|
||||||
public tagType: ArenaTagType;
|
public tagType: ArenaTagType;
|
||||||
public turnCount: integer;
|
public turnCount: number;
|
||||||
private failOnOverlap: boolean;
|
private failOnOverlap: boolean;
|
||||||
public selfSideTarget: boolean;
|
public selfSideTarget: boolean;
|
||||||
|
|
||||||
constructor(tagType: ArenaTagType, turnCount?: integer | null, failOnOverlap: boolean = false, selfSideTarget: boolean = false) {
|
constructor(tagType: ArenaTagType, turnCount?: number | null, failOnOverlap: boolean = false, selfSideTarget: boolean = false) {
|
||||||
super(true);
|
super(true);
|
||||||
|
|
||||||
this.tagType = tagType;
|
this.tagType = tagType;
|
||||||
@ -5983,7 +5983,7 @@ export class RevivalBlessingAttr extends MoveEffectAttr {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (user.hasTrainer() && globalScene.getEnemyParty().findIndex(p => p.isFainted() && !p.isBoss()) > -1) {
|
if (user.hasTrainer() && globalScene.getEnemyParty().findIndex(p => p.isFainted() && !p.isBoss()) > -1) {
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
@ -6212,13 +6212,13 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
if (!globalScene.getEnemyParty().find(p => p.isActive() && !p.isOnField())) {
|
if (!globalScene.getEnemyParty().find(p => p.isActive() && !p.isOnField())) {
|
||||||
return -20;
|
return -20;
|
||||||
}
|
}
|
||||||
let ret = this.selfSwitch ? Math.floor((1 - user.getHpRatio()) * 20) : super.getUserBenefitScore(user, target, move);
|
let ret = this.selfSwitch ? Math.floor((1 - user.getHpRatio()) * 20) : super.getUserBenefitScore(user, target, move);
|
||||||
if (this.selfSwitch && this.isBatonPass()) {
|
if (this.selfSwitch && this.isBatonPass()) {
|
||||||
const statStageTotal = user.getStatStages().reduce((s: integer, total: integer) => total += s, 0);
|
const statStageTotal = user.getStatStages().reduce((s: number, total: number) => total += s, 0);
|
||||||
ret = ret / 2 + (Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut")(Math.min(Math.abs(statStageTotal), 10) / 10) * (statStageTotal >= 0 ? 10 : -10));
|
ret = ret / 2 + (Phaser.Tweens.Builders.GetEaseFunction("Sine.easeOut")(Math.min(Math.abs(statStageTotal), 10) / 10) * (statStageTotal >= 0 ? 10 : -10));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -7185,7 +7185,7 @@ export class RepeatMoveAttr extends MoveEffectAttr {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
// TODO: Make the AI actually use instruct
|
// TODO: Make the AI actually use instruct
|
||||||
/* Ideally, the AI would score instruct based on the scorings of the on-field pokemons'
|
/* Ideally, the AI would score instruct based on the scorings of the on-field pokemons'
|
||||||
* last used moves at the time of using Instruct (by the time the instructor gets to act)
|
* last used moves at the time of using Instruct (by the time the instructor gets to act)
|
||||||
@ -7746,7 +7746,7 @@ export class ShiftStatAttr extends MoveEffectAttr {
|
|||||||
* @param move n/a
|
* @param move n/a
|
||||||
* @returns number of points to add to the user's benefit score
|
* @returns number of points to add to the user's benefit score
|
||||||
*/
|
*/
|
||||||
override getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
override getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return user.getStat(this.statToSwitchWith, false) > user.getStat(this.statToSwitch, false) ? 10 : 0;
|
return user.getStat(this.statToSwitchWith, false) > user.getStat(this.statToSwitch, false) ? 10 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7798,7 +7798,7 @@ export class AverageStatsAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class DiscourageFrequentUseAttr extends MoveAttr {
|
export class DiscourageFrequentUseAttr extends MoveAttr {
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
const lastMoves = user.getLastXMoves(4);
|
const lastMoves = user.getLastXMoves(4);
|
||||||
console.log(lastMoves);
|
console.log(lastMoves);
|
||||||
for (let m = 0; m < lastMoves.length; m++) {
|
for (let m = 0; m < lastMoves.length; m++) {
|
||||||
@ -8052,7 +8052,7 @@ export class MoveCondition {
|
|||||||
return this.func(user, target, move);
|
return this.func(user, target, move);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8062,7 +8062,7 @@ export class FirstMoveCondition extends MoveCondition {
|
|||||||
super((user, target, move) => user.battleSummonData?.waveTurnCount === 1);
|
super((user, target, move) => user.battleSummonData?.waveTurnCount === 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
||||||
return this.apply(user, target, move) ? 10 : -20;
|
return this.apply(user, target, move) ? 10 : -20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
|||||||
|
|
||||||
// Adds a real Pokemon sprite to the field (required for the animation)
|
// Adds a real Pokemon sprite to the field (required for the animation)
|
||||||
globalScene.getEnemyParty().forEach(enemyPokemon => {
|
globalScene.getEnemyParty().forEach(enemyPokemon => {
|
||||||
globalScene.field.remove(enemyPokemon, true);
|
enemyPokemon.leaveField(true, true, true);
|
||||||
});
|
});
|
||||||
globalScene.currentBattle.enemyParty = [ oricorio ];
|
globalScene.currentBattle.enemyParty = [ oricorio ];
|
||||||
globalScene.field.add(oricorio);
|
globalScene.field.add(oricorio);
|
||||||
|
@ -229,7 +229,7 @@ function handleLoseMinigame() {
|
|||||||
// End the battle
|
// End the battle
|
||||||
if (wobbuffet) {
|
if (wobbuffet) {
|
||||||
wobbuffet.hideInfo();
|
wobbuffet.hideInfo();
|
||||||
globalScene.field.remove(wobbuffet);
|
wobbuffet.leaveField();
|
||||||
}
|
}
|
||||||
transitionMysteryEncounterIntroVisuals(true, true);
|
transitionMysteryEncounterIntroVisuals(true, true);
|
||||||
globalScene.currentBattle.enemyParty = [];
|
globalScene.currentBattle.enemyParty = [];
|
||||||
@ -278,7 +278,7 @@ function handleNextTurn() {
|
|||||||
|
|
||||||
// End the battle
|
// End the battle
|
||||||
wobbuffet.hideInfo();
|
wobbuffet.hideInfo();
|
||||||
globalScene.field.remove(wobbuffet);
|
wobbuffet.leaveField();
|
||||||
globalScene.currentBattle.enemyParty = [];
|
globalScene.currentBattle.enemyParty = [];
|
||||||
globalScene.currentBattle.mysteryEncounter!.doContinueEncounter = undefined;
|
globalScene.currentBattle.mysteryEncounter!.doContinueEncounter = undefined;
|
||||||
leaveEncounterWithoutBattle(isHealPhase);
|
leaveEncounterWithoutBattle(isHealPhase);
|
||||||
|
@ -168,6 +168,7 @@ async function doBiomeTransitionDialogueAndBattleInit() {
|
|||||||
// Show dialogue and transition biome
|
// Show dialogue and transition biome
|
||||||
await showEncounterText(`${namespace}:transport`);
|
await showEncounterText(`${namespace}:transport`);
|
||||||
await Promise.all([ animateBiomeChange(newBiome), transitionMysteryEncounterIntroVisuals() ]);
|
await Promise.all([ animateBiomeChange(newBiome), transitionMysteryEncounterIntroVisuals() ]);
|
||||||
|
globalScene.updateBiomeWaveText();
|
||||||
globalScene.playBgm();
|
globalScene.playBgm();
|
||||||
await showEncounterText(`${namespace}:attacked`);
|
await showEncounterText(`${namespace}:attacked`);
|
||||||
|
|
||||||
|
@ -575,7 +575,7 @@ function onGameOver() {
|
|||||||
ease: "Sine.easeIn",
|
ease: "Sine.easeIn",
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(true, true, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
|
|||||||
}
|
}
|
||||||
|
|
||||||
globalScene.getEnemyParty().forEach(enemyPokemon => {
|
globalScene.getEnemyParty().forEach(enemyPokemon => {
|
||||||
globalScene.field.remove(enemyPokemon, true);
|
enemyPokemon.leaveField(true, true, true);
|
||||||
});
|
});
|
||||||
battle.enemyParty = [];
|
battle.enemyParty = [];
|
||||||
battle.double = doubleBattle;
|
battle.double = doubleBattle;
|
||||||
@ -810,7 +810,7 @@ export function transitionMysteryEncounterIntroVisuals(hide: boolean = true, des
|
|||||||
globalScene.field.remove(introVisuals, true);
|
globalScene.field.remove(introVisuals, true);
|
||||||
|
|
||||||
enemyPokemon.forEach(pokemon => {
|
enemyPokemon.forEach(pokemon => {
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(true, true, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
globalScene.currentBattle.mysteryEncounter!.introVisuals = undefined;
|
globalScene.currentBattle.mysteryEncounter!.introVisuals = undefined;
|
||||||
|
@ -592,7 +592,7 @@ export async function catchPokemon(pokemon: EnemyPokemon, pokeball: Phaser.GameO
|
|||||||
};
|
};
|
||||||
const removePokemon = () => {
|
const removePokemon = () => {
|
||||||
if (pokemon) {
|
if (pokemon) {
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(false, true, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const addToParty = (slotIndex?: number) => {
|
const addToParty = (slotIndex?: number) => {
|
||||||
@ -624,7 +624,7 @@ export async function catchPokemon(pokemon: EnemyPokemon, pokeball: Phaser.GameO
|
|||||||
});
|
});
|
||||||
}, false);
|
}, false);
|
||||||
}, () => {
|
}, () => {
|
||||||
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, 0, (slotIndex: integer, _option: PartyOption) => {
|
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, 0, (slotIndex: number, _option: PartyOption) => {
|
||||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
addToParty(slotIndex);
|
addToParty(slotIndex);
|
||||||
@ -695,7 +695,7 @@ export async function doPokemonFlee(pokemon: EnemyPokemon): Promise<void> {
|
|||||||
scale: pokemon.getSpriteScale(),
|
scale: pokemon.getSpriteScale(),
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.setVisible(false);
|
pokemon.setVisible(false);
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(true, true, true);
|
||||||
showEncounterText(i18next.t("battle:pokemonFled", { pokemonName: pokemon.getNameToRender() }), null, 600, false)
|
showEncounterText(i18next.t("battle:pokemonFled", { pokemonName: pokemon.getNameToRender() }), null, 600, false)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
resolve();
|
resolve();
|
||||||
@ -723,7 +723,7 @@ export function doPlayerFlee(pokemon: EnemyPokemon): Promise<void> {
|
|||||||
scale: pokemon.getSpriteScale(),
|
scale: pokemon.getSpriteScale(),
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.setVisible(false);
|
pokemon.setVisible(false);
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(true, true, true);
|
||||||
showEncounterText(i18next.t("battle:playerFled", { pokemonName: pokemon.getNameToRender() }), null, 600, false)
|
showEncounterText(i18next.t("battle:playerFled", { pokemonName: pokemon.getNameToRender() }), null, 600, false)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -4,7 +4,7 @@ import { NumberHolder } from "#app/utils";
|
|||||||
import { PokeballType } from "#enums/pokeball";
|
import { PokeballType } from "#enums/pokeball";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
export const MAX_PER_TYPE_POKEBALLS: integer = 99;
|
export const MAX_PER_TYPE_POKEBALLS: number = 99;
|
||||||
|
|
||||||
export function getPokeballAtlasKey(type: PokeballType): string {
|
export function getPokeballAtlasKey(type: PokeballType): string {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -755,23 +755,23 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||||||
new SpeciesFormChange(Species.SHAYMIN, "land", "sky", new SpeciesFormChangeItemTrigger(FormChangeItem.GRACIDEA)),
|
new SpeciesFormChange(Species.SHAYMIN, "land", "sky", new SpeciesFormChangeItemTrigger(FormChangeItem.GRACIDEA)),
|
||||||
],
|
],
|
||||||
[Species.ARCEUS]: [
|
[Species.ARCEUS]: [
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "fighting", new SpeciesFormChangeItemTrigger(FormChangeItem.FIST_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "fighting", new SpeciesFormChangeItemTrigger(FormChangeItem.FIST_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "flying", new SpeciesFormChangeItemTrigger(FormChangeItem.SKY_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "flying", new SpeciesFormChangeItemTrigger(FormChangeItem.SKY_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "poison", new SpeciesFormChangeItemTrigger(FormChangeItem.TOXIC_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "poison", new SpeciesFormChangeItemTrigger(FormChangeItem.TOXIC_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "ground", new SpeciesFormChangeItemTrigger(FormChangeItem.EARTH_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "ground", new SpeciesFormChangeItemTrigger(FormChangeItem.EARTH_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "rock", new SpeciesFormChangeItemTrigger(FormChangeItem.STONE_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "rock", new SpeciesFormChangeItemTrigger(FormChangeItem.STONE_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "bug", new SpeciesFormChangeItemTrigger(FormChangeItem.INSECT_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "bug", new SpeciesFormChangeItemTrigger(FormChangeItem.INSECT_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "ghost", new SpeciesFormChangeItemTrigger(FormChangeItem.SPOOKY_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "ghost", new SpeciesFormChangeItemTrigger(FormChangeItem.SPOOKY_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "steel", new SpeciesFormChangeItemTrigger(FormChangeItem.IRON_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "steel", new SpeciesFormChangeItemTrigger(FormChangeItem.IRON_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "fire", new SpeciesFormChangeItemTrigger(FormChangeItem.FLAME_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "fire", new SpeciesFormChangeItemTrigger(FormChangeItem.FLAME_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "water", new SpeciesFormChangeItemTrigger(FormChangeItem.SPLASH_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "water", new SpeciesFormChangeItemTrigger(FormChangeItem.SPLASH_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "grass", new SpeciesFormChangeItemTrigger(FormChangeItem.MEADOW_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "grass", new SpeciesFormChangeItemTrigger(FormChangeItem.MEADOW_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "electric", new SpeciesFormChangeItemTrigger(FormChangeItem.ZAP_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "electric", new SpeciesFormChangeItemTrigger(FormChangeItem.ZAP_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "psychic", new SpeciesFormChangeItemTrigger(FormChangeItem.MIND_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "psychic", new SpeciesFormChangeItemTrigger(FormChangeItem.MIND_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICICLE_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICICLE_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "dragon", new SpeciesFormChangeItemTrigger(FormChangeItem.DRACO_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "dragon", new SpeciesFormChangeItemTrigger(FormChangeItem.DRACO_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "dark", new SpeciesFormChangeItemTrigger(FormChangeItem.DREAD_PLATE)),
|
new SpeciesFormChange(Species.ARCEUS, "normal", "dark", new SpeciesFormChangeItemTrigger(FormChangeItem.DREAD_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
new SpeciesFormChange(Species.ARCEUS, "normal", "fairy", new SpeciesFormChangeItemTrigger(FormChangeItem.PIXIE_PLATE))
|
new SpeciesFormChange(Species.ARCEUS, "normal", "fairy", new SpeciesFormChangeItemTrigger(FormChangeItem.PIXIE_PLATE), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.MULTITYPE))),
|
||||||
],
|
],
|
||||||
[Species.DARMANITAN]: [
|
[Species.DARMANITAN]: [
|
||||||
new SpeciesFormChange(Species.DARMANITAN, "", "zen", new SpeciesFormChangeAbilityTrigger(), true),
|
new SpeciesFormChange(Species.DARMANITAN, "", "zen", new SpeciesFormChangeAbilityTrigger(), true),
|
||||||
@ -841,23 +841,23 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||||||
new SpeciesFormChange(Species.WISHIWASHI, "school", "", new SpeciesFormChangeAbilityTrigger(), true)
|
new SpeciesFormChange(Species.WISHIWASHI, "school", "", new SpeciesFormChangeAbilityTrigger(), true)
|
||||||
],
|
],
|
||||||
[Species.SILVALLY]: [
|
[Species.SILVALLY]: [
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "fighting", new SpeciesFormChangeItemTrigger(FormChangeItem.FIGHTING_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "fighting", new SpeciesFormChangeItemTrigger(FormChangeItem.FIGHTING_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "flying", new SpeciesFormChangeItemTrigger(FormChangeItem.FLYING_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "flying", new SpeciesFormChangeItemTrigger(FormChangeItem.FLYING_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "poison", new SpeciesFormChangeItemTrigger(FormChangeItem.POISON_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "poison", new SpeciesFormChangeItemTrigger(FormChangeItem.POISON_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "ground", new SpeciesFormChangeItemTrigger(FormChangeItem.GROUND_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "ground", new SpeciesFormChangeItemTrigger(FormChangeItem.GROUND_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "rock", new SpeciesFormChangeItemTrigger(FormChangeItem.ROCK_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "rock", new SpeciesFormChangeItemTrigger(FormChangeItem.ROCK_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "bug", new SpeciesFormChangeItemTrigger(FormChangeItem.BUG_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "bug", new SpeciesFormChangeItemTrigger(FormChangeItem.BUG_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "ghost", new SpeciesFormChangeItemTrigger(FormChangeItem.GHOST_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "ghost", new SpeciesFormChangeItemTrigger(FormChangeItem.GHOST_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "steel", new SpeciesFormChangeItemTrigger(FormChangeItem.STEEL_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "steel", new SpeciesFormChangeItemTrigger(FormChangeItem.STEEL_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "fire", new SpeciesFormChangeItemTrigger(FormChangeItem.FIRE_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "fire", new SpeciesFormChangeItemTrigger(FormChangeItem.FIRE_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "water", new SpeciesFormChangeItemTrigger(FormChangeItem.WATER_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "water", new SpeciesFormChangeItemTrigger(FormChangeItem.WATER_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "grass", new SpeciesFormChangeItemTrigger(FormChangeItem.GRASS_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "grass", new SpeciesFormChangeItemTrigger(FormChangeItem.GRASS_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "electric", new SpeciesFormChangeItemTrigger(FormChangeItem.ELECTRIC_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "electric", new SpeciesFormChangeItemTrigger(FormChangeItem.ELECTRIC_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "psychic", new SpeciesFormChangeItemTrigger(FormChangeItem.PSYCHIC_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "psychic", new SpeciesFormChangeItemTrigger(FormChangeItem.PSYCHIC_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICE_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "ice", new SpeciesFormChangeItemTrigger(FormChangeItem.ICE_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "dragon", new SpeciesFormChangeItemTrigger(FormChangeItem.DRAGON_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "dragon", new SpeciesFormChangeItemTrigger(FormChangeItem.DRAGON_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "dark", new SpeciesFormChangeItemTrigger(FormChangeItem.DARK_MEMORY)),
|
new SpeciesFormChange(Species.SILVALLY, "normal", "dark", new SpeciesFormChangeItemTrigger(FormChangeItem.DARK_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM))),
|
||||||
new SpeciesFormChange(Species.SILVALLY, "normal", "fairy", new SpeciesFormChangeItemTrigger(FormChangeItem.FAIRY_MEMORY))
|
new SpeciesFormChange(Species.SILVALLY, "normal", "fairy", new SpeciesFormChangeItemTrigger(FormChangeItem.FAIRY_MEMORY), true, new SpeciesFormChangeCondition((p) => p.hasAbility(Abilities.RKS_SYSTEM)))
|
||||||
],
|
],
|
||||||
[Species.MINIOR]: [
|
[Species.MINIOR]: [
|
||||||
new SpeciesFormChange(Species.MINIOR, "red-meteor", "red", new SpeciesFormChangeAbilityTrigger(), true),
|
new SpeciesFormChange(Species.MINIOR, "red-meteor", "red", new SpeciesFormChangeAbilityTrigger(), true),
|
||||||
|
@ -718,7 +718,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||||||
* The calculation with evolution delay is a weighted average of the easeIn and easeOut functions where preferredMinLevel is the denominator.
|
* The calculation with evolution delay is a weighted average of the easeIn and easeOut functions where preferredMinLevel is the denominator.
|
||||||
* This also means a lower value of x will lead to a higher evolution chance.
|
* This also means a lower value of x will lead to a higher evolution chance.
|
||||||
* @param strength {@linkcode PartyMemberStrength} The strength of the party member in question
|
* @param strength {@linkcode PartyMemberStrength} The strength of the party member in question
|
||||||
* @returns {@linkcode integer} The level difference from expected evolution level tolerated for a mon to be unevolved. Lower value = higher evolution chance.
|
* @returns {@linkcode number} The level difference from expected evolution level tolerated for a mon to be unevolved. Lower value = higher evolution chance.
|
||||||
*/
|
*/
|
||||||
private getStrengthLevelDiff(strength: PartyMemberStrength): number {
|
private getStrengthLevelDiff(strength: PartyMemberStrength): number {
|
||||||
switch (Math.min(strength, PartyMemberStrength.STRONGER)) {
|
switch (Math.min(strength, PartyMemberStrength.STRONGER)) {
|
||||||
|
@ -15,9 +15,9 @@ export enum TerrainType {
|
|||||||
|
|
||||||
export class Terrain {
|
export class Terrain {
|
||||||
public terrainType: TerrainType;
|
public terrainType: TerrainType;
|
||||||
public turnsLeft: integer;
|
public turnsLeft: number;
|
||||||
|
|
||||||
constructor(terrainType: TerrainType, turnsLeft?: integer) {
|
constructor(terrainType: TerrainType, turnsLeft?: number) {
|
||||||
this.terrainType = terrainType;
|
this.terrainType = terrainType;
|
||||||
this.turnsLeft = turnsLeft || 0;
|
this.turnsLeft = turnsLeft || 0;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ export function getTerrainName(terrainType: TerrainType): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getTerrainColor(terrainType: TerrainType): [ integer, integer, integer ] {
|
export function getTerrainColor(terrainType: TerrainType): [ number, number, number ] {
|
||||||
switch (terrainType) {
|
switch (terrainType) {
|
||||||
case TerrainType.MISTY:
|
case TerrainType.MISTY:
|
||||||
return [ 232, 136, 200 ];
|
return [ 232, 136, 200 ];
|
||||||
|
@ -35,7 +35,7 @@ export enum TrainerPoolTier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface TrainerTierPools {
|
export interface TrainerTierPools {
|
||||||
[key: integer]: Species[]
|
[key: number]: Species[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum TrainerSlot {
|
export enum TrainerSlot {
|
||||||
@ -45,27 +45,27 @@ export enum TrainerSlot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class TrainerPartyTemplate {
|
export class TrainerPartyTemplate {
|
||||||
public size: integer;
|
public size: number;
|
||||||
public strength: PartyMemberStrength;
|
public strength: PartyMemberStrength;
|
||||||
public sameSpecies: boolean;
|
public sameSpecies: boolean;
|
||||||
public balanced: boolean;
|
public balanced: boolean;
|
||||||
|
|
||||||
constructor(size: integer, strength: PartyMemberStrength, sameSpecies?: boolean, balanced?: boolean) {
|
constructor(size: number, strength: PartyMemberStrength, sameSpecies?: boolean, balanced?: boolean) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.strength = strength;
|
this.strength = strength;
|
||||||
this.sameSpecies = !!sameSpecies;
|
this.sameSpecies = !!sameSpecies;
|
||||||
this.balanced = !!balanced;
|
this.balanced = !!balanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStrength(index: integer): PartyMemberStrength {
|
getStrength(index: number): PartyMemberStrength {
|
||||||
return this.strength;
|
return this.strength;
|
||||||
}
|
}
|
||||||
|
|
||||||
isSameSpecies(index: integer): boolean {
|
isSameSpecies(index: number): boolean {
|
||||||
return this.sameSpecies;
|
return this.sameSpecies;
|
||||||
}
|
}
|
||||||
|
|
||||||
isBalanced(index: integer): boolean {
|
isBalanced(index: number): boolean {
|
||||||
return this.balanced;
|
return this.balanced;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,14 +74,14 @@ export class TrainerPartyCompoundTemplate extends TrainerPartyTemplate {
|
|||||||
public templates: TrainerPartyTemplate[];
|
public templates: TrainerPartyTemplate[];
|
||||||
|
|
||||||
constructor(...templates: TrainerPartyTemplate[]) {
|
constructor(...templates: TrainerPartyTemplate[]) {
|
||||||
super(templates.reduce((total: integer, template: TrainerPartyTemplate) => {
|
super(templates.reduce((total: number, template: TrainerPartyTemplate) => {
|
||||||
total += template.size;
|
total += template.size;
|
||||||
return total;
|
return total;
|
||||||
}, 0), PartyMemberStrength.AVERAGE);
|
}, 0), PartyMemberStrength.AVERAGE);
|
||||||
this.templates = templates;
|
this.templates = templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStrength(index: integer): PartyMemberStrength {
|
getStrength(index: number): PartyMemberStrength {
|
||||||
let t = 0;
|
let t = 0;
|
||||||
for (const template of this.templates) {
|
for (const template of this.templates) {
|
||||||
if (t + template.size > index) {
|
if (t + template.size > index) {
|
||||||
@ -93,7 +93,7 @@ export class TrainerPartyCompoundTemplate extends TrainerPartyTemplate {
|
|||||||
return super.getStrength(index);
|
return super.getStrength(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
isSameSpecies(index: integer): boolean {
|
isSameSpecies(index: number): boolean {
|
||||||
let t = 0;
|
let t = 0;
|
||||||
for (const template of this.templates) {
|
for (const template of this.templates) {
|
||||||
if (t + template.size > index) {
|
if (t + template.size > index) {
|
||||||
@ -105,7 +105,7 @@ export class TrainerPartyCompoundTemplate extends TrainerPartyTemplate {
|
|||||||
return super.isSameSpecies(index);
|
return super.isSameSpecies(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
isBalanced(index: integer): boolean {
|
isBalanced(index: number): boolean {
|
||||||
let t = 0;
|
let t = 0;
|
||||||
for (const template of this.templates) {
|
for (const template of this.templates) {
|
||||||
if (t + template.size > index) {
|
if (t + template.size > index) {
|
||||||
@ -173,11 +173,11 @@ export const trainerPartyTemplates = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type PartyTemplateFunc = () => TrainerPartyTemplate;
|
type PartyTemplateFunc = () => TrainerPartyTemplate;
|
||||||
type PartyMemberFunc = (level: integer, strength: PartyMemberStrength) => EnemyPokemon;
|
type PartyMemberFunc = (level: number, strength: PartyMemberStrength) => EnemyPokemon;
|
||||||
type GenModifiersFunc = (party: EnemyPokemon[]) => PersistentModifier[];
|
type GenModifiersFunc = (party: EnemyPokemon[]) => PersistentModifier[];
|
||||||
|
|
||||||
export interface PartyMemberFuncs {
|
export interface PartyMemberFuncs {
|
||||||
[key: integer]: PartyMemberFunc
|
[key: number]: PartyMemberFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TrainerConfig {
|
export class TrainerConfig {
|
||||||
@ -524,7 +524,7 @@ export class TrainerConfig {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
setPartyMemberFunc(slotIndex: integer, partyMemberFunc: PartyMemberFunc): TrainerConfig {
|
setPartyMemberFunc(slotIndex: number, partyMemberFunc: PartyMemberFunc): TrainerConfig {
|
||||||
this.partyMemberFuncs[slotIndex] = partyMemberFunc;
|
this.partyMemberFuncs[slotIndex] = partyMemberFunc;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -1125,7 +1125,7 @@ export class TrainerConfig {
|
|||||||
let t = 0;
|
let t = 0;
|
||||||
|
|
||||||
interface TrainerConfigs {
|
interface TrainerConfigs {
|
||||||
[key: integer]: TrainerConfig
|
[key: number]: TrainerConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1197,7 +1197,7 @@ function getSpeciesFilterRandomPartyMemberFunc(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomTeraModifiers(party: EnemyPokemon[], count: integer, types?: Type[]): PersistentModifier[] {
|
function getRandomTeraModifiers(party: EnemyPokemon[], count: number, types?: Type[]): PersistentModifier[] {
|
||||||
const ret: PersistentModifier[] = [];
|
const ret: PersistentModifier[] = [];
|
||||||
const partyMemberIndexes = new Array(party.length).fill(null).map((_, i) => i);
|
const partyMemberIndexes = new Array(party.length).fill(null).map((_, i) => i);
|
||||||
for (let t = 0; t < Math.min(count, party.length); t++) {
|
for (let t = 0; t < Math.min(count, party.length); t++) {
|
||||||
|
@ -16,7 +16,7 @@ class TrainerNameConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface TrainerNameConfigs {
|
interface TrainerNameConfigs {
|
||||||
[key: integer]: TrainerNameConfig
|
[key: number]: TrainerNameConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// used in a commented code
|
// used in a commented code
|
||||||
|
@ -313,7 +313,7 @@ export function getTypeDamageMultiplierColor(multiplier: TypeDamageMultiplier, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getTypeRgb(type: Type): [ integer, integer, integer ] {
|
export function getTypeRgb(type: Type): [ number, number, number ] {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Type.NORMAL:
|
case Type.NORMAL:
|
||||||
return [ 168, 168, 120 ];
|
return [ 168, 168, 120 ];
|
||||||
|
@ -8,7 +8,7 @@ export const variantData: any = {};
|
|||||||
|
|
||||||
export const variantColorCache = {};
|
export const variantColorCache = {};
|
||||||
|
|
||||||
export function getVariantTint(variant: Variant): integer {
|
export function getVariantTint(variant: Variant): number {
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
case 0:
|
case 0:
|
||||||
return 0xf8c020;
|
return 0xf8c020;
|
||||||
@ -19,7 +19,7 @@ export function getVariantTint(variant: Variant): integer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVariantIcon(variant: Variant): integer {
|
export function getVariantIcon(variant: Variant): number {
|
||||||
switch (variant) {
|
switch (variant) {
|
||||||
case 0:
|
case 0:
|
||||||
return VariantTier.STANDARD;
|
return VariantTier.STANDARD;
|
||||||
|
@ -14,9 +14,9 @@ import type { Arena } from "#app/field/arena";
|
|||||||
|
|
||||||
export class Weather {
|
export class Weather {
|
||||||
public weatherType: WeatherType;
|
public weatherType: WeatherType;
|
||||||
public turnsLeft: integer;
|
public turnsLeft: number;
|
||||||
|
|
||||||
constructor(weatherType: WeatherType, turnsLeft?: integer) {
|
constructor(weatherType: WeatherType, turnsLeft?: number) {
|
||||||
this.weatherType = weatherType;
|
this.weatherType = weatherType;
|
||||||
this.turnsLeft = !this.isImmutable() ? turnsLeft || 0 : 0;
|
this.turnsLeft = !this.isImmutable() ? turnsLeft || 0 : 0;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainTyp
|
|||||||
|
|
||||||
export interface WeatherPoolEntry {
|
export interface WeatherPoolEntry {
|
||||||
weatherType: WeatherType;
|
weatherType: WeatherType;
|
||||||
weight: integer;
|
weight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRandomWeatherType(arena: Arena): WeatherType {
|
export function getRandomWeatherType(arena: Arena): WeatherType {
|
||||||
|
@ -12,7 +12,7 @@ export enum EggEventType {
|
|||||||
*/
|
*/
|
||||||
export class EggCountChangedEvent extends Event {
|
export class EggCountChangedEvent extends Event {
|
||||||
/** The updated egg count. */
|
/** The updated egg count. */
|
||||||
public eggCount: integer;
|
public eggCount: number;
|
||||||
|
|
||||||
constructor(eggCount: number) {
|
constructor(eggCount: number) {
|
||||||
super(EggEventType.EGG_COUNT_CHANGED);
|
super(EggEventType.EGG_COUNT_CHANGED);
|
||||||
|
@ -34,7 +34,7 @@ function doDefaultPbOpenParticles(x: number, y: number, radius: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const addParticle = (index: integer) => {
|
const addParticle = (index: number) => {
|
||||||
const particle = globalScene.add.sprite(x, y, "pb_open_particle");
|
const particle = globalScene.add.sprite(x, y, "pb_open_particle");
|
||||||
globalScene.field.add(particle);
|
globalScene.field.add(particle);
|
||||||
const angle = index * 45;
|
const angle = index * 45;
|
||||||
@ -68,7 +68,7 @@ function doDefaultPbOpenParticles(x: number, y: number, radius: number) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function doUbOpenParticles(x: number, y: number, frameIndex: integer) {
|
function doUbOpenParticles(x: number, y: number, frameIndex: number) {
|
||||||
const particles: Phaser.GameObjects.Image[] = [];
|
const particles: Phaser.GameObjects.Image[] = [];
|
||||||
for (let i = 0; i < 10; i++) {
|
for (let i = 0; i < 10; i++) {
|
||||||
particles.push(doFanOutParticle(i * 25, x, y, 1, 1, 5, frameIndex));
|
particles.push(doFanOutParticle(i * 25, x, y, 1, 1, 5, frameIndex));
|
||||||
@ -110,7 +110,7 @@ function doMbOpenParticles(x: number, y: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doFanOutParticle(trigIndex: integer, x: integer, y: integer, xSpeed: integer, ySpeed: integer, angle: integer, frameIndex: integer): Phaser.GameObjects.Image {
|
function doFanOutParticle(trigIndex: number, x: number, y: number, xSpeed: number, ySpeed: number, angle: number, frameIndex: number): Phaser.GameObjects.Image {
|
||||||
let f = 0;
|
let f = 0;
|
||||||
|
|
||||||
const particle = globalScene.add.image(x, y, "pb_particles", `${frameIndex}.png`);
|
const particle = globalScene.add.image(x, y, "pb_particles", `${frameIndex}.png`);
|
||||||
@ -179,11 +179,11 @@ export function addPokeballCaptureStars(pokeball: Phaser.GameObjects.Sprite): vo
|
|||||||
new Array(3).fill(null).map(() => addParticle());
|
new Array(3).fill(null).map(() => addParticle());
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sin(index: integer, amplitude: integer): number {
|
export function sin(index: number, amplitude: number): number {
|
||||||
return amplitude * Math.sin(index * (Math.PI / 128));
|
return amplitude * Math.sin(index * (Math.PI / 128));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cos(index: integer, amplitude: integer): number {
|
export function cos(index: number, amplitude: number): number {
|
||||||
return amplitude * Math.cos(index * (Math.PI / 128));
|
return amplitude * Math.cos(index * (Math.PI / 128));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
randomSpecies(waveIndex: integer, level: integer, attempt?: integer, luckValue?: integer, isBoss?: boolean): PokemonSpecies {
|
randomSpecies(waveIndex: number, level: number, attempt?: number, luckValue?: number, isBoss?: boolean): PokemonSpecies {
|
||||||
const overrideSpecies = globalScene.gameMode.getOverrideSpecies(waveIndex);
|
const overrideSpecies = globalScene.gameMode.getOverrideSpecies(waveIndex);
|
||||||
if (overrideSpecies) {
|
if (overrideSpecies) {
|
||||||
return overrideSpecies;
|
return overrideSpecies;
|
||||||
@ -167,7 +167,7 @@ export class Arena {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
randomTrainerType(waveIndex: integer, isBoss: boolean = false): TrainerType {
|
randomTrainerType(waveIndex: number, isBoss: boolean = false): TrainerType {
|
||||||
const isTrainerBoss = !!this.trainerPool[BiomePoolTier.BOSS].length
|
const isTrainerBoss = !!this.trainerPool[BiomePoolTier.BOSS].length
|
||||||
&& (globalScene.gameMode.isTrainerBoss(waveIndex, this.biomeType, globalScene.offsetGym) || isBoss);
|
&& (globalScene.gameMode.isTrainerBoss(waveIndex, this.biomeType, globalScene.offsetGym) || isBoss);
|
||||||
console.log(isBoss, this.trainerPool);
|
console.log(isBoss, this.trainerPool);
|
||||||
@ -184,7 +184,7 @@ export class Arena {
|
|||||||
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
|
return !tierPool.length ? TrainerType.BREEDER : tierPool[Utils.randSeedInt(tierPool.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeciesFormIndex(species: PokemonSpecies): integer {
|
getSpeciesFormIndex(species: PokemonSpecies): number {
|
||||||
switch (species.speciesId) {
|
switch (species.speciesId) {
|
||||||
case Species.BURMY:
|
case Species.BURMY:
|
||||||
case Species.WORMADAM:
|
case Species.WORMADAM:
|
||||||
@ -372,7 +372,7 @@ export class Arena {
|
|||||||
* Gets the denominator for the chance for a trainer spawn
|
* Gets the denominator for the chance for a trainer spawn
|
||||||
* @returns n where 1/n is the chance of a trainer battle
|
* @returns n where 1/n is the chance of a trainer battle
|
||||||
*/
|
*/
|
||||||
getTrainerChance(): integer {
|
getTrainerChance(): number {
|
||||||
switch (this.biomeType) {
|
switch (this.biomeType) {
|
||||||
case Biome.METROPOLIS:
|
case Biome.METROPOLIS:
|
||||||
return 2;
|
return 2;
|
||||||
@ -457,10 +457,10 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
overrideTint(): [integer, integer, integer] {
|
overrideTint(): [number, number, number] {
|
||||||
switch (Overrides.ARENA_TINT_OVERRIDE) {
|
switch (Overrides.ARENA_TINT_OVERRIDE) {
|
||||||
case TimeOfDay.DUSK:
|
case TimeOfDay.DUSK:
|
||||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [number, number, number];
|
||||||
break;
|
break;
|
||||||
case (TimeOfDay.NIGHT):
|
case (TimeOfDay.NIGHT):
|
||||||
return [ 64, 64, 64 ];
|
return [ 64, 64, 64 ];
|
||||||
@ -473,7 +473,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDayTint(): [integer, integer, integer] {
|
getDayTint(): [number, number, number] {
|
||||||
if (Overrides.ARENA_TINT_OVERRIDE !== null) {
|
if (Overrides.ARENA_TINT_OVERRIDE !== null) {
|
||||||
return this.overrideTint();
|
return this.overrideTint();
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getDuskTint(): [integer, integer, integer] {
|
getDuskTint(): [number, number, number] {
|
||||||
if (Overrides.ARENA_TINT_OVERRIDE) {
|
if (Overrides.ARENA_TINT_OVERRIDE) {
|
||||||
return this.overrideTint();
|
return this.overrideTint();
|
||||||
}
|
}
|
||||||
@ -495,11 +495,11 @@ export class Arena {
|
|||||||
|
|
||||||
switch (this.biomeType) {
|
switch (this.biomeType) {
|
||||||
default:
|
default:
|
||||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [number, number, number];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getNightTint(): [integer, integer, integer] {
|
getNightTint(): [number, number, number] {
|
||||||
if (Overrides.ARENA_TINT_OVERRIDE) {
|
if (Overrides.ARENA_TINT_OVERRIDE) {
|
||||||
return this.overrideTint();
|
return this.overrideTint();
|
||||||
}
|
}
|
||||||
@ -813,7 +813,7 @@ export function getBiomeHasProps(biomeType: Biome): boolean {
|
|||||||
export class ArenaBase extends Phaser.GameObjects.Container {
|
export class ArenaBase extends Phaser.GameObjects.Container {
|
||||||
public player: boolean;
|
public player: boolean;
|
||||||
public biome: Biome;
|
public biome: Biome;
|
||||||
public propValue: integer;
|
public propValue: number;
|
||||||
public base: Phaser.GameObjects.Sprite;
|
public base: Phaser.GameObjects.Sprite;
|
||||||
public props: Phaser.GameObjects.Sprite[];
|
public props: Phaser.GameObjects.Sprite[];
|
||||||
|
|
||||||
@ -834,7 +834,7 @@ export class ArenaBase extends Phaser.GameObjects.Container {
|
|||||||
}) : [];
|
}) : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
setBiome(biome: Biome, propValue?: integer): void {
|
setBiome(biome: Biome, propValue?: number): void {
|
||||||
const hasProps = getBiomeHasProps(biome);
|
const hasProps = getBiomeHasProps(biome);
|
||||||
const biomeKey = getBiomeKey(biome);
|
const biomeKey = getBiomeKey(biome);
|
||||||
const baseKey = `${biomeKey}_${this.player ? "a" : "b"}`;
|
const baseKey = `${biomeKey}_${this.player ? "a" : "b"}`;
|
||||||
|
@ -15,7 +15,7 @@ export default class DamageNumberHandler {
|
|||||||
this.damageNumbers = new Map();
|
this.damageNumbers = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(target: Pokemon, amount: integer, result: DamageResult | HitResult.HEAL = HitResult.EFFECTIVE, critical: boolean = false): void {
|
add(target: Pokemon, amount: number, result: DamageResult | HitResult.HEAL = HitResult.EFFECTIVE, critical: boolean = false): void {
|
||||||
if (!globalScene?.damageNumbersMode) {
|
if (!globalScene?.damageNumbersMode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||||||
* @param duration
|
* @param duration
|
||||||
* @param ease
|
* @param ease
|
||||||
*/
|
*/
|
||||||
private tint(sprite, color: number, alpha?: number, duration?: integer, ease?: string): void {
|
private tint(sprite, color: number, alpha?: number, duration?: number, ease?: string): void {
|
||||||
// const tintSprites = this.getTintSprites();
|
// const tintSprites = this.getTintSprites();
|
||||||
sprite.setTintFill(color);
|
sprite.setTintFill(color);
|
||||||
sprite.setVisible(true);
|
sprite.setVisible(true);
|
||||||
@ -448,7 +448,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||||||
* @param duration
|
* @param duration
|
||||||
* @param ease
|
* @param ease
|
||||||
*/
|
*/
|
||||||
tintAll(color: number, alpha?: number, duration?: integer, ease?: string): void {
|
tintAll(color: number, alpha?: number, duration?: number, ease?: string): void {
|
||||||
const tintSprites = this.getTintSprites();
|
const tintSprites = this.getTintSprites();
|
||||||
tintSprites.map(tintSprite => {
|
tintSprites.map(tintSprite => {
|
||||||
this.tint(tintSprite, color, alpha, duration, ease);
|
this.tint(tintSprite, color, alpha, duration, ease);
|
||||||
@ -461,7 +461,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||||||
* @param duration
|
* @param duration
|
||||||
* @param ease
|
* @param ease
|
||||||
*/
|
*/
|
||||||
private untint(sprite, duration: integer, ease?: string): void {
|
private untint(sprite, duration: number, ease?: string): void {
|
||||||
if (duration) {
|
if (duration) {
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: sprite,
|
targets: sprite,
|
||||||
@ -485,7 +485,7 @@ export default class MysteryEncounterIntroVisuals extends Phaser.GameObjects.Con
|
|||||||
* @param duration
|
* @param duration
|
||||||
* @param ease
|
* @param ease
|
||||||
*/
|
*/
|
||||||
untintAll(duration: integer, ease?: string): void {
|
untintAll(duration: number, ease?: string): void {
|
||||||
const tintSprites = this.getTintSprites();
|
const tintSprites = this.getTintSprites();
|
||||||
tintSprites.map(tintSprite => {
|
tintSprites.map(tintSprite => {
|
||||||
this.untint(tintSprite, duration, ease);
|
this.untint(tintSprite, duration, ease);
|
||||||
|
@ -31,7 +31,7 @@ import { BattlerTag, BattlerTagLapseType, EncoreTag, GroundedTag, HighestStatBoo
|
|||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "#app/data/arena-tag";
|
import { ArenaTagSide, NoCritTag, WeakenMoveScreenTag } from "#app/data/arena-tag";
|
||||||
import type { Ability, AbAttr } from "#app/data/ability";
|
import type { Ability, AbAttr } from "#app/data/ability";
|
||||||
import { StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr, PostSetStatusAbAttr, applyPostSetStatusAbAttrs, InfiltratorAbAttr, AlliedFieldDamageReductionAbAttr, PostDamageAbAttr, applyPostDamageAbAttrs, CommanderAbAttr, applyPostItemLostAbAttrs, PostItemLostAbAttr } from "#app/data/ability";
|
import { StatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, IgnoreOpponentStatStagesAbAttr, MoveImmunityAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr, applyFieldStatMultiplierAbAttrs, FieldMultiplyStatAbAttr, AddSecondStrikeAbAttr, UserFieldStatusEffectImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr, BattlerTagImmunityAbAttr, MoveTypeChangeAbAttr, FullHpResistTypeAbAttr, applyCheckTrappedAbAttrs, CheckTrappedAbAttr, PostSetStatusAbAttr, applyPostSetStatusAbAttrs, InfiltratorAbAttr, AlliedFieldDamageReductionAbAttr, PostDamageAbAttr, applyPostDamageAbAttrs, CommanderAbAttr, applyPostItemLostAbAttrs, PostItemLostAbAttr, PreLeaveFieldAbAttr, applyPreLeaveFieldAbAttrs } from "#app/data/ability";
|
||||||
import type PokemonData from "#app/system/pokemon-data";
|
import type PokemonData from "#app/system/pokemon-data";
|
||||||
import { BattlerIndex } from "#app/battle";
|
import { BattlerIndex } from "#app/battle";
|
||||||
import { Mode } from "#app/ui/ui";
|
import { Mode } from "#app/ui/ui";
|
||||||
@ -99,45 +99,45 @@ export enum FieldPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
public id: integer;
|
public id: number;
|
||||||
public name: string;
|
public name: string;
|
||||||
public nickname: string;
|
public nickname: string;
|
||||||
public species: PokemonSpecies;
|
public species: PokemonSpecies;
|
||||||
public formIndex: integer;
|
public formIndex: number;
|
||||||
public abilityIndex: integer;
|
public abilityIndex: number;
|
||||||
public passive: boolean;
|
public passive: boolean;
|
||||||
public shiny: boolean;
|
public shiny: boolean;
|
||||||
public variant: Variant;
|
public variant: Variant;
|
||||||
public pokeball: PokeballType;
|
public pokeball: PokeballType;
|
||||||
protected battleInfo: BattleInfo;
|
protected battleInfo: BattleInfo;
|
||||||
public level: integer;
|
public level: number;
|
||||||
public exp: integer;
|
public exp: number;
|
||||||
public levelExp: integer;
|
public levelExp: number;
|
||||||
public gender: Gender;
|
public gender: Gender;
|
||||||
public hp: integer;
|
public hp: number;
|
||||||
public stats: integer[];
|
public stats: number[];
|
||||||
public ivs: integer[];
|
public ivs: number[];
|
||||||
public nature: Nature;
|
public nature: Nature;
|
||||||
public moveset: (PokemonMove | null)[];
|
public moveset: (PokemonMove | null)[];
|
||||||
public status: Status | null;
|
public status: Status | null;
|
||||||
public friendship: integer;
|
public friendship: number;
|
||||||
public metLevel: integer;
|
public metLevel: number;
|
||||||
public metBiome: Biome | -1;
|
public metBiome: Biome | -1;
|
||||||
public metSpecies: Species;
|
public metSpecies: Species;
|
||||||
public metWave: number;
|
public metWave: number;
|
||||||
public luck: integer;
|
public luck: number;
|
||||||
public pauseEvolutions: boolean;
|
public pauseEvolutions: boolean;
|
||||||
public pokerus: boolean;
|
public pokerus: boolean;
|
||||||
public switchOutStatus: boolean;
|
public switchOutStatus: boolean;
|
||||||
public evoCounter: integer;
|
public evoCounter: number;
|
||||||
|
|
||||||
public fusionSpecies: PokemonSpecies | null;
|
public fusionSpecies: PokemonSpecies | null;
|
||||||
public fusionFormIndex: integer;
|
public fusionFormIndex: number;
|
||||||
public fusionAbilityIndex: integer;
|
public fusionAbilityIndex: number;
|
||||||
public fusionShiny: boolean;
|
public fusionShiny: boolean;
|
||||||
public fusionVariant: Variant;
|
public fusionVariant: Variant;
|
||||||
public fusionGender: Gender;
|
public fusionGender: Gender;
|
||||||
public fusionLuck: integer;
|
public fusionLuck: number;
|
||||||
public fusionCustomPokemonData: CustomPokemonData | null;
|
public fusionCustomPokemonData: CustomPokemonData | null;
|
||||||
|
|
||||||
private summonDataPrimer: PokemonSummonData | null;
|
private summonDataPrimer: PokemonSummonData | null;
|
||||||
@ -160,7 +160,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
private shinySparkle: Phaser.GameObjects.Sprite;
|
private shinySparkle: Phaser.GameObjects.Sprite;
|
||||||
|
|
||||||
constructor(x: number, y: number, species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
constructor(x: number, y: number, species: PokemonSpecies, level: number, abilityIndex?: number, formIndex?: number, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: number[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
||||||
super(globalScene, x, y);
|
super(globalScene, x, y);
|
||||||
|
|
||||||
if (!species.isObtainable() && this.isPlayer()) {
|
if (!species.isObtainable() && this.isPlayer()) {
|
||||||
@ -423,7 +423,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
abstract hasTrainer(): boolean;
|
abstract hasTrainer(): boolean;
|
||||||
|
|
||||||
abstract getFieldIndex(): integer;
|
abstract getFieldIndex(): number;
|
||||||
|
|
||||||
abstract getBattlerIndex(): BattlerIndex;
|
abstract getBattlerIndex(): BattlerIndex;
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFieldPosition(fieldPosition: FieldPosition, duration?: integer): Promise<void> {
|
setFieldPosition(fieldPosition: FieldPosition, duration?: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (fieldPosition === this.fieldPosition) {
|
if (fieldPosition === this.fieldPosition) {
|
||||||
resolve();
|
resolve();
|
||||||
@ -949,7 +949,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param simulated if `true`, nullifies any effects that produce any changes to game state from triggering
|
* @param simulated if `true`, nullifies any effects that produce any changes to game state from triggering
|
||||||
* @returns the final in-battle value of a stat
|
* @returns the final in-battle value of a stat
|
||||||
*/
|
*/
|
||||||
getEffectiveStat(stat: EffectiveStat, opponent?: Pokemon, move?: Move, ignoreAbility: boolean = false, ignoreOppAbility: boolean = false, isCritical: boolean = false, simulated: boolean = true): integer {
|
getEffectiveStat(stat: EffectiveStat, opponent?: Pokemon, move?: Move, ignoreAbility: boolean = false, ignoreOppAbility: boolean = false, isCritical: boolean = false, simulated: boolean = true): number {
|
||||||
const statValue = new Utils.NumberHolder(this.getStat(stat, false));
|
const statValue = new Utils.NumberHolder(this.getStat(stat, false));
|
||||||
globalScene.applyModifiers(StatBoosterModifier, this.isPlayer(), this, stat, statValue);
|
globalScene.applyModifiers(StatBoosterModifier, this.isPlayer(), this, stat, statValue);
|
||||||
|
|
||||||
@ -1103,12 +1103,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.hp >= this.getMaxHp();
|
return this.hp >= this.getMaxHp();
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxHp(): integer {
|
getMaxHp(): number {
|
||||||
return this.getStat(Stat.HP);
|
return this.getStat(Stat.HP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the amount of hp currently missing from this {@linkcode Pokemon} (max - current) */
|
/** Returns the amount of hp currently missing from this {@linkcode Pokemon} (max - current) */
|
||||||
getInverseHp(): integer {
|
getInverseHp(): number {
|
||||||
return this.getMaxHp() - this.hp;
|
return this.getMaxHp() - this.hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,7 +1153,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return !this.isFusion() ? this.variant : Math.max(this.variant, this.fusionVariant) as Variant;
|
return !this.isFusion() ? this.variant : Math.max(this.variant, this.fusionVariant) as Variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
getLuck(): integer {
|
getLuck(): number {
|
||||||
return this.luck + (this.isFusion() ? this.fusionLuck : 0);
|
return this.luck + (this.isFusion() ? this.fusionLuck : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1422,8 +1422,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
*/
|
*/
|
||||||
public hasPassive(): boolean {
|
public hasPassive(): boolean {
|
||||||
// returns override if valid for current case
|
// returns override if valid for current case
|
||||||
if ((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && this.isPlayer())
|
if (
|
||||||
|| (Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE && !this.isPlayer())) {
|
(Overrides.HAS_PASSIVE_ABILITY_OVERRIDE === false && this.isPlayer())
|
||||||
|
|| (Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE === false && !this.isPlayer())
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
((Overrides.PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.HAS_PASSIVE_ABILITY_OVERRIDE) && this.isPlayer())
|
||||||
|
|| ((Overrides.OPP_PASSIVE_ABILITY_OVERRIDE !== Abilities.NONE || Overrides.OPP_HAS_PASSIVE_ABILITY_OVERRIDE) && !this.isPlayer())
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1816,13 +1824,13 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all level up moves in a given range for a particular pokemon.
|
* Gets all level up moves in a given range for a particular pokemon.
|
||||||
* @param {integer} startingLevel Don't include moves below this level
|
* @param {number} startingLevel Don't include moves below this level
|
||||||
* @param {boolean} includeEvolutionMoves Whether to include evolution moves
|
* @param {boolean} includeEvolutionMoves Whether to include evolution moves
|
||||||
* @param {boolean} simulateEvolutionChain Whether to include moves from prior evolutions
|
* @param {boolean} simulateEvolutionChain Whether to include moves from prior evolutions
|
||||||
* @param {boolean} includeRelearnerMoves Whether to include moves that would require a relearner. Note the move relearner inherently allows evolution moves
|
* @param {boolean} includeRelearnerMoves Whether to include moves that would require a relearner. Note the move relearner inherently allows evolution moves
|
||||||
* @returns {LevelMoves} A list of moves and the levels they can be learned at
|
* @returns {LevelMoves} A list of moves and the levels they can be learned at
|
||||||
*/
|
*/
|
||||||
getLevelMoves(startingLevel?: integer, includeEvolutionMoves: boolean = false, simulateEvolutionChain: boolean = false, includeRelearnerMoves: boolean = false, learnSituation: LearnMoveSituation = LearnMoveSituation.MISC): LevelMoves {
|
getLevelMoves(startingLevel?: number, includeEvolutionMoves: boolean = false, simulateEvolutionChain: boolean = false, includeRelearnerMoves: boolean = false, learnSituation: LearnMoveSituation = LearnMoveSituation.MISC): LevelMoves {
|
||||||
const ret: LevelMoves = [];
|
const ret: LevelMoves = [];
|
||||||
let levelMoves: LevelMoves = [];
|
let levelMoves: LevelMoves = [];
|
||||||
if (!startingLevel) {
|
if (!startingLevel) {
|
||||||
@ -1862,7 +1870,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
levelMoves.sort((lma: [integer, integer], lmb: [integer, integer]) => lma[0] > lmb[0] ? 1 : lma[0] < lmb[0] ? -1 : 0);
|
levelMoves.sort((lma: [number, number], lmb: [number, number]) => lma[0] > lmb[0] ? 1 : lma[0] < lmb[0] ? -1 : 0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1919,7 +1927,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return speciesEggMoves[this.getSpeciesForm().getRootSpeciesId()];
|
return speciesEggMoves[this.getSpeciesForm().getRootSpeciesId()];
|
||||||
}
|
}
|
||||||
|
|
||||||
setMove(moveIndex: integer, moveId: Moves): void {
|
setMove(moveIndex: number, moveId: Moves): void {
|
||||||
const move = moveId ? new PokemonMove(moveId) : null;
|
const move = moveId ? new PokemonMove(moveId) : null;
|
||||||
this.moveset[moveIndex] = move;
|
this.moveset[moveIndex] = move;
|
||||||
if (this.summonData?.moveset) {
|
if (this.summonData?.moveset) {
|
||||||
@ -2326,7 +2334,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public trySelectMove(moveIndex: integer, ignorePp?: boolean): boolean {
|
public trySelectMove(moveIndex: number, ignorePp?: boolean): boolean {
|
||||||
const move = this.getMoveset().length > moveIndex
|
const move = this.getMoveset().length > moveIndex
|
||||||
? this.getMoveset()[moveIndex]
|
? this.getMoveset()[moveIndex]
|
||||||
: null;
|
: null;
|
||||||
@ -2412,7 +2420,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param exp The amount of experience to add
|
* @param exp The amount of experience to add
|
||||||
* @param ignoreLevelCap Whether to ignore level caps when adding experience (defaults to false)
|
* @param ignoreLevelCap Whether to ignore level caps when adding experience (defaults to false)
|
||||||
*/
|
*/
|
||||||
addExp(exp: integer, ignoreLevelCap: boolean = false) {
|
addExp(exp: number, ignoreLevelCap: boolean = false) {
|
||||||
const maxExpLevel = globalScene.getMaxExpLevel(ignoreLevelCap);
|
const maxExpLevel = globalScene.getMaxExpLevel(ignoreLevelCap);
|
||||||
const initialExp = this.exp;
|
const initialExp = this.exp;
|
||||||
this.exp += exp;
|
this.exp += exp;
|
||||||
@ -2435,7 +2443,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.isPlayer() !== target.isPlayer();
|
return this.isPlayer() !== target.isPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
getOpponent(targetIndex: integer): Pokemon | null {
|
getOpponent(targetIndex: number): Pokemon | null {
|
||||||
const ret = this.getOpponents()[targetIndex];
|
const ret = this.getOpponents()[targetIndex];
|
||||||
if (ret.summonData) {
|
if (ret.summonData) {
|
||||||
return ret;
|
return ret;
|
||||||
@ -2992,7 +3000,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param ignoreFaintPhase flag on wheter to add FaintPhase if pokemon after applying damage faints
|
* @param ignoreFaintPhase flag on wheter to add FaintPhase if pokemon after applying damage faints
|
||||||
* @returns integer representing damage
|
* @returns integer representing damage
|
||||||
*/
|
*/
|
||||||
damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false): integer {
|
damage(damage: number, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false): number {
|
||||||
if (this.isFainted()) {
|
if (this.isFainted()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3062,7 +3070,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
heal(amount: integer): integer {
|
heal(amount: number): number {
|
||||||
const healAmount = Math.min(amount, this.getMaxHp() - this.hp);
|
const healAmount = Math.min(amount, this.getMaxHp() - this.hp);
|
||||||
this.hp += healAmount;
|
this.hp += healAmount;
|
||||||
return healAmount;
|
return healAmount;
|
||||||
@ -3093,7 +3101,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return !cancelled.value;
|
return !cancelled.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
addTag(tagType: BattlerTagType, turnCount: integer = 0, sourceMove?: Moves, sourceId?: integer): boolean {
|
addTag(tagType: BattlerTagType, turnCount: number = 0, sourceMove?: Moves, sourceId?: number): boolean {
|
||||||
const existingTag = this.getTag(tagType);
|
const existingTag = this.getTag(tagType);
|
||||||
if (existingTag) {
|
if (existingTag) {
|
||||||
existingTag.onOverlap(this);
|
existingTag.onOverlap(this);
|
||||||
@ -3199,11 +3207,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTagsBySourceId(sourceId: integer): void {
|
removeTagsBySourceId(sourceId: number): void {
|
||||||
this.findAndRemoveTags(t => t.isSourceLinked() && t.sourceId === sourceId);
|
this.findAndRemoveTags(t => t.isSourceLinked() && t.sourceId === sourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
transferTagsBySourceId(sourceId: integer, newSourceId: integer): void {
|
transferTagsBySourceId(sourceId: number, newSourceId: number): void {
|
||||||
if (!this.summonData) {
|
if (!this.summonData) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3780,12 +3788,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
this.turnData = new PokemonTurnData();
|
this.turnData = new PokemonTurnData();
|
||||||
}
|
}
|
||||||
|
|
||||||
getExpValue(): integer {
|
getExpValue(): number {
|
||||||
// Logic to factor in victor level has been removed for balancing purposes, so the player doesn't have to focus on EXP maxxing
|
// Logic to factor in victor level has been removed for balancing purposes, so the player doesn't have to focus on EXP maxxing
|
||||||
return ((this.getSpeciesForm().getBaseExp() * this.level) / 5 + 1);
|
return ((this.getSpeciesForm().getBaseExp() * this.level) / 5 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
setFrameRate(frameRate: integer) {
|
setFrameRate(frameRate: number) {
|
||||||
globalScene.anims.get(this.getBattleSpriteKey()).frameRate = frameRate;
|
globalScene.anims.get(this.getBattleSpriteKey()).frameRate = frameRate;
|
||||||
try {
|
try {
|
||||||
this.getSprite().play(this.getBattleSpriteKey());
|
this.getSprite().play(this.getBattleSpriteKey());
|
||||||
@ -3799,7 +3807,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tint(color: number, alpha?: number, duration?: integer, ease?: string) {
|
tint(color: number, alpha?: number, duration?: number, ease?: string) {
|
||||||
const tintSprite = this.getTintSprite();
|
const tintSprite = this.getTintSprite();
|
||||||
tintSprite?.setTintFill(color);
|
tintSprite?.setTintFill(color);
|
||||||
tintSprite?.setVisible(true);
|
tintSprite?.setVisible(true);
|
||||||
@ -3818,7 +3826,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
untint(duration: integer, ease?: string) {
|
untint(duration: number, ease?: string) {
|
||||||
const tintSprite = this.getTintSprite();
|
const tintSprite = this.getTintSprite();
|
||||||
|
|
||||||
if (duration) {
|
if (duration) {
|
||||||
@ -3895,10 +3903,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const fusionCanvas = document.createElement("canvas");
|
const fusionCanvas = document.createElement("canvas");
|
||||||
const fusionBackCanvas = document.createElement("canvas");
|
const fusionBackCanvas = document.createElement("canvas");
|
||||||
|
|
||||||
const spriteColors: integer[][] = [];
|
const spriteColors: number[][] = [];
|
||||||
const pixelData: Uint8ClampedArray[] = [];
|
const pixelData: Uint8ClampedArray[] = [];
|
||||||
|
|
||||||
[ canvas, backCanvas, fusionCanvas, fusionBackCanvas ].forEach((canv: HTMLCanvasElement, c: integer) => {
|
[ canvas, backCanvas, fusionCanvas, fusionBackCanvas ].forEach((canv: HTMLCanvasElement, c: number) => {
|
||||||
const context = canv.getContext("2d");
|
const context = canv.getContext("2d");
|
||||||
const frame = [ sourceFrame, sourceBackFrame, fusionFrame, fusionBackFrame ][c];
|
const frame = [ sourceFrame, sourceBackFrame, fusionFrame, fusionBackFrame ][c];
|
||||||
canv.width = frame.width;
|
canv.width = frame.width;
|
||||||
@ -3913,7 +3921,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
for (let f = 0; f < 2; f++) {
|
for (let f = 0; f < 2; f++) {
|
||||||
const variantColors = variantColorCache[!f ? spriteKey : backSpriteKey];
|
const variantColors = variantColorCache[!f ? spriteKey : backSpriteKey];
|
||||||
const variantColorSet = new Map<integer, integer[]>();
|
const variantColorSet = new Map<number, number[]>();
|
||||||
if (this.shiny && variantColors && variantColors[this.variant]) {
|
if (this.shiny && variantColors && variantColors[this.variant]) {
|
||||||
Object.keys(variantColors[this.variant]).forEach(k => {
|
Object.keys(variantColors[this.variant]).forEach(k => {
|
||||||
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.variant][k]))));
|
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.variant][k]))));
|
||||||
@ -3945,7 +3953,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const pixelColors: number[] = [];
|
const pixelColors: number[] = [];
|
||||||
for (let f = 0; f < 2; f++) {
|
for (let f = 0; f < 2; f++) {
|
||||||
for (let i = 0; i < pixelData[f].length; i += 4) {
|
for (let i = 0; i < pixelData[f].length; i += 4) {
|
||||||
const total = pixelData[f].slice(i, i + 3).reduce((total: integer, value: integer) => total + value, 0);
|
const total = pixelData[f].slice(i, i + 3).reduce((total: number, value: number) => total + value, 0);
|
||||||
if (!total) {
|
if (!total) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3956,14 +3964,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
const fusionPixelColors : number[] = [];
|
const fusionPixelColors : number[] = [];
|
||||||
for (let f = 0; f < 2; f++) {
|
for (let f = 0; f < 2; f++) {
|
||||||
const variantColors = variantColorCache[!f ? fusionSpriteKey : fusionBackSpriteKey];
|
const variantColors = variantColorCache[!f ? fusionSpriteKey : fusionBackSpriteKey];
|
||||||
const variantColorSet = new Map<integer, integer[]>();
|
const variantColorSet = new Map<number, number[]>();
|
||||||
if (this.fusionShiny && variantColors && variantColors[this.fusionVariant]) {
|
if (this.fusionShiny && variantColors && variantColors[this.fusionVariant]) {
|
||||||
Object.keys(variantColors[this.fusionVariant]).forEach(k => {
|
Object.keys(variantColors[this.fusionVariant]).forEach(k => {
|
||||||
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.fusionVariant][k]))));
|
variantColorSet.set(Utils.rgbaToInt(Array.from(Object.values(Utils.rgbHexToRgba(k)))), Array.from(Object.values(Utils.rgbHexToRgba(variantColors[this.fusionVariant][k]))));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (let i = 0; i < pixelData[2 + f].length; i += 4) {
|
for (let i = 0; i < pixelData[2 + f].length; i += 4) {
|
||||||
const total = pixelData[2 + f].slice(i, i + 3).reduce((total: integer, value: integer) => total + value, 0);
|
const total = pixelData[2 + f].slice(i, i + 3).reduce((total: number, value: number) => total + value, 0);
|
||||||
if (!total) {
|
if (!total) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3998,18 +4006,18 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
fusionPaletteColors = fusionPaletteColors!; // TS compiler that fusionPaletteColors is defined!
|
fusionPaletteColors = fusionPaletteColors!; // TS compiler that fusionPaletteColors is defined!
|
||||||
const [ palette, fusionPalette ] = [ paletteColors, fusionPaletteColors ]
|
const [ palette, fusionPalette ] = [ paletteColors, fusionPaletteColors ]
|
||||||
.map(paletteColors => {
|
.map(paletteColors => {
|
||||||
let keys = Array.from(paletteColors.keys()).sort((a: integer, b: integer) => paletteColors.get(a)! < paletteColors.get(b)! ? 1 : -1);
|
let keys = Array.from(paletteColors.keys()).sort((a: number, b: number) => paletteColors.get(a)! < paletteColors.get(b)! ? 1 : -1);
|
||||||
let rgbaColors: Map<number, integer[]>;
|
let rgbaColors: Map<number, number[]>;
|
||||||
let hsvColors: Map<number, number[]>;
|
let hsvColors: Map<number, number[]>;
|
||||||
|
|
||||||
const mappedColors = new Map<integer, integer[]>();
|
const mappedColors = new Map<number, number[]>();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
mappedColors.clear();
|
mappedColors.clear();
|
||||||
|
|
||||||
rgbaColors = keys.reduce((map: Map<number, integer[]>, k: number) => {
|
rgbaColors = keys.reduce((map: Map<number, number[]>, k: number) => {
|
||||||
map.set(k, Object.values(rgbaFromArgb(k))); return map;
|
map.set(k, Object.values(rgbaFromArgb(k))); return map;
|
||||||
}, new Map<number, integer[]>());
|
}, new Map<number, number[]>());
|
||||||
hsvColors = Array.from(rgbaColors.keys()).reduce((map: Map<number, number[]>, k: number) => {
|
hsvColors = Array.from(rgbaColors.keys()).reduce((map: Map<number, number[]>, k: number) => {
|
||||||
const rgb = rgbaColors.get(k)!.slice(0, 3);
|
const rgb = rgbaColors.get(k)!.slice(0, 3);
|
||||||
map.set(k, Utils.rgbToHsv(rgb[0], rgb[1], rgb[2]));
|
map.set(k, Utils.rgbToHsv(rgb[0], rgb[1], rgb[2]));
|
||||||
@ -4032,7 +4040,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mappedColors.forEach((values: integer[], key: integer) => {
|
mappedColors.forEach((values: number[], key: number) => {
|
||||||
const keyColor = rgbaColors.get(key)!;
|
const keyColor = rgbaColors.get(key)!;
|
||||||
const valueColors = values.map(v => rgbaColors.get(v)!);
|
const valueColors = values.map(v => rgbaColors.get(v)!);
|
||||||
const color = keyColor.slice(0);
|
const color = keyColor.slice(0);
|
||||||
@ -4047,7 +4055,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
for (let c = 0; c < 3; c++) {
|
for (let c = 0; c < 3; c++) {
|
||||||
color[c] *= (paletteColors.get(key)! / count);
|
color[c] *= (paletteColors.get(key)! / count);
|
||||||
values.forEach((value: integer, i: integer) => {
|
values.forEach((value: number, i: number) => {
|
||||||
if (paletteColors.has(value)) {
|
if (paletteColors.has(value)) {
|
||||||
const valueCount = paletteColors.get(value)!;
|
const valueCount = paletteColors.get(value)!;
|
||||||
color[c] += valueColors[i][c] * (valueCount / count);
|
color[c] += valueColors[i][c] * (valueCount / count);
|
||||||
@ -4067,7 +4075,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
paletteColors.set(argbFromRgba({ r: color[0], g: color[1], b: color[2], a: color[3] }), count);
|
paletteColors.set(argbFromRgba({ r: color[0], g: color[1], b: color[2], a: color[3] }), count);
|
||||||
});
|
});
|
||||||
|
|
||||||
keys = Array.from(paletteColors.keys()).sort((a: integer, b: integer) => paletteColors.get(a)! < paletteColors.get(b)! ? 1 : -1);
|
keys = Array.from(paletteColors.keys()).sort((a: number, b: number) => paletteColors.get(a)! < paletteColors.get(b)! ? 1 : -1);
|
||||||
} while (mappedColors.size);
|
} while (mappedColors.size);
|
||||||
|
|
||||||
return keys.map(c => Object.values(rgbaFromArgb(c)));
|
return keys.map(c => Object.values(rgbaFromArgb(c)));
|
||||||
@ -4076,7 +4084,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
const paletteDeltas: number[][] = [];
|
const paletteDeltas: number[][] = [];
|
||||||
|
|
||||||
spriteColors.forEach((sc: integer[], i: integer) => {
|
spriteColors.forEach((sc: number[], i: number) => {
|
||||||
paletteDeltas.push([]);
|
paletteDeltas.push([]);
|
||||||
for (let p = 0; p < palette.length; p++) {
|
for (let p = 0; p < palette.length; p++) {
|
||||||
paletteDeltas[i].push(Utils.deltaRgb(sc, palette[p]));
|
paletteDeltas[i].push(Utils.deltaRgb(sc, palette[p]));
|
||||||
@ -4119,7 +4127,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param min The minimum integer to pick, default `0`
|
* @param min The minimum integer to pick, default `0`
|
||||||
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
|
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
|
||||||
*/
|
*/
|
||||||
randSeedInt(range: integer, min: integer = 0): integer {
|
randSeedInt(range: number, min: number = 0): number {
|
||||||
return globalScene.currentBattle
|
return globalScene.currentBattle
|
||||||
? globalScene.randBattleSeedInt(range, min)
|
? globalScene.randBattleSeedInt(range, min)
|
||||||
: Utils.randSeedInt(range, min);
|
: Utils.randSeedInt(range, min);
|
||||||
@ -4131,7 +4139,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param max The maximum integer to generate
|
* @param max The maximum integer to generate
|
||||||
* @returns a random integer between {@linkcode min} and {@linkcode max} inclusive
|
* @returns a random integer between {@linkcode min} and {@linkcode max} inclusive
|
||||||
*/
|
*/
|
||||||
randSeedIntRange(min: integer, max: integer): integer {
|
randSeedIntRange(min: number, max: number): number {
|
||||||
return this.randSeedInt((max - min) + 1, min);
|
return this.randSeedInt((max - min) + 1, min);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4142,9 +4150,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
* @param hideInfo Indicates if this should also play the animation to hide the Pokemon's
|
* @param hideInfo Indicates if this should also play the animation to hide the Pokemon's
|
||||||
* info container.
|
* info container.
|
||||||
*/
|
*/
|
||||||
leaveField(clearEffects: boolean = true, hideInfo: boolean = true) {
|
leaveField(clearEffects: boolean = true, hideInfo: boolean = true, destroy: boolean = false) {
|
||||||
this.resetSprite();
|
this.resetSprite();
|
||||||
this.resetTurnData();
|
this.resetTurnData();
|
||||||
|
globalScene.getField(true).filter(p => p !== this).forEach(p => p.removeTagsBySourceId(this.id));
|
||||||
|
|
||||||
if (clearEffects) {
|
if (clearEffects) {
|
||||||
this.destroySubstitute();
|
this.destroySubstitute();
|
||||||
this.resetSummonData(); // this also calls `resetBattleSummonData`
|
this.resetSummonData(); // this also calls `resetBattleSummonData`
|
||||||
@ -4152,9 +4162,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
if (hideInfo) {
|
if (hideInfo) {
|
||||||
this.hideInfo();
|
this.hideInfo();
|
||||||
}
|
}
|
||||||
globalScene.field.remove(this);
|
// Trigger abilities that activate upon leaving the field
|
||||||
|
applyPreLeaveFieldAbAttrs(PreLeaveFieldAbAttr, this);
|
||||||
this.setSwitchOutStatus(true);
|
this.setSwitchOutStatus(true);
|
||||||
globalScene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true);
|
globalScene.triggerPokemonFormChange(this, SpeciesFormChangeActiveTrigger, true);
|
||||||
|
globalScene.field.remove(this, destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(): void {
|
destroy(): void {
|
||||||
@ -4223,7 +4235,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
export class PlayerPokemon extends Pokemon {
|
export class PlayerPokemon extends Pokemon {
|
||||||
public compatibleTms: Moves[];
|
public compatibleTms: Moves[];
|
||||||
|
|
||||||
constructor(species: PokemonSpecies, level: integer, abilityIndex?: integer, formIndex?: integer, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: integer[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
constructor(species: PokemonSpecies, level: number, abilityIndex?: number, formIndex?: number, gender?: Gender, shiny?: boolean, variant?: Variant, ivs?: number[], nature?: Nature, dataSource?: Pokemon | PokemonData) {
|
||||||
super(106, 148, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
|
super(106, 148, species, level, abilityIndex, formIndex, gender, shiny, variant, ivs, nature, dataSource);
|
||||||
|
|
||||||
if (Overrides.STATUS_OVERRIDE) {
|
if (Overrides.STATUS_OVERRIDE) {
|
||||||
@ -4268,7 +4280,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): number {
|
||||||
return globalScene.getPlayerField().indexOf(this);
|
return globalScene.getPlayerField().indexOf(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4325,7 +4337,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.leaveField(switchType === SwitchType.SWITCH);
|
this.leaveField(switchType === SwitchType.SWITCH);
|
||||||
|
|
||||||
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.FAINT_SWITCH, this.getFieldIndex(), (slotIndex: integer, option: PartyOption) => {
|
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.FAINT_SWITCH, this.getFieldIndex(), (slotIndex: number, option: PartyOption) => {
|
||||||
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
||||||
globalScene.prependToPhase(new SwitchSummonPhase(switchType, this.getFieldIndex(), slotIndex, false), MoveEndPhase);
|
globalScene.prependToPhase(new SwitchSummonPhase(switchType, this.getFieldIndex(), slotIndex, false), MoveEndPhase);
|
||||||
}
|
}
|
||||||
@ -4377,7 +4389,7 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
*/
|
*/
|
||||||
revivalBlessing(): Promise<void> {
|
revivalBlessing(): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.REVIVAL_BLESSING, this.getFieldIndex(), (slotIndex:integer, option: PartyOption) => {
|
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.REVIVAL_BLESSING, this.getFieldIndex(), (slotIndex:number, option: PartyOption) => {
|
||||||
if (slotIndex >= 0 && slotIndex < 6) {
|
if (slotIndex >= 0 && slotIndex < 6) {
|
||||||
const pokemon = globalScene.getPlayerParty()[slotIndex];
|
const pokemon = globalScene.getPlayerParty()[slotIndex];
|
||||||
if (!pokemon || !pokemon.isFainted()) {
|
if (!pokemon || !pokemon.isFainted()) {
|
||||||
@ -4679,12 +4691,12 @@ export class PlayerPokemon extends Pokemon {
|
|||||||
export class EnemyPokemon extends Pokemon {
|
export class EnemyPokemon extends Pokemon {
|
||||||
public trainerSlot: TrainerSlot;
|
public trainerSlot: TrainerSlot;
|
||||||
public aiType: AiType;
|
public aiType: AiType;
|
||||||
public bossSegments: integer;
|
public bossSegments: number;
|
||||||
public bossSegmentIndex: integer;
|
public bossSegmentIndex: number;
|
||||||
/** To indicate if the instance was populated with a dataSource -> e.g. loaded & populated from session data */
|
/** To indicate if the instance was populated with a dataSource -> e.g. loaded & populated from session data */
|
||||||
public readonly isPopulatedFromDataSource: boolean;
|
public readonly isPopulatedFromDataSource: boolean;
|
||||||
|
|
||||||
constructor(species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean, shinyLock: boolean = false, dataSource?: PokemonData) {
|
constructor(species: PokemonSpecies, level: number, trainerSlot: TrainerSlot, boss: boolean, shinyLock: boolean = false, dataSource?: PokemonData) {
|
||||||
super(236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex, dataSource?.gender,
|
super(236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex, dataSource?.gender,
|
||||||
(!shinyLock && dataSource) ? dataSource.shiny : false, (!shinyLock && dataSource) ? dataSource.variant : undefined,
|
(!shinyLock && dataSource) ? dataSource.shiny : false, (!shinyLock && dataSource) ? dataSource.variant : undefined,
|
||||||
undefined, dataSource ? dataSource.nature : undefined, dataSource);
|
undefined, dataSource ? dataSource.nature : undefined, dataSource);
|
||||||
@ -4767,7 +4779,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
* @param boss if the pokemon is a boss
|
* @param boss if the pokemon is a boss
|
||||||
* @param bossSegments amount of boss segments (health-bar segments)
|
* @param bossSegments amount of boss segments (health-bar segments)
|
||||||
*/
|
*/
|
||||||
setBoss(boss: boolean = true, bossSegments: integer = 0): void {
|
setBoss(boss: boolean = true, bossSegments: number = 0): void {
|
||||||
if (boss) {
|
if (boss) {
|
||||||
this.bossSegments = bossSegments || globalScene.getEncounterBossSegments(globalScene.currentBattle.waveIndex, this.level, this.species, true);
|
this.bossSegments = bossSegments || globalScene.getEncounterBossSegments(globalScene.currentBattle.waveIndex, this.level, this.species, true);
|
||||||
this.bossSegmentIndex = this.bossSegments - 1;
|
this.bossSegmentIndex = this.bossSegments - 1;
|
||||||
@ -4777,7 +4789,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generateAndPopulateMoveset(formIndex?: integer): void {
|
generateAndPopulateMoveset(formIndex?: number): void {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case (this.species.speciesId === Species.SMEARGLE):
|
case (this.species.speciesId === Species.SMEARGLE):
|
||||||
this.moveset = [
|
this.moveset = [
|
||||||
@ -4899,7 +4911,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
const move = pokemonMove.getMove();
|
const move = pokemonMove.getMove();
|
||||||
|
|
||||||
let moveScore = moveScores[m];
|
let moveScore = moveScores[m];
|
||||||
const targetScores: integer[] = [];
|
const targetScores: number[] = [];
|
||||||
|
|
||||||
for (const mt of moveTargets[move.id]) {
|
for (const mt of moveTargets[move.id]) {
|
||||||
// Prevent a target score from being calculated when the target is whoever attacks the user
|
// Prevent a target score from being calculated when the target is whoever attacks the user
|
||||||
@ -5039,9 +5051,9 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
targetWeights = targetWeights.slice(0, benefitCutoffIndex);
|
targetWeights = targetWeights.slice(0, benefitCutoffIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
const thresholds: integer[] = [];
|
const thresholds: number[] = [];
|
||||||
let totalWeight: integer = 0;
|
let totalWeight: number = 0;
|
||||||
targetWeights.reduce((total: integer, w: integer) => {
|
targetWeights.reduce((total: number, w: number) => {
|
||||||
total += w;
|
total += w;
|
||||||
thresholds.push(total);
|
thresholds.push(total);
|
||||||
totalWeight = total;
|
totalWeight = total;
|
||||||
@ -5054,7 +5066,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
* is greater than that random number.
|
* is greater than that random number.
|
||||||
*/
|
*/
|
||||||
const randValue = globalScene.randBattleSeedInt(totalWeight);
|
const randValue = globalScene.randBattleSeedInt(totalWeight);
|
||||||
let targetIndex: integer = 0;
|
let targetIndex: number = 0;
|
||||||
|
|
||||||
thresholds.every((t, i) => {
|
thresholds.every((t, i) => {
|
||||||
if (randValue >= t) {
|
if (randValue >= t) {
|
||||||
@ -5080,7 +5092,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
return !!this.bossSegments;
|
return !!this.bossSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
getBossSegmentIndex(): integer {
|
getBossSegmentIndex(): number {
|
||||||
const segments = (this as EnemyPokemon).bossSegments;
|
const segments = (this as EnemyPokemon).bossSegments;
|
||||||
const segmentSize = this.getMaxHp() / segments;
|
const segmentSize = this.getMaxHp() / segments;
|
||||||
for (let s = segments - 1; s > 0; s--) {
|
for (let s = segments - 1; s > 0; s--) {
|
||||||
@ -5093,7 +5105,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
damage(damage: integer, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false): integer {
|
damage(damage: number, ignoreSegments: boolean = false, preventEndure: boolean = false, ignoreFaintPhase: boolean = false): number {
|
||||||
if (this.isFainted()) {
|
if (this.isFainted()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5147,7 +5159,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
canBypassBossSegments(segmentCount: integer = 1): boolean {
|
canBypassBossSegments(segmentCount: number = 1): boolean {
|
||||||
if (globalScene.currentBattle.battleSpec === BattleSpec.FINAL_BOSS) {
|
if (globalScene.currentBattle.battleSpec === BattleSpec.FINAL_BOSS) {
|
||||||
if (!this.formIndex && (this.bossSegmentIndex - segmentCount) < 1) {
|
if (!this.formIndex && (this.bossSegmentIndex - segmentCount) < 1) {
|
||||||
return false;
|
return false;
|
||||||
@ -5164,7 +5176,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
* For Pokemon with 5 health segments or more, breaking the last two shields give +2 each
|
* For Pokemon with 5 health segments or more, breaking the last two shields give +2 each
|
||||||
* @param segmentIndex index of the segment to get down to (0 = no shield left, 1 = 1 shield left, etc.)
|
* @param segmentIndex index of the segment to get down to (0 = no shield left, 1 = 1 shield left, etc.)
|
||||||
*/
|
*/
|
||||||
handleBossSegmentCleared(segmentIndex: integer): void {
|
handleBossSegmentCleared(segmentIndex: number): void {
|
||||||
while (this.bossSegmentIndex > 0 && segmentIndex - 1 < this.bossSegmentIndex) {
|
while (this.bossSegmentIndex > 0 && segmentIndex - 1 < this.bossSegmentIndex) {
|
||||||
// Filter out already maxed out stat stages and weigh the rest based on existing stats
|
// Filter out already maxed out stat stages and weigh the rest based on existing stats
|
||||||
const leftoverStats = EFFECTIVE_STATS.filter((s: EffectiveStat) => this.getStatStage(s) < 6);
|
const leftoverStats = EFFECTIVE_STATS.filter((s: EffectiveStat) => this.getStatStage(s) < 6);
|
||||||
@ -5204,7 +5216,7 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): number {
|
||||||
return globalScene.getEnemyField().indexOf(this);
|
return globalScene.getEnemyField().indexOf(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5441,7 +5453,7 @@ export class PokemonMove {
|
|||||||
this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp());
|
this.ppUsed = Math.min(this.ppUsed + count, this.getMovePp());
|
||||||
}
|
}
|
||||||
|
|
||||||
getMovePp(): integer {
|
getMovePp(): number {
|
||||||
return this.maxPpOverride || (this.getMove().pp + this.ppUp * Utils.toDmgValue(this.getMove().pp / 5));
|
return this.maxPpOverride || (this.getMove().pp + this.ppUp * Utils.toDmgValue(this.getMove().pp / 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,11 @@ export enum TrainerVariant {
|
|||||||
export default class Trainer extends Phaser.GameObjects.Container {
|
export default class Trainer extends Phaser.GameObjects.Container {
|
||||||
public config: TrainerConfig;
|
public config: TrainerConfig;
|
||||||
public variant: TrainerVariant;
|
public variant: TrainerVariant;
|
||||||
public partyTemplateIndex: integer;
|
public partyTemplateIndex: number;
|
||||||
public name: string;
|
public name: string;
|
||||||
public partnerName: string;
|
public partnerName: string;
|
||||||
|
|
||||||
constructor(trainerType: TrainerType, variant: TrainerVariant, partyTemplateIndex?: integer, name?: string, partnerName?: string, trainerConfigOverride?: TrainerConfig) {
|
constructor(trainerType: TrainerType, variant: TrainerVariant, partyTemplateIndex?: number, name?: string, partnerName?: string, trainerConfigOverride?: TrainerConfig) {
|
||||||
super(globalScene, -72, 80);
|
super(globalScene, -72, 80);
|
||||||
this.config = trainerConfigs.hasOwnProperty(trainerType)
|
this.config = trainerConfigs.hasOwnProperty(trainerType)
|
||||||
? trainerConfigs[trainerType]
|
? trainerConfigs[trainerType]
|
||||||
@ -214,7 +214,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return this.config.partyTemplates[this.partyTemplateIndex];
|
return this.config.partyTemplates[this.partyTemplateIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
getPartyLevels(waveIndex: integer): integer[] {
|
getPartyLevels(waveIndex: number): number[] {
|
||||||
const ret: number[] = [];
|
const ret: number[] = [];
|
||||||
const partyTemplate = this.getPartyTemplate();
|
const partyTemplate = this.getPartyTemplate();
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
genPartyMember(index: integer): EnemyPokemon {
|
genPartyMember(index: number): EnemyPokemon {
|
||||||
const battle = globalScene.currentBattle;
|
const battle = globalScene.currentBattle;
|
||||||
const level = battle.enemyLevels?.[index]!; // TODO: is this bang correct?
|
const level = battle.enemyLevels?.[index]!; // TODO: is this bang correct?
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
genNewPartyMemberSpecies(level: integer, strength: PartyMemberStrength, attempt?: integer): PokemonSpecies {
|
genNewPartyMemberSpecies(level: number, strength: PartyMemberStrength, attempt?: number): PokemonSpecies {
|
||||||
const battle = globalScene.currentBattle;
|
const battle = globalScene.currentBattle;
|
||||||
const template = this.getPartyTemplate();
|
const template = this.getPartyTemplate();
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return currentSpecies.includes(baseSpecies) || staticSpecies.includes(baseSpecies);
|
return currentSpecies.includes(baseSpecies) || staticSpecies.includes(baseSpecies);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE, forSwitch: boolean = false): [integer, integer][] {
|
getPartyMemberMatchupScores(trainerSlot: TrainerSlot = TrainerSlot.NONE, forSwitch: boolean = false): [number, number][] {
|
||||||
if (trainerSlot && !this.isDouble()) {
|
if (trainerSlot && !this.isDouble()) {
|
||||||
trainerSlot = TrainerSlot.NONE;
|
trainerSlot = TrainerSlot.NONE;
|
||||||
}
|
}
|
||||||
@ -487,12 +487,12 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [ party.indexOf(p), score ];
|
return [ party.indexOf(p), score ];
|
||||||
}) as [integer, integer][];
|
}) as [number, number][];
|
||||||
|
|
||||||
return partyMemberScores;
|
return partyMemberScores;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSortedPartyMemberMatchupScores(partyMemberScores: [integer, integer][] = this.getPartyMemberMatchupScores()) {
|
getSortedPartyMemberMatchupScores(partyMemberScores: [number, number][] = this.getPartyMemberMatchupScores()) {
|
||||||
const sortedPartyMemberScores = partyMemberScores.slice(0);
|
const sortedPartyMemberScores = partyMemberScores.slice(0);
|
||||||
sortedPartyMemberScores.sort((a, b) => {
|
sortedPartyMemberScores.sort((a, b) => {
|
||||||
const scoreA = a[1];
|
const scoreA = a[1];
|
||||||
@ -503,7 +503,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return sortedPartyMemberScores;
|
return sortedPartyMemberScores;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNextSummonIndex(trainerSlot: TrainerSlot = TrainerSlot.NONE, partyMemberScores: [integer, integer][] = this.getPartyMemberMatchupScores(trainerSlot)): integer {
|
getNextSummonIndex(trainerSlot: TrainerSlot = TrainerSlot.NONE, partyMemberScores: [number, number][] = this.getPartyMemberMatchupScores(trainerSlot)): number {
|
||||||
if (trainerSlot && !this.isDouble()) {
|
if (trainerSlot && !this.isDouble()) {
|
||||||
trainerSlot = TrainerSlot.NONE;
|
trainerSlot = TrainerSlot.NONE;
|
||||||
}
|
}
|
||||||
@ -513,7 +513,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]);
|
const maxScorePartyMemberIndexes = partyMemberScores.filter(pms => pms[1] === sortedPartyMemberScores[0][1]).map(pms => pms[0]);
|
||||||
|
|
||||||
if (maxScorePartyMemberIndexes.length > 1) {
|
if (maxScorePartyMemberIndexes.length > 1) {
|
||||||
let rand: integer;
|
let rand: number;
|
||||||
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(maxScorePartyMemberIndexes.length), globalScene.currentBattle.turn << 2);
|
globalScene.executeWithSeedOffset(() => rand = Utils.randSeedInt(maxScorePartyMemberIndexes.length), globalScene.currentBattle.turn << 2);
|
||||||
return maxScorePartyMemberIndexes[rand!];
|
return maxScorePartyMemberIndexes[rand!];
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return maxScorePartyMemberIndexes[0];
|
return maxScorePartyMemberIndexes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
getPartyMemberModifierChanceMultiplier(index: integer): number {
|
getPartyMemberModifierChanceMultiplier(index: number): number {
|
||||||
switch (this.getPartyTemplate().getStrength(index)) {
|
switch (this.getPartyTemplate().getStrength(index)) {
|
||||||
case PartyMemberStrength.WEAKER:
|
case PartyMemberStrength.WEAKER:
|
||||||
return 0.75;
|
return 0.75;
|
||||||
@ -626,7 +626,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
tint(color: number, alpha?: number, duration?: integer, ease?: string): void {
|
tint(color: number, alpha?: number, duration?: number, ease?: string): void {
|
||||||
const tintSprites = this.getTintSprites();
|
const tintSprites = this.getTintSprites();
|
||||||
tintSprites.map(tintSprite => {
|
tintSprites.map(tintSprite => {
|
||||||
tintSprite.setTintFill(color);
|
tintSprite.setTintFill(color);
|
||||||
@ -647,7 +647,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
untint(duration: integer, ease?: string): void {
|
untint(duration: number, ease?: string): void {
|
||||||
const tintSprites = this.getTintSprites();
|
const tintSprites = this.getTintSprites();
|
||||||
tintSprites.map(tintSprite => {
|
tintSprites.map(tintSprite => {
|
||||||
if (duration) {
|
if (duration) {
|
||||||
|
@ -91,7 +91,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* - 20 for Daily Runs
|
* - 20 for Daily Runs
|
||||||
* - 5 for all other modes
|
* - 5 for all other modes
|
||||||
*/
|
*/
|
||||||
getStartingLevel(): integer {
|
getStartingLevel(): number {
|
||||||
if (Overrides.STARTING_LEVEL_OVERRIDE) {
|
if (Overrides.STARTING_LEVEL_OVERRIDE) {
|
||||||
return Overrides.STARTING_LEVEL_OVERRIDE;
|
return Overrides.STARTING_LEVEL_OVERRIDE;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* - override from overrides.ts
|
* - override from overrides.ts
|
||||||
* - 1000
|
* - 1000
|
||||||
*/
|
*/
|
||||||
getStartingMoney(): integer {
|
getStartingMoney(): number {
|
||||||
return Overrides.STARTING_MONEY_OVERRIDE || 1000;
|
return Overrides.STARTING_MONEY_OVERRIDE || 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getWaveForDifficulty(waveIndex: integer, ignoreCurveChanges: boolean = false): integer {
|
getWaveForDifficulty(waveIndex: number, ignoreCurveChanges: boolean = false): number {
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.DAILY:
|
case GameModes.DAILY:
|
||||||
return waveIndex + 30 + (!ignoreCurveChanges ? Math.floor(waveIndex / 5) : 0);
|
return waveIndex + 30 + (!ignoreCurveChanges ? Math.floor(waveIndex / 5) : 0);
|
||||||
@ -142,7 +142,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* @param arena the current {@linkcode Arena}
|
* @param arena the current {@linkcode Arena}
|
||||||
* @returns `true` if a trainer should be generated, `false` otherwise
|
* @returns `true` if a trainer should be generated, `false` otherwise
|
||||||
*/
|
*/
|
||||||
isWaveTrainer(waveIndex: integer, arena: Arena): boolean {
|
isWaveTrainer(waveIndex: number, arena: Arena): boolean {
|
||||||
/**
|
/**
|
||||||
* Daily spawns trainers on floors 5, 15, 20, 25, 30, 35, 40, and 45
|
* Daily spawns trainers on floors 5, 15, 20, 25, 30, 35, 40, and 45
|
||||||
*/
|
*/
|
||||||
@ -186,7 +186,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isTrainerBoss(waveIndex: integer, biomeType: Biome, offsetGym: boolean): boolean {
|
isTrainerBoss(waveIndex: number, biomeType: Biome, offsetGym: boolean): boolean {
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.DAILY:
|
case GameModes.DAILY:
|
||||||
return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10);
|
return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10);
|
||||||
@ -195,7 +195,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getOverrideSpecies(waveIndex: integer): PokemonSpecies | null {
|
getOverrideSpecies(waveIndex: number): PokemonSpecies | null {
|
||||||
if (this.isDaily && this.isWaveFinal(waveIndex)) {
|
if (this.isDaily && this.isWaveFinal(waveIndex)) {
|
||||||
const allFinalBossSpecies = allSpecies.filter(s => (s.subLegendary || s.legendary || s.mythical)
|
const allFinalBossSpecies = allSpecies.filter(s => (s.subLegendary || s.legendary || s.mythical)
|
||||||
&& s.baseTotal >= 600 && s.speciesId !== Species.ETERNATUS && s.speciesId !== Species.ARCEUS);
|
&& s.baseTotal >= 600 && s.speciesId !== Species.ETERNATUS && s.speciesId !== Species.ARCEUS);
|
||||||
@ -211,7 +211,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* @param modeId game mode
|
* @param modeId game mode
|
||||||
* @returns if the current wave is final for classic or daily OR a minor boss in endless
|
* @returns if the current wave is final for classic or daily OR a minor boss in endless
|
||||||
*/
|
*/
|
||||||
isWaveFinal(waveIndex: integer, modeId: GameModes = this.modeId): boolean {
|
isWaveFinal(waveIndex: number, modeId: GameModes = this.modeId): boolean {
|
||||||
switch (modeId) {
|
switch (modeId) {
|
||||||
case GameModes.CLASSIC:
|
case GameModes.CLASSIC:
|
||||||
case GameModes.CHALLENGE:
|
case GameModes.CHALLENGE:
|
||||||
@ -228,7 +228,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* Every 10 waves is a boss battle
|
* Every 10 waves is a boss battle
|
||||||
* @returns true if waveIndex is a multiple of 10
|
* @returns true if waveIndex is a multiple of 10
|
||||||
*/
|
*/
|
||||||
isBoss(waveIndex: integer): boolean {
|
isBoss(waveIndex: number): boolean {
|
||||||
return waveIndex % 10 === 0;
|
return waveIndex % 10 === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* At this time it is paradox pokemon
|
* At this time it is paradox pokemon
|
||||||
* @returns true if waveIndex is a multiple of 50 in Endless
|
* @returns true if waveIndex is a multiple of 50 in Endless
|
||||||
*/
|
*/
|
||||||
isEndlessBoss(waveIndex: integer): boolean {
|
isEndlessBoss(waveIndex: number): boolean {
|
||||||
return waveIndex % 50 === 0 &&
|
return waveIndex % 50 === 0 &&
|
||||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
* At this time it is Eternatus
|
* At this time it is Eternatus
|
||||||
* @returns true if waveIndex is a multiple of 250 in Endless
|
* @returns true if waveIndex is a multiple of 250 in Endless
|
||||||
*/
|
*/
|
||||||
isEndlessMinorBoss(waveIndex: integer): boolean {
|
isEndlessMinorBoss(waveIndex: number): boolean {
|
||||||
return waveIndex % 250 === 0 &&
|
return waveIndex % 250 === 0 &&
|
||||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||||
}
|
}
|
||||||
@ -264,27 +264,27 @@ export class GameMode implements GameModeConfig {
|
|||||||
* At this time it is Eternamax Eternatus
|
* At this time it is Eternamax Eternatus
|
||||||
* @returns true if waveIndex is a multiple of 1000 in Endless
|
* @returns true if waveIndex is a multiple of 1000 in Endless
|
||||||
*/
|
*/
|
||||||
isEndlessMajorBoss(waveIndex: integer): boolean {
|
isEndlessMajorBoss(waveIndex: number): boolean {
|
||||||
return waveIndex % 1000 === 0 &&
|
return waveIndex % 1000 === 0 &&
|
||||||
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
(this.modeId === GameModes.ENDLESS || this.modeId === GameModes.SPLICED_ENDLESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether there is a fixed battle on this gamemode on a given wave.
|
* Checks whether there is a fixed battle on this gamemode on a given wave.
|
||||||
* @param {integer} waveIndex The wave to check.
|
* @param {number} waveIndex The wave to check.
|
||||||
* @returns {boolean} If this game mode has a fixed battle on this wave
|
* @returns {boolean} If this game mode has a fixed battle on this wave
|
||||||
*/
|
*/
|
||||||
isFixedBattle(waveIndex: integer): boolean {
|
isFixedBattle(waveIndex: number): boolean {
|
||||||
const dummyConfig = new FixedBattleConfig();
|
const dummyConfig = new FixedBattleConfig();
|
||||||
return this.battleConfig.hasOwnProperty(waveIndex) || applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, dummyConfig);
|
return this.battleConfig.hasOwnProperty(waveIndex) || applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, dummyConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the config for the fixed battle for a particular wave.
|
* Returns the config for the fixed battle for a particular wave.
|
||||||
* @param {integer} waveIndex The wave to check.
|
* @param {number} waveIndex The wave to check.
|
||||||
* @returns {boolean} The fixed battle for this wave.
|
* @returns {boolean} The fixed battle for this wave.
|
||||||
*/
|
*/
|
||||||
getFixedBattle(waveIndex: integer): FixedBattleConfig {
|
getFixedBattle(waveIndex: number): FixedBattleConfig {
|
||||||
const challengeConfig = new FixedBattleConfig();
|
const challengeConfig = new FixedBattleConfig();
|
||||||
if (applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, challengeConfig)) {
|
if (applyChallenges(this, ChallengeType.FIXED_BATTLES, waveIndex, challengeConfig)) {
|
||||||
return challengeConfig;
|
return challengeConfig;
|
||||||
@ -294,7 +294,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getClearScoreBonus(): integer {
|
getClearScoreBonus(): number {
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.CLASSIC:
|
case GameModes.CLASSIC:
|
||||||
case GameModes.CHALLENGE:
|
case GameModes.CHALLENGE:
|
||||||
@ -306,7 +306,7 @@ export class GameMode implements GameModeConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getEnemyModifierChance(isBoss: boolean): integer {
|
getEnemyModifierChance(isBoss: boolean): number {
|
||||||
switch (this.modeId) {
|
switch (this.modeId) {
|
||||||
case GameModes.CLASSIC:
|
case GameModes.CLASSIC:
|
||||||
case GameModes.CHALLENGE:
|
case GameModes.CHALLENGE:
|
||||||
|
@ -194,9 +194,9 @@ export interface GeneratedPersistentModifierType {
|
|||||||
|
|
||||||
class AddPokeballModifierType extends ModifierType {
|
class AddPokeballModifierType extends ModifierType {
|
||||||
private pokeballType: PokeballType;
|
private pokeballType: PokeballType;
|
||||||
private count: integer;
|
private count: number;
|
||||||
|
|
||||||
constructor(iconImage: string, pokeballType: PokeballType, count: integer) {
|
constructor(iconImage: string, pokeballType: PokeballType, count: number) {
|
||||||
super("", iconImage, (_type, _args) => new AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
super("", iconImage, (_type, _args) => new AddPokeballModifier(this, pokeballType, count), "pb", "se/pb_bounce_1");
|
||||||
this.pokeballType = pokeballType;
|
this.pokeballType = pokeballType;
|
||||||
this.count = count;
|
this.count = count;
|
||||||
@ -221,9 +221,9 @@ class AddPokeballModifierType extends ModifierType {
|
|||||||
|
|
||||||
class AddVoucherModifierType extends ModifierType {
|
class AddVoucherModifierType extends ModifierType {
|
||||||
private voucherType: VoucherType;
|
private voucherType: VoucherType;
|
||||||
private count: integer;
|
private count: number;
|
||||||
|
|
||||||
constructor(voucherType: VoucherType, count: integer) {
|
constructor(voucherType: VoucherType, count: number) {
|
||||||
super("", getVoucherTypeIcon(voucherType), (_type, _args) => new AddVoucherModifier(this, voucherType, count), "voucher");
|
super("", getVoucherTypeIcon(voucherType), (_type, _args) => new AddVoucherModifier(this, voucherType, count), "voucher");
|
||||||
this.count = count;
|
this.count = count;
|
||||||
this.voucherType = voucherType;
|
this.voucherType = voucherType;
|
||||||
@ -276,11 +276,11 @@ export class PokemonHeldItemModifierType extends PokemonModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonHpRestoreModifierType extends PokemonModifierType {
|
export class PokemonHpRestoreModifierType extends PokemonModifierType {
|
||||||
protected restorePoints: integer;
|
protected restorePoints: number;
|
||||||
protected restorePercent: integer;
|
protected restorePercent: number;
|
||||||
protected healStatus: boolean;
|
protected healStatus: boolean;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, restorePoints: integer, restorePercent: integer, healStatus: boolean = false, newModifierFunc?: NewModifierFunc, selectFilter?: PokemonSelectFilter, group?: string) {
|
constructor(localeKey: string, iconImage: string, restorePoints: number, restorePercent: number, healStatus: boolean = false, newModifierFunc?: NewModifierFunc, selectFilter?: PokemonSelectFilter, group?: string) {
|
||||||
super(localeKey, iconImage, newModifierFunc || ((_type, args) => new PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints, this.restorePercent, this.healStatus, false)),
|
super(localeKey, iconImage, newModifierFunc || ((_type, args) => new PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints, this.restorePercent, this.healStatus, false)),
|
||||||
selectFilter || ((pokemon: PlayerPokemon) => {
|
selectFilter || ((pokemon: PlayerPokemon) => {
|
||||||
if (!pokemon.hp || (pokemon.isFullHp() && (!this.healStatus || (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED))))) {
|
if (!pokemon.hp || (pokemon.isFullHp() && (!this.healStatus || (!pokemon.status && !pokemon.getTag(BattlerTagType.CONFUSED))))) {
|
||||||
@ -307,7 +307,7 @@ export class PokemonHpRestoreModifierType extends PokemonModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
|
export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
|
||||||
constructor(localeKey: string, iconImage: string, restorePercent: integer) {
|
constructor(localeKey: string, iconImage: string, restorePercent: number) {
|
||||||
super(localeKey, iconImage, 0, restorePercent, false, (_type, args) => new PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, 0, this.restorePercent, false, true),
|
super(localeKey, iconImage, 0, restorePercent, false, (_type, args) => new PokemonHpRestoreModifier(this, (args[0] as PlayerPokemon).id, 0, this.restorePercent, false, true),
|
||||||
((pokemon: PlayerPokemon) => {
|
((pokemon: PlayerPokemon) => {
|
||||||
if (!pokemon.isFainted()) {
|
if (!pokemon.isFainted()) {
|
||||||
@ -356,10 +356,10 @@ export abstract class PokemonMoveModifierType extends PokemonModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonPpRestoreModifierType extends PokemonMoveModifierType {
|
export class PokemonPpRestoreModifierType extends PokemonMoveModifierType {
|
||||||
protected restorePoints: integer;
|
protected restorePoints: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, restorePoints: integer) {
|
constructor(localeKey: string, iconImage: string, restorePoints: number) {
|
||||||
super(localeKey, iconImage, (_type, args) => new PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.restorePoints),
|
super(localeKey, iconImage, (_type, args) => new PokemonPpRestoreModifier(this, (args[0] as PlayerPokemon).id, (args[1] as number), this.restorePoints),
|
||||||
(_pokemon: PlayerPokemon) => {
|
(_pokemon: PlayerPokemon) => {
|
||||||
return null;
|
return null;
|
||||||
}, (pokemonMove: PokemonMove) => {
|
}, (pokemonMove: PokemonMove) => {
|
||||||
@ -381,9 +381,9 @@ export class PokemonPpRestoreModifierType extends PokemonMoveModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
|
export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
|
||||||
protected restorePoints: integer;
|
protected restorePoints: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, restorePoints: integer) {
|
constructor(localeKey: string, iconImage: string, restorePoints: number) {
|
||||||
super(localeKey, iconImage, (_type, args) => new PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
|
super(localeKey, iconImage, (_type, args) => new PokemonAllMovePpRestoreModifier(this, (args[0] as PlayerPokemon).id, this.restorePoints),
|
||||||
(pokemon: PlayerPokemon) => {
|
(pokemon: PlayerPokemon) => {
|
||||||
if (!pokemon.getMoveset().filter(m => m?.ppUsed).length) {
|
if (!pokemon.getMoveset().filter(m => m?.ppUsed).length) {
|
||||||
@ -404,10 +404,10 @@ export class PokemonAllMovePpRestoreModifierType extends PokemonModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonPpUpModifierType extends PokemonMoveModifierType {
|
export class PokemonPpUpModifierType extends PokemonMoveModifierType {
|
||||||
protected upPoints: integer;
|
protected upPoints: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, upPoints: integer) {
|
constructor(localeKey: string, iconImage: string, upPoints: number) {
|
||||||
super(localeKey, iconImage, (_type, args) => new PokemonPpUpModifier(this, (args[0] as PlayerPokemon).id, (args[1] as integer), this.upPoints),
|
super(localeKey, iconImage, (_type, args) => new PokemonPpUpModifier(this, (args[0] as PlayerPokemon).id, (args[1] as number), this.upPoints),
|
||||||
(_pokemon: PlayerPokemon) => {
|
(_pokemon: PlayerPokemon) => {
|
||||||
return null;
|
return null;
|
||||||
}, (pokemonMove: PokemonMove) => {
|
}, (pokemonMove: PokemonMove) => {
|
||||||
@ -451,7 +451,7 @@ export class PokemonNatureChangeModifierType extends PokemonModifierType {
|
|||||||
|
|
||||||
export class RememberMoveModifierType extends PokemonModifierType {
|
export class RememberMoveModifierType extends PokemonModifierType {
|
||||||
constructor(localeKey: string, iconImage: string, group?: string) {
|
constructor(localeKey: string, iconImage: string, group?: string) {
|
||||||
super(localeKey, iconImage, (type, args) => new RememberMoveModifier(type, (args[0] as PlayerPokemon).id, (args[1] as integer)),
|
super(localeKey, iconImage, (type, args) => new RememberMoveModifier(type, (args[0] as PlayerPokemon).id, (args[1] as number)),
|
||||||
(pokemon: PlayerPokemon) => {
|
(pokemon: PlayerPokemon) => {
|
||||||
if (!pokemon.getLearnableLevelMoves().length) {
|
if (!pokemon.getLearnableLevelMoves().length) {
|
||||||
return PartyUiHandler.NoEffectMessage;
|
return PartyUiHandler.NoEffectMessage;
|
||||||
@ -552,9 +552,9 @@ enum AttackTypeBoosterItem {
|
|||||||
|
|
||||||
export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
export class AttackTypeBoosterModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
||||||
public moveType: Type;
|
public moveType: Type;
|
||||||
public boostPercent: integer;
|
public boostPercent: number;
|
||||||
|
|
||||||
constructor(moveType: Type, boostPercent: integer) {
|
constructor(moveType: Type, boostPercent: number) {
|
||||||
super("", `${AttackTypeBoosterItem[moveType]?.toLowerCase()}`,
|
super("", `${AttackTypeBoosterItem[moveType]?.toLowerCase()}`,
|
||||||
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent));
|
(_type, args) => new AttackTypeBoosterModifier(this, (args[0] as Pokemon).id, moveType, boostPercent));
|
||||||
|
|
||||||
@ -657,9 +657,9 @@ export class BaseStatBoosterModifierType extends PokemonHeldItemModifierType imp
|
|||||||
* Shuckle Juice item
|
* Shuckle Juice item
|
||||||
*/
|
*/
|
||||||
export class PokemonBaseStatTotalModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
export class PokemonBaseStatTotalModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
||||||
private readonly statModifier: integer;
|
private readonly statModifier: number;
|
||||||
|
|
||||||
constructor(statModifier: integer) {
|
constructor(statModifier: number) {
|
||||||
super("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE", "berry_juice", (_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.statModifier));
|
super("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE", "berry_juice", (_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.statModifier));
|
||||||
this.statModifier = statModifier;
|
this.statModifier = statModifier;
|
||||||
}
|
}
|
||||||
@ -681,10 +681,10 @@ export class PokemonBaseStatTotalModifierType extends PokemonHeldItemModifierTyp
|
|||||||
* Old Gateau item
|
* Old Gateau item
|
||||||
*/
|
*/
|
||||||
export class PokemonBaseStatFlatModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
export class PokemonBaseStatFlatModifierType extends PokemonHeldItemModifierType implements GeneratedPersistentModifierType {
|
||||||
private readonly statModifier: integer;
|
private readonly statModifier: number;
|
||||||
private readonly stats: Stat[];
|
private readonly stats: Stat[];
|
||||||
|
|
||||||
constructor(statModifier: integer, stats: Stat[]) {
|
constructor(statModifier: number, stats: Stat[]) {
|
||||||
super("modifierType:ModifierType.MYSTERY_ENCOUNTER_OLD_GATEAU", "old_gateau", (_type, args) => new PokemonBaseStatFlatModifier(this, (args[0] as Pokemon).id, this.statModifier, this.stats));
|
super("modifierType:ModifierType.MYSTERY_ENCOUNTER_OLD_GATEAU", "old_gateau", (_type, args) => new PokemonBaseStatFlatModifier(this, (args[0] as Pokemon).id, this.statModifier, this.stats));
|
||||||
this.statModifier = statModifier;
|
this.statModifier = statModifier;
|
||||||
this.stats = stats;
|
this.stats = stats;
|
||||||
@ -746,9 +746,9 @@ export class MoneyRewardModifierType extends ModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ExpBoosterModifierType extends ModifierType {
|
export class ExpBoosterModifierType extends ModifierType {
|
||||||
private boostPercent: integer;
|
private boostPercent: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, boostPercent: integer) {
|
constructor(localeKey: string, iconImage: string, boostPercent: number) {
|
||||||
super(localeKey, iconImage, () => new ExpBoosterModifier(this, boostPercent));
|
super(localeKey, iconImage, () => new ExpBoosterModifier(this, boostPercent));
|
||||||
|
|
||||||
this.boostPercent = boostPercent;
|
this.boostPercent = boostPercent;
|
||||||
@ -760,9 +760,9 @@ export class ExpBoosterModifierType extends ModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonExpBoosterModifierType extends PokemonHeldItemModifierType {
|
export class PokemonExpBoosterModifierType extends PokemonHeldItemModifierType {
|
||||||
private boostPercent: integer;
|
private boostPercent: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, boostPercent: integer) {
|
constructor(localeKey: string, iconImage: string, boostPercent: number) {
|
||||||
super(localeKey, iconImage, (_type, args) => new PokemonExpBoosterModifier(this, (args[0] as Pokemon).id, boostPercent));
|
super(localeKey, iconImage, (_type, args) => new PokemonExpBoosterModifier(this, (args[0] as Pokemon).id, boostPercent));
|
||||||
|
|
||||||
this.boostPercent = boostPercent;
|
this.boostPercent = boostPercent;
|
||||||
@ -784,9 +784,9 @@ export class PokemonFriendshipBoosterModifierType extends PokemonHeldItemModifie
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class PokemonMoveAccuracyBoosterModifierType extends PokemonHeldItemModifierType {
|
export class PokemonMoveAccuracyBoosterModifierType extends PokemonHeldItemModifierType {
|
||||||
private amount: integer;
|
private amount: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, amount: integer, group?: string, soundName?: string) {
|
constructor(localeKey: string, iconImage: string, amount: number, group?: string, soundName?: string) {
|
||||||
super(localeKey, iconImage, (_type, args) => new PokemonMoveAccuracyBoosterModifier(this, (args[0] as Pokemon).id, amount), group, soundName);
|
super(localeKey, iconImage, (_type, args) => new PokemonMoveAccuracyBoosterModifier(this, (args[0] as Pokemon).id, amount), group, soundName);
|
||||||
|
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
@ -934,7 +934,7 @@ class AttackTypeBoosterModifierTypeGenerator extends ModifierTypeGenerator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const attackMoveTypeWeights = new Map<Type, integer>();
|
const attackMoveTypeWeights = new Map<Type, number>();
|
||||||
let totalWeight = 0;
|
let totalWeight = 0;
|
||||||
for (const t of attackMoveTypes) {
|
for (const t of attackMoveTypes) {
|
||||||
if (attackMoveTypeWeights.has(t)) {
|
if (attackMoveTypeWeights.has(t)) {
|
||||||
@ -1215,9 +1215,9 @@ export class TerastallizeModifierType extends PokemonHeldItemModifierType implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ContactHeldItemTransferChanceModifierType extends PokemonHeldItemModifierType {
|
export class ContactHeldItemTransferChanceModifierType extends PokemonHeldItemModifierType {
|
||||||
private chancePercent: integer;
|
private chancePercent: number;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, chancePercent: integer, group?: string, soundName?: string) {
|
constructor(localeKey: string, iconImage: string, chancePercent: number, group?: string, soundName?: string) {
|
||||||
super(localeKey, iconImage, (type, args) => new ContactHeldItemTransferChanceModifier(type, (args[0] as Pokemon).id, chancePercent), group, soundName);
|
super(localeKey, iconImage, (type, args) => new ContactHeldItemTransferChanceModifier(type, (args[0] as Pokemon).id, chancePercent), group, soundName);
|
||||||
|
|
||||||
this.chancePercent = chancePercent;
|
this.chancePercent = chancePercent;
|
||||||
@ -1239,10 +1239,10 @@ export class TurnHeldItemTransferModifierType extends PokemonHeldItemModifierTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class EnemyAttackStatusEffectChanceModifierType extends ModifierType {
|
export class EnemyAttackStatusEffectChanceModifierType extends ModifierType {
|
||||||
private chancePercent: integer;
|
private chancePercent: number;
|
||||||
private effect: StatusEffect;
|
private effect: StatusEffect;
|
||||||
|
|
||||||
constructor(localeKey: string, iconImage: string, chancePercent: integer, effect: StatusEffect, stackCount?: integer) {
|
constructor(localeKey: string, iconImage: string, chancePercent: number, effect: StatusEffect, stackCount?: number) {
|
||||||
super(localeKey, iconImage, (type, _args) => new EnemyAttackStatusEffectChanceModifier(type, effect, chancePercent, stackCount), "enemy_status_chance");
|
super(localeKey, iconImage, (type, _args) => new EnemyAttackStatusEffectChanceModifier(type, effect, chancePercent, stackCount), "enemy_status_chance");
|
||||||
|
|
||||||
this.chancePercent = chancePercent;
|
this.chancePercent = chancePercent;
|
||||||
@ -1272,7 +1272,7 @@ export class EnemyEndureChanceModifierType extends ModifierType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ModifierTypeFunc = () => ModifierType;
|
export type ModifierTypeFunc = () => ModifierType;
|
||||||
type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: integer) => integer;
|
type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: number) => number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High order function that returns a WeightedModifierTypeWeightFunc that will only be applied on
|
* High order function that returns a WeightedModifierTypeWeightFunc that will only be applied on
|
||||||
@ -1281,7 +1281,7 @@ type WeightedModifierTypeWeightFunc = (party: Pokemon[], rerollCount?: integer)
|
|||||||
* @param defaultWeight - ModifierType default weight
|
* @param defaultWeight - ModifierType default weight
|
||||||
* @returns A WeightedModifierTypeWeightFunc
|
* @returns A WeightedModifierTypeWeightFunc
|
||||||
*/
|
*/
|
||||||
function skipInClassicAfterWave(wave: integer, defaultWeight: integer): WeightedModifierTypeWeightFunc {
|
function skipInClassicAfterWave(wave: number, defaultWeight: number): WeightedModifierTypeWeightFunc {
|
||||||
return () => {
|
return () => {
|
||||||
const gameMode = globalScene.gameMode;
|
const gameMode = globalScene.gameMode;
|
||||||
const currentWave = globalScene.currentBattle.waveIndex;
|
const currentWave = globalScene.currentBattle.waveIndex;
|
||||||
@ -1295,7 +1295,7 @@ function skipInClassicAfterWave(wave: integer, defaultWeight: integer): Weighted
|
|||||||
* @param defaultWeight ModifierType default weight
|
* @param defaultWeight ModifierType default weight
|
||||||
* @returns A WeightedModifierTypeWeightFunc
|
* @returns A WeightedModifierTypeWeightFunc
|
||||||
*/
|
*/
|
||||||
function skipInLastClassicWaveOrDefault(defaultWeight: integer) : WeightedModifierTypeWeightFunc {
|
function skipInLastClassicWaveOrDefault(defaultWeight: number) : WeightedModifierTypeWeightFunc {
|
||||||
return skipInClassicAfterWave(199, defaultWeight);
|
return skipInClassicAfterWave(199, defaultWeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1314,10 +1314,10 @@ function lureWeightFunc(maxBattles: number, weight: number): WeightedModifierTyp
|
|||||||
}
|
}
|
||||||
class WeightedModifierType {
|
class WeightedModifierType {
|
||||||
public modifierType: ModifierType;
|
public modifierType: ModifierType;
|
||||||
public weight: integer | WeightedModifierTypeWeightFunc;
|
public weight: number | WeightedModifierTypeWeightFunc;
|
||||||
public maxWeight: integer | WeightedModifierTypeWeightFunc;
|
public maxWeight: number | WeightedModifierTypeWeightFunc;
|
||||||
|
|
||||||
constructor(modifierTypeFunc: ModifierTypeFunc, weight: integer | WeightedModifierTypeWeightFunc, maxWeight?: integer | WeightedModifierTypeWeightFunc) {
|
constructor(modifierTypeFunc: ModifierTypeFunc, weight: number | WeightedModifierTypeWeightFunc, maxWeight?: number | WeightedModifierTypeWeightFunc) {
|
||||||
this.modifierType = modifierTypeFunc();
|
this.modifierType = modifierTypeFunc();
|
||||||
this.modifierType.id = Object.keys(modifierTypes).find(k => modifierTypes[k] === modifierTypeFunc)!; // TODO: is this bang correct?
|
this.modifierType.id = Object.keys(modifierTypes).find(k => modifierTypes[k] === modifierTypeFunc)!; // TODO: is this bang correct?
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
@ -1715,7 +1715,7 @@ const modifierPool: ModifierPool = {
|
|||||||
if (!party.find(p => p.getLearnableLevelMoves().length)) {
|
if (!party.find(p => p.getLearnableLevelMoves().length)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const highestPartyLevel = party.map(p => p.level).reduce((highestLevel: integer, level: integer) => Math.max(highestLevel, level), 1);
|
const highestPartyLevel = party.map(p => p.level).reduce((highestLevel: number, level: number) => Math.max(highestLevel, level), 1);
|
||||||
return Math.min(Math.ceil(highestPartyLevel / 20), 4);
|
return Math.min(Math.ceil(highestPartyLevel / 20), 4);
|
||||||
}, 4),
|
}, 4),
|
||||||
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
|
new WeightedModifierType(modifierTypes.BASE_STAT_BOOSTER, 3),
|
||||||
@ -1730,7 +1730,7 @@ const modifierPool: ModifierPool = {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}, 4),
|
}, 4),
|
||||||
new WeightedModifierType(modifierTypes.VOUCHER, (_party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1),
|
new WeightedModifierType(modifierTypes.VOUCHER, (_party: Pokemon[], rerollCount: number) => !globalScene.gameMode.isDaily ? Math.max(1 - rerollCount, 0) : 0, 1),
|
||||||
].map(m => {
|
].map(m => {
|
||||||
m.setTier(ModifierTier.GREAT); return m;
|
m.setTier(ModifierTier.GREAT); return m;
|
||||||
}),
|
}),
|
||||||
@ -1877,7 +1877,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
|
new WeightedModifierType(modifierTypes.RARE_FORM_CHANGE_ITEM, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 6, 24),
|
||||||
new WeightedModifierType(modifierTypes.MEGA_BRACELET, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
|
new WeightedModifierType(modifierTypes.MEGA_BRACELET, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
|
||||||
new WeightedModifierType(modifierTypes.DYNAMAX_BAND, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
|
new WeightedModifierType(modifierTypes.DYNAMAX_BAND, () => Math.min(Math.ceil(globalScene.currentBattle.waveIndex / 50), 4) * 9, 36),
|
||||||
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (_party: Pokemon[], rerollCount: integer) => !globalScene.gameMode.isDaily ? Math.max(3 - rerollCount * 1, 0) : 0, 3),
|
new WeightedModifierType(modifierTypes.VOUCHER_PLUS, (_party: Pokemon[], rerollCount: number) => !globalScene.gameMode.isDaily ? Math.max(3 - rerollCount * 1, 0) : 0, 3),
|
||||||
].map(m => {
|
].map(m => {
|
||||||
m.setTier(ModifierTier.ROGUE); return m;
|
m.setTier(ModifierTier.ROGUE); return m;
|
||||||
}),
|
}),
|
||||||
@ -1886,7 +1886,7 @@ const modifierPool: ModifierPool = {
|
|||||||
new WeightedModifierType(modifierTypes.SHINY_CHARM, 14),
|
new WeightedModifierType(modifierTypes.SHINY_CHARM, 14),
|
||||||
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
|
new WeightedModifierType(modifierTypes.HEALING_CHARM, 18),
|
||||||
new WeightedModifierType(modifierTypes.MULTI_LENS, 18),
|
new WeightedModifierType(modifierTypes.MULTI_LENS, 18),
|
||||||
new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (_party: Pokemon[], rerollCount: integer) =>
|
new WeightedModifierType(modifierTypes.VOUCHER_PREMIUM, (_party: Pokemon[], rerollCount: number) =>
|
||||||
!globalScene.gameMode.isDaily && !globalScene.gameMode.isEndless && !globalScene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5),
|
!globalScene.gameMode.isDaily && !globalScene.gameMode.isEndless && !globalScene.gameMode.isSplicedOnly ? Math.max(5 - rerollCount * 2, 0) : 0, 5),
|
||||||
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !(globalScene.gameMode.isClassic && globalScene.eventManager.areFusionsBoosted()) && !globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
|
new WeightedModifierType(modifierTypes.DNA_SPLICERS, (party: Pokemon[]) => !(globalScene.gameMode.isClassic && globalScene.eventManager.areFusionsBoosted()) && !globalScene.gameMode.isSplicedOnly && party.filter(p => !p.fusionSpecies).length > 1 ? 24 : 0, 24),
|
||||||
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, () => (globalScene.gameMode.isDaily || (!globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))) ? 1 : 0, 1),
|
new WeightedModifierType(modifierTypes.MINI_BLACK_HOLE, () => (globalScene.gameMode.isDaily || (!globalScene.gameMode.isFreshStartChallenge() && globalScene.gameData.isUnlocked(Unlockables.MINI_BLACK_HOLE))) ? 1 : 0, 1),
|
||||||
@ -2086,7 +2086,7 @@ const tierWeights = [ 768 / 1024, 195 / 1024, 48 / 1024, 12 / 1024, 1 / 1024 ];
|
|||||||
*/
|
*/
|
||||||
export const itemPoolChecks: Map<ModifierTypeKeys, boolean | undefined> = new Map();
|
export const itemPoolChecks: Map<ModifierTypeKeys, boolean | undefined> = new Map();
|
||||||
|
|
||||||
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: integer = 0) {
|
export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: ModifierPoolType, rerollCount: number = 0) {
|
||||||
const pool = getModifierPoolForType(poolType);
|
const pool = getModifierPoolForType(poolType);
|
||||||
itemPoolChecks.forEach((_v, k) => {
|
itemPoolChecks.forEach((_v, k) => {
|
||||||
itemPoolChecks.set(k, false);
|
itemPoolChecks.set(k, false);
|
||||||
@ -2100,7 +2100,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
|
|||||||
const tierModifierIds: string[] = [];
|
const tierModifierIds: string[] = [];
|
||||||
let tierMaxWeight = 0;
|
let tierMaxWeight = 0;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
pool[t].reduce((total: integer, modifierType: WeightedModifierType) => {
|
pool[t].reduce((total: number, modifierType: WeightedModifierType) => {
|
||||||
const weightedModifierType = modifierType as WeightedModifierType;
|
const weightedModifierType = modifierType as WeightedModifierType;
|
||||||
const existingModifiers = globalScene.findModifiers(m => m.type.id === weightedModifierType.modifierType.id, poolType === ModifierPoolType.PLAYER);
|
const existingModifiers = globalScene.findModifiers(m => m.type.id === weightedModifierType.modifierType.id, poolType === ModifierPoolType.PLAYER);
|
||||||
const itemModifierType = weightedModifierType.modifierType instanceof ModifierTypeGenerator
|
const itemModifierType = weightedModifierType.modifierType instanceof ModifierTypeGenerator
|
||||||
@ -2112,7 +2112,7 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
|
|||||||
|| existingModifiers.find(m => m.stackCount < m.getMaxStackCount(true))
|
|| existingModifiers.find(m => m.stackCount < m.getMaxStackCount(true))
|
||||||
? weightedModifierType.weight instanceof Function
|
? weightedModifierType.weight instanceof Function
|
||||||
? (weightedModifierType.weight as Function)(party, rerollCount)
|
? (weightedModifierType.weight as Function)(party, rerollCount)
|
||||||
: weightedModifierType.weight as integer
|
: weightedModifierType.weight as number
|
||||||
: 0;
|
: 0;
|
||||||
if (weightedModifierType.maxWeight) {
|
if (weightedModifierType.maxWeight) {
|
||||||
const modifierId = weightedModifierType.modifierType.id;
|
const modifierId = weightedModifierType.modifierType.id;
|
||||||
@ -2196,7 +2196,7 @@ export function getModifierTypeFuncById(id: string): ModifierTypeFunc {
|
|||||||
* - `rerollMultiplier?: number` If specified, can adjust the amount of money required for a shop reroll. If set to a negative value, the shop will not allow rerolls at all.
|
* - `rerollMultiplier?: number` If specified, can adjust the amount of money required for a shop reroll. If set to a negative value, the shop will not allow rerolls at all.
|
||||||
* - `allowLuckUpgrades?: boolean` Default `true`, if `false` will prevent set item tiers from upgrading via luck
|
* - `allowLuckUpgrades?: boolean` Default `true`, if `false` will prevent set item tiers from upgrading via luck
|
||||||
*/
|
*/
|
||||||
export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemon[], modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings): ModifierTypeOption[] {
|
export function getPlayerModifierTypeOptions(count: number, party: PlayerPokemon[], modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings): ModifierTypeOption[] {
|
||||||
const options: ModifierTypeOption[] = [];
|
const options: ModifierTypeOption[] = [];
|
||||||
const retryCount = Math.min(count * 5, 50);
|
const retryCount = Math.min(count * 5, 50);
|
||||||
if (!customModifierSettings) {
|
if (!customModifierSettings) {
|
||||||
@ -2257,7 +2257,7 @@ export function getPlayerModifierTypeOptions(count: integer, party: PlayerPokemo
|
|||||||
* @param tier If specified will generate item of tier
|
* @param tier If specified will generate item of tier
|
||||||
* @param allowLuckUpgrades `true` to allow items to upgrade tiers (the little animation that plays and is affected by luck)
|
* @param allowLuckUpgrades `true` to allow items to upgrade tiers (the little animation that plays and is affected by luck)
|
||||||
*/
|
*/
|
||||||
function getModifierTypeOptionWithRetry(existingOptions: ModifierTypeOption[], retryCount: integer, party: PlayerPokemon[], tier?: ModifierTier, allowLuckUpgrades?: boolean): ModifierTypeOption {
|
function getModifierTypeOptionWithRetry(existingOptions: ModifierTypeOption[], retryCount: number, party: PlayerPokemon[], tier?: ModifierTier, allowLuckUpgrades?: boolean): ModifierTypeOption {
|
||||||
allowLuckUpgrades = allowLuckUpgrades ?? true;
|
allowLuckUpgrades = allowLuckUpgrades ?? true;
|
||||||
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades);
|
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades);
|
||||||
let r = 0;
|
let r = 0;
|
||||||
@ -2292,7 +2292,7 @@ export function overridePlayerModifierTypeOptions(options: ModifierTypeOption[],
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, baseCost: integer): ModifierTypeOption[] {
|
export function getPlayerShopModifierTypeOptionsForWave(waveIndex: number, baseCost: number): ModifierTypeOption[] {
|
||||||
if (!(waveIndex % 10)) {
|
if (!(waveIndex % 10)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -2358,7 +2358,7 @@ export function getEnemyBuffModifierForWave(tier: ModifierTier, enemyModifiers:
|
|||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getEnemyModifierTypesForWave(waveIndex: integer, count: integer, party: EnemyPokemon[], poolType: ModifierPoolType.WILD | ModifierPoolType.TRAINER, upgradeChance: integer = 0): PokemonHeldItemModifierType[] {
|
export function getEnemyModifierTypesForWave(waveIndex: number, count: number, party: EnemyPokemon[], poolType: ModifierPoolType.WILD | ModifierPoolType.TRAINER, upgradeChance: number = 0): PokemonHeldItemModifierType[] {
|
||||||
const ret = new Array(count).fill(0).map(() => getNewModifierTypeOption(party, poolType, undefined, upgradeChance && !randSeedInt(upgradeChance) ? 1 : 0)?.type as PokemonHeldItemModifierType);
|
const ret = new Array(count).fill(0).map(() => getNewModifierTypeOption(party, poolType, undefined, upgradeChance && !randSeedInt(upgradeChance) ? 1 : 0)?.type as PokemonHeldItemModifierType);
|
||||||
if (!(waveIndex % 1000)) {
|
if (!(waveIndex % 1000)) {
|
||||||
ret.push(getModifierType(modifierTypes.MINI_BLACK_HOLE) as PokemonHeldItemModifierType);
|
ret.push(getModifierType(modifierTypes.MINI_BLACK_HOLE) as PokemonHeldItemModifierType);
|
||||||
@ -2402,7 +2402,7 @@ export function getDailyRunStarterModifiers(party: PlayerPokemon[]): PokemonHeld
|
|||||||
* @param retryCount Max allowed tries before the next tier down is checked for a valid ModifierType
|
* @param retryCount Max allowed tries before the next tier down is checked for a valid ModifierType
|
||||||
* @param allowLuckUpgrades Default true. If false, will not allow ModifierType to randomly upgrade to next tier
|
* @param allowLuckUpgrades Default true. If false, will not allow ModifierType to randomly upgrade to next tier
|
||||||
*/
|
*/
|
||||||
function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, tier?: ModifierTier, upgradeCount?: integer, retryCount: integer = 0, allowLuckUpgrades: boolean = true): ModifierTypeOption | null {
|
function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType, tier?: ModifierTier, upgradeCount?: number, retryCount: number = 0, allowLuckUpgrades: boolean = true): ModifierTypeOption | null {
|
||||||
const player = !poolType;
|
const player = !poolType;
|
||||||
const pool = getModifierPoolForType(poolType);
|
const pool = getModifierPoolForType(poolType);
|
||||||
let thresholds: object;
|
let thresholds: object;
|
||||||
@ -2481,7 +2481,7 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
|
|||||||
const tierThresholds = Object.keys(thresholds[tier]);
|
const tierThresholds = Object.keys(thresholds[tier]);
|
||||||
const totalWeight = parseInt(tierThresholds[tierThresholds.length - 1]);
|
const totalWeight = parseInt(tierThresholds[tierThresholds.length - 1]);
|
||||||
const value = randSeedInt(totalWeight);
|
const value = randSeedInt(totalWeight);
|
||||||
let index: integer | undefined;
|
let index: number | undefined;
|
||||||
for (const t of tierThresholds) {
|
for (const t of tierThresholds) {
|
||||||
const threshold = parseInt(t);
|
const threshold = parseInt(t);
|
||||||
if (value < threshold) {
|
if (value < threshold) {
|
||||||
@ -2523,10 +2523,10 @@ export function getDefaultModifierTypeForTier(tier: ModifierTier): ModifierType
|
|||||||
|
|
||||||
export class ModifierTypeOption {
|
export class ModifierTypeOption {
|
||||||
public type: ModifierType;
|
public type: ModifierType;
|
||||||
public upgradeCount: integer;
|
public upgradeCount: number;
|
||||||
public cost: integer;
|
public cost: number;
|
||||||
|
|
||||||
constructor(type: ModifierType, upgradeCount: integer, cost: number = 0) {
|
constructor(type: ModifierType, upgradeCount: number, cost: number = 0) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.upgradeCount = upgradeCount;
|
this.upgradeCount = upgradeCount;
|
||||||
this.cost = Math.min(Math.round(cost), Number.MAX_SAFE_INTEGER);
|
this.cost = Math.min(Math.round(cost), Number.MAX_SAFE_INTEGER);
|
||||||
@ -2538,7 +2538,7 @@ export class ModifierTypeOption {
|
|||||||
* @param party The player's party.
|
* @param party The player's party.
|
||||||
* @returns A number between 0 and 14 based on the party's total luck value, or a random number between 0 and 14 if the player is in Daily Run mode.
|
* @returns A number between 0 and 14 based on the party's total luck value, or a random number between 0 and 14 if the player is in Daily Run mode.
|
||||||
*/
|
*/
|
||||||
export function getPartyLuckValue(party: Pokemon[]): integer {
|
export function getPartyLuckValue(party: Pokemon[]): number {
|
||||||
if (globalScene.gameMode.isDaily) {
|
if (globalScene.gameMode.isDaily) {
|
||||||
const DailyLuck = new NumberHolder(0);
|
const DailyLuck = new NumberHolder(0);
|
||||||
globalScene.executeWithSeedOffset(() => {
|
globalScene.executeWithSeedOffset(() => {
|
||||||
@ -2548,15 +2548,15 @@ export function getPartyLuckValue(party: Pokemon[]): integer {
|
|||||||
}
|
}
|
||||||
const eventSpecies = globalScene.eventManager.getEventLuckBoostedSpecies();
|
const eventSpecies = globalScene.eventManager.getEventLuckBoostedSpecies();
|
||||||
const luck = Phaser.Math.Clamp(party.map(p => p.isAllowedInBattle() ? p.getLuck() + (eventSpecies.includes(p.species.speciesId) ? 1 : 0) : 0)
|
const luck = Phaser.Math.Clamp(party.map(p => p.isAllowedInBattle() ? p.getLuck() + (eventSpecies.includes(p.species.speciesId) ? 1 : 0) : 0)
|
||||||
.reduce((total: integer, value: integer) => total += value, 0), 0, 14);
|
.reduce((total: number, value: number) => total += value, 0), 0, 14);
|
||||||
return Math.min(globalScene.eventManager.getEventLuckBoost() + (luck ?? 0), 14);
|
return Math.min(globalScene.eventManager.getEventLuckBoost() + (luck ?? 0), 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLuckString(luckValue: integer): string {
|
export function getLuckString(luckValue: number): string {
|
||||||
return [ "D", "C", "C+", "B-", "B", "B+", "A-", "A", "A+", "A++", "S", "S+", "SS", "SS+", "SSS" ][luckValue];
|
return [ "D", "C", "C+", "B-", "B", "B+", "A-", "A", "A+", "A++", "S", "S+", "SS", "SS+", "SSS" ][luckValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLuckTextTint(luckValue: integer): integer {
|
export function getLuckTextTint(luckValue: number): number {
|
||||||
let modifierTier: ModifierTier;
|
let modifierTier: ModifierTier;
|
||||||
if (luckValue > 11) {
|
if (luckValue > 11) {
|
||||||
modifierTier = ModifierTier.LUXURY;
|
modifierTier = ModifierTier.LUXURY;
|
||||||
|
@ -126,9 +126,10 @@ class DefaultOverrides {
|
|||||||
/**
|
/**
|
||||||
* This will override the species of the fusion
|
* This will override the species of the fusion
|
||||||
*/
|
*/
|
||||||
readonly STARTER_FUSION_SPECIES_OVERRIDE: Species | integer = 0;
|
readonly STARTER_FUSION_SPECIES_OVERRIDE: Species | number = 0;
|
||||||
readonly ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
readonly ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
readonly PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
readonly PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
|
readonly HAS_PASSIVE_ABILITY_OVERRIDE: boolean | null = null;
|
||||||
readonly STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
readonly STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
||||||
readonly GENDER_OVERRIDE: Gender | null = null;
|
readonly GENDER_OVERRIDE: Gender | null = null;
|
||||||
readonly MOVESET_OVERRIDE: Moves | Array<Moves> = [];
|
readonly MOVESET_OVERRIDE: Moves | Array<Moves> = [];
|
||||||
@ -146,10 +147,11 @@ class DefaultOverrides {
|
|||||||
/**
|
/**
|
||||||
* This will override the species of the fusion only when the opponent is already a fusion
|
* This will override the species of the fusion only when the opponent is already a fusion
|
||||||
*/
|
*/
|
||||||
readonly OPP_FUSION_SPECIES_OVERRIDE: Species | integer = 0;
|
readonly OPP_FUSION_SPECIES_OVERRIDE: Species | number = 0;
|
||||||
readonly OPP_LEVEL_OVERRIDE: number = 0;
|
readonly OPP_LEVEL_OVERRIDE: number = 0;
|
||||||
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
readonly OPP_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
readonly OPP_PASSIVE_ABILITY_OVERRIDE: Abilities = Abilities.NONE;
|
||||||
|
readonly OPP_HAS_PASSIVE_ABILITY_OVERRIDE: boolean | null = null;
|
||||||
readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
readonly OPP_STATUS_OVERRIDE: StatusEffect = StatusEffect.NONE;
|
||||||
readonly OPP_GENDER_OVERRIDE: Gender | null = null;
|
readonly OPP_GENDER_OVERRIDE: Gender | null = null;
|
||||||
readonly OPP_MOVESET_OVERRIDE: Moves | Array<Moves> = [];
|
readonly OPP_MOVESET_OVERRIDE: Moves | Array<Moves> = [];
|
||||||
|
@ -24,7 +24,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
private pokeball: Phaser.GameObjects.Sprite;
|
private pokeball: Phaser.GameObjects.Sprite;
|
||||||
private originalY: number;
|
private originalY: number;
|
||||||
|
|
||||||
constructor(targetIndex: integer, pokeballType: PokeballType) {
|
constructor(targetIndex: number, pokeballType: PokeballType) {
|
||||||
super(BattlerIndex.ENEMY + targetIndex);
|
super(BattlerIndex.ENEMY + targetIndex);
|
||||||
|
|
||||||
this.pokeballType = pokeballType;
|
this.pokeballType = pokeballType;
|
||||||
@ -174,7 +174,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
failCatch(shakeCount: integer) {
|
failCatch(shakeCount: number) {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
globalScene.playSound("se/pb_rel");
|
globalScene.playSound("se/pb_rel");
|
||||||
@ -241,11 +241,10 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
};
|
};
|
||||||
const removePokemon = () => {
|
const removePokemon = () => {
|
||||||
globalScene.addFaintedEnemyScore(pokemon);
|
globalScene.addFaintedEnemyScore(pokemon);
|
||||||
globalScene.getPlayerField().filter(p => p.isActive(true)).forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
|
||||||
pokemon.hp = 0;
|
pokemon.hp = 0;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.trySetStatus(StatusEffect.FAINT);
|
||||||
globalScene.clearEnemyHeldItemModifiers();
|
globalScene.clearEnemyHeldItemModifiers();
|
||||||
globalScene.field.remove(pokemon, true);
|
pokemon.leaveField(true, true, true);
|
||||||
};
|
};
|
||||||
const addToParty = (slotIndex?: number) => {
|
const addToParty = (slotIndex?: number) => {
|
||||||
const newPokemon = pokemon.addToParty(this.pokeballType, slotIndex);
|
const newPokemon = pokemon.addToParty(this.pokeballType, slotIndex);
|
||||||
@ -276,7 +275,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
}, false);
|
}, false);
|
||||||
}, () => {
|
}, () => {
|
||||||
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
|
globalScene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: number, _option: PartyOption) => {
|
||||||
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
addToParty(slotIndex);
|
addToParty(slotIndex);
|
||||||
|
@ -10,10 +10,10 @@ import { SwitchPhase } from "./switch-phase";
|
|||||||
import { SwitchType } from "#enums/switch-type";
|
import { SwitchType } from "#enums/switch-type";
|
||||||
|
|
||||||
export class CheckSwitchPhase extends BattlePhase {
|
export class CheckSwitchPhase extends BattlePhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected useName: boolean;
|
protected useName: boolean;
|
||||||
|
|
||||||
constructor(fieldIndex: integer, useName: boolean) {
|
constructor(fieldIndex: number, useName: boolean) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
|
@ -25,9 +25,9 @@ import { ArenaTagSide } from "#app/data/arena-tag";
|
|||||||
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
|
|
||||||
export class CommandPhase extends FieldPhase {
|
export class CommandPhase extends FieldPhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
|
|
||||||
constructor(fieldIndex: integer) {
|
constructor(fieldIndex: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
@ -113,7 +113,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCommand(command: Command, cursor: integer, ...args: any[]): boolean {
|
handleCommand(command: Command, cursor: number, ...args: any[]): boolean {
|
||||||
const playerPokemon = globalScene.getPlayerField()[this.fieldIndex];
|
const playerPokemon = globalScene.getPlayerField()[this.fieldIndex];
|
||||||
let success: boolean = false;
|
let success: boolean = false;
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getFieldIndex(): integer {
|
getFieldIndex(): number {
|
||||||
return this.fieldIndex;
|
return this.fieldIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { PokemonPhase } from "./pokemon-phase";
|
|||||||
|
|
||||||
export class CommonAnimPhase extends PokemonPhase {
|
export class CommonAnimPhase extends PokemonPhase {
|
||||||
private anim: CommonAnim | null;
|
private anim: CommonAnim | null;
|
||||||
private targetIndex: integer | undefined;
|
private targetIndex: number | undefined;
|
||||||
private playOnEmptyField: boolean;
|
private playOnEmptyField: boolean;
|
||||||
|
|
||||||
constructor(battlerIndex?: BattlerIndex, targetIndex?: BattlerIndex, anim?: CommonAnim, playOnEmptyField: boolean = false) {
|
constructor(battlerIndex?: BattlerIndex, targetIndex?: BattlerIndex, anim?: CommonAnim, playOnEmptyField: boolean = false) {
|
||||||
|
@ -6,11 +6,11 @@ import { fixedInt } from "#app/utils";
|
|||||||
import { PokemonPhase } from "#app/phases/pokemon-phase";
|
import { PokemonPhase } from "#app/phases/pokemon-phase";
|
||||||
|
|
||||||
export class DamageAnimPhase extends PokemonPhase {
|
export class DamageAnimPhase extends PokemonPhase {
|
||||||
private amount: integer;
|
private amount: number;
|
||||||
private damageResult: DamageResult;
|
private damageResult: DamageResult;
|
||||||
private critical: boolean;
|
private critical: boolean;
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex, amount: integer, damageResult?: DamageResult, critical: boolean = false) {
|
constructor(battlerIndex: BattlerIndex, amount: number, damageResult?: DamageResult, critical: boolean = false) {
|
||||||
super(battlerIndex);
|
super(battlerIndex);
|
||||||
|
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
@ -35,7 +35,7 @@ export class DamageAnimPhase extends PokemonPhase {
|
|||||||
this.applyDamage();
|
this.applyDamage();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAmount(amount: integer): void {
|
updateAmount(amount: number): void {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
private eggHatchData: EggHatchData;
|
private eggHatchData: EggHatchData;
|
||||||
|
|
||||||
/** The number of eggs that are hatching */
|
/** The number of eggs that are hatching */
|
||||||
private eggsToHatchCount: integer;
|
private eggsToHatchCount: number;
|
||||||
/** The container that lists how many eggs are hatching */
|
/** The container that lists how many eggs are hatching */
|
||||||
private eggCounterContainer: EggCounterContainer;
|
private eggCounterContainer: EggCounterContainer;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
/** The newly hatched {@link PlayerPokemon} */
|
/** The newly hatched {@link PlayerPokemon} */
|
||||||
private pokemon: PlayerPokemon;
|
private pokemon: PlayerPokemon;
|
||||||
/** The index of which egg move is unlocked. 0-2 is common, 3 is rare */
|
/** The index of which egg move is unlocked. 0-2 is common, 3 is rare */
|
||||||
private eggMoveIndex: integer;
|
private eggMoveIndex: number;
|
||||||
/** Internal booleans representing if the egg is hatched, able to be skipped, or skipped */
|
/** Internal booleans representing if the egg is hatched, able to be skipped, or skipped */
|
||||||
private hatched: boolean;
|
private hatched: boolean;
|
||||||
private canSkip: boolean;
|
private canSkip: boolean;
|
||||||
@ -68,7 +68,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
private evolutionBgm: AnySound;
|
private evolutionBgm: AnySound;
|
||||||
private eggLapsePhase: EggLapsePhase;
|
private eggLapsePhase: EggLapsePhase;
|
||||||
|
|
||||||
constructor(hatchScene: EggLapsePhase, egg: Egg, eggsToHatchCount: integer) {
|
constructor(hatchScene: EggLapsePhase, egg: Egg, eggsToHatchCount: number) {
|
||||||
super();
|
super();
|
||||||
this.eggLapsePhase = hatchScene;
|
this.eggLapsePhase = hatchScene;
|
||||||
this.egg = egg;
|
this.egg = egg;
|
||||||
@ -221,7 +221,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param count the current number of times this function has been called.
|
* @param count the current number of times this function has been called.
|
||||||
* @returns nothing since it's a Promise<void>
|
* @returns nothing since it's a Promise<void>
|
||||||
*/
|
*/
|
||||||
doEggShake(intensity: number, repeatCount?: integer, count?: integer): Promise<void> {
|
doEggShake(intensity: number, repeatCount?: number, count?: number): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (repeatCount === undefined) {
|
if (repeatCount === undefined) {
|
||||||
repeatCount = 0;
|
repeatCount = 0;
|
||||||
@ -382,7 +382,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param amplitude Scaling
|
* @param amplitude Scaling
|
||||||
* @returns a number
|
* @returns a number
|
||||||
*/
|
*/
|
||||||
sin(index: integer, amplitude: integer): number {
|
sin(index: number, amplitude: number): number {
|
||||||
return amplitude * Math.sin(index * (Math.PI / 128));
|
return amplitude * Math.sin(index * (Math.PI / 128));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param intensity number of times this is repeated (this is a badly named variable)
|
* @param intensity number of times this is repeated (this is a badly named variable)
|
||||||
* @param offsetY how much to offset the Y coordinates
|
* @param offsetY how much to offset the Y coordinates
|
||||||
*/
|
*/
|
||||||
doSpray(intensity: integer, offsetY?: number) {
|
doSpray(intensity: number, offsetY?: number) {
|
||||||
globalScene.tweens.addCounter({
|
globalScene.tweens.addCounter({
|
||||||
repeat: intensity,
|
repeat: intensity,
|
||||||
duration: Utils.getFrameMs(1),
|
duration: Utils.getFrameMs(1),
|
||||||
@ -406,7 +406,7 @@ export class EggHatchPhase extends Phase {
|
|||||||
* @param trigIndex Used to modify the particle's vertical speed, is a random number from 0-7
|
* @param trigIndex Used to modify the particle's vertical speed, is a random number from 0-7
|
||||||
* @param offsetY how much to offset the Y coordinate
|
* @param offsetY how much to offset the Y coordinate
|
||||||
*/
|
*/
|
||||||
doSprayParticle(trigIndex: integer, offsetY: number) {
|
doSprayParticle(trigIndex: number, offsetY: number) {
|
||||||
const initialX = this.eggHatchBg.displayWidth / 2;
|
const initialX = this.eggHatchBg.displayWidth / 2;
|
||||||
const initialY = this.eggHatchBg.displayHeight / 2 + offsetY;
|
const initialY = this.eggHatchBg.displayHeight / 2 + offsetY;
|
||||||
const shardKey = !this.egg.isManaphyEgg() ? this.egg.tier.toString() : "1";
|
const shardKey = !this.egg.isManaphyEgg() ? this.egg.tier.toString() : "1";
|
||||||
|
@ -272,7 +272,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
const enemyField = globalScene.getEnemyField();
|
const enemyField = globalScene.getEnemyField();
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
targets: [ globalScene.arenaEnemy, globalScene.currentBattle.trainer, enemyField, globalScene.arenaPlayer, globalScene.trainer ].flat(),
|
targets: [ globalScene.arenaEnemy, globalScene.currentBattle.trainer, enemyField, globalScene.arenaPlayer, globalScene.trainer ].flat(),
|
||||||
x: (_target, _key, value, fieldIndex: integer) => fieldIndex < 2 + (enemyField.length) ? value + 300 : value - 300,
|
x: (_target, _key, value, fieldIndex: number) => fieldIndex < 2 + (enemyField.length) ? value + 300 : value - 300,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (!this.tryOverrideForBattleSpec()) {
|
if (!this.tryOverrideForBattleSpec()) {
|
||||||
|
@ -15,10 +15,10 @@ import { BattlerTagType } from "#enums/battler-tag-type";
|
|||||||
* @see {@linkcode EnemyPokemon.getNextMove}
|
* @see {@linkcode EnemyPokemon.getNextMove}
|
||||||
*/
|
*/
|
||||||
export class EnemyCommandPhase extends FieldPhase {
|
export class EnemyCommandPhase extends FieldPhase {
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected skipTurn: boolean = false;
|
protected skipTurn: boolean = false;
|
||||||
|
|
||||||
constructor(fieldIndex: integer) {
|
constructor(fieldIndex: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.fieldIndex = fieldIndex;
|
this.fieldIndex = fieldIndex;
|
||||||
|
@ -2,7 +2,7 @@ import type { EnemyPokemon } from "#app/field/pokemon";
|
|||||||
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
||||||
|
|
||||||
export abstract class EnemyPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
export abstract class EnemyPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
||||||
constructor(partyMemberIndex: integer) {
|
constructor(partyMemberIndex: number) {
|
||||||
super(partyMemberIndex, false);
|
super(partyMemberIndex, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import { EVOLVE_MOVE } from "#app/data/balance/pokemon-level-moves";
|
|||||||
|
|
||||||
export class EvolutionPhase extends Phase {
|
export class EvolutionPhase extends Phase {
|
||||||
protected pokemon: PlayerPokemon;
|
protected pokemon: PlayerPokemon;
|
||||||
protected lastLevel: integer;
|
protected lastLevel: number;
|
||||||
|
|
||||||
private preEvolvedPokemonName: string;
|
private preEvolvedPokemonName: string;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
protected pokemonEvoSprite: Phaser.GameObjects.Sprite;
|
protected pokemonEvoSprite: Phaser.GameObjects.Sprite;
|
||||||
protected pokemonEvoTintSprite: Phaser.GameObjects.Sprite;
|
protected pokemonEvoTintSprite: Phaser.GameObjects.Sprite;
|
||||||
|
|
||||||
constructor(pokemon: PlayerPokemon, evolution: SpeciesFormEvolution | null, lastLevel: integer) {
|
constructor(pokemon: PlayerPokemon, evolution: SpeciesFormEvolution | null, lastLevel: number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.pokemon = pokemon;
|
this.pokemon = pokemon;
|
||||||
@ -356,7 +356,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doCycle(l: number, lastCycle: integer = 15): Promise<boolean> {
|
doCycle(l: number, lastCycle: number = 15): Promise<boolean> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const isLastCycle = l === lastCycle;
|
const isLastCycle = l === lastCycle;
|
||||||
globalScene.tweens.add({
|
globalScene.tweens.add({
|
||||||
@ -427,7 +427,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
doSpiralUpwardParticle(trigIndex: integer) {
|
doSpiralUpwardParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const particle = globalScene.add.image(initialX, 0, "evo_sparkle");
|
const particle = globalScene.add.image(initialX, 0, "evo_sparkle");
|
||||||
this.evolutionContainer.add(particle);
|
this.evolutionContainer.add(particle);
|
||||||
@ -463,7 +463,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doArcDownParticle(trigIndex: integer) {
|
doArcDownParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const particle = globalScene.add.image(initialX, 0, "evo_sparkle");
|
const particle = globalScene.add.image(initialX, 0, "evo_sparkle");
|
||||||
particle.setScale(0.5);
|
particle.setScale(0.5);
|
||||||
@ -496,7 +496,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doCircleInwardParticle(trigIndex: integer, speed: integer) {
|
doCircleInwardParticle(trigIndex: number, speed: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
||||||
const particle = globalScene.add.image(initialX, initialY, "evo_sparkle");
|
const particle = globalScene.add.image(initialX, initialY, "evo_sparkle");
|
||||||
@ -528,7 +528,7 @@ export class EvolutionPhase extends Phase {
|
|||||||
updateParticle();
|
updateParticle();
|
||||||
}
|
}
|
||||||
|
|
||||||
doSprayParticle(trigIndex: integer) {
|
doSprayParticle(trigIndex: number) {
|
||||||
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
const initialX = this.evolutionBaseBg.displayWidth / 2;
|
||||||
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
const initialY = this.evolutionBaseBg.displayHeight / 2;
|
||||||
const particle = globalScene.add.image(initialX, initialY, "evo_sparkle");
|
const particle = globalScene.add.image(initialX, initialY, "evo_sparkle");
|
||||||
|
@ -9,7 +9,7 @@ import { LevelUpPhase } from "./level-up-phase";
|
|||||||
export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
export class ExpPhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private expValue: number;
|
private expValue: number;
|
||||||
|
|
||||||
constructor(partyMemberIndex: integer, expValue: number) {
|
constructor(partyMemberIndex: number, expValue: number) {
|
||||||
super(partyMemberIndex);
|
super(partyMemberIndex);
|
||||||
|
|
||||||
this.expValue = expValue;
|
this.expValue = expValue;
|
||||||
|
@ -181,9 +181,7 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
y: pokemon.y + 150,
|
y: pokemon.y + 150,
|
||||||
ease: "Sine.easeIn",
|
ease: "Sine.easeIn",
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.resetSprite();
|
|
||||||
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
pokemon.lapseTags(BattlerTagLapseType.FAINT);
|
||||||
globalScene.getField(true).filter(p => p !== pokemon).forEach(p => p.removeTagsBySourceId(pokemon.id));
|
|
||||||
|
|
||||||
pokemon.y -= 150;
|
pokemon.y -= 150;
|
||||||
pokemon.trySetStatus(StatusEffect.FAINT);
|
pokemon.trySetStatus(StatusEffect.FAINT);
|
||||||
@ -193,7 +191,7 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
globalScene.addFaintedEnemyScore(pokemon as EnemyPokemon);
|
globalScene.addFaintedEnemyScore(pokemon as EnemyPokemon);
|
||||||
globalScene.currentBattle.addPostBattleLoot(pokemon as EnemyPokemon);
|
globalScene.currentBattle.addPostBattleLoot(pokemon as EnemyPokemon);
|
||||||
}
|
}
|
||||||
globalScene.field.remove(pokemon);
|
pokemon.leaveField();
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
private learnMoveType: LearnMoveType;
|
private learnMoveType: LearnMoveType;
|
||||||
private cost: number;
|
private cost: number;
|
||||||
|
|
||||||
constructor(partyMemberIndex: integer, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
constructor(partyMemberIndex: number, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
||||||
super(partyMemberIndex);
|
super(partyMemberIndex);
|
||||||
this.moveId = moveId;
|
this.moveId = moveId;
|
||||||
this.learnMoveType = learnMoveType;
|
this.learnMoveType = learnMoveType;
|
||||||
@ -99,7 +99,7 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
async forgetMoveProcess(move: Move, pokemon: Pokemon) {
|
async forgetMoveProcess(move: Move, pokemon: Pokemon) {
|
||||||
globalScene.ui.setMode(this.messageMode);
|
globalScene.ui.setMode(this.messageMode);
|
||||||
await globalScene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
await globalScene.ui.showTextPromise(i18next.t("battle:learnMoveForgetQuestion"), undefined, true);
|
||||||
await globalScene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: integer) => {
|
await globalScene.ui.setModeWithoutClear(Mode.SUMMARY, pokemon, SummaryUiMode.LEARN_MOVE, move, (moveIndex: number) => {
|
||||||
if (moveIndex === 4) {
|
if (moveIndex === 4) {
|
||||||
globalScene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
globalScene.ui.setMode(this.messageMode).then(() => this.rejectMoveAndEnd(move, pokemon));
|
||||||
return;
|
return;
|
||||||
|
@ -3,12 +3,12 @@ import { Phase } from "#app/phase";
|
|||||||
|
|
||||||
export class MessagePhase extends Phase {
|
export class MessagePhase extends Phase {
|
||||||
private text: string;
|
private text: string;
|
||||||
private callbackDelay: integer | null;
|
private callbackDelay: number | null;
|
||||||
private prompt: boolean | null;
|
private prompt: boolean | null;
|
||||||
private promptDelay: integer | null;
|
private promptDelay: number | null;
|
||||||
private speaker?: string;
|
private speaker?: string;
|
||||||
|
|
||||||
constructor(text: string, callbackDelay?: integer | null, prompt?: boolean | null, promptDelay?: integer | null, speaker?: string) {
|
constructor(text: string, callbackDelay?: number | null, prompt?: boolean | null, promptDelay?: number | null, speaker?: string) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.text = text;
|
this.text = text;
|
||||||
|
@ -3,11 +3,11 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
|
|
||||||
export abstract class PartyMemberPokemonPhase extends FieldPhase {
|
export abstract class PartyMemberPokemonPhase extends FieldPhase {
|
||||||
protected partyMemberIndex: integer;
|
protected partyMemberIndex: number;
|
||||||
protected fieldIndex: integer;
|
protected fieldIndex: number;
|
||||||
protected player: boolean;
|
protected player: boolean;
|
||||||
|
|
||||||
constructor(partyMemberIndex: integer, player: boolean) {
|
constructor(partyMemberIndex: number, player: boolean) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.partyMemberIndex = partyMemberIndex;
|
this.partyMemberIndex = partyMemberIndex;
|
||||||
|
@ -2,7 +2,7 @@ import type { PlayerPokemon } from "#app/field/pokemon";
|
|||||||
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
import { PartyMemberPokemonPhase } from "./party-member-pokemon-phase";
|
||||||
|
|
||||||
export abstract class PlayerPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
export abstract class PlayerPartyMemberPokemonPhase extends PartyMemberPokemonPhase {
|
||||||
constructor(partyMemberIndex: integer) {
|
constructor(partyMemberIndex: number) {
|
||||||
super(partyMemberIndex, true);
|
super(partyMemberIndex, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ import { BattlerTagType } from "#app/enums/battler-tag-type";
|
|||||||
import type { HealBlockTag } from "#app/data/battler-tags";
|
import type { HealBlockTag } from "#app/data/battler-tags";
|
||||||
|
|
||||||
export class PokemonHealPhase extends CommonAnimPhase {
|
export class PokemonHealPhase extends CommonAnimPhase {
|
||||||
private hpHealed: integer;
|
private hpHealed: number;
|
||||||
private message: string | null;
|
private message: string | null;
|
||||||
private showFullHpMessage: boolean;
|
private showFullHpMessage: boolean;
|
||||||
private skipAnim: boolean;
|
private skipAnim: boolean;
|
||||||
@ -24,7 +24,7 @@ export class PokemonHealPhase extends CommonAnimPhase {
|
|||||||
private preventFullHeal: boolean;
|
private preventFullHeal: boolean;
|
||||||
private fullRestorePP: boolean;
|
private fullRestorePP: boolean;
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex, hpHealed: integer, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false, fullRestorePP: boolean = false) {
|
constructor(battlerIndex: BattlerIndex, hpHealed: number, message: string | null, showFullHpMessage: boolean, skipAnim: boolean = false, revive: boolean = false, healStatus: boolean = false, preventFullHeal: boolean = false, fullRestorePP: boolean = false) {
|
||||||
super(battlerIndex, undefined, CommonAnim.HEALTH_UP);
|
super(battlerIndex, undefined, CommonAnim.HEALTH_UP);
|
||||||
|
|
||||||
this.hpHealed = hpHealed;
|
this.hpHealed = hpHealed;
|
||||||
|
@ -4,11 +4,11 @@ import type Pokemon from "#app/field/pokemon";
|
|||||||
import { FieldPhase } from "./field-phase";
|
import { FieldPhase } from "./field-phase";
|
||||||
|
|
||||||
export abstract class PokemonPhase extends FieldPhase {
|
export abstract class PokemonPhase extends FieldPhase {
|
||||||
protected battlerIndex: BattlerIndex | integer;
|
protected battlerIndex: BattlerIndex | number;
|
||||||
public player: boolean;
|
public player: boolean;
|
||||||
public fieldIndex: integer;
|
public fieldIndex: number;
|
||||||
|
|
||||||
constructor(battlerIndex?: BattlerIndex | integer) {
|
constructor(battlerIndex?: BattlerIndex | number) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (battlerIndex === undefined) {
|
if (battlerIndex === undefined) {
|
||||||
|
@ -4,7 +4,7 @@ import { SwitchType } from "#enums/switch-type";
|
|||||||
import { SwitchSummonPhase } from "./switch-summon-phase";
|
import { SwitchSummonPhase } from "./switch-summon-phase";
|
||||||
|
|
||||||
export class ReturnPhase extends SwitchSummonPhase {
|
export class ReturnPhase extends SwitchSummonPhase {
|
||||||
constructor(fieldIndex: integer) {
|
constructor(fieldIndex: number) {
|
||||||
super(SwitchType.SWITCH, fieldIndex, -1, true);
|
super(SwitchType.SWITCH, fieldIndex, -1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ import i18next from "i18next";
|
|||||||
import { PokemonPhase } from "./pokemon-phase";
|
import { PokemonPhase } from "./pokemon-phase";
|
||||||
|
|
||||||
export class ScanIvsPhase extends PokemonPhase {
|
export class ScanIvsPhase extends PokemonPhase {
|
||||||
private shownIvs: integer;
|
private shownIvs: number;
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex, shownIvs: integer) {
|
constructor(battlerIndex: BattlerIndex, shownIvs: number) {
|
||||||
super(battlerIndex);
|
super(battlerIndex);
|
||||||
|
|
||||||
this.shownIvs = shownIvs;
|
this.shownIvs = shownIvs;
|
||||||
|
@ -37,7 +37,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
} else if (Array.isArray(biomeLinks[currentBiome])) {
|
||||||
let biomes: Biome[] = [];
|
let biomes: Biome[] = [];
|
||||||
globalScene.executeWithSeedOffset(() => {
|
globalScene.executeWithSeedOffset(() => {
|
||||||
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, integer])[])
|
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter(b => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter(b => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
||||||
.map(b => !Array.isArray(b) ? b : b[0]);
|
.map(b => !Array.isArray(b) ? b : b[0]);
|
||||||
}, globalScene.currentBattle.waveIndex);
|
}, globalScene.currentBattle.waveIndex);
|
||||||
@ -46,7 +46,7 @@ export class SelectBiomePhase extends BattlePhase {
|
|||||||
globalScene.executeWithSeedOffset(() => {
|
globalScene.executeWithSeedOffset(() => {
|
||||||
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
biomeChoices = (!Array.isArray(biomeLinks[currentBiome])
|
||||||
? [ biomeLinks[currentBiome] as Biome ]
|
? [ biomeLinks[currentBiome] as Biome ]
|
||||||
: biomeLinks[currentBiome] as (Biome | [Biome, integer])[])
|
: biomeLinks[currentBiome] as (Biome | [Biome, number])[])
|
||||||
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
.filter((b, i) => !Array.isArray(b) || !Utils.randSeedInt(b[1]))
|
||||||
.map(b => Array.isArray(b) ? b[0] : b);
|
.map(b => Array.isArray(b) ? b[0] : b);
|
||||||
}, globalScene.currentBattle.waveIndex);
|
}, globalScene.currentBattle.waveIndex);
|
||||||
|
@ -16,14 +16,14 @@ import type { CustomModifierSettings } from "#app/modifier/modifier-type";
|
|||||||
import { isNullOrUndefined, NumberHolder } from "#app/utils";
|
import { isNullOrUndefined, NumberHolder } from "#app/utils";
|
||||||
|
|
||||||
export class SelectModifierPhase extends BattlePhase {
|
export class SelectModifierPhase extends BattlePhase {
|
||||||
private rerollCount: integer;
|
private rerollCount: number;
|
||||||
private modifierTiers?: ModifierTier[];
|
private modifierTiers?: ModifierTier[];
|
||||||
private customModifierSettings?: CustomModifierSettings;
|
private customModifierSettings?: CustomModifierSettings;
|
||||||
private isCopy: boolean;
|
private isCopy: boolean;
|
||||||
|
|
||||||
private typeOptions: ModifierTypeOption[];
|
private typeOptions: ModifierTypeOption[];
|
||||||
|
|
||||||
constructor(rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
constructor(rerollCount: number = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.rerollCount = rerollCount;
|
this.rerollCount = rerollCount;
|
||||||
@ -66,7 +66,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
||||||
|
|
||||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
const modifierSelectCallback = (rowCursor: number, cursor: number) => {
|
||||||
if (rowCursor < 0 || cursor < 0) {
|
if (rowCursor < 0 || cursor < 0) {
|
||||||
globalScene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
globalScene.ui.showText(i18next.t("battle:skipItemQuestion"), null, () => {
|
||||||
globalScene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
globalScene.ui.setOverlayMode(Mode.CONFIRM, () => {
|
||||||
@ -78,7 +78,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let modifierType: ModifierType;
|
let modifierType: ModifierType;
|
||||||
let cost: integer;
|
let cost: number;
|
||||||
const rerollCost = this.getRerollCost(globalScene.lockModifierTiers);
|
const rerollCost = this.getRerollCost(globalScene.lockModifierTiers);
|
||||||
switch (rowCursor) {
|
switch (rowCursor) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -101,7 +101,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: number, itemIndex: number, itemQuantity: number, toSlotIndex: number) => {
|
||||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||||
const itemModifiers = globalScene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
const itemModifiers = globalScene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||||
&& m.isTransferable && m.pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
&& m.isTransferable && m.pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||||
@ -200,7 +200,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
|
|
||||||
if (modifierType! instanceof PokemonModifierType) { //TODO: is the bang correct?
|
if (modifierType! instanceof PokemonModifierType) { //TODO: is the bang correct?
|
||||||
if (modifierType instanceof FusePokemonModifierType) {
|
if (modifierType instanceof FusePokemonModifierType) {
|
||||||
globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: integer, spliceSlotIndex: integer) => {
|
globalScene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.SPLICE, -1, (fromSlotIndex: number, spliceSlotIndex: number) => {
|
||||||
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
if (spliceSlotIndex !== undefined && fromSlotIndex < 6 && spliceSlotIndex < 6 && fromSlotIndex !== spliceSlotIndex) {
|
||||||
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||||
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct?
|
const modifier = modifierType.newModifier(party[fromSlotIndex], party[spliceSlotIndex])!; //TODO: is the bang correct?
|
||||||
@ -223,13 +223,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
const tmMoveId = isTmModifier
|
const tmMoveId = isTmModifier
|
||||||
? (modifierType as TmModifierType).moveId
|
? (modifierType as TmModifierType).moveId
|
||||||
: undefined;
|
: undefined;
|
||||||
globalScene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: integer, option: PartyOption) => {
|
globalScene.ui.setModeWithoutClear(Mode.PARTY, partyUiMode, -1, (slotIndex: number, option: PartyOption) => {
|
||||||
if (slotIndex < 6) {
|
if (slotIndex < 6) {
|
||||||
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
globalScene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer()).then(() => {
|
||||||
const modifier = !isMoveModifier
|
const modifier = !isMoveModifier
|
||||||
? !isRememberMoveModifier
|
? !isRememberMoveModifier
|
||||||
? modifierType.newModifier(party[slotIndex])
|
? modifierType.newModifier(party[slotIndex])
|
||||||
: modifierType.newModifier(party[slotIndex], option as integer)
|
: modifierType.newModifier(party[slotIndex], option as number)
|
||||||
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
||||||
applyModifier(modifier!, true); // TODO: is the bang correct?
|
applyModifier(modifier!, true); // TODO: is the bang correct?
|
||||||
});
|
});
|
||||||
@ -291,7 +291,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||||||
return ModifierPoolType.PLAYER;
|
return ModifierPoolType.PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
getModifierTypeOptions(modifierCount: integer): ModifierTypeOption[] {
|
getModifierTypeOptions(modifierCount: number): ModifierTypeOption[] {
|
||||||
return getPlayerModifierTypeOptions(modifierCount, globalScene.getPlayerParty(), globalScene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
return getPlayerModifierTypeOptions(modifierCount, globalScene.getPlayerParty(), globalScene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
|
|
||||||
globalScene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
globalScene.ui.setMode(Mode.STARTER_SELECT, (starters: Starter[]) => {
|
||||||
globalScene.ui.clearText();
|
globalScene.ui.clearText();
|
||||||
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
globalScene.clearPhaseQueue();
|
globalScene.clearPhaseQueue();
|
||||||
globalScene.pushPhase(new TitlePhase());
|
globalScene.pushPhase(new TitlePhase());
|
||||||
@ -45,7 +45,7 @@ export class SelectStarterPhase extends Phase {
|
|||||||
initBattle(starters: Starter[]) {
|
initBattle(starters: Starter[]) {
|
||||||
const party = globalScene.getPlayerParty();
|
const party = globalScene.getPlayerParty();
|
||||||
const loadPokemonAssets: Promise<void>[] = [];
|
const loadPokemonAssets: Promise<void>[] = [];
|
||||||
starters.forEach((starter: Starter, i: integer) => {
|
starters.forEach((starter: Starter, i: number) => {
|
||||||
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
|
if (!i && Overrides.STARTER_SPECIES_OVERRIDE) {
|
||||||
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
starter.species = getPokemonSpecies(Overrides.STARTER_SPECIES_OVERRIDE as Species);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import i18next from "#app/plugins/i18n";
|
|||||||
import { allMoves } from "#app/data/move";
|
import { allMoves } from "#app/data/move";
|
||||||
|
|
||||||
export class SelectTargetPhase extends PokemonPhase {
|
export class SelectTargetPhase extends PokemonPhase {
|
||||||
constructor(fieldIndex: integer) {
|
constructor(fieldIndex: number) {
|
||||||
super(fieldIndex);
|
super(fieldIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-pha
|
|||||||
export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
|
export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
|
||||||
private expValue: number;
|
private expValue: number;
|
||||||
|
|
||||||
constructor(partyMemberIndex: integer, expValue: number) {
|
constructor(partyMemberIndex: number, expValue: number) {
|
||||||
super(partyMemberIndex);
|
super(partyMemberIndex);
|
||||||
|
|
||||||
this.expValue = expValue;
|
this.expValue = expValue;
|
||||||
|
@ -16,14 +16,14 @@ export type StatStageChangeCallback = (target: Pokemon | null, changed: BattleSt
|
|||||||
export class StatStageChangePhase extends PokemonPhase {
|
export class StatStageChangePhase extends PokemonPhase {
|
||||||
private stats: BattleStat[];
|
private stats: BattleStat[];
|
||||||
private selfTarget: boolean;
|
private selfTarget: boolean;
|
||||||
private stages: integer;
|
private stages: number;
|
||||||
private showMessage: boolean;
|
private showMessage: boolean;
|
||||||
private ignoreAbilities: boolean;
|
private ignoreAbilities: boolean;
|
||||||
private canBeCopied: boolean;
|
private canBeCopied: boolean;
|
||||||
private onChange: StatStageChangeCallback | null;
|
private onChange: StatStageChangeCallback | null;
|
||||||
|
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: integer, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null) {
|
constructor(battlerIndex: BattlerIndex, selfTarget: boolean, stats: BattleStat[], stages: number, showMessage: boolean = true, ignoreAbilities: boolean = false, canBeCopied: boolean = true, onChange: StatStageChangeCallback | null = null) {
|
||||||
super(battlerIndex);
|
super(battlerIndex);
|
||||||
|
|
||||||
this.selfTarget = selfTarget;
|
this.selfTarget = selfTarget;
|
||||||
@ -211,7 +211,7 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatStageChangeMessages(stats: BattleStat[], stages: integer, relStages: integer[]): string[] {
|
getStatStageChangeMessages(stats: BattleStat[], stages: number, relStages: number[]): string[] {
|
||||||
const messages: string[] = [];
|
const messages: string[] = [];
|
||||||
|
|
||||||
const relStageStatIndexes = {};
|
const relStageStatIndexes = {};
|
||||||
|
@ -4,7 +4,7 @@ import { SummonPhase } from "./summon-phase";
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
|
||||||
export class SummonMissingPhase extends SummonPhase {
|
export class SummonMissingPhase extends SummonPhase {
|
||||||
constructor(fieldIndex: integer) {
|
constructor(fieldIndex: number) {
|
||||||
super(fieldIndex);
|
super(fieldIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ import { globalScene } from "#app/global-scene";
|
|||||||
export class SummonPhase extends PartyMemberPokemonPhase {
|
export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
private loaded: boolean;
|
private loaded: boolean;
|
||||||
|
|
||||||
constructor(fieldIndex: integer, player: boolean = true, loaded: boolean = false) {
|
constructor(fieldIndex: number, player: boolean = true, loaded: boolean = false) {
|
||||||
super(fieldIndex, player);
|
super(fieldIndex, player);
|
||||||
|
|
||||||
this.loaded = loaded;
|
this.loaded = loaded;
|
||||||
|
@ -11,7 +11,7 @@ import { SwitchSummonPhase } from "./switch-summon-phase";
|
|||||||
* for the player (if a switch would be valid for the current battle state).
|
* for the player (if a switch would be valid for the current battle state).
|
||||||
*/
|
*/
|
||||||
export class SwitchPhase extends BattlePhase {
|
export class SwitchPhase extends BattlePhase {
|
||||||
protected readonly fieldIndex: integer;
|
protected readonly fieldIndex: number;
|
||||||
private readonly switchType: SwitchType;
|
private readonly switchType: SwitchType;
|
||||||
private readonly isModal: boolean;
|
private readonly isModal: boolean;
|
||||||
private readonly doReturn: boolean;
|
private readonly doReturn: boolean;
|
||||||
@ -25,7 +25,7 @@ export class SwitchPhase extends BattlePhase {
|
|||||||
* @param doReturn Indicates if the party member on the field should be
|
* @param doReturn Indicates if the party member on the field should be
|
||||||
* recalled to ball or has already left the field. Passed to {@linkcode SwitchSummonPhase}.
|
* recalled to ball or has already left the field. Passed to {@linkcode SwitchSummonPhase}.
|
||||||
*/
|
*/
|
||||||
constructor(switchType: SwitchType, fieldIndex: integer, isModal: boolean, doReturn: boolean) {
|
constructor(switchType: SwitchType, fieldIndex: number, isModal: boolean, doReturn: boolean) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.switchType = switchType;
|
this.switchType = switchType;
|
||||||
@ -61,7 +61,7 @@ export class SwitchPhase extends BattlePhase {
|
|||||||
// Override field index to 0 in case of double battle where 2/3 remaining legal party members fainted at once
|
// Override field index to 0 in case of double battle where 2/3 remaining legal party members fainted at once
|
||||||
const fieldIndex = globalScene.currentBattle.getBattlerCount() === 1 || globalScene.getPokemonAllowedInBattle().length > 1 ? this.fieldIndex : 0;
|
const fieldIndex = globalScene.currentBattle.getBattlerCount() === 1 || globalScene.getPokemonAllowedInBattle().length > 1 ? this.fieldIndex : 0;
|
||||||
|
|
||||||
globalScene.ui.setMode(Mode.PARTY, this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH, fieldIndex, (slotIndex: integer, option: PartyOption) => {
|
globalScene.ui.setMode(Mode.PARTY, this.isModal ? PartyUiMode.FAINT_SWITCH : PartyUiMode.POST_BATTLE_SWITCH, fieldIndex, (slotIndex: number, option: PartyOption) => {
|
||||||
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
if (slotIndex >= globalScene.currentBattle.getBattlerCount() && slotIndex < 6) {
|
||||||
// Remove any pre-existing PostSummonPhase under the same field index.
|
// Remove any pre-existing PostSummonPhase under the same field index.
|
||||||
// Pre-existing PostSummonPhases may occur when this phase is invoked during a prompt to switch at the start of a wave.
|
// Pre-existing PostSummonPhases may occur when this phase is invoked during a prompt to switch at the start of a wave.
|
||||||
|
@ -16,7 +16,7 @@ import { SwitchType } from "#enums/switch-type";
|
|||||||
|
|
||||||
export class SwitchSummonPhase extends SummonPhase {
|
export class SwitchSummonPhase extends SummonPhase {
|
||||||
private readonly switchType: SwitchType;
|
private readonly switchType: SwitchType;
|
||||||
private readonly slotIndex: integer;
|
private readonly slotIndex: number;
|
||||||
private readonly doReturn: boolean;
|
private readonly doReturn: boolean;
|
||||||
|
|
||||||
private lastPokemon: Pokemon;
|
private lastPokemon: Pokemon;
|
||||||
@ -29,7 +29,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
* @param doReturn boolean whether to render "comeback" dialogue
|
* @param doReturn boolean whether to render "comeback" dialogue
|
||||||
* @param player boolean if the switch is from the player
|
* @param player boolean if the switch is from the player
|
||||||
*/
|
*/
|
||||||
constructor(switchType: SwitchType, fieldIndex: integer, slotIndex: integer, doReturn: boolean, player?: boolean) {
|
constructor(switchType: SwitchType, fieldIndex: number, slotIndex: number, doReturn: boolean, player?: boolean) {
|
||||||
super(fieldIndex, player !== undefined ? player : true);
|
super(fieldIndex, player !== undefined ? player : true);
|
||||||
|
|
||||||
this.switchType = switchType;
|
this.switchType = switchType;
|
||||||
@ -64,6 +64,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
|
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
(this.player ? globalScene.getEnemyField() : globalScene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
(this.player ? globalScene.getEnemyField() : globalScene.getPlayerField()).forEach(enemyPokemon => enemyPokemon.removeTagsBySourceId(pokemon.id));
|
||||||
|
|
||||||
if (this.switchType === SwitchType.SWITCH || this.switchType === SwitchType.INITIAL_SWITCH) {
|
if (this.switchType === SwitchType.SWITCH || this.switchType === SwitchType.INITIAL_SWITCH) {
|
||||||
const substitute = pokemon.getTag(SubstituteTag);
|
const substitute = pokemon.getTag(SubstituteTag);
|
||||||
if (substitute) {
|
if (substitute) {
|
||||||
@ -93,8 +94,8 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
ease: "Sine.easeIn",
|
ease: "Sine.easeIn",
|
||||||
scale: 0.5,
|
scale: 0.5,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
pokemon.leaveField(this.switchType === SwitchType.SWITCH, false);
|
|
||||||
globalScene.time.delayedCall(750, () => this.switchAndSummon());
|
globalScene.time.delayedCall(750, () => this.switchAndSummon());
|
||||||
|
pokemon.leaveField(this.switchType === SwitchType.SWITCH, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ export class TitlePhase extends Phase {
|
|||||||
label: i18next.t("menu:loadGame"),
|
label: i18next.t("menu:loadGame"),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
globalScene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD,
|
globalScene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD,
|
||||||
(slotId: integer) => {
|
(slotId: number) => {
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
return this.showOptions();
|
return this.showOptions();
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ export class TitlePhase extends Phase {
|
|||||||
globalScene.ui.setMode(Mode.TITLE, config);
|
globalScene.ui.setMode(Mode.TITLE, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSaveSlot(slotId: integer): void {
|
loadSaveSlot(slotId: number): void {
|
||||||
globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
globalScene.sessionSlotId = slotId > -1 || !loggedInUser ? slotId : loggedInUser.lastSessionSlot;
|
||||||
globalScene.ui.setMode(Mode.MESSAGE);
|
globalScene.ui.setMode(Mode.MESSAGE);
|
||||||
globalScene.ui.resetModeChain();
|
globalScene.ui.resetModeChain();
|
||||||
@ -192,7 +192,7 @@ export class TitlePhase extends Phase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initDailyRun(): void {
|
initDailyRun(): void {
|
||||||
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => {
|
globalScene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: number) => {
|
||||||
globalScene.clearPhaseQueue();
|
globalScene.clearPhaseQueue();
|
||||||
if (slotId === -1) {
|
if (slotId === -1) {
|
||||||
globalScene.pushPhase(new TitlePhase());
|
globalScene.pushPhase(new TitlePhase());
|
||||||
|
@ -18,7 +18,7 @@ export class VictoryPhase extends PokemonPhase {
|
|||||||
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
/** If true, indicates that the phase is intended for EXP purposes only, and not to continue a battle to next phase */
|
||||||
isExpOnly: boolean;
|
isExpOnly: boolean;
|
||||||
|
|
||||||
constructor(battlerIndex: BattlerIndex | integer, isExpOnly: boolean = false) {
|
constructor(battlerIndex: BattlerIndex | number, isExpOnly: boolean = false) {
|
||||||
super(battlerIndex);
|
super(battlerIndex);
|
||||||
|
|
||||||
this.isExpOnly = isExpOnly;
|
this.isExpOnly = isExpOnly;
|
||||||
|
@ -351,7 +351,7 @@ export default class SpritePipeline extends FieldSpritePipeline {
|
|||||||
|
|
||||||
const data = sprite.pipelineData;
|
const data = sprite.pipelineData;
|
||||||
const tone = data["tone"] as number[];
|
const tone = data["tone"] as number[];
|
||||||
const teraColor = data["teraColor"] as integer[] ?? [ 0, 0, 0 ];
|
const teraColor = data["teraColor"] as number[] ?? [ 0, 0, 0 ];
|
||||||
const hasShadow = data["hasShadow"] as boolean;
|
const hasShadow = data["hasShadow"] as boolean;
|
||||||
const yShadowOffset = data["yShadowOffset"] as number;
|
const yShadowOffset = data["yShadowOffset"] as number;
|
||||||
const ignoreFieldPos = data["ignoreFieldPos"] as boolean;
|
const ignoreFieldPos = data["ignoreFieldPos"] as boolean;
|
||||||
@ -389,8 +389,8 @@ export default class SpritePipeline extends FieldSpritePipeline {
|
|||||||
const fusionSpriteColors = ((ignoreOverride && data["fusionSpriteColorsBase"]) || data["fusionSpriteColors"] || []) as number[][];
|
const fusionSpriteColors = ((ignoreOverride && data["fusionSpriteColorsBase"]) || data["fusionSpriteColors"] || []) as number[][];
|
||||||
|
|
||||||
const emptyColors = [ 0, 0, 0, 0 ];
|
const emptyColors = [ 0, 0, 0, 0 ];
|
||||||
const flatSpriteColors: integer[] = [];
|
const flatSpriteColors: number[] = [];
|
||||||
const flatFusionSpriteColors: integer[] = [];
|
const flatFusionSpriteColors: number[] = [];
|
||||||
for (let c = 0; c < 32; c++) {
|
for (let c = 0; c < 32; c++) {
|
||||||
flatSpriteColors.splice(flatSpriteColors.length, 0, ...(c < spriteColors.length ? spriteColors[c] : emptyColors));
|
flatSpriteColors.splice(flatSpriteColors.length, 0, ...(c < spriteColors.length ? spriteColors[c] : emptyColors));
|
||||||
flatFusionSpriteColors.splice(flatFusionSpriteColors.length, 0, ...(c < fusionSpriteColors.length ? fusionSpriteColors[c] : emptyColors));
|
flatFusionSpriteColors.splice(flatFusionSpriteColors.length, 0, ...(c < fusionSpriteColors.length ? fusionSpriteColors[c] : emptyColors));
|
||||||
@ -406,14 +406,14 @@ export default class SpritePipeline extends FieldSpritePipeline {
|
|||||||
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
||||||
const data = sprite.pipelineData;
|
const data = sprite.pipelineData;
|
||||||
|
|
||||||
const variant: integer = data.hasOwnProperty("variant")
|
const variant: number = data.hasOwnProperty("variant")
|
||||||
? data["variant"]
|
? data["variant"]
|
||||||
: sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.variant
|
: sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.variant
|
||||||
: 0;
|
: 0;
|
||||||
let variantColors;
|
let variantColors;
|
||||||
|
|
||||||
const emptyColors = [ 0, 0, 0, 0 ];
|
const emptyColors = [ 0, 0, 0, 0 ];
|
||||||
const flatBaseColors: integer[] = [];
|
const flatBaseColors: number[] = [];
|
||||||
const flatVariantColors: number[] = [];
|
const flatVariantColors: number[] = [];
|
||||||
|
|
||||||
if ((sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.shiny : !!data["shiny"])
|
if ((sprite.parentContainer instanceof Pokemon ? sprite.parentContainer.shiny : !!data["shiny"])
|
||||||
|
@ -41,7 +41,7 @@ export class SceneBase extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSpritesheet(key: string, folder: string, size: integer, filename?: string) {
|
loadSpritesheet(key: string, folder: string, size: number, filename?: string) {
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
filename = `${key}.png`;
|
filename = `${key}.png`;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ export class Achv {
|
|||||||
public name: string;
|
public name: string;
|
||||||
public description: string;
|
public description: string;
|
||||||
public iconImage: string;
|
public iconImage: string;
|
||||||
public score: integer;
|
public score: number;
|
||||||
|
|
||||||
public secret: boolean;
|
public secret: boolean;
|
||||||
public hasParent: boolean;
|
public hasParent: boolean;
|
||||||
@ -33,7 +33,7 @@ export class Achv {
|
|||||||
|
|
||||||
private conditionFunc: ConditionFn | undefined;
|
private conditionFunc: ConditionFn | undefined;
|
||||||
|
|
||||||
constructor(localizationKey:string, name: string, description: string, iconImage: string, score: integer, conditionFunc?: ConditionFn) {
|
constructor(localizationKey:string, name: string, description: string, iconImage: string, score: number, conditionFunc?: ConditionFn) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.iconImage = iconImage;
|
this.iconImage = iconImage;
|
||||||
@ -89,58 +89,58 @@ export class Achv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class MoneyAchv extends Achv {
|
export class MoneyAchv extends Achv {
|
||||||
moneyAmount: integer;
|
moneyAmount: number;
|
||||||
|
|
||||||
constructor(localizationKey: string, name: string, moneyAmount: integer, iconImage: string, score: integer) {
|
constructor(localizationKey: string, name: string, moneyAmount: number, iconImage: string, score: number) {
|
||||||
super(localizationKey, name, "", iconImage, score, (_args: any[]) => globalScene.money >= this.moneyAmount);
|
super(localizationKey, name, "", iconImage, score, (_args: any[]) => globalScene.money >= this.moneyAmount);
|
||||||
this.moneyAmount = moneyAmount;
|
this.moneyAmount = moneyAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RibbonAchv extends Achv {
|
export class RibbonAchv extends Achv {
|
||||||
ribbonAmount: integer;
|
ribbonAmount: number;
|
||||||
|
|
||||||
constructor(localizationKey: string, name: string, ribbonAmount: integer, iconImage: string, score: integer) {
|
constructor(localizationKey: string, name: string, ribbonAmount: number, iconImage: string, score: number) {
|
||||||
super(localizationKey, name, "", iconImage, score, (_args: any[]) => globalScene.gameData.gameStats.ribbonsOwned >= this.ribbonAmount);
|
super(localizationKey, name, "", iconImage, score, (_args: any[]) => globalScene.gameData.gameStats.ribbonsOwned >= this.ribbonAmount);
|
||||||
this.ribbonAmount = ribbonAmount;
|
this.ribbonAmount = ribbonAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DamageAchv extends Achv {
|
export class DamageAchv extends Achv {
|
||||||
damageAmount: integer;
|
damageAmount: number;
|
||||||
|
|
||||||
constructor(localizationKey: string, name: string, damageAmount: integer, iconImage: string, score: integer) {
|
constructor(localizationKey: string, name: string, damageAmount: number, iconImage: string, score: number) {
|
||||||
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.damageAmount);
|
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.damageAmount);
|
||||||
this.damageAmount = damageAmount;
|
this.damageAmount = damageAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HealAchv extends Achv {
|
export class HealAchv extends Achv {
|
||||||
healAmount: integer;
|
healAmount: number;
|
||||||
|
|
||||||
constructor(localizationKey: string, name: string, healAmount: integer, iconImage: string, score: integer) {
|
constructor(localizationKey: string, name: string, healAmount: number, iconImage: string, score: number) {
|
||||||
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.healAmount);
|
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.healAmount);
|
||||||
this.healAmount = healAmount;
|
this.healAmount = healAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LevelAchv extends Achv {
|
export class LevelAchv extends Achv {
|
||||||
level: integer;
|
level: number;
|
||||||
|
|
||||||
constructor(localizationKey: string, name: string, level: integer, iconImage: string, score: integer) {
|
constructor(localizationKey: string, name: string, level: number, iconImage: string, score: number) {
|
||||||
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.level);
|
super(localizationKey, name, "", iconImage, score, (args: any[]) => (args[0] instanceof Utils.NumberHolder ? args[0].value : args[0]) >= this.level);
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ModifierAchv extends Achv {
|
export class ModifierAchv extends Achv {
|
||||||
constructor(localizationKey: string, name: string, description: string, iconImage: string, score: integer, modifierFunc: (modifier: Modifier) => boolean) {
|
constructor(localizationKey: string, name: string, description: string, iconImage: string, score: number, modifierFunc: (modifier: Modifier) => boolean) {
|
||||||
super(localizationKey, name, description, iconImage, score, (args: any[]) => modifierFunc((args[0] as Modifier)));
|
super(localizationKey, name, description, iconImage, score, (args: any[]) => modifierFunc((args[0] as Modifier)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ChallengeAchv extends Achv {
|
export class ChallengeAchv extends Achv {
|
||||||
constructor(localizationKey: string, name: string, description: string, iconImage: string, score: integer, challengeFunc: (challenge: Challenge) => boolean) {
|
constructor(localizationKey: string, name: string, description: string, iconImage: string, score: number, challengeFunc: (challenge: Challenge) => boolean) {
|
||||||
super(localizationKey, name, description, iconImage, score, (args: any[]) => challengeFunc(args[0] as Challenge));
|
super(localizationKey, name, description, iconImage, score, (args: any[]) => challengeFunc(args[0] as Challenge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ export const achvs = {
|
|||||||
|
|
||||||
export function initAchievements() {
|
export function initAchievements() {
|
||||||
const achvKeys = Object.keys(achvs);
|
const achvKeys = Object.keys(achvs);
|
||||||
achvKeys.forEach((a: string, i: integer) => {
|
achvKeys.forEach((a: string, i: number) => {
|
||||||
achvs[a].id = a;
|
achvs[a].id = a;
|
||||||
if (achvs[a].hasParent) {
|
if (achvs[a].hasParent) {
|
||||||
achvs[a].parentId = achvKeys[i - 1];
|
achvs[a].parentId = achvKeys[i - 1];
|
||||||
|
@ -2,9 +2,9 @@ import type { Challenge } from "#app/data/challenge";
|
|||||||
import { copyChallenge } from "#app/data/challenge";
|
import { copyChallenge } from "#app/data/challenge";
|
||||||
|
|
||||||
export default class ChallengeData {
|
export default class ChallengeData {
|
||||||
public id: integer;
|
public id: number;
|
||||||
public value: integer;
|
public value: number;
|
||||||
public severity: integer;
|
public severity: number;
|
||||||
|
|
||||||
constructor(source: Challenge | any) {
|
constructor(source: Challenge | any) {
|
||||||
this.id = source.id;
|
this.id = source.id;
|
||||||
|
@ -5,11 +5,11 @@ import { EGG_SEED, Egg } from "../data/egg";
|
|||||||
import type { EggSourceType } from "#app/enums/egg-source-types";
|
import type { EggSourceType } from "#app/enums/egg-source-types";
|
||||||
|
|
||||||
export default class EggData {
|
export default class EggData {
|
||||||
public id: integer;
|
public id: number;
|
||||||
public tier: EggTier;
|
public tier: EggTier;
|
||||||
public sourceType: EggSourceType;
|
public sourceType: EggSourceType;
|
||||||
public hatchWaves: integer;
|
public hatchWaves: number;
|
||||||
public timestamp: integer;
|
public timestamp: number;
|
||||||
public variantTier: VariantTier;
|
public variantTier: VariantTier;
|
||||||
public isShiny: boolean;
|
public isShiny: boolean;
|
||||||
public species: Species;
|
public species: Species;
|
||||||
|
@ -70,7 +70,7 @@ export const defaultStarterSpecies: Species[] = [
|
|||||||
|
|
||||||
const saveKey = "x0i2O7WRiANTqPmZ"; // Temporary; secure encryption is not yet necessary
|
const saveKey = "x0i2O7WRiANTqPmZ"; // Temporary; secure encryption is not yet necessary
|
||||||
|
|
||||||
export function getDataTypeKey(dataType: GameDataType, slotId: integer = 0): string {
|
export function getDataTypeKey(dataType: GameDataType, slotId: number = 0): string {
|
||||||
switch (dataType) {
|
switch (dataType) {
|
||||||
case GameDataType.SYSTEM:
|
case GameDataType.SYSTEM:
|
||||||
return "data";
|
return "data";
|
||||||
@ -104,8 +104,8 @@ export function decrypt(data: string, bypassLogin: boolean): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface SystemSaveData {
|
export interface SystemSaveData {
|
||||||
trainerId: integer;
|
trainerId: number;
|
||||||
secretId: integer;
|
secretId: number;
|
||||||
gender: PlayerGender;
|
gender: PlayerGender;
|
||||||
dexData: DexData;
|
dexData: DexData;
|
||||||
starterData: StarterData;
|
starterData: StarterData;
|
||||||
@ -116,14 +116,14 @@ export interface SystemSaveData {
|
|||||||
voucherCounts: VoucherCounts;
|
voucherCounts: VoucherCounts;
|
||||||
eggs: EggData[];
|
eggs: EggData[];
|
||||||
gameVersion: string;
|
gameVersion: string;
|
||||||
timestamp: integer;
|
timestamp: number;
|
||||||
eggPity: integer[];
|
eggPity: number[];
|
||||||
unlockPity: integer[];
|
unlockPity: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SessionSaveData {
|
export interface SessionSaveData {
|
||||||
seed: string;
|
seed: string;
|
||||||
playTime: integer;
|
playTime: number;
|
||||||
gameMode: GameModes;
|
gameMode: GameModes;
|
||||||
party: PokemonData[];
|
party: PokemonData[];
|
||||||
enemyParty: PokemonData[];
|
enemyParty: PokemonData[];
|
||||||
@ -131,46 +131,46 @@ export interface SessionSaveData {
|
|||||||
enemyModifiers: PersistentModifierData[];
|
enemyModifiers: PersistentModifierData[];
|
||||||
arena: ArenaData;
|
arena: ArenaData;
|
||||||
pokeballCounts: PokeballCounts;
|
pokeballCounts: PokeballCounts;
|
||||||
money: integer;
|
money: number;
|
||||||
score: integer;
|
score: number;
|
||||||
waveIndex: integer;
|
waveIndex: number;
|
||||||
battleType: BattleType;
|
battleType: BattleType;
|
||||||
trainer: TrainerData;
|
trainer: TrainerData;
|
||||||
gameVersion: string;
|
gameVersion: string;
|
||||||
timestamp: integer;
|
timestamp: number;
|
||||||
challenges: ChallengeData[];
|
challenges: ChallengeData[];
|
||||||
mysteryEncounterType: MysteryEncounterType | -1; // Only defined when current wave is ME,
|
mysteryEncounterType: MysteryEncounterType | -1; // Only defined when current wave is ME,
|
||||||
mysteryEncounterSaveData: MysteryEncounterSaveData;
|
mysteryEncounterSaveData: MysteryEncounterSaveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Unlocks {
|
interface Unlocks {
|
||||||
[key: integer]: boolean;
|
[key: number]: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AchvUnlocks {
|
interface AchvUnlocks {
|
||||||
[key: string]: integer
|
[key: string]: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface VoucherUnlocks {
|
interface VoucherUnlocks {
|
||||||
[key: string]: integer
|
[key: string]: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VoucherCounts {
|
export interface VoucherCounts {
|
||||||
[type: string]: integer;
|
[type: string]: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DexData {
|
export interface DexData {
|
||||||
[key: integer]: DexEntry
|
[key: number]: DexEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DexEntry {
|
export interface DexEntry {
|
||||||
seenAttr: bigint;
|
seenAttr: bigint;
|
||||||
caughtAttr: bigint;
|
caughtAttr: bigint;
|
||||||
natureAttr: integer,
|
natureAttr: number,
|
||||||
seenCount: integer;
|
seenCount: number;
|
||||||
caughtCount: integer;
|
caughtCount: number;
|
||||||
hatchedCount: integer;
|
hatchedCount: number;
|
||||||
ivs: integer[];
|
ivs: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DexAttr = {
|
export const DexAttr = {
|
||||||
@ -188,7 +188,7 @@ export interface DexAttrProps {
|
|||||||
shiny: boolean;
|
shiny: boolean;
|
||||||
female: boolean;
|
female: boolean;
|
||||||
variant: Variant;
|
variant: Variant;
|
||||||
formIndex: integer;
|
formIndex: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AbilityAttr = {
|
export const AbilityAttr = {
|
||||||
@ -209,18 +209,18 @@ export interface RunEntry {
|
|||||||
export type StarterMoveset = [ Moves ] | [ Moves, Moves ] | [ Moves, Moves, Moves ] | [ Moves, Moves, Moves, Moves ];
|
export type StarterMoveset = [ Moves ] | [ Moves, Moves ] | [ Moves, Moves, Moves ] | [ Moves, Moves, Moves, Moves ];
|
||||||
|
|
||||||
export interface StarterFormMoveData {
|
export interface StarterFormMoveData {
|
||||||
[key: integer]: StarterMoveset
|
[key: number]: StarterMoveset
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StarterMoveData {
|
export interface StarterMoveData {
|
||||||
[key: integer]: StarterMoveset | StarterFormMoveData
|
[key: number]: StarterMoveset | StarterFormMoveData
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StarterAttributes {
|
export interface StarterAttributes {
|
||||||
nature?: integer;
|
nature?: number;
|
||||||
ability?: integer;
|
ability?: number;
|
||||||
variant?: integer;
|
variant?: number;
|
||||||
form?: integer;
|
form?: number;
|
||||||
female?: boolean;
|
female?: boolean;
|
||||||
shiny?: boolean;
|
shiny?: boolean;
|
||||||
favorite?: boolean;
|
favorite?: boolean;
|
||||||
@ -228,7 +228,7 @@ export interface StarterAttributes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface StarterPreferences {
|
export interface StarterPreferences {
|
||||||
[key: integer]: StarterAttributes;
|
[key: number]: StarterAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the latest data saved/loaded for the Starter Preferences. Required to reduce read/writes. Initialize as "{}", since this is the default value and no data needs to be stored if present.
|
// the latest data saved/loaded for the Starter Preferences. Required to reduce read/writes. Initialize as "{}", since this is the default value and no data needs to be stored if present.
|
||||||
@ -263,17 +263,17 @@ export class StarterPrefs {
|
|||||||
|
|
||||||
export interface StarterDataEntry {
|
export interface StarterDataEntry {
|
||||||
moveset: StarterMoveset | StarterFormMoveData | null;
|
moveset: StarterMoveset | StarterFormMoveData | null;
|
||||||
eggMoves: integer;
|
eggMoves: number;
|
||||||
candyCount: integer;
|
candyCount: number;
|
||||||
friendship: integer;
|
friendship: number;
|
||||||
abilityAttr: integer;
|
abilityAttr: number;
|
||||||
passiveAttr: integer;
|
passiveAttr: number;
|
||||||
valueReduction: integer;
|
valueReduction: number;
|
||||||
classicWinCount: integer;
|
classicWinCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StarterData {
|
export interface StarterData {
|
||||||
[key: integer]: StarterDataEntry
|
[key: number]: StarterDataEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TutorialFlags {
|
export interface TutorialFlags {
|
||||||
@ -303,8 +303,8 @@ const systemShortKeys = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export class GameData {
|
export class GameData {
|
||||||
public trainerId: integer;
|
public trainerId: number;
|
||||||
public secretId: integer;
|
public secretId: number;
|
||||||
|
|
||||||
public gender: PlayerGender;
|
public gender: PlayerGender;
|
||||||
|
|
||||||
@ -323,8 +323,8 @@ export class GameData {
|
|||||||
public voucherUnlocks: VoucherUnlocks;
|
public voucherUnlocks: VoucherUnlocks;
|
||||||
public voucherCounts: VoucherCounts;
|
public voucherCounts: VoucherCounts;
|
||||||
public eggs: Egg[];
|
public eggs: Egg[];
|
||||||
public eggPity: integer[];
|
public eggPity: number[];
|
||||||
public unlockPity: integer[];
|
public unlockPity: number[];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.loadSettings();
|
this.loadSettings();
|
||||||
@ -733,7 +733,7 @@ export class GameData {
|
|||||||
* @param valueIndex index of the setting's option
|
* @param valueIndex index of the setting's option
|
||||||
* @returns true
|
* @returns true
|
||||||
*/
|
*/
|
||||||
public saveSetting(setting: string, valueIndex: integer): boolean {
|
public saveSetting(setting: string, valueIndex: number): boolean {
|
||||||
let settings: object = {};
|
let settings: object = {};
|
||||||
if (localStorage.hasOwnProperty("settings")) {
|
if (localStorage.hasOwnProperty("settings")) {
|
||||||
settings = JSON.parse(localStorage.getItem("settings")!); // TODO: is this bang correct?
|
settings = JSON.parse(localStorage.getItem("settings")!); // TODO: is this bang correct?
|
||||||
@ -816,7 +816,7 @@ export class GameData {
|
|||||||
* to update the specified setting with the new value. Finally, it saves the updated settings back
|
* to update the specified setting with the new value. Finally, it saves the updated settings back
|
||||||
* to localStorage and returns `true` to indicate success.
|
* to localStorage and returns `true` to indicate success.
|
||||||
*/
|
*/
|
||||||
public saveControlSetting(device: Device, localStoragePropertyName: string, setting: SettingGamepad|SettingKeyboard, settingDefaults, valueIndex: integer): boolean {
|
public saveControlSetting(device: Device, localStoragePropertyName: string, setting: SettingGamepad|SettingKeyboard, settingDefaults, valueIndex: number): boolean {
|
||||||
let settingsControls: object = {}; // Initialize an empty object to hold the gamepad settings
|
let settingsControls: object = {}; // Initialize an empty object to hold the gamepad settings
|
||||||
|
|
||||||
if (localStorage.hasOwnProperty(localStoragePropertyName)) { // Check if 'settingsControls' exists in localStorage
|
if (localStorage.hasOwnProperty(localStoragePropertyName)) { // Check if 'settingsControls' exists in localStorage
|
||||||
@ -968,7 +968,7 @@ export class GameData {
|
|||||||
} as SessionSaveData;
|
} as SessionSaveData;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSession(slotId: integer): Promise<SessionSaveData | null> {
|
getSession(slotId: number): Promise<SessionSaveData | null> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
if (slotId < 0) {
|
if (slotId < 0) {
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
@ -1006,7 +1006,7 @@ export class GameData {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadSession(slotId: integer, sessionData?: SessionSaveData): Promise<boolean> {
|
loadSession(slotId: number, sessionData?: SessionSaveData): Promise<boolean> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const initSessionFromData = async (sessionData: SessionSaveData) => {
|
const initSessionFromData = async (sessionData: SessionSaveData) => {
|
||||||
@ -1137,7 +1137,7 @@ export class GameData {
|
|||||||
* @param slotId the slot to clear
|
* @param slotId the slot to clear
|
||||||
* @returns Promise with result `true` if the session was deleted successfully, `false` otherwise
|
* @returns Promise with result `true` if the session was deleted successfully, `false` otherwise
|
||||||
*/
|
*/
|
||||||
deleteSession(slotId: integer): Promise<boolean> {
|
deleteSession(slotId: number): Promise<boolean> {
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
localStorage.removeItem(`sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`);
|
localStorage.removeItem(`sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`);
|
||||||
@ -1206,7 +1206,7 @@ export class GameData {
|
|||||||
* After session data is removed, attempt to update user info so the menu updates
|
* After session data is removed, attempt to update user info so the menu updates
|
||||||
* To delete an unfinished run instead, use {@linkcode deleteSession}
|
* To delete an unfinished run instead, use {@linkcode deleteSession}
|
||||||
*/
|
*/
|
||||||
async tryClearSession(slotId: integer): Promise<[success: boolean, newClear: boolean]> {
|
async tryClearSession(slotId: number): Promise<[success: boolean, newClear: boolean]> {
|
||||||
let result: [boolean, boolean] = [ false, false ];
|
let result: [boolean, boolean] = [ false, false ];
|
||||||
|
|
||||||
if (bypassLogin) {
|
if (bypassLogin) {
|
||||||
@ -1361,7 +1361,7 @@ export class GameData {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public tryExportData(dataType: GameDataType, slotId: integer = 0): Promise<boolean> {
|
public tryExportData(dataType: GameDataType, slotId: number = 0): Promise<boolean> {
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
const dataKey: string = `${getDataTypeKey(dataType, slotId)}_${loggedInUser?.username}`;
|
const dataKey: string = `${getDataTypeKey(dataType, slotId)}_${loggedInUser?.username}`;
|
||||||
const handleData = (dataStr: string) => {
|
const handleData = (dataStr: string) => {
|
||||||
@ -1407,7 +1407,7 @@ export class GameData {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public importData(dataType: GameDataType, slotId: integer = 0): void {
|
public importData(dataType: GameDataType, slotId: number = 0): void {
|
||||||
const dataKey = `${getDataTypeKey(dataType, slotId)}_${loggedInUser?.username}`;
|
const dataKey = `${getDataTypeKey(dataType, slotId)}_${loggedInUser?.username}`;
|
||||||
|
|
||||||
let saveFile: any = document.getElementById("saveFile");
|
let saveFile: any = document.getElementById("saveFile");
|
||||||
@ -1695,7 +1695,7 @@ export class GameData {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
incrementRibbonCount(species: PokemonSpecies, forStarter: boolean = false): integer {
|
incrementRibbonCount(species: PokemonSpecies, forStarter: boolean = false): number {
|
||||||
const speciesIdToIncrement: Species = species.getRootSpeciesId(forStarter);
|
const speciesIdToIncrement: Species = species.getRootSpeciesId(forStarter);
|
||||||
|
|
||||||
if (!this.starterData[speciesIdToIncrement].classicWinCount) {
|
if (!this.starterData[speciesIdToIncrement].classicWinCount) {
|
||||||
@ -1706,7 +1706,7 @@ export class GameData {
|
|||||||
globalScene.gameData.gameStats.ribbonsOwned++;
|
globalScene.gameData.gameStats.ribbonsOwned++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ribbonsInStats: integer = globalScene.gameData.gameStats.ribbonsOwned;
|
const ribbonsInStats: number = globalScene.gameData.gameStats.ribbonsOwned;
|
||||||
|
|
||||||
if (ribbonsInStats >= 100) {
|
if (ribbonsInStats >= 100) {
|
||||||
globalScene.validateAchv(achvs._100_RIBBONS);
|
globalScene.validateAchv(achvs._100_RIBBONS);
|
||||||
@ -1733,7 +1733,7 @@ export class GameData {
|
|||||||
* @param species
|
* @param species
|
||||||
* @param count
|
* @param count
|
||||||
*/
|
*/
|
||||||
addStarterCandy(species: PokemonSpecies, count: integer): void {
|
addStarterCandy(species: PokemonSpecies, count: number): void {
|
||||||
// Only gain candies if the Pokemon has already been marked as caught in dex (ignore "rental" pokemon)
|
// Only gain candies if the Pokemon has already been marked as caught in dex (ignore "rental" pokemon)
|
||||||
const speciesRootForm = species.getRootSpeciesId();
|
const speciesRootForm = species.getRootSpeciesId();
|
||||||
if (globalScene.gameData.dexData[speciesRootForm].caughtAttr) {
|
if (globalScene.gameData.dexData[speciesRootForm].caughtAttr) {
|
||||||
@ -1749,7 +1749,7 @@ export class GameData {
|
|||||||
* @param showMessage Default true. If true, will display message for unlocked egg move
|
* @param showMessage Default true. If true, will display message for unlocked egg move
|
||||||
* @param prependSpeciesToMessage Default false. If true, will change message from "X Egg Move Unlocked!" to "Bulbasaur X Egg Move Unlocked!"
|
* @param prependSpeciesToMessage Default false. If true, will change message from "X Egg Move Unlocked!" to "Bulbasaur X Egg Move Unlocked!"
|
||||||
*/
|
*/
|
||||||
setEggMoveUnlocked(species: PokemonSpecies, eggMoveIndex: integer, showMessage: boolean = true, prependSpeciesToMessage: boolean = false): Promise<boolean> {
|
setEggMoveUnlocked(species: PokemonSpecies, eggMoveIndex: number, showMessage: boolean = true, prependSpeciesToMessage: boolean = false): Promise<boolean> {
|
||||||
return new Promise<boolean>(resolve => {
|
return new Promise<boolean>(resolve => {
|
||||||
const speciesId = species.speciesId;
|
const speciesId = species.speciesId;
|
||||||
if (!speciesEggMoves.hasOwnProperty(speciesId) || !speciesEggMoves[speciesId][eggMoveIndex]) {
|
if (!speciesEggMoves.hasOwnProperty(speciesId) || !speciesEggMoves[speciesId][eggMoveIndex]) {
|
||||||
@ -1808,7 +1808,7 @@ export class GameData {
|
|||||||
_unlockSpeciesNature(species.speciesId);
|
_unlockSpeciesNature(species.speciesId);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpeciesDexIvs(speciesId: Species, ivs: integer[]): void {
|
updateSpeciesDexIvs(speciesId: Species, ivs: number[]): void {
|
||||||
let dexEntry: DexEntry;
|
let dexEntry: DexEntry;
|
||||||
do {
|
do {
|
||||||
dexEntry = globalScene.gameData.dexData[speciesId];
|
dexEntry = globalScene.gameData.dexData[speciesId];
|
||||||
@ -1824,7 +1824,7 @@ export class GameData {
|
|||||||
} while (pokemonPrevolutions.hasOwnProperty(speciesId) && (speciesId = pokemonPrevolutions[speciesId]));
|
} while (pokemonPrevolutions.hasOwnProperty(speciesId) && (speciesId = pokemonPrevolutions[speciesId]));
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeciesCount(dexEntryPredicate: (entry: DexEntry) => boolean): integer {
|
getSpeciesCount(dexEntryPredicate: (entry: DexEntry) => boolean): number {
|
||||||
const dexKeys = Object.keys(this.dexData);
|
const dexKeys = Object.keys(this.dexData);
|
||||||
let speciesCount = 0;
|
let speciesCount = 0;
|
||||||
for (const s of dexKeys) {
|
for (const s of dexKeys) {
|
||||||
@ -1835,7 +1835,7 @@ export class GameData {
|
|||||||
return speciesCount;
|
return speciesCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStarterCount(dexEntryPredicate: (entry: DexEntry) => boolean): integer {
|
getStarterCount(dexEntryPredicate: (entry: DexEntry) => boolean): number {
|
||||||
const starterKeys = Object.keys(speciesStarterCosts);
|
const starterKeys = Object.keys(speciesStarterCosts);
|
||||||
let starterCount = 0;
|
let starterCount = 0;
|
||||||
for (const s of starterKeys) {
|
for (const s of starterKeys) {
|
||||||
@ -1906,7 +1906,7 @@ export class GameData {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
getStarterSpeciesDefaultAbilityIndex(species: PokemonSpecies): integer {
|
getStarterSpeciesDefaultAbilityIndex(species: PokemonSpecies): number {
|
||||||
const abilityAttr = this.starterData[species.speciesId].abilityAttr;
|
const abilityAttr = this.starterData[species.speciesId].abilityAttr;
|
||||||
return abilityAttr & AbilityAttr.ABILITY_1 ? 0 : !species.ability2 || abilityAttr & AbilityAttr.ABILITY_2 ? 1 : 2;
|
return abilityAttr & AbilityAttr.ABILITY_1 ? 0 : !species.ability2 || abilityAttr & AbilityAttr.ABILITY_2 ? 1 : 2;
|
||||||
}
|
}
|
||||||
@ -1921,15 +1921,15 @@ export class GameData {
|
|||||||
return 0 as Nature;
|
return 0 as Nature;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSpeciesDefaultNatureAttr(species: PokemonSpecies): integer {
|
getSpeciesDefaultNatureAttr(species: PokemonSpecies): number {
|
||||||
return 1 << (this.getSpeciesDefaultNature(species));
|
return 1 << (this.getSpeciesDefaultNature(species));
|
||||||
}
|
}
|
||||||
|
|
||||||
getDexAttrLuck(dexAttr: bigint): integer {
|
getDexAttrLuck(dexAttr: bigint): number {
|
||||||
return dexAttr & DexAttr.SHINY ? dexAttr & DexAttr.VARIANT_3 ? 3 : dexAttr & DexAttr.VARIANT_2 ? 2 : 1 : 0;
|
return dexAttr & DexAttr.SHINY ? dexAttr & DexAttr.VARIANT_3 ? 3 : dexAttr & DexAttr.VARIANT_2 ? 2 : 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getNaturesForAttr(natureAttr: integer = 0): Nature[] {
|
getNaturesForAttr(natureAttr: number = 0): Nature[] {
|
||||||
const ret: Nature[] = [];
|
const ret: Nature[] = [];
|
||||||
for (let n = 0; n < 25; n++) {
|
for (let n = 0; n < 25; n++) {
|
||||||
if (natureAttr & (1 << (n + 1))) {
|
if (natureAttr & (1 << (n + 1))) {
|
||||||
@ -1962,7 +1962,7 @@ export class GameData {
|
|||||||
return cost.value;
|
return cost.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormIndex(attr: bigint): integer {
|
getFormIndex(attr: bigint): number {
|
||||||
if (!attr || attr < DexAttr.DEFAULT_FORM) {
|
if (!attr || attr < DexAttr.DEFAULT_FORM) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1973,7 +1973,7 @@ export class GameData {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormAttr(formIndex: integer): bigint {
|
getFormAttr(formIndex: number): bigint {
|
||||||
return BigInt(1) << BigInt(7 + formIndex);
|
return BigInt(1) << BigInt(7 + formIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
// public (.*?): integer;
|
// public (.*?): number;
|
||||||
// this.$1 = source?.$1 || 0;
|
// this.$1 = source?.$1 || 0;
|
||||||
|
|
||||||
export class GameStats {
|
export class GameStats {
|
||||||
public playTime: integer;
|
public playTime: number;
|
||||||
public battles: integer;
|
public battles: number;
|
||||||
public classicSessionsPlayed: integer;
|
public classicSessionsPlayed: number;
|
||||||
public sessionsWon: integer;
|
public sessionsWon: number;
|
||||||
public ribbonsOwned: integer;
|
public ribbonsOwned: number;
|
||||||
public dailyRunSessionsPlayed: integer;
|
public dailyRunSessionsPlayed: number;
|
||||||
public dailyRunSessionsWon: integer;
|
public dailyRunSessionsWon: number;
|
||||||
public endlessSessionsPlayed: integer;
|
public endlessSessionsPlayed: number;
|
||||||
public highestEndlessWave: integer;
|
public highestEndlessWave: number;
|
||||||
public highestLevel: integer;
|
public highestLevel: number;
|
||||||
public highestMoney: integer;
|
public highestMoney: number;
|
||||||
public highestDamage: integer;
|
public highestDamage: number;
|
||||||
public highestHeal: integer;
|
public highestHeal: number;
|
||||||
public pokemonSeen: integer;
|
public pokemonSeen: number;
|
||||||
public pokemonDefeated: integer;
|
public pokemonDefeated: number;
|
||||||
public pokemonCaught: integer;
|
public pokemonCaught: number;
|
||||||
public pokemonHatched: integer;
|
public pokemonHatched: number;
|
||||||
public subLegendaryPokemonSeen: integer;
|
public subLegendaryPokemonSeen: number;
|
||||||
public subLegendaryPokemonCaught: integer;
|
public subLegendaryPokemonCaught: number;
|
||||||
public subLegendaryPokemonHatched: integer;
|
public subLegendaryPokemonHatched: number;
|
||||||
public legendaryPokemonSeen: integer;
|
public legendaryPokemonSeen: number;
|
||||||
public legendaryPokemonCaught: integer;
|
public legendaryPokemonCaught: number;
|
||||||
public legendaryPokemonHatched: integer;
|
public legendaryPokemonHatched: number;
|
||||||
public mythicalPokemonSeen: integer;
|
public mythicalPokemonSeen: number;
|
||||||
public mythicalPokemonCaught: integer;
|
public mythicalPokemonCaught: number;
|
||||||
public mythicalPokemonHatched: integer;
|
public mythicalPokemonHatched: number;
|
||||||
public shinyPokemonSeen: integer;
|
public shinyPokemonSeen: number;
|
||||||
public shinyPokemonCaught: integer;
|
public shinyPokemonCaught: number;
|
||||||
public shinyPokemonHatched: integer;
|
public shinyPokemonHatched: number;
|
||||||
public pokemonFused: integer;
|
public pokemonFused: number;
|
||||||
public trainersDefeated: integer;
|
public trainersDefeated: number;
|
||||||
public eggsPulled: integer;
|
public eggsPulled: number;
|
||||||
public rareEggsPulled: integer;
|
public rareEggsPulled: number;
|
||||||
public epicEggsPulled: integer;
|
public epicEggsPulled: number;
|
||||||
public legendaryEggsPulled: integer;
|
public legendaryEggsPulled: number;
|
||||||
public manaphyEggsPulled: integer;
|
public manaphyEggsPulled: number;
|
||||||
|
|
||||||
constructor(source?: any) {
|
constructor(source?: any) {
|
||||||
this.playTime = source?.playTime || 0;
|
this.playTime = source?.playTime || 0;
|
||||||
|
@ -8,7 +8,7 @@ export default class ModifierData {
|
|||||||
public typeId: string;
|
public typeId: string;
|
||||||
public typePregenArgs: any[];
|
public typePregenArgs: any[];
|
||||||
public args: any[];
|
public args: any[];
|
||||||
public stackCount: integer;
|
public stackCount: number;
|
||||||
|
|
||||||
public className: string;
|
public className: string;
|
||||||
|
|
||||||
|
@ -15,47 +15,47 @@ import type { Species } from "#enums/species";
|
|||||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||||
|
|
||||||
export default class PokemonData {
|
export default class PokemonData {
|
||||||
public id: integer;
|
public id: number;
|
||||||
public player: boolean;
|
public player: boolean;
|
||||||
public species: Species;
|
public species: Species;
|
||||||
public nickname: string;
|
public nickname: string;
|
||||||
public formIndex: integer;
|
public formIndex: number;
|
||||||
public abilityIndex: integer;
|
public abilityIndex: number;
|
||||||
public passive: boolean;
|
public passive: boolean;
|
||||||
public shiny: boolean;
|
public shiny: boolean;
|
||||||
public variant: Variant;
|
public variant: Variant;
|
||||||
public pokeball: PokeballType;
|
public pokeball: PokeballType;
|
||||||
public level: integer;
|
public level: number;
|
||||||
public exp: integer;
|
public exp: number;
|
||||||
public levelExp: integer;
|
public levelExp: number;
|
||||||
public gender: Gender;
|
public gender: Gender;
|
||||||
public hp: integer;
|
public hp: number;
|
||||||
public stats: integer[];
|
public stats: number[];
|
||||||
public ivs: integer[];
|
public ivs: number[];
|
||||||
public nature: Nature;
|
public nature: Nature;
|
||||||
public moveset: (PokemonMove | null)[];
|
public moveset: (PokemonMove | null)[];
|
||||||
public status: Status | null;
|
public status: Status | null;
|
||||||
public friendship: integer;
|
public friendship: number;
|
||||||
public metLevel: integer;
|
public metLevel: number;
|
||||||
public metBiome: Biome | -1; // -1 for starters
|
public metBiome: Biome | -1; // -1 for starters
|
||||||
public metSpecies: Species;
|
public metSpecies: Species;
|
||||||
public metWave: number; // 0 for unknown (previous saves), -1 for starters
|
public metWave: number; // 0 for unknown (previous saves), -1 for starters
|
||||||
public luck: integer;
|
public luck: number;
|
||||||
public pauseEvolutions: boolean;
|
public pauseEvolutions: boolean;
|
||||||
public pokerus: boolean;
|
public pokerus: boolean;
|
||||||
public usedTMs: Moves[];
|
public usedTMs: Moves[];
|
||||||
public evoCounter: integer;
|
public evoCounter: number;
|
||||||
|
|
||||||
public fusionSpecies: Species;
|
public fusionSpecies: Species;
|
||||||
public fusionFormIndex: integer;
|
public fusionFormIndex: number;
|
||||||
public fusionAbilityIndex: integer;
|
public fusionAbilityIndex: number;
|
||||||
public fusionShiny: boolean;
|
public fusionShiny: boolean;
|
||||||
public fusionVariant: Variant;
|
public fusionVariant: Variant;
|
||||||
public fusionGender: Gender;
|
public fusionGender: Gender;
|
||||||
public fusionLuck: integer;
|
public fusionLuck: number;
|
||||||
|
|
||||||
public boss: boolean;
|
public boss: boolean;
|
||||||
public bossSegments?: integer;
|
public bossSegments?: number;
|
||||||
|
|
||||||
public summonData: PokemonSummonData;
|
public summonData: PokemonSummonData;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ export default class PokemonData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toPokemon(battleType?: BattleType, partyMemberIndex: integer = 0, double: boolean = false): Pokemon {
|
toPokemon(battleType?: BattleType, partyMemberIndex: number = 0, double: boolean = false): Pokemon {
|
||||||
const species = getPokemonSpecies(this.species);
|
const species = getPokemonSpecies(this.species);
|
||||||
const ret: Pokemon = this.player
|
const ret: Pokemon = this.player
|
||||||
? globalScene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this, (playerPokemon) => {
|
? globalScene.addPlayerPokemon(species, this.level, this.abilityIndex, this.formIndex, this.gender, this.shiny, this.variant, this.ivs, this.nature, this, (playerPokemon) => {
|
||||||
|
@ -10,13 +10,13 @@ export enum SessionHistoryResult {
|
|||||||
|
|
||||||
export interface SessionHistory {
|
export interface SessionHistory {
|
||||||
seed: string;
|
seed: string;
|
||||||
playTime: integer;
|
playTime: number;
|
||||||
result: SessionHistoryResult,
|
result: SessionHistoryResult,
|
||||||
gameMode: GameModes;
|
gameMode: GameModes;
|
||||||
party: PokemonData[];
|
party: PokemonData[];
|
||||||
modifiers: PersistentModifierData[];
|
modifiers: PersistentModifierData[];
|
||||||
money: integer;
|
money: number;
|
||||||
waveIndex: integer;
|
waveIndex: number;
|
||||||
gameVersion: string;
|
gameVersion: string;
|
||||||
timestamp: integer;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ export const settingGamepadBlackList = [
|
|||||||
SettingKeyboard.Button_Right,
|
SettingKeyboard.Button_Right,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function setSettingGamepad(setting: SettingGamepad, value: integer): boolean {
|
export function setSettingGamepad(setting: SettingGamepad, value: number): boolean {
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case SettingGamepad.Gamepad_Support:
|
case SettingGamepad.Gamepad_Support:
|
||||||
// if we change the value of the gamepad support, we call a method in the inputController to
|
// if we change the value of the gamepad support, we call a method in the inputController to
|
||||||
|
@ -133,7 +133,7 @@ export const settingKeyboardBlackList = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export function setSettingKeyboard(setting: SettingKeyboard, value: integer): boolean {
|
export function setSettingKeyboard(setting: SettingKeyboard, value: number): boolean {
|
||||||
switch (setting) {
|
switch (setting) {
|
||||||
case SettingKeyboard.Button_Up:
|
case SettingKeyboard.Button_Up:
|
||||||
case SettingKeyboard.Button_Down:
|
case SettingKeyboard.Button_Down:
|
||||||
|
@ -713,7 +713,7 @@ export function resetSettings() {
|
|||||||
* @param value value to update setting with
|
* @param value value to update setting with
|
||||||
* @returns true if successful, false if not
|
* @returns true if successful, false if not
|
||||||
*/
|
*/
|
||||||
export function setSetting(setting: string, value: integer): boolean {
|
export function setSetting(setting: string, value: number): boolean {
|
||||||
const index: number = settingIndex(setting);
|
const index: number = settingIndex(setting);
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4,7 +4,7 @@ import Trainer, { TrainerVariant } from "../field/trainer";
|
|||||||
export default class TrainerData {
|
export default class TrainerData {
|
||||||
public trainerType: TrainerType;
|
public trainerType: TrainerType;
|
||||||
public variant: TrainerVariant;
|
public variant: TrainerVariant;
|
||||||
public partyTemplateIndex: integer;
|
public partyTemplateIndex: number;
|
||||||
public name: string;
|
public name: string;
|
||||||
public partnerName: string;
|
public partnerName: string;
|
||||||
|
|
||||||
|
139
src/test/abilities/desolate-land.test.ts
Normal file
139
src/test/abilities/desolate-land.test.ts
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
import { PokeballType } from "#app/enums/pokeball";
|
||||||
|
import { WeatherType } from "#app/enums/weather-type";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, it, expect, vi } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Desolate Land", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset(Moves.SPLASH)
|
||||||
|
.hasPassiveAbility(true)
|
||||||
|
.enemySpecies(Species.RALTS)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks that the weather has changed after the Enemy Pokemon with {@linkcode Abilities.DESOLATE_LAND}
|
||||||
|
* is forcefully moved out of the field from moves such as Roar {@linkcode Moves.ROAR}
|
||||||
|
*/
|
||||||
|
it("should lift only when all pokemon with this ability leave the field", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("double")
|
||||||
|
.enemyMoveset([ Moves.SPLASH, Moves.ROAR ]);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGCARGO, Species.MAGCARGO, Species.MAGIKARP, Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "randBattleSeedInt").mockImplementation((range, min: number = 0) => {
|
||||||
|
return min;
|
||||||
|
});
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0, 2);
|
||||||
|
game.move.select(Moves.SPLASH, 1, 2);
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.ROAR, 0);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
vi.spyOn(game.scene, "randBattleSeedInt").mockImplementation((range, min: number = 0) => {
|
||||||
|
return min + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0, 2);
|
||||||
|
game.move.select(Moves.SPLASH, 1, 2);
|
||||||
|
|
||||||
|
await game.forceEnemyMove(Moves.ROAR, 1);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 0);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should lift when enemy faints", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("single")
|
||||||
|
.moveset([ Moves.SHEER_COLD ])
|
||||||
|
.ability(Abilities.NO_GUARD)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(1)
|
||||||
|
.enemyMoveset([ Moves.SPLASH ])
|
||||||
|
.enemySpecies(Species.MAGCARGO)
|
||||||
|
.enemyHasPassiveAbility(true);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
game.move.select(Moves.SHEER_COLD);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should lift when pokemon returns upon switching from double to single battle", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("even-doubles")
|
||||||
|
.enemyMoveset([ Moves.SPLASH, Moves.MEMENTO ])
|
||||||
|
.startingWave(12);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.MAGCARGO ]);
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0, 2);
|
||||||
|
game.move.select(Moves.SPLASH, 1, 2);
|
||||||
|
await game.forceEnemyMove(Moves.MEMENTO, 0);
|
||||||
|
await game.forceEnemyMove(Moves.MEMENTO, 1);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
await game.toNextWave();
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should lift when enemy is captured", async () => {
|
||||||
|
game.override
|
||||||
|
.battleType("single")
|
||||||
|
.enemyMoveset([ Moves.SPLASH ])
|
||||||
|
.enemySpecies(Species.MAGCARGO)
|
||||||
|
.enemyHasPassiveAbility(true);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.HARSH_SUN);
|
||||||
|
|
||||||
|
game.scene.pokeballCounts[PokeballType.MASTER_BALL] = 1;
|
||||||
|
|
||||||
|
game.doThrowPokeball(PokeballType.MASTER_BALL);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.HARSH_SUN);
|
||||||
|
});
|
||||||
|
});
|
143
src/test/abilities/good_as_gold.test.ts
Normal file
143
src/test/abilities/good_as_gold.test.ts
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
import { BattlerIndex } from "#app/battle";
|
||||||
|
import { allAbilities } from "#app/data/ability";
|
||||||
|
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||||
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
|
import { Stat } from "#app/enums/stat";
|
||||||
|
import { StatusEffect } from "#app/enums/status-effect";
|
||||||
|
import { WeatherType } from "#app/enums/weather-type";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Good As Gold", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.SPLASH ])
|
||||||
|
.ability(Abilities.GOOD_AS_GOLD)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should block normal status moves", async () => {
|
||||||
|
game.override.enemyMoveset( [ Moves.GROWL ] );
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const player = game.scene.getPlayerPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(player.battleData.abilitiesApplied[0]).toBe(Abilities.GOOD_AS_GOLD);
|
||||||
|
expect(player.getStatStage(Stat.ATK)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should block memento and prevent the user from fainting", async () => {
|
||||||
|
game.override.enemyMoveset( [ Moves.MEMENTO ] );
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
game.move.select(Moves.MEMENTO);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(game.scene.getPlayerPokemon()!.isFainted()).toBe(false);
|
||||||
|
expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.ATK)).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not block any status moves that target the field, one side, or all pokemon", async () => {
|
||||||
|
game.override.battleType("double");
|
||||||
|
game.override.enemyMoveset( [ Moves.STEALTH_ROCK, Moves.HAZE ] );
|
||||||
|
game.override.moveset([ Moves.SWORDS_DANCE, Moves.SAFEGUARD ]);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
||||||
|
const [ good_as_gold, ball_fetch ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
// Force second pokemon to have ball fetch to isolate to a single mon.
|
||||||
|
vi.spyOn(ball_fetch, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SWORDS_DANCE, 0);
|
||||||
|
game.move.select(Moves.SAFEGUARD, 1);
|
||||||
|
await game.forceEnemyMove(Moves.STEALTH_ROCK);
|
||||||
|
await game.forceEnemyMove(Moves.HAZE);
|
||||||
|
await game.setTurnOrder( [ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ] );
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(good_as_gold.getAbility().id).toBe(Abilities.GOOD_AS_GOLD);
|
||||||
|
expect(good_as_gold.getStatStage(Stat.ATK)).toBe(0);
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.STEALTH_ROCK, ArenaTagSide.PLAYER)).toBeDefined();
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.SAFEGUARD, ArenaTagSide.PLAYER)).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not block field targeted effects in singles", async () => {
|
||||||
|
game.override.battleType("single");
|
||||||
|
game.override.enemyMoveset( [ Moves.SPIKES ] );
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.PLAYER)).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should block the ally's helping hand", async () => {
|
||||||
|
game.override.battleType("double");
|
||||||
|
game.override.moveset([ Moves.HELPING_HAND, Moves.TACKLE ]);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS ]);
|
||||||
|
|
||||||
|
game.move.select(Moves.HELPING_HAND, 0);
|
||||||
|
game.move.select(Moves.TACKLE, 1);
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase", true);
|
||||||
|
|
||||||
|
expect(game.scene.getPlayerField()[1].getTag(BattlerTagType.HELPING_HAND)).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should block the ally's heal bell, but only if the good as gold user is on the field", async () => {
|
||||||
|
game.override.battleType("double");
|
||||||
|
game.override.moveset([ Moves.HEAL_BELL, Moves.SPLASH ]);
|
||||||
|
game.override.statusEffect(StatusEffect.BURN);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP, Species.FEEBAS, Species.ABRA ]);
|
||||||
|
const [ good_as_gold, ball_fetch ] = game.scene.getPlayerField();
|
||||||
|
|
||||||
|
// Force second pokemon to have ball fetch to isolate to a single mon.
|
||||||
|
vi.spyOn(ball_fetch, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
|
||||||
|
|
||||||
|
// turn 1
|
||||||
|
game.move.select(Moves.SPLASH, 0);
|
||||||
|
game.move.select(Moves.HEAL_BELL, 1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(good_as_gold.status?.effect).toBe(StatusEffect.BURN);
|
||||||
|
|
||||||
|
game.doSwitchPokemon(2);
|
||||||
|
game.move.select(Moves.HEAL_BELL, 0);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(good_as_gold.status?.effect).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not block field targeted effects like rain dance", async () => {
|
||||||
|
game.override.battleType("single");
|
||||||
|
game.override.enemyMoveset( [ Moves.RAIN_DANCE ] );
|
||||||
|
game.override.weather(WeatherType.NONE);
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH, 0);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
|
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.RAIN);
|
||||||
|
});
|
||||||
|
});
|
@ -189,4 +189,19 @@ describe("Abilities - SHIELDS DOWN", () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test("should not prevent minior from receiving the fainted status effect in trainer battles", async () => {
|
||||||
|
game.override.enemyMoveset([ Moves.TACKLE ]);
|
||||||
|
game.override.moveset([ Moves.THUNDERBOLT ]);
|
||||||
|
game.override.startingLevel(100);
|
||||||
|
game.override.startingWave(5);
|
||||||
|
game.override.enemySpecies(Species.MINIOR);
|
||||||
|
await game.classicMode.startBattle([ Species.REGIELEKI ]);
|
||||||
|
const minior = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.move.select(Moves.THUNDERBOLT);
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(minior.isFainted()).toBe(true);
|
||||||
|
expect(minior.status?.effect).toBe(StatusEffect.FAINT);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
|
|||||||
describe("Egg Generation Tests", () => {
|
describe("Egg Generation Tests", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
const EGG_HATCH_COUNT: integer = 1000;
|
const EGG_HATCH_COUNT: number = 1000;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
|
@ -9,7 +9,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
|
|||||||
describe("Manaphy Eggs", () => {
|
describe("Manaphy Eggs", () => {
|
||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
const EGG_HATCH_COUNT: integer = 48;
|
const EGG_HATCH_COUNT: number = 48;
|
||||||
let rngSweepProgress: number = 0;
|
let rngSweepProgress: number = 0;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
@ -221,7 +221,8 @@ describe("Moves - Instruct", () => {
|
|||||||
it("should allow for dancer copying of instructed dance move", async () => {
|
it("should allow for dancer copying of instructed dance move", async () => {
|
||||||
game.override
|
game.override
|
||||||
.battleType("double")
|
.battleType("double")
|
||||||
.enemyMoveset([ Moves.INSTRUCT, Moves.SPLASH ]);
|
.enemyMoveset([ Moves.INSTRUCT, Moves.SPLASH ])
|
||||||
|
.enemyLevel(1000);
|
||||||
await game.classicMode.startBattle([ Species.ORICORIO, Species.VOLCARONA ]);
|
await game.classicMode.startBattle([ Species.ORICORIO, Species.VOLCARONA ]);
|
||||||
|
|
||||||
const [ oricorio, volcarona ] = game.scene.getPlayerField();
|
const [ oricorio, volcarona ] = game.scene.getPlayerField();
|
||||||
@ -236,11 +237,9 @@ describe("Moves - Instruct", () => {
|
|||||||
await game.phaseInterceptor.to("BerryPhase");
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
|
||||||
// fiery dance triggered dancer successfully for a total of 4 hits
|
// fiery dance triggered dancer successfully for a total of 4 hits
|
||||||
// Volcarona fiery dance has a _small_ chance to 3HKO a shuckle in worst case, so we add the hit count of both
|
// Enemy level is set to a high value so that it does not faint even after all 4 hits
|
||||||
// foes to account for spillover
|
|
||||||
instructSuccess(volcarona, Moves.FIERY_DANCE);
|
instructSuccess(volcarona, Moves.FIERY_DANCE);
|
||||||
expect(game.scene.getEnemyField()[0].turnData.attacksReceived.length +
|
expect(game.scene.getEnemyField()[0].turnData.attacksReceived.length).toBe(4);
|
||||||
game.scene.getEnemyField()[1].turnData.attacksReceived.length).toBe(4);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not repeat move when switching out", async () => {
|
it("should not repeat move when switching out", async () => {
|
||||||
|
@ -372,7 +372,7 @@ describe("Clowning Around - Mystery Encounter", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function addItemToPokemon(scene: BattleScene, pokemon: Pokemon, stackCount: integer, itemType: PokemonHeldItemModifierType) {
|
async function addItemToPokemon(scene: BattleScene, pokemon: Pokemon, stackCount: number, itemType: PokemonHeldItemModifierType) {
|
||||||
const itemMod = itemType.newModifier(pokemon) as PokemonHeldItemModifier;
|
const itemMod = itemType.newModifier(pokemon) as PokemonHeldItemModifier;
|
||||||
itemMod.stackCount = stackCount;
|
itemMod.stackCount = stackCount;
|
||||||
await scene.addModifier(itemMod, true, false, false, true);
|
await scene.addModifier(itemMod, true, false, false, true);
|
||||||
|
@ -9,12 +9,12 @@ export default class TextInterceptor {
|
|||||||
scene.messageWrapper = this;
|
scene.messageWrapper = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
showText(text: string, delay?: integer, callback?: Function, callbackDelay?: integer, prompt?: boolean, promptDelay?: integer): void {
|
showText(text: string, delay?: number, callback?: Function, callbackDelay?: number, prompt?: boolean, promptDelay?: number): void {
|
||||||
console.log(text);
|
console.log(text);
|
||||||
this.logs.push(text);
|
this.logs.push(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
showDialogue(text: string, name: string, delay?: integer, callback?: Function, callbackDelay?: integer, promptDelay?: integer): void {
|
showDialogue(text: string, name: string, delay?: number, callback?: Function, callbackDelay?: number, promptDelay?: number): void {
|
||||||
console.log(name, text);
|
console.log(name, text);
|
||||||
this.logs.push(name, text);
|
this.logs.push(name, text);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|||||||
import { TurnStartPhase } from "#app/phases/turn-start-phase";
|
import { TurnStartPhase } from "#app/phases/turn-start-phase";
|
||||||
import ErrorInterceptor from "#app/test/utils/errorInterceptor";
|
import ErrorInterceptor from "#app/test/utils/errorInterceptor";
|
||||||
import type InputsHandler from "#app/test/utils/inputsHandler";
|
import type InputsHandler from "#app/test/utils/inputsHandler";
|
||||||
|
import type BallUiHandler from "#app/ui/ball-ui-handler";
|
||||||
import type BattleMessageUiHandler from "#app/ui/battle-message-ui-handler";
|
import type BattleMessageUiHandler from "#app/ui/battle-message-ui-handler";
|
||||||
import type CommandUiHandler from "#app/ui/command-ui-handler";
|
import type CommandUiHandler from "#app/ui/command-ui-handler";
|
||||||
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
import type ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
|
||||||
@ -255,7 +256,7 @@ export default class GameManager {
|
|||||||
* @param {BattlerIndex} targetIndex The index of the attack target, or `undefined` for multi-target attacks
|
* @param {BattlerIndex} targetIndex The index of the attack target, or `undefined` for multi-target attacks
|
||||||
* @param movePosition The index of the move in the pokemon's moveset array
|
* @param movePosition The index of the move in the pokemon's moveset array
|
||||||
*/
|
*/
|
||||||
selectTarget(movePosition: integer, targetIndex?: BattlerIndex) {
|
selectTarget(movePosition: number, targetIndex?: BattlerIndex) {
|
||||||
this.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
|
this.onNextPrompt("SelectTargetPhase", Mode.TARGET_SELECT, () => {
|
||||||
const handler = this.scene.ui.getHandler() as TargetSelectUiHandler;
|
const handler = this.scene.ui.getHandler() as TargetSelectUiHandler;
|
||||||
const move = (this.scene.getCurrentPhase() as SelectTargetPhase).getPokemon().getMoveset()[movePosition]!.getMove(); // TODO: is the bang correct?
|
const move = (this.scene.getCurrentPhase() as SelectTargetPhase).getPokemon().getMoveset()[movePosition]!.getMove(); // TODO: is the bang correct?
|
||||||
@ -387,7 +388,7 @@ export default class GameManager {
|
|||||||
* @param path - The path to the data file.
|
* @param path - The path to the data file.
|
||||||
* @returns A promise that resolves with a tuple containing a boolean indicating success and an integer status code.
|
* @returns A promise that resolves with a tuple containing a boolean indicating success and an integer status code.
|
||||||
*/
|
*/
|
||||||
async importData(path): Promise<[boolean, integer]> {
|
async importData(path): Promise<[boolean, number]> {
|
||||||
const saveKey = "x0i2O7WRiANTqPmZ";
|
const saveKey = "x0i2O7WRiANTqPmZ";
|
||||||
const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" });
|
const dataRaw = fs.readFileSync(path, { encoding: "utf8", flag: "r" });
|
||||||
let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8);
|
let dataStr = AES.decrypt(dataRaw, saveKey).toString(enc.Utf8);
|
||||||
@ -458,6 +459,24 @@ export default class GameManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the BALL option from the command menu, then press Action; in the BALL
|
||||||
|
* menu, select a pokéball type and press Action again to throw it.
|
||||||
|
* @param ballIndex the index of the pokeball to throw
|
||||||
|
*/
|
||||||
|
public doThrowPokeball(ballIndex: number) {
|
||||||
|
this.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
|
||||||
|
(this.scene.ui.getHandler() as CommandUiHandler).setCursor(1);
|
||||||
|
(this.scene.ui.getHandler() as CommandUiHandler).processInput(Button.ACTION);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.onNextPrompt("CommandPhase", Mode.BALL, () => {
|
||||||
|
const ballHandler = this.scene.ui.getHandler() as BallUiHandler;
|
||||||
|
ballHandler.setCursor(ballIndex);
|
||||||
|
ballHandler.processInput(Button.ACTION); // select ball and throw
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intercepts `TurnStartPhase` and mocks {@linkcode TurnStartPhase.getSpeedOrder}'s return value.
|
* Intercepts `TurnStartPhase` and mocks {@linkcode TurnStartPhase.getSpeedOrder}'s return value.
|
||||||
* Used to manually modify Pokemon turn order.
|
* Used to manually modify Pokemon turn order.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user