Merge pull request #4897 from pagefaultgames/beta
Beta -> Main 1.2.0 update
|
@ -10,5 +10,5 @@ declare global {
|
|||
*
|
||||
* To set up your own server in a test see `game_data.test.ts`
|
||||
*/
|
||||
var i18nServer: SetupServerApi;
|
||||
var server: SetupServerApi;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.1.6",
|
||||
"version": "1.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.1.6",
|
||||
"version": "1.2.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@material/material-color-utilities": "^0.2.7",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"private": true,
|
||||
"version": "1.1.6",
|
||||
"version": "1.2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 322 B |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 464 B |
After Width: | Height: | Size: 267 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 373 B |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 493 B |
After Width: | Height: | Size: 451 B |
After Width: | Height: | Size: 524 B |
After Width: | Height: | Size: 530 B |
|
@ -1647,6 +1647,27 @@
|
|||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "85-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 5,
|
||||
"y": 3,
|
||||
"w": 29,
|
||||
"h": 25
|
||||
},
|
||||
"frame": {
|
||||
"x": 55,
|
||||
"y": 270,
|
||||
"w": 29,
|
||||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "22s",
|
||||
"rotated": false,
|
||||
|
@ -1731,6 +1752,27 @@
|
|||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "85s-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 5,
|
||||
"y": 3,
|
||||
"w": 29,
|
||||
"h": 25
|
||||
},
|
||||
"frame": {
|
||||
"x": 56,
|
||||
"y": 317,
|
||||
"w": 29,
|
||||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "9s",
|
||||
"rotated": false,
|
||||
|
@ -6456,6 +6498,27 @@
|
|||
"h": 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "84-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 9,
|
||||
"y": 10,
|
||||
"w": 21,
|
||||
"h": 18
|
||||
},
|
||||
"frame": {
|
||||
"x": 98,
|
||||
"y": 712,
|
||||
"w": 21,
|
||||
"h": 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "107",
|
||||
"rotated": false,
|
||||
|
@ -6519,6 +6582,27 @@
|
|||
"h": 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "84s-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 9,
|
||||
"y": 10,
|
||||
"w": 21,
|
||||
"h": 18
|
||||
},
|
||||
"frame": {
|
||||
"x": 96,
|
||||
"y": 770,
|
||||
"w": 21,
|
||||
"h": 18
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "88",
|
||||
"rotated": false,
|
||||
|
|
|
@ -786,6 +786,27 @@
|
|||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "154-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 8,
|
||||
"y": 1,
|
||||
"w": 23,
|
||||
"h": 27
|
||||
},
|
||||
"frame": {
|
||||
"x": 29,
|
||||
"y": 147,
|
||||
"w": 23,
|
||||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "154s",
|
||||
"rotated": false,
|
||||
|
@ -807,6 +828,27 @@
|
|||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "154s-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 8,
|
||||
"y": 1,
|
||||
"w": 23,
|
||||
"h": 27
|
||||
},
|
||||
"frame": {
|
||||
"x": 29,
|
||||
"y": 174,
|
||||
"w": 23,
|
||||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "229-mega",
|
||||
"rotated": false,
|
||||
|
|
|
@ -198,6 +198,27 @@
|
|||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257-f-mega",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 4,
|
||||
"y": 2,
|
||||
"w": 32,
|
||||
"h": 27
|
||||
},
|
||||
"frame": {
|
||||
"x": 0,
|
||||
"y": 79,
|
||||
"w": 32,
|
||||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257s-mega",
|
||||
"rotated": false,
|
||||
|
@ -219,6 +240,27 @@
|
|||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257s-f-mega",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 4,
|
||||
"y": 2,
|
||||
"w": 32,
|
||||
"h": 27
|
||||
},
|
||||
"frame": {
|
||||
"x": 0,
|
||||
"y": 106,
|
||||
"w": 32,
|
||||
"h": 27
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "323-mega",
|
||||
"rotated": false,
|
||||
|
@ -1248,6 +1290,27 @@
|
|||
"h": 26
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 7,
|
||||
"y": 2,
|
||||
"w": 25,
|
||||
"h": 26
|
||||
},
|
||||
"frame": {
|
||||
"x": 28,
|
||||
"y": 556,
|
||||
"w": 25,
|
||||
"h": 26
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257s",
|
||||
"rotated": false,
|
||||
|
@ -1269,6 +1332,27 @@
|
|||
"h": 26
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "257s-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 7,
|
||||
"y": 2,
|
||||
"w": 25,
|
||||
"h": 26
|
||||
},
|
||||
"frame": {
|
||||
"x": 28,
|
||||
"y": 582,
|
||||
"w": 25,
|
||||
"h": 26
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "359-mega",
|
||||
"rotated": false,
|
||||
|
@ -1605,6 +1689,27 @@
|
|||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "256-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 8,
|
||||
"y": 3,
|
||||
"w": 23,
|
||||
"h": 25
|
||||
},
|
||||
"frame": {
|
||||
"x": 98,
|
||||
"y": 72,
|
||||
"w": 23,
|
||||
"h": 25
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "282s-mega",
|
||||
"rotated": false,
|
||||
|
@ -5553,6 +5658,27 @@
|
|||
"h": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "255-f",
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"sourceSize": {
|
||||
"w": 40,
|
||||
"h": 30
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"x": 13,
|
||||
"y": 9,
|
||||
"w": 13,
|
||||
"h": 19
|
||||
},
|
||||
"frame": {
|
||||
"x": 204,
|
||||
"y": 342,
|
||||
"w": 13,
|
||||
"h": 19
|
||||
}
|
||||
},
|
||||
{
|
||||
"filename": "307s",
|
||||
"rotated": false,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"textures": [
|
||||
{
|
||||
"image": "statuses_es.png",
|
||||
"image": "statuses_es-ES.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 22,
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 441 B |
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"textures": [
|
||||
{
|
||||
"image": "types_es.png",
|
||||
"image": "types_es-ES.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 32,
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -1 +1 @@
|
|||
Subproject commit 71390cba88f4103d0d2273d59a6dd8340a4fa54f
|
||||
Subproject commit ed1b1df4776ccd4330e8ac1d2f44de611d04c2bc
|
|
@ -0,0 +1,17 @@
|
|||
import type { UserInfo } from "#app/@types/UserInfo";
|
||||
|
||||
export interface AccountInfoResponse extends UserInfo {}
|
||||
|
||||
export interface AccountLoginRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface AccountLoginResponse {
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface AccountRegisterRequest {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
export interface LinkAccountToDiscordIdRequest {
|
||||
username: string;
|
||||
discordId: string;
|
||||
}
|
||||
|
||||
export interface UnlinkAccountFromDiscordIdRequest {
|
||||
username: string;
|
||||
discordId: string;
|
||||
}
|
||||
|
||||
export interface LinkAccountToGoogledIdRequest {
|
||||
username: string;
|
||||
googleId: string;
|
||||
}
|
||||
|
||||
export interface UnlinkAccountFromGoogledIdRequest {
|
||||
username: string;
|
||||
googleId: string;
|
||||
}
|
||||
|
||||
export interface SearchAccountRequest {
|
||||
username: string;
|
||||
}
|
||||
|
||||
export interface SearchAccountResponse {
|
||||
username: string;
|
||||
discordId: string;
|
||||
googleId: string;
|
||||
lastLoggedIn: string;
|
||||
registered: string;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
export interface TitleStatsResponse {
|
||||
playerCount: number;
|
||||
battleCount: number;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
import type { ScoreboardCategory } from "#app/ui/daily-run-scoreboard";
|
||||
|
||||
export interface GetDailyRankingsRequest {
|
||||
category: ScoreboardCategory;
|
||||
page?: number;
|
||||
}
|
||||
|
||||
export interface GetDailyRankingsPageCountRequest {
|
||||
category: ScoreboardCategory;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
import type { SessionSaveData, SystemSaveData } from "#app/system/game-data";
|
||||
|
||||
export interface UpdateAllSavedataRequest {
|
||||
system: SystemSaveData;
|
||||
session: SessionSaveData;
|
||||
sessionSlotId: number;
|
||||
clientSessionId: string;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
export class UpdateSessionSavedataRequest {
|
||||
slot: number;
|
||||
trainerId: number;
|
||||
secretId: number;
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
/** This is **NOT** similar to {@linkcode ClearSessionSavedataRequest} */
|
||||
export interface NewClearSessionSavedataRequest {
|
||||
slot: number;
|
||||
isVictory: boolean;
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
export interface GetSessionSavedataRequest {
|
||||
slot: number;
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
export interface DeleteSessionSavedataRequest {
|
||||
slot: number;
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
/** This is **NOT** similar to {@linkcode NewClearSessionSavedataRequest} */
|
||||
export interface ClearSessionSavedataRequest {
|
||||
slot: number;
|
||||
trainerId: number;
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pokerogue API response for path: `/savedata/session/clear`
|
||||
*/
|
||||
export interface ClearSessionSavedataResponse {
|
||||
/** Contains the error message if any occured */
|
||||
error?: string;
|
||||
/** Is `true` if the request was successfully processed */
|
||||
success?: boolean;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
import type { SystemSaveData } from "#app/system/game-data";
|
||||
|
||||
export interface GetSystemSavedataRequest {
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
export class UpdateSystemSavedataRequest {
|
||||
clientSessionId: string;
|
||||
trainerId?: number;
|
||||
secretId?: number;
|
||||
}
|
||||
|
||||
export interface VerifySystemSavedataRequest {
|
||||
clientSessionId: string;
|
||||
}
|
||||
|
||||
export interface VerifySystemSavedataResponse {
|
||||
valid: boolean;
|
||||
systemData: SystemSaveData;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
export interface UserInfo {
|
||||
username: string;
|
||||
lastSessionSlot: number;
|
||||
discordId: string;
|
||||
googleId: string;
|
||||
hasAdminRole: boolean;
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
/**
|
||||
* Pokerogue API response for path: `/savedata/session/clear`
|
||||
*/
|
||||
export interface PokerogueApiClearSessionData {
|
||||
/** Contains the error message if any occured */
|
||||
error?: string;
|
||||
/** Is `true` if the request was successfully processed */
|
||||
success?: boolean;
|
||||
}
|
|
@ -1,14 +1,8 @@
|
|||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
import type { UserInfo } from "#app/@types/UserInfo";
|
||||
import { bypassLogin } from "./battle-scene";
|
||||
import * as Utils from "./utils";
|
||||
|
||||
export interface UserInfo {
|
||||
username: string;
|
||||
lastSessionSlot: integer;
|
||||
discordId: string;
|
||||
googleId: string;
|
||||
hasAdminRole: boolean;
|
||||
}
|
||||
|
||||
export let loggedInUser: UserInfo | null = null;
|
||||
// This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting
|
||||
export const clientSessionId = Utils.randomString(32);
|
||||
|
@ -43,18 +37,14 @@ export function updateUserInfo(): Promise<[boolean, integer]> {
|
|||
});
|
||||
return resolve([ true, 200 ]);
|
||||
}
|
||||
Utils.apiFetch("account/info", true).then(response => {
|
||||
if (!response.ok) {
|
||||
resolve([ false, response.status ]);
|
||||
pokerogueApi.account.getInfo().then(([ accountInfo, status ]) => {
|
||||
if (!accountInfo) {
|
||||
resolve([ false, status ]);
|
||||
return;
|
||||
}
|
||||
return response.json();
|
||||
}).then(jsonResponse => {
|
||||
loggedInUser = jsonResponse;
|
||||
} else {
|
||||
loggedInUser = accountInfo;
|
||||
resolve([ true, 200 ]);
|
||||
}).catch(err => {
|
||||
console.error(err);
|
||||
resolve([ false, 500 ]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import PokemonSpecies, { allSpecies, getPokemonSpecies, PokemonSpeciesFilter } f
|
|||
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import * as Utils from "#app/utils";
|
||||
import { ConsumableModifier, ConsumablePokemonModifier, DoubleBattleChanceBoosterModifier, ExpBalanceModifier, ExpShareModifier, FusePokemonModifier, HealingBoosterModifier, Modifier, ModifierBar, ModifierPredicate, MultipleParticipantExpBonusModifier, overrideHeldItems, overrideModifiers, PersistentModifier, PokemonExpBoosterModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, PokemonHpRestoreModifier, PokemonIncrementingStatModifier, RememberMoveModifier, TerastallizeModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from "#app/data/battle-anims";
|
||||
import { Phase } from "#app/phase";
|
||||
import { initGameSpeed } from "#app/system/game-speed";
|
||||
|
@ -13,9 +13,10 @@ import { Arena, ArenaBase } from "#app/field/arena";
|
|||
import { GameData } from "#app/system/game-data";
|
||||
import { addTextObject, getTextColor, TextStyle } from "#app/ui/text";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getModifierType, getPartyLuckValue, ModifierPoolType, modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import AbilityBar from "#app/ui/ability-bar";
|
||||
import { allAbilities, applyAbAttrs, applyPostBattleInitAbAttrs, BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, PostBattleInitAbAttr } from "#app/data/ability";
|
||||
import { allAbilities, applyAbAttrs, applyPostBattleInitAbAttrs, applyPostItemLostAbAttrs, BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, PostBattleInitAbAttr, PostItemLostAbAttr } from "#app/data/ability";
|
||||
import Battle, { BattleType, FixedBattleConfig } from "#app/battle";
|
||||
import { GameMode, GameModes, getGameMode } from "#app/game-mode";
|
||||
import FieldSpritePipeline from "#app/pipelines/field-sprite";
|
||||
|
@ -34,10 +35,11 @@ import { Gender } from "#app/data/gender";
|
|||
import UIPlugin from "phaser3-rex-plugins/templates/ui/ui-plugin";
|
||||
import { addUiThemeOverrides } from "#app/ui/ui-theme";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { FormChangeItem, pokemonFormChanges, SpeciesFormChange, SpeciesFormChangeManualTrigger, SpeciesFormChangeTimeOfDayTrigger, SpeciesFormChangeTrigger } from "#app/data/pokemon-forms";
|
||||
import { FormChangePhase } from "#app/phases/form-change-phase";
|
||||
import { getTypeRgb } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import PokemonSpriteSparkleHandler from "#app/field/pokemon-sprite-sparkle-handler";
|
||||
import CharSprite from "#app/ui/char-sprite";
|
||||
import DamageNumberHandler from "#app/field/damage-number-handler";
|
||||
|
@ -95,7 +97,9 @@ import { ExpPhase } from "#app/phases/exp-phase";
|
|||
import { ShowPartyExpBarPhase } from "#app/phases/show-party-exp-bar-phase";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
|
||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||
|
||||
|
@ -169,7 +173,7 @@ export default class BattleScene extends SceneBase {
|
|||
public uiTheme: UiTheme = UiTheme.DEFAULT;
|
||||
public windowType: integer = 0;
|
||||
public experimentalSprites: boolean = false;
|
||||
public musicPreference: integer = 0;
|
||||
public musicPreference: number = MusicPreference.MIXED;
|
||||
public moveAnimations: boolean = true;
|
||||
public expGainsSpeed: ExpGainsSpeed = ExpGainsSpeed.DEFAULT;
|
||||
public skipSeenDialogues: boolean = false;
|
||||
|
@ -323,6 +327,7 @@ export default class BattleScene extends SceneBase {
|
|||
this.conditionalQueue = [];
|
||||
this.phaseQueuePrependSpliceIndex = -1;
|
||||
this.nextCommandPhaseQueue = [];
|
||||
this.eventManager = new TimedEventManager();
|
||||
this.updateGameInfo();
|
||||
}
|
||||
|
||||
|
@ -378,7 +383,6 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
this.fieldSpritePipeline = new FieldSpritePipeline(this.game);
|
||||
(this.renderer as Phaser.Renderer.WebGL.WebGLRenderer).pipelines.add("FieldSprite", this.fieldSpritePipeline);
|
||||
this.eventManager = new TimedEventManager();
|
||||
|
||||
this.launchBattle();
|
||||
}
|
||||
|
@ -764,57 +768,65 @@ export default class BattleScene extends SceneBase {
|
|||
return true;
|
||||
}
|
||||
|
||||
getParty(): PlayerPokemon[] {
|
||||
public getPlayerParty(): PlayerPokemon[] {
|
||||
return this.party;
|
||||
}
|
||||
|
||||
getPlayerPokemon(): PlayerPokemon | undefined {
|
||||
return this.getPlayerField().find(p => p.isActive());
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first {@linkcode Pokemon.isActive() | active PlayerPokemon} that isn't also currently switching out
|
||||
* @returns Either the first {@linkcode PlayerPokemon} satisfying, or undefined if no player pokemon on the field satisfy
|
||||
* @returns An array of {@linkcode PlayerPokemon} filtered from the player's party
|
||||
* that are {@linkcode Pokemon.isAllowedInBattle | allowed in battle}.
|
||||
*/
|
||||
getNonSwitchedPlayerPokemon(): PlayerPokemon | undefined {
|
||||
return this.getPlayerField().find(p => p.isActive() && p.switchOutStatus === false);
|
||||
public getPokemonAllowedInBattle(): PlayerPokemon[] {
|
||||
return this.getPlayerParty().filter(p => p.isAllowedInBattle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of PlayerPokemon of length 1 or 2 depending on if double battles or not
|
||||
* @returns The first {@linkcode PlayerPokemon} that is {@linkcode getPlayerField on the field}
|
||||
* and {@linkcode PlayerPokemon.isActive is active}
|
||||
* (aka {@linkcode PlayerPokemon.isAllowedInBattle is allowed in battle}),
|
||||
* or `undefined` if there are no valid pokemon
|
||||
* @param includeSwitching Whether a pokemon that is currently switching out is valid, default `true`
|
||||
*/
|
||||
public getPlayerPokemon(includeSwitching: boolean = true): PlayerPokemon | undefined {
|
||||
return this.getPlayerField().find(p => p.isActive() && (includeSwitching || p.switchOutStatus === false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of PlayerPokemon of length 1 or 2 depending on if in a double battle or not.
|
||||
* Does not actually check if the pokemon are on the field or not.
|
||||
* @returns array of {@linkcode PlayerPokemon}
|
||||
*/
|
||||
getPlayerField(): PlayerPokemon[] {
|
||||
const party = this.getParty();
|
||||
public getPlayerField(): PlayerPokemon[] {
|
||||
const party = this.getPlayerParty();
|
||||
return party.slice(0, Math.min(party.length, this.currentBattle?.double ? 2 : 1));
|
||||
}
|
||||
|
||||
getEnemyParty(): EnemyPokemon[] {
|
||||
public getEnemyParty(): EnemyPokemon[] {
|
||||
return this.currentBattle?.enemyParty ?? [];
|
||||
}
|
||||
|
||||
getEnemyPokemon(): EnemyPokemon | undefined {
|
||||
return this.getEnemyField().find(p => p.isActive());
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first {@linkcode Pokemon.isActive() | active EnemyPokemon} pokemon from the enemy that isn't also currently switching out
|
||||
* @returns Either the first {@linkcode EnemyPokemon} satisfying, or undefined if no player pokemon on the field satisfy
|
||||
* @returns The first {@linkcode EnemyPokemon} that is {@linkcode getEnemyField on the field}
|
||||
* and {@linkcode EnemyPokemon.isActive is active}
|
||||
* (aka {@linkcode EnemyPokemon.isAllowedInBattle is allowed in battle}),
|
||||
* or `undefined` if there are no valid pokemon
|
||||
* @param includeSwitching Whether a pokemon that is currently switching out is valid, default `true`
|
||||
*/
|
||||
getNonSwitchedEnemyPokemon(): EnemyPokemon | undefined {
|
||||
return this.getEnemyField().find(p => p.isActive() && p.switchOutStatus === false);
|
||||
public getEnemyPokemon(includeSwitching: boolean = true): EnemyPokemon | undefined {
|
||||
return this.getEnemyField().find(p => p.isActive() && (includeSwitching || p.switchOutStatus === false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of EnemyPokemon of length 1 or 2 depending on if double battles or not
|
||||
* Returns an array of EnemyPokemon of length 1 or 2 depending on if in a double battle or not.
|
||||
* Does not actually check if the pokemon are on the field or not.
|
||||
* @returns array of {@linkcode EnemyPokemon}
|
||||
*/
|
||||
getEnemyField(): EnemyPokemon[] {
|
||||
public getEnemyField(): EnemyPokemon[] {
|
||||
const party = this.getEnemyParty();
|
||||
return party.slice(0, Math.min(party.length, this.currentBattle?.double ? 2 : 1));
|
||||
}
|
||||
|
||||
getField(activeOnly: boolean = false): Pokemon[] {
|
||||
public getField(activeOnly: boolean = false): Pokemon[] {
|
||||
const ret = new Array(4).fill(null);
|
||||
const playerField = this.getPlayerField();
|
||||
const enemyField = this.getEnemyField();
|
||||
|
@ -867,7 +879,7 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
getPokemonById(pokemonId: integer): Pokemon | null {
|
||||
const findInParty = (party: Pokemon[]) => party.find(p => p.id === pokemonId);
|
||||
return (findInParty(this.getParty()) || 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 {
|
||||
|
@ -1062,7 +1074,7 @@ export default class BattleScene extends SceneBase {
|
|||
this.modifierBar.removeAll(true);
|
||||
this.enemyModifierBar.removeAll(true);
|
||||
|
||||
for (const p of this.getParty()) {
|
||||
for (const p of this.getPlayerParty()) {
|
||||
p.destroy();
|
||||
}
|
||||
this.party = [];
|
||||
|
@ -1221,33 +1233,64 @@ export default class BattleScene extends SceneBase {
|
|||
newDouble = !!double;
|
||||
}
|
||||
|
||||
if (Overrides.BATTLE_TYPE_OVERRIDE === "double") {
|
||||
newDouble = true;
|
||||
}
|
||||
/* Override battles into single only if not fighting with trainers */
|
||||
if (newBattleType !== BattleType.TRAINER && Overrides.BATTLE_TYPE_OVERRIDE === "single") {
|
||||
// Disable double battles on Endless/Endless Spliced Wave 50x boss battles (Introduced 1.2.0)
|
||||
if (this.gameMode.isEndlessBoss(newWaveIndex)) {
|
||||
newDouble = false;
|
||||
}
|
||||
|
||||
const lastBattle = this.currentBattle;
|
||||
if (!isNullOrUndefined(Overrides.BATTLE_TYPE_OVERRIDE)) {
|
||||
let doubleOverrideForWave: "single" | "double" | null = null;
|
||||
|
||||
if (lastBattle?.double && !newDouble) {
|
||||
this.tryRemovePhase(p => p instanceof SwitchPhase);
|
||||
switch (Overrides.BATTLE_TYPE_OVERRIDE) {
|
||||
case "double":
|
||||
doubleOverrideForWave = "double";
|
||||
break;
|
||||
case "single":
|
||||
doubleOverrideForWave = "single";
|
||||
break;
|
||||
case "even-doubles":
|
||||
doubleOverrideForWave = (newWaveIndex % 2) ? "single" : "double";
|
||||
break;
|
||||
case "odd-doubles":
|
||||
doubleOverrideForWave = (newWaveIndex % 2) ? "double" : "single";
|
||||
break;
|
||||
}
|
||||
|
||||
if (doubleOverrideForWave === "double") {
|
||||
newDouble = true;
|
||||
}
|
||||
/**
|
||||
* Override battles into single only if not fighting with trainers.
|
||||
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 | GitHub Issue #1948}
|
||||
*/
|
||||
if (newBattleType !== BattleType.TRAINER && doubleOverrideForWave === "single") {
|
||||
newDouble = false;
|
||||
}
|
||||
}
|
||||
|
||||
const lastBattle = this.currentBattle;
|
||||
|
||||
const maxExpLevel = this.getMaxExpLevel();
|
||||
|
||||
this.lastEnemyTrainer = lastBattle?.trainer ?? null;
|
||||
this.lastMysteryEncounter = lastBattle?.mysteryEncounter;
|
||||
|
||||
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||
// Disable double battle on mystery encounters (it may be re-enabled as part of encounter)
|
||||
newDouble = false;
|
||||
}
|
||||
|
||||
if (lastBattle?.double && !newDouble) {
|
||||
this.tryRemovePhase(p => p instanceof SwitchPhase);
|
||||
this.getPlayerField().forEach(p => p.lapseTag(BattlerTagType.COMMANDED));
|
||||
}
|
||||
|
||||
this.executeWithSeedOffset(() => {
|
||||
this.currentBattle = new Battle(this.gameMode, newWaveIndex, newBattleType, newTrainer, newDouble);
|
||||
}, newWaveIndex << 3, this.waveSeed);
|
||||
this.currentBattle.incrementTurn(this);
|
||||
|
||||
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||
// Disable double battle on mystery encounters (it may be re-enabled as part of encounter)
|
||||
this.currentBattle.double = false;
|
||||
// Will generate the actual Mystery Encounter during NextEncounterPhase, to ensure it uses proper biome
|
||||
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
||||
}
|
||||
|
@ -1269,13 +1312,15 @@ export default class BattleScene extends SceneBase {
|
|||
if (resetArenaState) {
|
||||
this.arena.resetArenaEffects();
|
||||
|
||||
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||
|
||||
playerField.forEach((pokemon, p) => {
|
||||
if (pokemon.isOnField()) {
|
||||
this.pushPhase(new ReturnPhase(this, p));
|
||||
}
|
||||
});
|
||||
|
||||
for (const pokemon of this.getParty()) {
|
||||
for (const pokemon of this.getPlayerParty()) {
|
||||
pokemon.resetBattleData();
|
||||
applyPostBattleInitAbAttrs(PostBattleInitAbAttr, pokemon);
|
||||
}
|
||||
|
@ -1285,7 +1330,7 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
}
|
||||
|
||||
for (const pokemon of this.getParty()) {
|
||||
for (const pokemon of this.getPlayerParty()) {
|
||||
this.triggerPokemonFormChange(pokemon, SpeciesFormChangeTimeOfDayTrigger);
|
||||
}
|
||||
|
||||
|
@ -1379,10 +1424,19 @@ export default class BattleScene extends SceneBase {
|
|||
case Species.PALDEA_TAUROS:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
case Species.PIKACHU:
|
||||
if (this.currentBattle?.battleType === BattleType.TRAINER && this.currentBattle?.waveIndex < 30) {
|
||||
return 0; // Ban Cosplay and Partner Pika from Trainers before wave 30
|
||||
}
|
||||
return Utils.randSeedInt(8);
|
||||
case Species.EEVEE:
|
||||
if (this.currentBattle?.battleType === BattleType.TRAINER && this.currentBattle?.waveIndex < 30) {
|
||||
return 0; // No Partner Eevee for Wave 12 Preschoolers
|
||||
}
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.GRENINJA:
|
||||
if (this.currentBattle?.battleType === BattleType.TRAINER) {
|
||||
return 0; // Don't give trainers Battle Bond Greninja
|
||||
}
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.ZYGARDE:
|
||||
return Utils.randSeedInt(4);
|
||||
|
@ -1480,7 +1534,7 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
|
||||
trySpreadPokerus(): void {
|
||||
const party = this.getParty();
|
||||
const party = this.getPlayerParty();
|
||||
const infectedIndexes: integer[] = [];
|
||||
const spread = (index: number, spreadTo: number) => {
|
||||
const partyMember = party[index + spreadTo];
|
||||
|
@ -1677,7 +1731,7 @@ export default class BattleScene extends SceneBase {
|
|||
updateAndShowText(duration: number): void {
|
||||
const labels = [ this.luckLabelText, this.luckText ];
|
||||
labels.forEach(t => t.setAlpha(0));
|
||||
const luckValue = getPartyLuckValue(this.getParty());
|
||||
const luckValue = getPartyLuckValue(this.getPlayerParty());
|
||||
this.luckText.setText(getLuckString(luckValue));
|
||||
if (luckValue < 14) {
|
||||
this.luckText.setTint(getLuckTextTint(luckValue));
|
||||
|
@ -2554,14 +2608,15 @@ export default class BattleScene extends SceneBase {
|
|||
* The quantity to transfer is automatically capped at how much the recepient can take before reaching the maximum stack size for the item.
|
||||
* A transfer that moves a quantity smaller than what is specified in the transferQuantity parameter is still considered successful.
|
||||
* @param itemModifier {@linkcode PokemonHeldItemModifier} item to transfer (represents the whole stack)
|
||||
* @param target {@linkcode Pokemon} pokemon recepient in this transfer
|
||||
* @param playSound {boolean}
|
||||
* @param transferQuantity {@linkcode integer} how many items of the stack to transfer. Optional, defaults to 1
|
||||
* @param instant {boolean}
|
||||
* @param ignoreUpdate {boolean}
|
||||
* @returns true if the transfer was successful
|
||||
* @param target {@linkcode Pokemon} recepient in this transfer
|
||||
* @param playSound `true` to play a sound when transferring the item
|
||||
* @param transferQuantity How many items of the stack to transfer. Optional, defaults to `1`
|
||||
* @param instant ??? (Optional)
|
||||
* @param ignoreUpdate ??? (Optional)
|
||||
* @param itemLost If `true`, treat the item's current holder as losing the item (for now, this simply enables Unburden). Default is `true`.
|
||||
* @returns `true` if the transfer was successful
|
||||
*/
|
||||
tryTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, playSound: boolean, transferQuantity: integer = 1, instant?: boolean, ignoreUpdate?: boolean): Promise<boolean> {
|
||||
tryTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, playSound: boolean, transferQuantity: number = 1, instant?: boolean, ignoreUpdate?: boolean, itemLost: boolean = true): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
const source = itemModifier.pokemonId ? itemModifier.getPokemon(target.scene) : null;
|
||||
const cancelled = new Utils.BooleanHolder(false);
|
||||
|
@ -2593,9 +2648,19 @@ export default class BattleScene extends SceneBase {
|
|||
const addModifier = () => {
|
||||
if (!matchingModifier || this.removeModifier(matchingModifier, !target.isPlayer())) {
|
||||
if (target.isPlayer()) {
|
||||
this.addModifier(newItemModifier, ignoreUpdate, playSound, false, instant).then(() => resolve(true));
|
||||
this.addModifier(newItemModifier, ignoreUpdate, playSound, false, instant).then(() => {
|
||||
if (source && itemLost) {
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, source, false);
|
||||
}
|
||||
resolve(true);
|
||||
});
|
||||
} else {
|
||||
this.addEnemyModifier(newItemModifier, ignoreUpdate, instant).then(() => resolve(true));
|
||||
this.addEnemyModifier(newItemModifier, ignoreUpdate, instant).then(() => {
|
||||
if (source && itemLost) {
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, source, false);
|
||||
}
|
||||
resolve(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
resolve(false);
|
||||
|
@ -2615,7 +2680,7 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
removePartyMemberModifiers(partyMemberIndex: integer): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const pokemonId = this.getParty()[partyMemberIndex].id;
|
||||
const pokemonId = this.getPlayerParty()[partyMemberIndex].id;
|
||||
const modifiersToRemove = this.modifiers.filter(m => m instanceof PokemonHeldItemModifier && (m as PokemonHeldItemModifier).pokemonId === pokemonId);
|
||||
for (const m of modifiersToRemove) {
|
||||
this.modifiers.splice(this.modifiers.indexOf(m), 1);
|
||||
|
@ -2742,7 +2807,7 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
}
|
||||
|
||||
this.updatePartyForModifiers(player ? this.getParty() : this.getEnemyParty(), instant).then(() => {
|
||||
this.updatePartyForModifiers(player ? this.getPlayerParty() : this.getEnemyParty(), instant).then(() => {
|
||||
(player ? this.modifierBar : this.enemyModifierBar).updateModifiers(modifiers);
|
||||
if (!player) {
|
||||
this.updateUIPositions();
|
||||
|
@ -2763,7 +2828,15 @@ export default class BattleScene extends SceneBase {
|
|||
});
|
||||
}
|
||||
|
||||
removeModifier(modifier: PersistentModifier, enemy?: boolean): boolean {
|
||||
/**
|
||||
* Removes a currently owned item. If the item is stacked, the entire item stack
|
||||
* gets removed. This function does NOT apply in-battle effects, such as Unburden.
|
||||
* If in-battle effects are needed, use {@linkcode Pokemon.loseHeldItem} instead.
|
||||
* @param modifier The item to be removed.
|
||||
* @param enemy If `true`, remove an item owned by the enemy. If `false`, remove an item owned by the player. Default is `false`.
|
||||
* @returns `true` if the item exists and was successfully removed, `false` otherwise.
|
||||
*/
|
||||
removeModifier(modifier: PersistentModifier, enemy: boolean = false): boolean {
|
||||
const modifiers = !enemy ? this.modifiers : this.enemyModifiers;
|
||||
const modifierIndex = modifiers.indexOf(modifier);
|
||||
if (modifierIndex > -1) {
|
||||
|
@ -2960,12 +3033,21 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
updateGameInfo(): void {
|
||||
const gameInfo = {
|
||||
playTime: this.sessionPlayTime ? this.sessionPlayTime : 0,
|
||||
playTime: this.sessionPlayTime ?? 0,
|
||||
gameMode: this.currentBattle ? this.gameMode.getName() : "Title",
|
||||
biome: this.currentBattle ? getBiomeName(this.arena.biomeType) : "",
|
||||
wave: this.currentBattle?.waveIndex || 0,
|
||||
party: this.party ? this.party.map(p => {
|
||||
return { name: p.name, level: p.level };
|
||||
wave: this.currentBattle?.waveIndex ?? 0,
|
||||
party: this.party ? this.party.map((p) => {
|
||||
return {
|
||||
name: p.name,
|
||||
form: p.getFormKey(),
|
||||
types: p.getTypes().map((type) => Type[type]),
|
||||
teraType: p.getTeraType() !== Type.UNKNOWN ? Type[p.getTeraType()] : "",
|
||||
level: p.level,
|
||||
currentHP: p.hp,
|
||||
maxHP: p.getMaxHp(),
|
||||
status: p.status?.effect ? StatusEffect[p.status.effect] : ""
|
||||
};
|
||||
}) : [],
|
||||
modeChain: this.ui?.getModeChain() ?? [],
|
||||
};
|
||||
|
@ -2980,22 +3062,16 @@ export default class BattleScene extends SceneBase {
|
|||
*/
|
||||
getActiveKeys(): string[] {
|
||||
const keys: string[] = [];
|
||||
const playerParty = this.getParty();
|
||||
playerParty.forEach(p => {
|
||||
let activePokemon: (PlayerPokemon | EnemyPokemon)[] = this.getPlayerParty();
|
||||
activePokemon = activePokemon.concat(this.getEnemyParty());
|
||||
activePokemon.forEach((p) => {
|
||||
keys.push(p.getSpriteKey(true));
|
||||
if (p instanceof PlayerPokemon) {
|
||||
keys.push(p.getBattleSpriteKey(true, true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.formIndex));
|
||||
if (p.fusionSpecies) {
|
||||
keys.push("cry/" + p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
}
|
||||
});
|
||||
// enemyParty has to be operated on separately from playerParty because playerPokemon =/= enemyPokemon
|
||||
const enemyParty = this.getEnemyParty();
|
||||
enemyParty.forEach(p => {
|
||||
keys.push(p.getSpriteKey(true));
|
||||
keys.push("cry/" + p.species.getCryKey(p.formIndex));
|
||||
keys.push(p.species.getCryKey(p.formIndex));
|
||||
if (p.fusionSpecies) {
|
||||
keys.push("cry/" + p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
keys.push(p.fusionSpecies.getCryKey(p.fusionFormIndex));
|
||||
}
|
||||
});
|
||||
return keys;
|
||||
|
@ -3016,7 +3092,7 @@ export default class BattleScene extends SceneBase {
|
|||
this.setFieldScale(0.75);
|
||||
this.triggerPokemonFormChange(pokemon, SpeciesFormChangeManualTrigger, false);
|
||||
this.currentBattle.double = true;
|
||||
const availablePartyMembers = this.getParty().filter((p) => p.isAllowedInBattle());
|
||||
const availablePartyMembers = this.getPlayerParty().filter((p) => p.isAllowedInBattle());
|
||||
if (availablePartyMembers.length > 1) {
|
||||
this.pushPhase(new ToggleDoublePositionPhase(this, true));
|
||||
if (!availablePartyMembers[1].isOnField()) {
|
||||
|
@ -3041,7 +3117,7 @@ export default class BattleScene extends SceneBase {
|
|||
*/
|
||||
applyPartyExp(expValue: number, pokemonDefeated: boolean, useWaveIndexMultiplier?: boolean, pokemonParticipantIds?: Set<number>): void {
|
||||
const participantIds = pokemonParticipantIds ?? this.currentBattle.playerParticipantIds;
|
||||
const party = this.getParty();
|
||||
const party = this.getPlayerParty();
|
||||
const expShareModifier = this.findModifier(m => m instanceof ExpShareModifier) as ExpShareModifier;
|
||||
const expBalanceModifier = this.findModifier(m => m instanceof ExpBalanceModifier) as ExpBalanceModifier;
|
||||
const multipleParticipantExpBonusModifier = this.findModifier(m => m instanceof MultipleParticipantExpBonusModifier) as MultipleParticipantExpBonusModifier;
|
||||
|
|
204
src/battle.ts
|
@ -4,13 +4,15 @@ import * as Utils from "./utils";
|
|||
import Trainer, { TrainerVariant } from "./field/trainer";
|
||||
import { GameMode } from "./game-mode";
|
||||
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "./data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { trainerConfigs } from "#app/data/trainer-config";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon, QueuedMove } from "#app/field/pokemon";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattleSpec } from "#enums/battle-spec";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { Species } from "#enums/species";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
|
@ -212,7 +214,6 @@ export default class Battle {
|
|||
}
|
||||
|
||||
getBgmOverride(scene: BattleScene): string | null {
|
||||
const battlers = this.enemyParty.slice(0, this.getBattlerCount());
|
||||
if (this.isBattleMysteryEncounter() && this.mysteryEncounter?.encounterMode === MysteryEncounterMode.DEFAULT) {
|
||||
// Music is overridden for MEs during ME onInit()
|
||||
// Should not use any BGM overrides before swapping from DEFAULT mode
|
||||
|
@ -221,7 +222,7 @@ export default class Battle {
|
|||
if (!this.started && this.trainer?.config.encounterBgm && this.trainer?.getEncounterMessages()?.length) {
|
||||
return `encounter_${this.trainer?.getEncounterBgm()}`;
|
||||
}
|
||||
if (scene.musicPreference === 0) {
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
return this.trainer?.getBattleBgm() ?? null;
|
||||
} else {
|
||||
return this.trainer?.getMixedBattleBgm() ?? null;
|
||||
|
@ -229,143 +230,163 @@ export default class Battle {
|
|||
} else if (this.gameMode.isClassic && this.waveIndex > 195 && this.battleSpec !== BattleSpec.FINAL_BOSS) {
|
||||
return "end_summit";
|
||||
}
|
||||
for (const pokemon of battlers) {
|
||||
const wildOpponents = scene.getEnemyParty();
|
||||
for (const pokemon of wildOpponents) {
|
||||
if (this.battleSpec === BattleSpec.FINAL_BOSS) {
|
||||
if (pokemon.formIndex) {
|
||||
if (pokemon.species.getFormSpriteKey(pokemon.formIndex) === SpeciesFormKey.ETERNAMAX) {
|
||||
return "battle_final";
|
||||
}
|
||||
return "battle_final_encounter";
|
||||
}
|
||||
if (pokemon.species.legendary || pokemon.species.subLegendary || pokemon.species.mythical) {
|
||||
if (scene.musicPreference === 0) {
|
||||
if (pokemon.species.speciesId === Species.REGIROCK || pokemon.species.speciesId === Species.REGICE || pokemon.species.speciesId === Species.REGISTEEL || pokemon.species.speciesId === Species.REGIGIGAS || pokemon.species.speciesId === Species.REGIELEKI || pokemon.species.speciesId === Species.REGIDRAGO) {
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
switch (pokemon.species.speciesId) {
|
||||
case Species.REGIROCK:
|
||||
case Species.REGICE:
|
||||
case Species.REGISTEEL:
|
||||
case Species.REGIGIGAS:
|
||||
case Species.REGIDRAGO:
|
||||
case Species.REGIELEKI:
|
||||
return "battle_legendary_regis_g5";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.COBALION || pokemon.species.speciesId === Species.TERRAKION || pokemon.species.speciesId === Species.VIRIZION || pokemon.species.speciesId === Species.TORNADUS || pokemon.species.speciesId === Species.THUNDURUS || pokemon.species.speciesId === Species.LANDORUS || pokemon.species.speciesId === Species.KELDEO || pokemon.species.speciesId === Species.MELOETTA || pokemon.species.speciesId === Species.GENESECT) {
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KYUREM) {
|
||||
case Species.KYUREM:
|
||||
return "battle_legendary_kyurem";
|
||||
}
|
||||
default:
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
return "battle_legendary_unova";
|
||||
} else {
|
||||
if (pokemon.species.speciesId === Species.ARTICUNO || pokemon.species.speciesId === Species.ZAPDOS || pokemon.species.speciesId === Species.MOLTRES || pokemon.species.speciesId === Species.MEWTWO || pokemon.species.speciesId === Species.MEW) {
|
||||
}
|
||||
} else if (scene.musicPreference === MusicPreference.MIXED) {
|
||||
switch (pokemon.species.speciesId) {
|
||||
case Species.ARTICUNO:
|
||||
case Species.ZAPDOS:
|
||||
case Species.MOLTRES:
|
||||
case Species.MEWTWO:
|
||||
case Species.MEW:
|
||||
return "battle_legendary_kanto";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.RAIKOU) {
|
||||
case Species.RAIKOU:
|
||||
return "battle_legendary_raikou";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ENTEI) {
|
||||
case Species.ENTEI:
|
||||
return "battle_legendary_entei";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.SUICUNE) {
|
||||
case Species.SUICUNE:
|
||||
return "battle_legendary_suicune";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.LUGIA) {
|
||||
case Species.LUGIA:
|
||||
return "battle_legendary_lugia";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.HO_OH) {
|
||||
case Species.HO_OH:
|
||||
return "battle_legendary_ho_oh";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.REGIROCK || pokemon.species.speciesId === Species.REGICE || pokemon.species.speciesId === Species.REGISTEEL || pokemon.species.speciesId === Species.REGIGIGAS || pokemon.species.speciesId === Species.REGIELEKI || pokemon.species.speciesId === Species.REGIDRAGO) {
|
||||
case Species.REGIROCK:
|
||||
case Species.REGICE:
|
||||
case Species.REGISTEEL:
|
||||
case Species.REGIGIGAS:
|
||||
case Species.REGIDRAGO:
|
||||
case Species.REGIELEKI:
|
||||
return "battle_legendary_regis_g6";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GROUDON || pokemon.species.speciesId === Species.KYOGRE) {
|
||||
case Species.GROUDON:
|
||||
case Species.KYOGRE:
|
||||
return "battle_legendary_gro_kyo";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.RAYQUAZA) {
|
||||
case Species.RAYQUAZA:
|
||||
return "battle_legendary_rayquaza";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.DEOXYS) {
|
||||
case Species.DEOXYS:
|
||||
return "battle_legendary_deoxys";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.UXIE || pokemon.species.speciesId === Species.MESPRIT || pokemon.species.speciesId === Species.AZELF) {
|
||||
case Species.UXIE:
|
||||
case Species.MESPRIT:
|
||||
case Species.AZELF:
|
||||
return "battle_legendary_lake_trio";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.HEATRAN || pokemon.species.speciesId === Species.CRESSELIA || pokemon.species.speciesId === Species.DARKRAI || pokemon.species.speciesId === Species.SHAYMIN) {
|
||||
case Species.HEATRAN:
|
||||
case Species.CRESSELIA:
|
||||
case Species.DARKRAI:
|
||||
case Species.SHAYMIN:
|
||||
return "battle_legendary_sinnoh";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.DIALGA || pokemon.species.speciesId === Species.PALKIA) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
return "battle_legendary_dia_pal";
|
||||
}
|
||||
if (pokemon.getFormKey() === "origin") {
|
||||
case Species.DIALGA:
|
||||
case Species.PALKIA:
|
||||
if (pokemon.species.getFormSpriteKey(pokemon.formIndex) === SpeciesFormKey.ORIGIN) {
|
||||
return "battle_legendary_origin_forme";
|
||||
}
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GIRATINA) {
|
||||
return "battle_legendary_dia_pal";
|
||||
case Species.GIRATINA:
|
||||
return "battle_legendary_giratina";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ARCEUS) {
|
||||
case Species.ARCEUS:
|
||||
return "battle_legendary_arceus";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.COBALION || pokemon.species.speciesId === Species.TERRAKION || pokemon.species.speciesId === Species.VIRIZION || pokemon.species.speciesId === Species.TORNADUS || pokemon.species.speciesId === Species.THUNDURUS || pokemon.species.speciesId === Species.LANDORUS || pokemon.species.speciesId === Species.KELDEO || pokemon.species.speciesId === Species.MELOETTA || pokemon.species.speciesId === Species.GENESECT) {
|
||||
case Species.COBALION:
|
||||
case Species.TERRAKION:
|
||||
case Species.VIRIZION:
|
||||
case Species.KELDEO:
|
||||
case Species.TORNADUS:
|
||||
case Species.LANDORUS:
|
||||
case Species.THUNDURUS:
|
||||
case Species.MELOETTA:
|
||||
case Species.GENESECT:
|
||||
return "battle_legendary_unova";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KYUREM) {
|
||||
case Species.KYUREM:
|
||||
return "battle_legendary_kyurem";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.XERNEAS || pokemon.species.speciesId === Species.YVELTAL || pokemon.species.speciesId === Species.ZYGARDE) {
|
||||
case Species.XERNEAS:
|
||||
case Species.YVELTAL:
|
||||
case Species.ZYGARDE:
|
||||
return "battle_legendary_xern_yvel";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.TAPU_KOKO || pokemon.species.speciesId === Species.TAPU_LELE || pokemon.species.speciesId === Species.TAPU_BULU || pokemon.species.speciesId === Species.TAPU_FINI) {
|
||||
case Species.TAPU_KOKO:
|
||||
case Species.TAPU_LELE:
|
||||
case Species.TAPU_BULU:
|
||||
case Species.TAPU_FINI:
|
||||
return "battle_legendary_tapu";
|
||||
}
|
||||
if ([ Species.COSMOG, Species.COSMOEM, Species.SOLGALEO, Species.LUNALA ].includes(pokemon.species.speciesId)) {
|
||||
case Species.SOLGALEO:
|
||||
case Species.LUNALA:
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.NECROZMA) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
if (pokemon.getFormKey() === "dusk-mane" || pokemon.getFormKey() === "dawn-wings") {
|
||||
case Species.NECROZMA:
|
||||
switch (pokemon.getFormKey()) {
|
||||
case "dusk-mane":
|
||||
case "dawn-wings":
|
||||
return "battle_legendary_dusk_dawn";
|
||||
}
|
||||
if (pokemon.getFormKey() === "ultra") {
|
||||
case "ultra":
|
||||
return "battle_legendary_ultra_nec";
|
||||
default:
|
||||
return "battle_legendary_sol_lun";
|
||||
}
|
||||
}
|
||||
if ([ Species.NIHILEGO, Species.BUZZWOLE, Species.PHEROMOSA, Species.XURKITREE, Species.CELESTEELA, Species.KARTANA, Species.GUZZLORD, Species.POIPOLE, Species.NAGANADEL, Species.STAKATAKA, Species.BLACEPHALON ].includes(pokemon.species.speciesId)) {
|
||||
case Species.NIHILEGO:
|
||||
case Species.PHEROMOSA:
|
||||
case Species.BUZZWOLE:
|
||||
case Species.XURKITREE:
|
||||
case Species.CELESTEELA:
|
||||
case Species.KARTANA:
|
||||
case Species.GUZZLORD:
|
||||
case Species.POIPOLE:
|
||||
case Species.NAGANADEL:
|
||||
case Species.STAKATAKA:
|
||||
case Species.BLACEPHALON:
|
||||
return "battle_legendary_ub";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.ZACIAN || pokemon.species.speciesId === Species.ZAMAZENTA) {
|
||||
case Species.ZACIAN:
|
||||
case Species.ZAMAZENTA:
|
||||
return "battle_legendary_zac_zam";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GLASTRIER || pokemon.species.speciesId === Species.SPECTRIER) {
|
||||
case Species.GLASTRIER:
|
||||
case Species.SPECTRIER:
|
||||
return "battle_legendary_glas_spec";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.CALYREX) {
|
||||
if (pokemon.getFormKey() === "") {
|
||||
return "battle_legendary_calyrex";
|
||||
}
|
||||
case Species.CALYREX:
|
||||
if (pokemon.getFormKey() === "ice" || pokemon.getFormKey() === "shadow") {
|
||||
return "battle_legendary_riders";
|
||||
}
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.GALAR_ARTICUNO || pokemon.species.speciesId === Species.GALAR_ZAPDOS || pokemon.species.speciesId === Species.GALAR_MOLTRES) {
|
||||
return "battle_legendary_calyrex";
|
||||
case Species.GALAR_ARTICUNO:
|
||||
case Species.GALAR_ZAPDOS:
|
||||
case Species.GALAR_MOLTRES:
|
||||
return "battle_legendary_birds_galar";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.WO_CHIEN || pokemon.species.speciesId === Species.CHIEN_PAO || pokemon.species.speciesId === Species.TING_LU || pokemon.species.speciesId === Species.CHI_YU) {
|
||||
case Species.WO_CHIEN:
|
||||
case Species.CHIEN_PAO:
|
||||
case Species.TING_LU:
|
||||
case Species.CHI_YU:
|
||||
return "battle_legendary_ruinous";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.KORAIDON || pokemon.species.speciesId === Species.MIRAIDON) {
|
||||
case Species.KORAIDON:
|
||||
case Species.MIRAIDON:
|
||||
return "battle_legendary_kor_mir";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.OKIDOGI || pokemon.species.speciesId === Species.MUNKIDORI || pokemon.species.speciesId === Species.FEZANDIPITI) {
|
||||
case Species.OKIDOGI:
|
||||
case Species.MUNKIDORI:
|
||||
case Species.FEZANDIPITI:
|
||||
return "battle_legendary_loyal_three";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.OGERPON) {
|
||||
case Species.OGERPON:
|
||||
return "battle_legendary_ogerpon";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.TERAPAGOS) {
|
||||
case Species.TERAPAGOS:
|
||||
return "battle_legendary_terapagos";
|
||||
}
|
||||
if (pokemon.species.speciesId === Species.PECHARUNT) {
|
||||
case Species.PECHARUNT:
|
||||
return "battle_legendary_pecharunt";
|
||||
}
|
||||
default:
|
||||
if (pokemon.species.legendary) {
|
||||
return "battle_legendary_res_zek";
|
||||
}
|
||||
|
@ -373,6 +394,7 @@ export default class Battle {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scene.gameMode.isClassic && this.waveIndex <= 4) {
|
||||
return "battle_wild";
|
||||
|
|
|
@ -3,3 +3,9 @@ export const PLAYER_PARTY_MAX_SIZE: number = 6;
|
|||
|
||||
/** Whether to use seasonal splash messages in general */
|
||||
export const USE_SEASONAL_SPLASH_MESSAGES: boolean = false;
|
||||
|
||||
/** Name of the session ID cookie */
|
||||
export const SESSION_ID_COOKIE_NAME: string = "pokerogue_sessionId";
|
||||
|
||||
/** Max value for an integer attribute in {@linkcode SystemSaveData} */
|
||||
export const MAX_INT_ATTR_VALUE = 0x80000000;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import Pokemon, { HitResult, PlayerPokemon, PokemonMove } from "../field/pokemon";
|
||||
import { Type } from "./type";
|
||||
import Pokemon, { EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove } from "../field/pokemon";
|
||||
import { Type } from "#enums/type";
|
||||
import { Constructor } from "#app/utils";
|
||||
import * as Utils from "../utils";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import { Weather, WeatherType } from "./weather";
|
||||
import { BattlerTag, GroundedTag } from "./battler-tags";
|
||||
import { StatusEffect, getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "./status-effect";
|
||||
import { Weather } from "#app/data/weather";
|
||||
import { BattlerTag, BattlerTagLapseType, GroundedTag } from "./battler-tags";
|
||||
import { getNonVolatileStatusEffects, getStatusEffectDescriptor, getStatusEffectHealText } from "#app/data/status-effect";
|
||||
import { Gender } from "./gender";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, MoveAttr, MultiHitAttr, SacrificialAttr, SacrificialAttrOnHit, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
||||
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, FlinchAttr, OneHitKOAttr, HitHealAttr, allMoves, StatusMove, SelfStatusMove, VariablePowerAttr, applyMoveAttrs, VariableMoveTypeAttr, RandomMovesetMoveAttr, RandomMoveAttr, NaturePowerAttr, CopyMoveAttr, NeutralDamageAgainstFlyingTypeMultiplierAttr, FixedDamageAttr } from "./move";
|
||||
import { ArenaTagSide, ArenaTrapTag } from "./arena-tag";
|
||||
import { BerryModifier, PokemonHeldItemModifier } from "../modifier/modifier";
|
||||
import { BerryModifier, HitHealModifier, PokemonHeldItemModifier } from "../modifier/modifier";
|
||||
import { TerrainType } from "./terrain";
|
||||
import { SpeciesFormChangeManualTrigger, SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "./pokemon-forms";
|
||||
import i18next from "i18next";
|
||||
|
@ -17,7 +17,7 @@ import { Localizable } from "#app/interfaces/locales";
|
|||
import { Command } from "../ui/command-ui-handler";
|
||||
import { BerryModifierType } from "#app/modifier/modifier-type";
|
||||
import { getPokeballName } from "./pokeball";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { BattlerIndex, BattleType } from "#app/battle";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
|
@ -29,6 +29,15 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
|||
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { SwitchType } from "#app/enums/switch-type";
|
||||
import { SwitchPhase } from "#app/phases/switch-phase";
|
||||
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
|
||||
import { BattleEndPhase } from "#app/phases/battle-end-phase";
|
||||
import { NewBattlePhase } from "#app/phases/new-battle-phase";
|
||||
import { MoveEndPhase } from "#app/phases/move-end-phase";
|
||||
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
|
||||
export class Ability implements Localizable {
|
||||
public id: Abilities;
|
||||
|
@ -330,6 +339,30 @@ export class ReceivedMoveDamageMultiplierAbAttr extends PreDefendAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces the damage dealt to an allied Pokemon. Used by Friend Guard.
|
||||
* @see {@linkcode applyPreDefend}
|
||||
*/
|
||||
export class AlliedFieldDamageReductionAbAttr extends PreDefendAbAttr {
|
||||
private damageMultiplier: number;
|
||||
|
||||
constructor(damageMultiplier: number) {
|
||||
super();
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the damage reduction
|
||||
* @param args
|
||||
* - `[0]` {@linkcode Utils.NumberHolder} - The damage being dealt
|
||||
*/
|
||||
override applyPreDefend(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, _attacker: Pokemon, _move: Move, _cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
const damage = args[0] as Utils.NumberHolder;
|
||||
damage.value = Utils.toDmgValue(damage.value * this.damageMultiplier);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class ReceivedTypeDamageMultiplierAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
|
||||
constructor(moveType: Type, damageMultiplier: number) {
|
||||
super((target, user, move) => user.getMoveType(move) === moveType, damageMultiplier);
|
||||
|
@ -481,7 +514,11 @@ export class NonSuperEffectiveImmunityAbAttr extends TypeImmunityAbAttr {
|
|||
}
|
||||
|
||||
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (move instanceof AttackMove && pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker) < 2) {
|
||||
const modifierValue = args.length > 0
|
||||
? (args[0] as Utils.NumberHolder).value
|
||||
: pokemon.getAttackTypeEffectiveness(attacker.getMoveType(move), attacker, undefined, undefined, move);
|
||||
|
||||
if (move instanceof AttackMove && modifierValue < 2) {
|
||||
cancelled.value = true; // Suppresses "No Effect" message
|
||||
(args[0] as Utils.NumberHolder).value = 0;
|
||||
return true;
|
||||
|
@ -548,15 +585,11 @@ export class PostDefendAbAttr extends AbAttr {
|
|||
|
||||
export class FieldPriorityMoveImmunityAbAttr extends PreDefendAbAttr {
|
||||
applyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
const attackPriority = new Utils.IntegerHolder(move.priority);
|
||||
applyMoveAttrs(IncrementMovePriorityAttr, attacker, null, move, attackPriority);
|
||||
applyAbAttrs(ChangeMovePriorityAbAttr, attacker, null, simulated, move, attackPriority);
|
||||
|
||||
if (move.moveTarget === MoveTarget.USER || move.moveTarget === MoveTarget.NEAR_ALLY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (attackPriority.value > 0 && !move.isMultiTarget()) {
|
||||
if (move.getPriority(attacker) > 0 && !move.isMultiTarget()) {
|
||||
cancelled.value = true;
|
||||
return true;
|
||||
}
|
||||
|
@ -1318,65 +1351,30 @@ export class AddSecondStrikeAbAttr extends PreAttackAbAttr {
|
|||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether this attribute can apply to a given move.
|
||||
* @param {Move} move the move to which this attribute may apply
|
||||
* @param numTargets the number of {@linkcode Pokemon} targeted by this move
|
||||
* @returns true if the attribute can apply to the move, false otherwise
|
||||
*/
|
||||
canApplyPreAttack(move: Move, numTargets: integer): boolean {
|
||||
/**
|
||||
* Parental Bond cannot apply to multi-hit moves, charging moves, or
|
||||
* moves that cause the user to faint.
|
||||
*/
|
||||
const exceptAttrs: Constructor<MoveAttr>[] = [
|
||||
MultiHitAttr,
|
||||
SacrificialAttr,
|
||||
SacrificialAttrOnHit
|
||||
];
|
||||
|
||||
/** Parental Bond cannot apply to these specific moves */
|
||||
const exceptMoves: Moves[] = [
|
||||
Moves.FLING,
|
||||
Moves.UPROAR,
|
||||
Moves.ROLLOUT,
|
||||
Moves.ICE_BALL,
|
||||
Moves.ENDEAVOR
|
||||
];
|
||||
|
||||
/** Also check if this move is an Attack move and if it's only targeting one Pokemon */
|
||||
return numTargets === 1
|
||||
&& !move.isChargingMove()
|
||||
&& !exceptAttrs.some(attr => move.hasAttr(attr))
|
||||
&& !exceptMoves.some(id => move.id === id)
|
||||
&& move.category !== MoveCategory.STATUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* If conditions are met, this doubles the move's hit count (via args[1])
|
||||
* or multiplies the damage of secondary strikes (via args[2])
|
||||
* @param {Pokemon} pokemon the Pokemon using the move
|
||||
* @param pokemon the {@linkcode Pokemon} using the move
|
||||
* @param passive n/a
|
||||
* @param defender n/a
|
||||
* @param {Move} move the move used by the ability source
|
||||
* @param args\[0\] the number of Pokemon this move is targeting
|
||||
* @param {Utils.IntegerHolder} args\[1\] the number of strikes with this move
|
||||
* @param {Utils.NumberHolder} args\[2\] the damage multiplier for the current strike
|
||||
* @param move the {@linkcode Move} used by the ability source
|
||||
* @param args Additional arguments:
|
||||
* - `[0]` the number of strikes this move currently has ({@linkcode Utils.NumberHolder})
|
||||
* - `[1]` the damage multiplier for the current strike ({@linkcode Utils.NumberHolder})
|
||||
* @returns
|
||||
*/
|
||||
applyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean {
|
||||
const numTargets = args[0] as integer;
|
||||
const hitCount = args[1] as Utils.IntegerHolder;
|
||||
const multiplier = args[2] as Utils.NumberHolder;
|
||||
const hitCount = args[0] as Utils.NumberHolder;
|
||||
const multiplier = args[1] as Utils.NumberHolder;
|
||||
|
||||
if (this.canApplyPreAttack(move, numTargets)) {
|
||||
if (move.canBeMultiStrikeEnhanced(pokemon, true)) {
|
||||
this.showAbility = !!hitCount?.value;
|
||||
if (!!hitCount?.value) {
|
||||
hitCount.value *= 2;
|
||||
if (hitCount?.value) {
|
||||
hitCount.value += 1;
|
||||
}
|
||||
|
||||
if (!!multiplier?.value && pokemon.turnData.hitsLeft % 2 === 1 && pokemon.turnData.hitsLeft !== pokemon.turnData.hitCount) {
|
||||
multiplier.value *= this.damageMultiplier;
|
||||
if (multiplier?.value && pokemon.turnData.hitsLeft === 1) {
|
||||
multiplier.value = this.damageMultiplier;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1926,6 +1924,10 @@ export class CopyFaintedAllyAbilityAbAttr extends PostKnockOutAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ability attribute for ignoring the opponent's stat changes
|
||||
* @param stats the stats that should be ignored
|
||||
*/
|
||||
export class IgnoreOpponentStatStagesAbAttr extends AbAttr {
|
||||
private stats: readonly BattleStat[];
|
||||
|
||||
|
@ -1935,6 +1937,15 @@ export class IgnoreOpponentStatStagesAbAttr extends AbAttr {
|
|||
this.stats = stats ?? BATTLE_STATS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies a BooleanHolder and returns the result to see if a stat is ignored or not
|
||||
* @param _pokemon n/a
|
||||
* @param _passive n/a
|
||||
* @param simulated n/a
|
||||
* @param _cancelled n/a
|
||||
* @param args A BooleanHolder that represents whether or not to ignore a stat's stat changes
|
||||
* @returns true if the stat is ignored, false otherwise
|
||||
*/
|
||||
apply(_pokemon: Pokemon, _passive: boolean, simulated: boolean, _cancelled: Utils.BooleanHolder, args: any[]) {
|
||||
if (this.stats.includes(args[0])) {
|
||||
(args[1] as Utils.BooleanHolder).value = true;
|
||||
|
@ -2417,12 +2428,15 @@ export class PostSummonCopyAllyStatsAbAttr extends PostSummonAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by Imposter
|
||||
*/
|
||||
export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
async applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): Promise<boolean> {
|
||||
async applyPostSummon(pokemon: Pokemon, _passive: boolean, simulated: boolean, _args: any[]): Promise<boolean> {
|
||||
const targets = pokemon.getOpponents();
|
||||
if (simulated || !targets.length) {
|
||||
return simulated;
|
||||
|
@ -2431,17 +2445,31 @@ export class PostSummonTransformAbAttr extends PostSummonAbAttr {
|
|||
|
||||
let target: Pokemon;
|
||||
if (targets.length > 1) {
|
||||
pokemon.scene.executeWithSeedOffset(() => target = Utils.randSeedItem(targets), pokemon.scene.currentBattle.waveIndex);
|
||||
pokemon.scene.executeWithSeedOffset(() => {
|
||||
// in a double battle, if one of the opposing pokemon is fused the other one will be chosen
|
||||
// if both are fused, then Imposter will fail below
|
||||
if (targets[0].fusionSpecies) {
|
||||
target = targets[1];
|
||||
return;
|
||||
} else if (targets[1].fusionSpecies) {
|
||||
target = targets[0];
|
||||
return;
|
||||
}
|
||||
target = Utils.randSeedItem(targets);
|
||||
}, pokemon.scene.currentBattle.waveIndex);
|
||||
} else {
|
||||
target = targets[0];
|
||||
}
|
||||
|
||||
target = target!;
|
||||
|
||||
// transforming from or into fusion pokemon causes various problems (including crashes and save corruption)
|
||||
if (target.fusionSpecies || pokemon.fusionSpecies) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pokemon.summonData.speciesForm = target.getSpeciesForm();
|
||||
pokemon.summonData.fusionSpeciesForm = target.getFusionSpeciesForm();
|
||||
pokemon.summonData.ability = target.getAbility().id;
|
||||
pokemon.summonData.gender = target.getGender();
|
||||
pokemon.summonData.fusionGender = target.getFusionGender();
|
||||
|
||||
// Copy all stats (except HP)
|
||||
for (const s of EFFECTIVE_STATS) {
|
||||
|
@ -2548,6 +2576,42 @@ export class PostSummonFormChangeByWeatherAbAttr extends PostSummonAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute implementing the effects of {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander}.
|
||||
* When the source of an ability with this attribute detects a Dondozo as their active ally, the source "jumps
|
||||
* into the Dondozo's mouth," sharply boosting the Dondozo's stats, cancelling the source's moves, and
|
||||
* causing attacks that target the source to always miss.
|
||||
*/
|
||||
export class CommanderAbAttr extends AbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: null, args: any[]): boolean {
|
||||
// TODO: Should this work with X + Dondozo fusions?
|
||||
if (pokemon.scene.currentBattle?.double && pokemon.getAlly()?.species.speciesId === Species.DONDOZO) {
|
||||
// If the ally Dondozo is fainted or was previously "commanded" by
|
||||
// another Pokemon, this effect cannot apply.
|
||||
if (pokemon.getAlly().isFainted() || pokemon.getAlly().getTag(BattlerTagType.COMMANDED)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!simulated) {
|
||||
// Lapse the source's semi-invulnerable tags (to avoid visual inconsistencies)
|
||||
pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);
|
||||
// Play an animation of the source jumping into the ally Dondozo's mouth
|
||||
pokemon.scene.triggerPokemonBattleAnim(pokemon, PokemonAnimType.COMMANDER_APPLY);
|
||||
// Apply boosts from this effect to the ally Dondozo
|
||||
pokemon.getAlly().addTag(BattlerTagType.COMMANDED, 0, Moves.NONE, pokemon.id);
|
||||
// Cancel the source Pokemon's next move (if a move is queued)
|
||||
pokemon.scene.tryRemovePhase((phase) => phase instanceof MovePhase && phase.pokemon === pokemon);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class PreSwitchOutAbAttr extends AbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
|
@ -3068,7 +3132,7 @@ export class SuppressWeatherEffectAbAttr extends PreWeatherEffectAbAttr {
|
|||
/**
|
||||
* Condition function to applied to abilities related to Sheer Force.
|
||||
* Checks if last move used against target was affected by a Sheer Force user and:
|
||||
* Disables: Color Change, Pickpocket, Wimp Out, Emergency Exit, Berserk, Anger Shell
|
||||
* Disables: Color Change, Pickpocket, Berserk, Anger Shell
|
||||
* @returns {AbAttrCondition} If false disables the ability which the condition is applied to.
|
||||
*/
|
||||
function getSheerForceHitDisableAbCondition(): AbAttrCondition {
|
||||
|
@ -3116,7 +3180,7 @@ function getAnticipationCondition(): AbAttrCondition {
|
|||
continue;
|
||||
}
|
||||
// the move's base type (not accounting for variable type changes) is super effective
|
||||
if (move.getMove() instanceof AttackMove && pokemon.getAttackTypeEffectiveness(move.getMove().type, opponent, true) >= 2) {
|
||||
if (move.getMove() instanceof AttackMove && pokemon.getAttackTypeEffectiveness(move.getMove().type, opponent, true, undefined, move.getMove()) >= 2) {
|
||||
return true;
|
||||
}
|
||||
// move is a OHKO
|
||||
|
@ -3590,22 +3654,19 @@ export class MoodyAbAttr extends PostTurnAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class PostTurnStatStageChangeAbAttr extends PostTurnAbAttr {
|
||||
private stats: BattleStat[];
|
||||
private stages: number;
|
||||
export class SpeedBoostAbAttr extends PostTurnAbAttr {
|
||||
|
||||
constructor(stats: BattleStat[], stages: number) {
|
||||
constructor() {
|
||||
super(true);
|
||||
|
||||
this.stats = Array.isArray(stats)
|
||||
? stats
|
||||
: [ stats ];
|
||||
this.stages = stages;
|
||||
}
|
||||
|
||||
applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
if (!simulated) {
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.stages));
|
||||
if (!pokemon.turnData.switchedInThisTurn && !pokemon.turnData.failedRunAway) {
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ Stat.SPD ], 1));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3817,6 +3878,41 @@ export class PostDancingMoveAbAttr extends PostMoveUsedAbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers after the Pokemon loses or consumes an item
|
||||
* @extends AbAttr
|
||||
*/
|
||||
export class PostItemLostAbAttr extends AbAttr {
|
||||
applyPostItemLost(pokemon: Pokemon, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a Battler Tag to the Pokemon after it loses or consumes item
|
||||
* @extends PostItemLostAbAttr
|
||||
*/
|
||||
export class PostItemLostApplyBattlerTagAbAttr extends PostItemLostAbAttr {
|
||||
private tagType: BattlerTagType;
|
||||
constructor(tagType: BattlerTagType) {
|
||||
super(true);
|
||||
this.tagType = tagType;
|
||||
}
|
||||
/**
|
||||
* Adds the last used Pokeball back into the player's inventory
|
||||
* @param pokemon {@linkcode Pokemon} with this ability
|
||||
* @param args N/A
|
||||
* @returns true if BattlerTag was applied
|
||||
*/
|
||||
applyPostItemLost(pokemon: Pokemon, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
if (!pokemon.getTag(this.tagType) && !simulated) {
|
||||
pokemon.addTag(this.tagType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class StatStageChangeMultiplierAbAttr extends AbAttr {
|
||||
private multiplier: integer;
|
||||
|
||||
|
@ -4021,7 +4117,7 @@ export class PostBattleLootAbAttr extends PostBattleAbAttr {
|
|||
if (!simulated && postBattleLoot.length) {
|
||||
const randItem = Utils.randSeedItem(postBattleLoot);
|
||||
//@ts-ignore - TODO see below
|
||||
if (pokemon.scene.tryTransferHeldItemModifier(randItem, pokemon, true, 1, true)) { // TODO: fix. This is a promise!?
|
||||
if (pokemon.scene.tryTransferHeldItemModifier(randItem, pokemon, true, 1, true, undefined, false)) { // TODO: fix. This is a promise!?
|
||||
postBattleLoot.splice(postBattleLoot.indexOf(randItem), 1);
|
||||
pokemon.scene.queueMessage(i18next.t("abilityTriggers:postBattleLoot", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), itemName: randItem.type.name }));
|
||||
return true;
|
||||
|
@ -4679,6 +4775,84 @@ export class PreventBypassSpeedChanceAbAttr extends AbAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This applies a terrain-based type change to the Pokemon.
|
||||
* Used by Mimicry.
|
||||
*/
|
||||
export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
override apply(pokemon: Pokemon, _passive: boolean, _simulated: boolean, _cancelled: Utils.BooleanHolder, _args: any[]): boolean {
|
||||
if (pokemon.isTerastallized()) {
|
||||
return false;
|
||||
}
|
||||
const currentTerrain = pokemon.scene.arena.getTerrainType();
|
||||
const typeChange: Type[] = this.determineTypeChange(pokemon, currentTerrain);
|
||||
if (typeChange.length !== 0) {
|
||||
if (pokemon.summonData.addedType && typeChange.includes(pokemon.summonData.addedType)) {
|
||||
pokemon.summonData.addedType = null;
|
||||
}
|
||||
pokemon.summonData.types = typeChange;
|
||||
pokemon.updateInfo();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the type(s) the Pokemon should change to in response to a terrain
|
||||
* @param pokemon
|
||||
* @param currentTerrain {@linkcode TerrainType}
|
||||
* @returns a list of type(s)
|
||||
*/
|
||||
private determineTypeChange(pokemon: Pokemon, currentTerrain: TerrainType): Type[] {
|
||||
const typeChange: Type[] = [];
|
||||
switch (currentTerrain) {
|
||||
case TerrainType.ELECTRIC:
|
||||
typeChange.push(Type.ELECTRIC);
|
||||
break;
|
||||
case TerrainType.MISTY:
|
||||
typeChange.push(Type.FAIRY);
|
||||
break;
|
||||
case TerrainType.GRASSY:
|
||||
typeChange.push(Type.GRASS);
|
||||
break;
|
||||
case TerrainType.PSYCHIC:
|
||||
typeChange.push(Type.PSYCHIC);
|
||||
break;
|
||||
default:
|
||||
pokemon.getTypes(false, false, true).forEach(t => {
|
||||
typeChange.push(t);
|
||||
});
|
||||
break;
|
||||
}
|
||||
return typeChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Pokemon should change types if summoned into an active terrain
|
||||
* @returns `true` if there is an active terrain requiring a type change | `false` if not
|
||||
*/
|
||||
override applyPostSummon(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
if (pokemon.scene.arena.getTerrainType() !== TerrainType.NONE) {
|
||||
return this.apply(pokemon, passive, simulated, new Utils.BooleanHolder(false), []);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) {
|
||||
const currentTerrain = pokemon.scene.arena.getTerrainType();
|
||||
const pokemonNameWithAffix = getPokemonNameWithAffix(pokemon);
|
||||
if (currentTerrain === TerrainType.NONE) {
|
||||
return i18next.t("abilityTriggers:pokemonTypeChangeRevert", { pokemonNameWithAffix });
|
||||
} else {
|
||||
const moveType = i18next.t(`pokemonInfo:Type.${Type[this.determineTypeChange(pokemon, currentTerrain)[0]]}`);
|
||||
return i18next.t("abilityTriggers:pokemonTypeChange", { pokemonNameWithAffix, moveType });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function applyAbAttrsInternal<TAttr extends AbAttr>(
|
||||
attrType: Constructor<TAttr>,
|
||||
pokemon: Pokemon | null,
|
||||
|
@ -4734,6 +4908,240 @@ async function applyAbAttrsInternal<TAttr extends AbAttr>(
|
|||
}
|
||||
}
|
||||
|
||||
class ForceSwitchOutHelper {
|
||||
constructor(private switchType: SwitchType) {}
|
||||
|
||||
/**
|
||||
* Handles the logic for switching out a Pokémon based on battle conditions, HP, and the switch type.
|
||||
*
|
||||
* @param pokemon The {@linkcode Pokemon} attempting to switch out.
|
||||
* @returns `true` if the switch is successful
|
||||
*/
|
||||
public switchOutLogic(pokemon: Pokemon): boolean {
|
||||
const switchOutTarget = pokemon;
|
||||
/**
|
||||
* If the switch-out target is a player-controlled Pokémon, the function checks:
|
||||
* - Whether there are available party members to switch in.
|
||||
* - If the Pokémon is still alive (hp > 0), and if so, it leaves the field and a new SwitchPhase is initiated.
|
||||
*/
|
||||
if (switchOutTarget instanceof PlayerPokemon) {
|
||||
if (switchOutTarget.scene.getPlayerParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (switchOutTarget.hp > 0) {
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
pokemon.scene.prependToPhase(new SwitchPhase(pokemon.scene, this.switchType, switchOutTarget.getFieldIndex(), true, true), MoveEndPhase);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* For non-wild battles, it checks if the opposing party has any available Pokémon to switch in.
|
||||
* If yes, the Pokémon leaves the field and a new SwitchSummonPhase is initiated.
|
||||
*/
|
||||
} else if (pokemon.scene.currentBattle.battleType !== BattleType.WILD) {
|
||||
if (switchOutTarget.scene.getEnemyParty().filter((p) => p.isAllowedInBattle() && !p.isOnField()).length < 1) {
|
||||
return false;
|
||||
}
|
||||
if (switchOutTarget.hp > 0) {
|
||||
switchOutTarget.leaveField(this.switchType === SwitchType.SWITCH);
|
||||
pokemon.scene.prependToPhase(new SwitchSummonPhase(pokemon.scene, this.switchType, switchOutTarget.getFieldIndex(),
|
||||
(pokemon.scene.currentBattle.trainer ? pokemon.scene.currentBattle.trainer.getNextSummonIndex((switchOutTarget as EnemyPokemon).trainerSlot) : 0),
|
||||
false, false), MoveEndPhase);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* For wild Pokémon battles, the Pokémon will flee if the conditions are met (waveIndex and double battles).
|
||||
* It will not flee if it is a Mystery Encounter with fleeing disabled (checked in `getSwitchOutCondition()`) or if it is a wave 10x wild boss
|
||||
*/
|
||||
} else {
|
||||
if (!pokemon.scene.currentBattle.waveIndex || pokemon.scene.currentBattle.waveIndex % 10 === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (switchOutTarget.hp > 0) {
|
||||
switchOutTarget.leaveField(false);
|
||||
pokemon.scene.queueMessage(i18next.t("moveTriggers:fled", { pokemonName: getPokemonNameWithAffix(switchOutTarget) }), null, true, 500);
|
||||
|
||||
if (switchOutTarget.scene.currentBattle.double) {
|
||||
const allyPokemon = switchOutTarget.getAlly();
|
||||
switchOutTarget.scene.redirectPokemonMoves(switchOutTarget, allyPokemon);
|
||||
}
|
||||
}
|
||||
|
||||
if (!switchOutTarget.getAlly()?.isActive(true)) {
|
||||
pokemon.scene.clearEnemyHeldItemModifiers();
|
||||
|
||||
if (switchOutTarget.hp) {
|
||||
pokemon.scene.pushPhase(new BattleEndPhase(pokemon.scene));
|
||||
pokemon.scene.pushPhase(new NewBattlePhase(pokemon.scene));
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a Pokémon can switch out based on its status, the opponent's status, and battle conditions.
|
||||
*
|
||||
* @param pokemon The Pokémon attempting to switch out.
|
||||
* @param opponent The opponent Pokémon.
|
||||
* @returns `true` if the switch-out condition is met
|
||||
*/
|
||||
public getSwitchOutCondition(pokemon: Pokemon, opponent: Pokemon): boolean {
|
||||
const switchOutTarget = pokemon;
|
||||
const player = switchOutTarget instanceof PlayerPokemon;
|
||||
|
||||
if (player) {
|
||||
const blockedByAbility = new Utils.BooleanHolder(false);
|
||||
applyAbAttrs(ForceSwitchOutImmunityAbAttr, opponent, blockedByAbility);
|
||||
return !blockedByAbility.value;
|
||||
}
|
||||
|
||||
if (!player && pokemon.scene.currentBattle.battleType === BattleType.WILD) {
|
||||
if (!pokemon.scene.currentBattle.waveIndex && pokemon.scene.currentBattle.waveIndex % 10 === 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!player && pokemon.scene.currentBattle.isBattleMysteryEncounter() && !pokemon.scene.currentBattle.mysteryEncounter?.fleeAllowed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const party = player ? pokemon.scene.getPlayerParty() : pokemon.scene.getEnemyParty();
|
||||
return (!player && pokemon.scene.currentBattle.battleType === BattleType.WILD)
|
||||
|| party.filter(p => p.isAllowedInBattle()
|
||||
&& (player || (p as EnemyPokemon).trainerSlot === (switchOutTarget as EnemyPokemon).trainerSlot)).length > pokemon.scene.currentBattle.getBattlerCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a message if the switch-out attempt fails due to ability effects.
|
||||
*
|
||||
* @param target The target Pokémon.
|
||||
* @returns The failure message, or `null` if no failure.
|
||||
*/
|
||||
public getFailedText(target: Pokemon): string | null {
|
||||
const blockedByAbility = new Utils.BooleanHolder(false);
|
||||
applyAbAttrs(ForceSwitchOutImmunityAbAttr, target, blockedByAbility);
|
||||
return blockedByAbility.value ? i18next.t("moveTriggers:cannotBeSwitchedOut", { pokemonName: getPokemonNameWithAffix(target) }) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the amount of recovery from the Shell Bell item.
|
||||
*
|
||||
* If the Pokémon is holding a Shell Bell, this function computes the amount of health
|
||||
* recovered based on the damage dealt in the current turn. The recovery is multiplied by the
|
||||
* Shell Bell's modifier (if any).
|
||||
*
|
||||
* @param pokemon - The Pokémon whose Shell Bell recovery is being calculated.
|
||||
* @returns The amount of health recovered by Shell Bell.
|
||||
*/
|
||||
function calculateShellBellRecovery(pokemon: Pokemon): number {
|
||||
const shellBellModifier = pokemon.getHeldItems().find(m => m instanceof HitHealModifier);
|
||||
if (shellBellModifier) {
|
||||
return Utils.toDmgValue(pokemon.turnData.totalDamageDealt / 8) * shellBellModifier.stackCount;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers after the Pokemon takes any damage
|
||||
* @extends AbAttr
|
||||
*/
|
||||
export class PostDamageAbAttr extends AbAttr {
|
||||
public applyPostDamage(pokemon: Pokemon, damage: number, passive: boolean, simulated: boolean, args: any[], source?: Pokemon): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ability attribute for forcing a Pokémon to switch out after its health drops below half.
|
||||
* This attribute checks various conditions related to the damage received, the moves used by the Pokémon
|
||||
* and its opponents, and determines whether a forced switch-out should occur.
|
||||
*
|
||||
* Used by Wimp Out and Emergency Exit
|
||||
*
|
||||
* @extends PostDamageAbAttr
|
||||
* @see {@linkcode applyPostDamage}
|
||||
*/
|
||||
export class PostDamageForceSwitchAbAttr extends PostDamageAbAttr {
|
||||
private helper: ForceSwitchOutHelper = new ForceSwitchOutHelper(SwitchType.SWITCH);
|
||||
private hpRatio: number;
|
||||
|
||||
constructor(hpRatio: number = 0.5) {
|
||||
super();
|
||||
this.hpRatio = hpRatio;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the switch-out logic after the Pokémon takes damage.
|
||||
* Checks various conditions based on the moves used by the Pokémon, the opponents' moves, and
|
||||
* the Pokémon's health after damage to determine whether the switch-out should occur.
|
||||
*
|
||||
* @param pokemon The Pokémon that took damage.
|
||||
* @param damage The amount of damage taken by the Pokémon.
|
||||
* @param passive N/A
|
||||
* @param simulated Whether the ability is being simulated.
|
||||
* @param args N/A
|
||||
* @param source The Pokemon that dealt damage
|
||||
* @returns `true` if the switch-out logic was successfully applied
|
||||
*/
|
||||
public override applyPostDamage(pokemon: Pokemon, damage: number, passive: boolean, simulated: boolean, args: any[], source?: Pokemon): boolean | Promise<boolean> {
|
||||
const moveHistory = pokemon.getMoveHistory();
|
||||
// Will not activate when the Pokémon's HP is lowered by cutting its own HP
|
||||
const fordbiddenAttackingMoves = [ Moves.BELLY_DRUM, Moves.SUBSTITUTE, Moves.CURSE, Moves.PAIN_SPLIT ];
|
||||
if (moveHistory.length > 0) {
|
||||
const lastMoveUsed = moveHistory[moveHistory.length - 1];
|
||||
if (fordbiddenAttackingMoves.includes(lastMoveUsed.move)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Dragon Tail and Circle Throw switch out Pokémon before the Ability activates.
|
||||
const fordbiddenDefendingMoves = [ Moves.DRAGON_TAIL, Moves.CIRCLE_THROW ];
|
||||
if (source) {
|
||||
const enemyMoveHistory = source.getMoveHistory();
|
||||
if (enemyMoveHistory.length > 0) {
|
||||
const enemyLastMoveUsed = enemyMoveHistory[enemyMoveHistory.length - 1];
|
||||
// Will not activate if the Pokémon's HP falls below half while it is in the air during Sky Drop.
|
||||
if (fordbiddenDefendingMoves.includes(enemyLastMoveUsed.move) || enemyLastMoveUsed.move === Moves.SKY_DROP && enemyLastMoveUsed.result === MoveResult.OTHER) {
|
||||
return false;
|
||||
// Will not activate if the Pokémon's HP falls below half by a move affected by Sheer Force.
|
||||
} else if (allMoves[enemyLastMoveUsed.move].chance >= 0 && source.hasAbility(Abilities.SHEER_FORCE)) {
|
||||
return false;
|
||||
// Activate only after the last hit of multistrike moves
|
||||
} else if (source.turnData.hitsLeft > 1) {
|
||||
return false;
|
||||
}
|
||||
if (source.turnData.hitCount > 1) {
|
||||
damage = pokemon.turnData.damageTaken;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pokemon.hp + damage >= pokemon.getMaxHp() * this.hpRatio) {
|
||||
// Activates if it falls below half and recovers back above half from a Shell Bell
|
||||
const shellBellHeal = calculateShellBellRecovery(pokemon);
|
||||
if (pokemon.hp - shellBellHeal < pokemon.getMaxHp() * this.hpRatio) {
|
||||
for (const opponent of pokemon.getOpponents()) {
|
||||
if (!this.helper.getSwitchOutCondition(pokemon, opponent)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return this.helper.switchOutLogic(pokemon);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public getFailedText(user: Pokemon, target: Pokemon, move: Move, cancelled: Utils.BooleanHolder): string | null {
|
||||
return this.helper.getFailedText(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function applyAbAttrs(attrType: Constructor<AbAttr>, pokemon: Pokemon, cancelled: Utils.BooleanHolder | null, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<AbAttr>(attrType, pokemon, (attr, passive) => attr.apply(pokemon, passive, simulated, cancelled, args), args, false, simulated);
|
||||
}
|
||||
|
@ -4767,6 +5175,11 @@ export function applyPostSetStatusAbAttrs(attrType: Constructor<PostSetStatusAbA
|
|||
return applyAbAttrsInternal<PostSetStatusAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostSetStatus(pokemon, sourcePokemon, passive, effect, simulated, args), args, false, simulated);
|
||||
}
|
||||
|
||||
export function applyPostDamageAbAttrs(attrType: Constructor<PostDamageAbAttr>,
|
||||
pokemon: Pokemon, damage: number, passive: boolean, simulated: boolean = false, args: any[], source?: Pokemon): Promise<void> {
|
||||
return applyAbAttrsInternal<PostDamageAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostDamage(pokemon, damage, passive, simulated, args, source), args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a field Stat multiplier attribute
|
||||
* @param attrType {@linkcode FieldMultiplyStatAbAttr} should always be FieldMultiplyBattleStatAbAttr for the time being
|
||||
|
@ -4872,6 +5285,11 @@ export function applyPostFaintAbAttrs(attrType: Constructor<PostFaintAbAttr>,
|
|||
return applyAbAttrsInternal<PostFaintAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostFaint(pokemon, passive, simulated, attacker, move, hitResult, args), args, false, simulated);
|
||||
}
|
||||
|
||||
export function applyPostItemLostAbAttrs(attrType: Constructor<PostItemLostAbAttr>,
|
||||
pokemon: Pokemon, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<PostItemLostAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostItemLost(pokemon, simulated, args), args);
|
||||
}
|
||||
|
||||
function queueShowAbility(pokemon: Pokemon, passive: boolean): void {
|
||||
pokemon.scene.unshiftPhase(new ShowAbilityPhase(pokemon.scene, pokemon.id, passive));
|
||||
pokemon.scene.clearPhaseQueueSplice();
|
||||
|
@ -4909,7 +5327,7 @@ export function initAbilities() {
|
|||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN)
|
||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.RAIN),
|
||||
new Ability(Abilities.SPEED_BOOST, 3)
|
||||
.attr(PostTurnStatStageChangeAbAttr, [ Stat.SPD ], 1),
|
||||
.attr(SpeedBoostAbAttr),
|
||||
new Ability(Abilities.BATTLE_ARMOR, 3)
|
||||
.attr(BlockCritAbAttr)
|
||||
.ignorable(),
|
||||
|
@ -4963,7 +5381,8 @@ export function initAbilities() {
|
|||
.attr(TypeImmunityAddBattlerTagAbAttr, Type.FIRE, BattlerTagType.FIRE_BOOST, 1)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.SHIELD_DUST, 3)
|
||||
.attr(IgnoreMoveEffectsAbAttr),
|
||||
.attr(IgnoreMoveEffectsAbAttr)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.OWN_TEMPO, 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.CONFUSED)
|
||||
.attr(IntimidateImmunityAbAttr)
|
||||
|
@ -4995,8 +5414,7 @@ export function initAbilities() {
|
|||
.attr(EffectSporeAbAttr),
|
||||
new Ability(Abilities.SYNCHRONIZE, 3)
|
||||
.attr(SyncEncounterNatureAbAttr)
|
||||
.attr(SynchronizeStatusAbAttr)
|
||||
.partial(), // interaction with psycho shift needs work, keeping to old Gen interaction for now
|
||||
.attr(SynchronizeStatusAbAttr),
|
||||
new Ability(Abilities.CLEAR_BODY, 3)
|
||||
.attr(ProtectStatAbAttr)
|
||||
.ignorable(),
|
||||
|
@ -5017,6 +5435,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.ILLUMINATE, 3)
|
||||
.attr(ProtectStatAbAttr, Stat.ACC)
|
||||
.attr(DoubleBattleChanceAbAttr)
|
||||
.attr(IgnoreOpponentStatStagesAbAttr, [ Stat.EVA ])
|
||||
.ignorable(),
|
||||
new Ability(Abilities.TRACE, 3)
|
||||
.attr(PostSummonCopyAbilityAbAttr)
|
||||
|
@ -5081,11 +5500,9 @@ export function initAbilities() {
|
|||
new Ability(Abilities.CUTE_CHARM, 3)
|
||||
.attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED),
|
||||
new Ability(Abilities.PLUS, 3)
|
||||
.conditionalAttr(p => p.scene.currentBattle.double && [ Abilities.PLUS, Abilities.MINUS ].some(a => p.getAlly().hasAbility(a)), StatMultiplierAbAttr, Stat.SPATK, 1.5)
|
||||
.ignorable(),
|
||||
.conditionalAttr(p => p.scene.currentBattle.double && [ Abilities.PLUS, Abilities.MINUS ].some(a => p.getAlly().hasAbility(a)), StatMultiplierAbAttr, Stat.SPATK, 1.5),
|
||||
new Ability(Abilities.MINUS, 3)
|
||||
.conditionalAttr(p => p.scene.currentBattle.double && [ Abilities.PLUS, Abilities.MINUS ].some(a => p.getAlly().hasAbility(a)), StatMultiplierAbAttr, Stat.SPATK, 1.5)
|
||||
.ignorable(),
|
||||
.conditionalAttr(p => p.scene.currentBattle.double && [ Abilities.PLUS, Abilities.MINUS ].some(a => p.getAlly().hasAbility(a)), StatMultiplierAbAttr, Stat.SPATK, 1.5),
|
||||
new Ability(Abilities.FORECAST, 3)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(NoFusionAbilityAbAttr)
|
||||
|
@ -5165,7 +5582,9 @@ export function initAbilities() {
|
|||
new Ability(Abilities.ANGER_POINT, 4)
|
||||
.attr(PostDefendCritStatStageChangeAbAttr, Stat.ATK, 6),
|
||||
new Ability(Abilities.UNBURDEN, 4)
|
||||
.unimplemented(),
|
||||
.attr(PostItemLostApplyBattlerTagAbAttr, BattlerTagType.UNBURDEN)
|
||||
.bypassFaint() // Allows reviver seed to activate Unburden
|
||||
.edgeCase(), // Should not restore Unburden boost if Pokemon loses then regains Unburden ability
|
||||
new Ability(Abilities.HEATPROOF, 4)
|
||||
.attr(ReceivedTypeDamageMultiplierAbAttr, Type.FIRE, 0.5)
|
||||
.attr(ReduceBurnDamageAbAttr, 0.5)
|
||||
|
@ -5238,7 +5657,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.FOREWARN, 4)
|
||||
.attr(ForewarnAbAttr),
|
||||
new Ability(Abilities.UNAWARE, 4)
|
||||
.attr(IgnoreOpponentStatStagesAbAttr)
|
||||
.attr(IgnoreOpponentStatStagesAbAttr, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.ACC, Stat.EVA ])
|
||||
.ignorable(),
|
||||
new Ability(Abilities.TINTED_LENS, 4)
|
||||
.attr(DamageBoostAbAttr, 2, (user, target, move) => (target?.getMoveEffectiveness(user!, move) ?? 1) <= 0.5),
|
||||
|
@ -5310,8 +5729,8 @@ export function initAbilities() {
|
|||
new Ability(Abilities.HEALER, 5)
|
||||
.conditionalAttr(pokemon => pokemon.getAlly() && Utils.randSeedInt(10) < 3, PostTurnResetStatusAbAttr, true),
|
||||
new Ability(Abilities.FRIEND_GUARD, 5)
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
.attr(AlliedFieldDamageReductionAbAttr, 0.75)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.WEAK_ARMOR, 5)
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, Stat.DEF, -1)
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, Stat.SPD, 2),
|
||||
|
@ -5423,7 +5842,8 @@ export function initAbilities() {
|
|||
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonTeravolt", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
|
||||
.attr(MoveAbilityBypassAbAttr),
|
||||
new Ability(Abilities.AROMA_VEIL, 6)
|
||||
.attr(UserFieldBattlerTagImmunityAbAttr, [ BattlerTagType.INFATUATED, BattlerTagType.TAUNT, BattlerTagType.DISABLED, BattlerTagType.TORMENT, BattlerTagType.HEAL_BLOCK ]),
|
||||
.attr(UserFieldBattlerTagImmunityAbAttr, [ BattlerTagType.INFATUATED, BattlerTagType.TAUNT, BattlerTagType.DISABLED, BattlerTagType.TORMENT, BattlerTagType.HEAL_BLOCK ])
|
||||
.ignorable(),
|
||||
new Ability(Abilities.FLOWER_VEIL, 6)
|
||||
.ignorable()
|
||||
.unimplemented(),
|
||||
|
@ -5508,11 +5928,11 @@ export function initAbilities() {
|
|||
new Ability(Abilities.STAMINA, 7)
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, Stat.DEF, 1),
|
||||
new Ability(Abilities.WIMP_OUT, 7)
|
||||
.condition(getSheerForceHitDisableAbCondition())
|
||||
.unimplemented(),
|
||||
.attr(PostDamageForceSwitchAbAttr)
|
||||
.edgeCase(), // Should not trigger when hurting itself in confusion
|
||||
new Ability(Abilities.EMERGENCY_EXIT, 7)
|
||||
.condition(getSheerForceHitDisableAbCondition())
|
||||
.unimplemented(),
|
||||
.attr(PostDamageForceSwitchAbAttr)
|
||||
.edgeCase(), // Should not trigger when hurting itself in confusion
|
||||
new Ability(Abilities.WATER_COMPACTION, 7)
|
||||
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => user.getMoveType(move) === Type.WATER && move.category !== MoveCategory.STATUS, Stat.DEF, 2),
|
||||
new Ability(Abilities.MERCILESS, 7)
|
||||
|
@ -5598,7 +6018,7 @@ export function initAbilities() {
|
|||
.bypassFaint(),
|
||||
new Ability(Abilities.CORROSION, 7)
|
||||
.attr(IgnoreTypeStatusEffectImmunityAbAttr, [ StatusEffect.POISON, StatusEffect.TOXIC ], [ Type.STEEL, Type.POISON ])
|
||||
.edgeCase(), // Should interact correctly with magic coat/bounce (not yet implemented), fling with toxic orb (not implemented yet), and synchronize (not fully implemented yet)
|
||||
.edgeCase(), // Should interact correctly with magic coat/bounce (not yet implemented) + fling with toxic orb (not implemented yet)
|
||||
new Ability(Abilities.COMATOSE, 7)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
|
@ -5702,7 +6122,8 @@ export function initAbilities() {
|
|||
.attr(NoFusionAbilityAbAttr)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.bypassFaint(),
|
||||
.bypassFaint()
|
||||
.edgeCase(), // Soft-locks the game if a form-changed Cramorant and its attacker both faint at the same time (ex. using Self-Destruct)
|
||||
new Ability(Abilities.STALWART, 8)
|
||||
.attr(BlockRedirectAbAttr),
|
||||
new Ability(Abilities.STEAM_ENGINE, 8)
|
||||
|
@ -5743,7 +6164,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.POWER_SPOT, 8)
|
||||
.attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL, MoveCategory.PHYSICAL ], 1.3),
|
||||
new Ability(Abilities.MIMICRY, 8)
|
||||
.unimplemented(),
|
||||
.attr(TerrainEventTypeChangeAbAttr),
|
||||
new Ability(Abilities.SCREEN_CLEANER, 8)
|
||||
.attr(PostSummonRemoveArenaTagAbAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.REFLECT ]),
|
||||
new Ability(Abilities.STEELY_SPIRIT, 8)
|
||||
|
@ -5845,9 +6266,11 @@ export function initAbilities() {
|
|||
.attr(PreSwitchOutFormChangeAbAttr, (pokemon) => !pokemon.isFainted() ? 1 : pokemon.formIndex)
|
||||
.bypassFaint(),
|
||||
new Ability(Abilities.COMMANDER, 9)
|
||||
.attr(CommanderAbAttr)
|
||||
.attr(DoubleBattleChanceAbAttr)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.unimplemented(),
|
||||
.edgeCase(), // Encore, Frenzy, and other non-`TURN_END` tags don't lapse correctly on the commanding Pokemon.
|
||||
new Ability(Abilities.ELECTROMORPHOSIS, 9)
|
||||
.attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED),
|
||||
new Ability(Abilities.PROTOSYNTHESIS, 9)
|
||||
|
@ -5874,16 +6297,14 @@ export function initAbilities() {
|
|||
.ignorable(),
|
||||
new Ability(Abilities.SWORD_OF_RUIN, 9)
|
||||
.attr(FieldMultiplyStatAbAttr, Stat.DEF, 0.75)
|
||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonSwordOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.DEF)) }))
|
||||
.ignorable(),
|
||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonSwordOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.DEF)) })),
|
||||
new Ability(Abilities.TABLETS_OF_RUIN, 9)
|
||||
.attr(FieldMultiplyStatAbAttr, Stat.ATK, 0.75)
|
||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonTabletsOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.ATK)) }))
|
||||
.ignorable(),
|
||||
new Ability(Abilities.BEADS_OF_RUIN, 9)
|
||||
.attr(FieldMultiplyStatAbAttr, Stat.SPDEF, 0.75)
|
||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonBeadsOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.SPDEF)) }))
|
||||
.ignorable(),
|
||||
.attr(PostSummonMessageAbAttr, (user) => i18next.t("abilityTriggers:postSummonBeadsOfRuin", { pokemonNameWithAffix: getPokemonNameWithAffix(user), statName: i18next.t(getStatKey(Stat.SPDEF)) })),
|
||||
new Ability(Abilities.ORICHALCUM_PULSE, 9)
|
||||
.attr(PostSummonWeatherChangeAbAttr, WeatherType.SUNNY)
|
||||
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SUNNY)
|
||||
|
@ -5900,7 +6321,7 @@ export function initAbilities() {
|
|||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
||||
new Ability(Abilities.SUPREME_OVERLORD, 9)
|
||||
.attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? user.scene.currentBattle.playerFaints : user.scene.currentBattle.enemyFaints, 5))
|
||||
.partial(), // Counter resets every wave
|
||||
.partial(), // Counter resets every wave instead of on arena reset
|
||||
new Ability(Abilities.COSTAR, 9)
|
||||
.attr(PostSummonCopyAllyStatsAbAttr),
|
||||
new Ability(Abilities.TOXIC_DEBRIS, 9)
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { Arena } from "#app/field/arena";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils";
|
||||
import { MoveCategory, allMoves, MoveTarget, IncrementMovePriorityAttr, applyMoveAttrs } from "#app/data/move";
|
||||
import { MoveCategory, allMoves, MoveTarget } from "#app/data/move";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import Pokemon, { HitResult, PokemonMove } from "#app/field/pokemon";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { BlockNonDirectDamageAbAttr, ChangeMovePriorityAbAttr, InfiltratorAbAttr, ProtectStatAbAttr, applyAbAttrs } from "#app/data/ability";
|
||||
import { BlockNonDirectDamageAbAttr, InfiltratorAbAttr, ProtectStatAbAttr, applyAbAttrs } from "#app/data/ability";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { CommonAnim, CommonBattleAnim } from "#app/data/battle-anims";
|
||||
import i18next from "i18next";
|
||||
|
@ -313,20 +313,20 @@ export class ConditionalProtectTag extends ArenaTag {
|
|||
* protection effect.
|
||||
* @param arena {@linkcode Arena} The arena containing the protection effect
|
||||
* @param moveId {@linkcode Moves} The move to check against this condition
|
||||
* @returns `true` if the incoming move's priority is greater than 0. This includes
|
||||
* moves with modified priorities from abilities (e.g. Prankster)
|
||||
* @returns `true` if the incoming move's priority is greater than 0.
|
||||
* This includes moves with modified priorities from abilities (e.g. Prankster)
|
||||
*/
|
||||
const QuickGuardConditionFunc: ProtectConditionFunc = (arena, moveId) => {
|
||||
const move = allMoves[moveId];
|
||||
const priority = new NumberHolder(move.priority);
|
||||
const effectPhase = arena.scene.getCurrentPhase();
|
||||
|
||||
if (effectPhase instanceof MoveEffectPhase) {
|
||||
const attacker = effectPhase.getUserPokemon()!;
|
||||
applyMoveAttrs(IncrementMovePriorityAttr, attacker, null, move, priority);
|
||||
applyAbAttrs(ChangeMovePriorityAbAttr, attacker, null, false, move, priority);
|
||||
const attacker = effectPhase.getUserPokemon();
|
||||
if (attacker) {
|
||||
return move.getPriority(attacker) > 0;
|
||||
}
|
||||
return priority.value > 0;
|
||||
}
|
||||
return move.priority > 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -778,13 +778,14 @@ class ToxicSpikesTag extends ArenaTrapTag {
|
|||
* Delays the attack's effect by a set amount of turns, usually 3 (including the turn the move is used),
|
||||
* and deals damage after the turn count is reached.
|
||||
*/
|
||||
class DelayedAttackTag extends ArenaTag {
|
||||
export class DelayedAttackTag extends ArenaTag {
|
||||
public targetIndex: BattlerIndex;
|
||||
|
||||
constructor(tagType: ArenaTagType, sourceMove: Moves | undefined, sourceId: number, targetIndex: BattlerIndex) {
|
||||
super(tagType, 3, sourceMove, sourceId);
|
||||
constructor(tagType: ArenaTagType, sourceMove: Moves | undefined, sourceId: number, targetIndex: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH) {
|
||||
super(tagType, 3, sourceMove, sourceId, side);
|
||||
|
||||
this.targetIndex = targetIndex;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
lapse(arena: Arena): boolean {
|
||||
|
@ -1203,6 +1204,24 @@ class GrassWaterPledgeTag extends ArenaTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Arena Tag class for {@link https://bulbapedia.bulbagarden.net/wiki/Fairy_Lock_(move) Fairy Lock}.
|
||||
* Fairy Lock prevents all Pokémon (except Ghost types) on the field from switching out or
|
||||
* fleeing during their next turn.
|
||||
* If a Pokémon that's on the field when Fairy Lock is used goes on to faint later in the same turn,
|
||||
* the Pokémon that replaces it will still be unable to switch out in the following turn.
|
||||
*/
|
||||
export class FairyLockTag extends ArenaTag {
|
||||
constructor(turnCount: number, sourceId: number) {
|
||||
super(ArenaTagType.FAIRY_LOCK, turnCount, Moves.FAIRY_LOCK, sourceId);
|
||||
}
|
||||
|
||||
onAdd(arena: Arena): void {
|
||||
arena.scene.queueMessage(i18next.t("arenaTag:fairyLockOnAdd"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
||||
export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove: Moves | undefined, sourceId: number, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag | null {
|
||||
switch (tagType) {
|
||||
|
@ -1230,7 +1249,7 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove
|
|||
return new ToxicSpikesTag(sourceId, side);
|
||||
case ArenaTagType.FUTURE_SIGHT:
|
||||
case ArenaTagType.DOOM_DESIRE:
|
||||
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex!); // TODO:questionable bang
|
||||
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex!, side); // TODO:questionable bang
|
||||
case ArenaTagType.WISH:
|
||||
return new WishTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.STEALTH_ROCK:
|
||||
|
@ -1261,6 +1280,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove
|
|||
return new WaterFirePledgeTag(sourceId, side);
|
||||
case ArenaTagType.GRASS_WATER_PLEDGE:
|
||||
return new GrassWaterPledgeTag(sourceId, side);
|
||||
case ArenaTagType.FAIRY_LOCK:
|
||||
return new FairyLockTag(turnCount, sourceId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import * as Utils from "#app/utils";
|
||||
import { pokemonEvolutions, SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
|
||||
import i18next from "i18next";
|
||||
|
@ -7666,7 +7666,7 @@ export function initBiomes() {
|
|||
if (biome === Biome.END) {
|
||||
const biomeList = Object.keys(Biome).filter(key => !isNaN(Number(key)));
|
||||
biomeList.pop(); // Removes Biome.END from the list
|
||||
const randIndex = Utils.randInt(biomeList.length, 1); // Will never be Biome.TOWN
|
||||
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
|
||||
biome = Biome[biomeList[randIndex]];
|
||||
}
|
||||
const linkedBiomes: (Biome | [ Biome, integer ])[] = Array.isArray(biomeLinks[biome])
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { Gender } from "#app/data/gender";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import * as Utils from "#app/utils";
|
||||
import { WeatherType } from "#app/data/weather";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
|
@ -478,7 +478,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
|||
],
|
||||
[Species.NINCADA]: [
|
||||
new SpeciesEvolution(Species.NINJASK, 20, null, null),
|
||||
new SpeciesEvolution(Species.SHEDINJA, 20, null, new SpeciesEvolutionCondition(p => p.scene.getParty().length < 6 && p.scene.pokeballCounts[PokeballType.POKEBALL] > 0))
|
||||
new SpeciesEvolution(Species.SHEDINJA, 20, null, new SpeciesEvolutionCondition(p => p.scene.getPlayerParty().length < 6 && p.scene.pokeballCounts[PokeballType.POKEBALL] > 0))
|
||||
],
|
||||
[Species.WHISMUR]: [
|
||||
new SpeciesEvolution(Species.LOUDRED, 20, null, null)
|
||||
|
@ -890,7 +890,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
|||
new SpeciesEvolution(Species.GOGOAT, 32, null, null)
|
||||
],
|
||||
[Species.PANCHAM]: [
|
||||
new SpeciesEvolution(Species.PANGORO, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.getParty().find(p => p.getTypes(false, false, true).indexOf(Type.DARK) > -1)), SpeciesWildEvolutionDelay.MEDIUM)
|
||||
new SpeciesEvolution(Species.PANGORO, 32, null, new SpeciesEvolutionCondition(p => !!p.scene.getPlayerParty().find(p => p.getTypes(false, false, true).indexOf(Type.DARK) > -1)), SpeciesWildEvolutionDelay.MEDIUM)
|
||||
],
|
||||
[Species.ESPURR]: [
|
||||
new SpeciesFormEvolution(Species.MEOWSTIC, "", "female", 25, null, new SpeciesEvolutionCondition(p => p.gender === Gender.FEMALE, p => p.gender = Gender.FEMALE)),
|
||||
|
@ -1005,8 +1005,8 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
|||
new SpeciesEvolution(Species.COSMOEM, 23, null, null)
|
||||
],
|
||||
[Species.COSMOEM]: [
|
||||
new SpeciesEvolution(Species.SOLGALEO, 53, EvolutionItem.SUN_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG),
|
||||
new SpeciesEvolution(Species.LUNALA, 53, EvolutionItem.MOON_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG)
|
||||
new SpeciesEvolution(Species.SOLGALEO, 1, EvolutionItem.SUN_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG),
|
||||
new SpeciesEvolution(Species.LUNALA, 1, EvolutionItem.MOON_FLUTE, null, SpeciesWildEvolutionDelay.VERY_LONG)
|
||||
],
|
||||
[Species.MELTAN]: [
|
||||
new SpeciesEvolution(Species.MELMETAL, 48, null, null)
|
||||
|
@ -1443,7 +1443,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
|||
],
|
||||
[Species.ROCKRUFF]: [
|
||||
new SpeciesFormEvolution(Species.LYCANROC, "", "midday", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DAWN || p.scene.arena.getTimeOfDay() === TimeOfDay.DAY) && (p.formIndex === 0))),
|
||||
new SpeciesFormEvolution(Species.LYCANROC, "", "dusk", 25, null, new SpeciesEvolutionCondition(p => p.formIndex === 1)),
|
||||
new SpeciesFormEvolution(Species.LYCANROC, "own-tempo", "dusk", 25, null, new SpeciesEvolutionCondition(p => p.formIndex === 1)),
|
||||
new SpeciesFormEvolution(Species.LYCANROC, "", "midnight", 25, null, new SpeciesEvolutionCondition(p => (p.scene.arena.getTimeOfDay() === TimeOfDay.DUSK || p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT) && (p.formIndex === 0)))
|
||||
],
|
||||
[Species.STEENEE]: [
|
||||
|
|
|
@ -428,7 +428,7 @@ class AnimTimedAddBgEvent extends AnimTimedBgEvent {
|
|||
moveAnim.bgSprite.setScale(1.25);
|
||||
moveAnim.bgSprite.setAlpha(this.opacity / 255);
|
||||
scene.field.add(moveAnim.bgSprite);
|
||||
const fieldPokemon = scene.getNonSwitchedEnemyPokemon() || scene.getNonSwitchedPlayerPokemon();
|
||||
const fieldPokemon = scene.getEnemyPokemon(false) ?? scene.getPlayerPokemon(false);
|
||||
if (!isNullOrUndefined(priority)) {
|
||||
scene.field.moveTo(moveAnim.bgSprite as Phaser.GameObjects.GameObject, priority);
|
||||
} else if (fieldPokemon?.isOnField()) {
|
||||
|
@ -999,7 +999,7 @@ export abstract class BattleAnim {
|
|||
const setSpritePriority = (priority: integer) => {
|
||||
switch (priority) {
|
||||
case 0:
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, scene.getNonSwitchedEnemyPokemon() || scene.getNonSwitchedPlayerPokemon()!); // This bang assumes that if (the EnemyPokemon is undefined, then the PlayerPokemon function must return an object), correct assumption?
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, scene.getEnemyPokemon(false) ?? scene.getPlayerPokemon(false)!); // TODO: is this bang correct?
|
||||
break;
|
||||
case 1:
|
||||
scene.field.moveTo(moveSprite, scene.field.getAll().length - 1);
|
||||
|
|
|
@ -18,10 +18,9 @@ import Move, {
|
|||
StatusCategoryOnAllyAttr
|
||||
} from "#app/data/move";
|
||||
import { SpeciesFormChangeManualTrigger } from "#app/data/pokemon-forms";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { getStatusEffectHealText } from "#app/data/status-effect";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { Type } from "#app/data/type";
|
||||
import { WeatherType } from "#app/data/weather";
|
||||
import { Type } from "#enums/type";
|
||||
import Pokemon, { HitResult, MoveResult } from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { CommonAnimPhase } from "#app/phases/common-anim-phase";
|
||||
|
@ -38,6 +37,8 @@ import { Moves } from "#enums/moves";
|
|||
import { PokemonAnimType } from "#enums/pokemon-anim-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
|
||||
export enum BattlerTagLapseType {
|
||||
FAINT,
|
||||
|
@ -909,11 +910,15 @@ export class FrenzyTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
export class EncoreTag extends BattlerTag {
|
||||
/**
|
||||
* Applies the effects of the move Encore onto the target Pokemon
|
||||
* Encore forces the target Pokemon to use its most-recent move for 3 turns
|
||||
*/
|
||||
export class EncoreTag extends MoveRestrictionBattlerTag {
|
||||
public moveId: Moves;
|
||||
|
||||
constructor(sourceId: number) {
|
||||
super(BattlerTagType.ENCORE, BattlerTagLapseType.AFTER_MOVE, 3, Moves.ENCORE, sourceId);
|
||||
super(BattlerTagType.ENCORE, [ BattlerTagLapseType.CUSTOM, BattlerTagLapseType.AFTER_MOVE ], 3, Moves.ENCORE, sourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -969,6 +974,39 @@ export class EncoreTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the encored move has run out of PP, Encore ends early. Otherwise, Encore lapses based on the AFTER_MOVE battler tag lapse type.
|
||||
* @returns `true` to persist | `false` to end and be removed
|
||||
*/
|
||||
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM) {
|
||||
const encoredMove = pokemon.getMoveset().find(m => m?.moveId === this.moveId);
|
||||
if (encoredMove && encoredMove?.getPpRatio() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return super.lapse(pokemon, lapseType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the move matches the moveId stored within the tag and returns a boolean value
|
||||
* @param move {@linkcode Moves} the move selected
|
||||
* @param user N/A
|
||||
* @returns `true` if the move does not match with the moveId stored and as a result, restricted
|
||||
*/
|
||||
override isMoveRestricted(move: Moves, _user?: Pokemon): boolean {
|
||||
if (move !== this.moveId) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override selectionDeniedText(_pokemon: Pokemon, move: Moves): string {
|
||||
return i18next.t("battle:moveDisabled", { moveName: allMoves[move].name });
|
||||
}
|
||||
|
||||
onRemove(pokemon: Pokemon): void {
|
||||
super.onRemove(pokemon);
|
||||
|
||||
|
@ -1464,9 +1502,14 @@ export class ContactBurnProtectedTag extends DamageProtectedTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* `BattlerTag` class for effects that cause the affected Pokemon to survive lethal attacks at 1 HP.
|
||||
* Used for {@link https://bulbapedia.bulbagarden.net/wiki/Endure_(move) | Endure} and
|
||||
* Endure Tokens.
|
||||
*/
|
||||
export class EnduringTag extends BattlerTag {
|
||||
constructor(sourceMove: Moves) {
|
||||
super(BattlerTagType.ENDURING, BattlerTagLapseType.TURN_END, 0, sourceMove);
|
||||
constructor(tagType: BattlerTagType, lapseType: BattlerTagLapseType, sourceMove: Moves) {
|
||||
super(tagType, lapseType, 0, sourceMove);
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
|
@ -1573,6 +1616,22 @@ export class AbilityBattlerTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag used by Unburden to double speed
|
||||
* @extends AbilityBattlerTag
|
||||
*/
|
||||
export class UnburdenTag extends AbilityBattlerTag {
|
||||
constructor() {
|
||||
super(BattlerTagType.UNBURDEN, Abilities.UNBURDEN, BattlerTagLapseType.CUSTOM, 1);
|
||||
}
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
super.onAdd(pokemon);
|
||||
}
|
||||
onRemove(pokemon: Pokemon): void {
|
||||
super.onRemove(pokemon);
|
||||
}
|
||||
}
|
||||
|
||||
export class TruantTag extends AbilityBattlerTag {
|
||||
constructor() {
|
||||
super(BattlerTagType.TRUANT, Abilities.TRUANT, BattlerTagLapseType.MOVE, 1);
|
||||
|
@ -1755,8 +1814,8 @@ export class TypeImmuneTag extends BattlerTag {
|
|||
* @see {@link https://bulbapedia.bulbagarden.net/wiki/Telekinesis_(move) | Moves.TELEKINESIS}
|
||||
*/
|
||||
export class FloatingTag extends TypeImmuneTag {
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves) {
|
||||
super(tagType, sourceMove, Type.GROUND, 5);
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves, turnCount: number) {
|
||||
super(tagType, sourceMove, Type.GROUND, turnCount);
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon): void {
|
||||
|
@ -2075,6 +2134,42 @@ export class IceFaceBlockDamageTag extends FormBlockDamageTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Battler tag indicating a Tatsugiri with {@link https://bulbapedia.bulbagarden.net/wiki/Commander_(Ability) | Commander}
|
||||
* has entered the tagged Pokemon's mouth.
|
||||
*/
|
||||
export class CommandedTag extends BattlerTag {
|
||||
private _tatsugiriFormKey: string;
|
||||
|
||||
constructor(sourceId: number) {
|
||||
super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, Moves.NONE, sourceId);
|
||||
}
|
||||
|
||||
public get tatsugiriFormKey(): string {
|
||||
return this._tatsugiriFormKey;
|
||||
}
|
||||
|
||||
/** Caches the Tatsugiri's form key and sharply boosts the tagged Pokemon's stats */
|
||||
override onAdd(pokemon: Pokemon): void {
|
||||
this._tatsugiriFormKey = this.getSourcePokemon(pokemon.scene)?.getFormKey() ?? "curly";
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(
|
||||
pokemon.scene, pokemon.getBattlerIndex(), true, [ Stat.ATK, Stat.DEF, Stat.SPATK, Stat.SPDEF, Stat.SPD ], 2
|
||||
));
|
||||
}
|
||||
|
||||
/** Triggers an {@linkcode PokemonAnimType | animation} of the tagged Pokemon "spitting out" Tatsugiri */
|
||||
override onRemove(pokemon: Pokemon): void {
|
||||
if (this.getSourcePokemon(pokemon.scene)?.isActive(true)) {
|
||||
pokemon.scene.triggerPokemonBattleAnim(pokemon, PokemonAnimType.COMMANDER_REMOVE);
|
||||
}
|
||||
}
|
||||
|
||||
override loadTag(source: BattlerTag | any): void {
|
||||
super.loadTag(source);
|
||||
this._tatsugiriFormKey = source._tatsugiriFormKey;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Battler tag enabling the Stockpile mechanic. This tag handles:
|
||||
* - Stack tracking, including max limit enforcement (which is replicated in Stockpile for redundancy).
|
||||
|
@ -2313,7 +2408,7 @@ export class HealBlockTag extends MoveRestrictionBattlerTag {
|
|||
}
|
||||
|
||||
/**
|
||||
* Uses DisabledTag's selectionDeniedText() message
|
||||
* Uses its own unique selectionDeniedText() message
|
||||
*/
|
||||
override selectionDeniedText(pokemon: Pokemon, move: Moves): string {
|
||||
return i18next.t("battle:moveDisabledHealBlock", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: allMoves[move].name, healBlockName: allMoves[Moves.HEAL_BLOCK].name });
|
||||
|
@ -2480,7 +2575,10 @@ export class SubstituteTag extends BattlerTag {
|
|||
onHit(pokemon: Pokemon): void {
|
||||
const moveEffectPhase = pokemon.scene.getCurrentPhase();
|
||||
if (moveEffectPhase instanceof MoveEffectPhase) {
|
||||
const attacker = moveEffectPhase.getUserPokemon()!;
|
||||
const attacker = moveEffectPhase.getUserPokemon();
|
||||
if (!attacker) {
|
||||
return;
|
||||
}
|
||||
const move = moveEffectPhase.move.getMove();
|
||||
const firstHit = (attacker.turnData.hitCount === attacker.turnData.hitsLeft);
|
||||
|
||||
|
@ -2777,6 +2875,67 @@ export class PowerTrickTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag associated with the move Grudge.
|
||||
* If this tag is active when the bearer faints from an opponent's move, the tag reduces that move's PP to 0.
|
||||
* Otherwise, it lapses when the bearer makes another move.
|
||||
*/
|
||||
export class GrudgeTag extends BattlerTag {
|
||||
constructor() {
|
||||
super(BattlerTagType.GRUDGE, [ BattlerTagLapseType.CUSTOM, BattlerTagLapseType.PRE_MOVE ], 1, Moves.GRUDGE);
|
||||
}
|
||||
|
||||
onAdd(pokemon: Pokemon) {
|
||||
super.onAdd(pokemon);
|
||||
pokemon.scene.queueMessage(i18next.t("battlerTags:grudgeOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Activates Grudge's special effect on the attacking Pokemon and lapses the tag.
|
||||
* @param pokemon
|
||||
* @param lapseType
|
||||
* @param sourcePokemon {@linkcode Pokemon} the source of the move that fainted the tag's bearer
|
||||
* @returns `false` if Grudge activates its effect or lapses
|
||||
*/
|
||||
override lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType, sourcePokemon?: Pokemon): boolean {
|
||||
if (lapseType === BattlerTagLapseType.CUSTOM && sourcePokemon) {
|
||||
if (sourcePokemon.isActive() && pokemon.isOpponent(sourcePokemon)) {
|
||||
const lastMove = pokemon.turnData.attacksReceived[0];
|
||||
const lastMoveData = sourcePokemon.getMoveset().find(m => m?.moveId === lastMove.move);
|
||||
if (lastMoveData && lastMove.move !== Moves.STRUGGLE) {
|
||||
lastMoveData.ppUsed = lastMoveData.getMovePp();
|
||||
pokemon.scene.queueMessage(i18next.t("battlerTags:grudgeLapse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: lastMoveData.getName() }));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return super.lapse(pokemon, lapseType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag used to heal the user of Psycho Shift of its status effect if Psycho Shift succeeds in transferring its status effect to the target Pokemon
|
||||
*/
|
||||
export class PsychoShiftTag extends BattlerTag {
|
||||
constructor() {
|
||||
super(BattlerTagType.PSYCHO_SHIFT, BattlerTagLapseType.AFTER_MOVE, 1, Moves.PSYCHO_SHIFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Heals Psycho Shift's user of its status effect after it uses a move
|
||||
* @returns `false` to expire the tag immediately
|
||||
*/
|
||||
override lapse(pokemon: Pokemon, _lapseType: BattlerTagLapseType): boolean {
|
||||
if (pokemon.status && pokemon.isActive(true)) {
|
||||
pokemon.scene.queueMessage(getStatusEffectHealText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
||||
pokemon.resetStatus();
|
||||
pokemon.updateInfo();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
||||
* @param sourceId - The ID of the pokemon adding the tag
|
||||
|
@ -2855,7 +3014,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||
case BattlerTagType.BURNING_BULWARK:
|
||||
return new ContactBurnProtectedTag(sourceMove);
|
||||
case BattlerTagType.ENDURING:
|
||||
return new EnduringTag(sourceMove);
|
||||
return new EnduringTag(tagType, BattlerTagLapseType.TURN_END, sourceMove);
|
||||
case BattlerTagType.ENDURE_TOKEN:
|
||||
return new EnduringTag(tagType, BattlerTagLapseType.AFTER_HIT, sourceMove);
|
||||
case BattlerTagType.STURDY:
|
||||
return new SturdyTag(sourceMove);
|
||||
case BattlerTagType.PERISH_SONG:
|
||||
|
@ -2904,7 +3065,7 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||
case BattlerTagType.CHARGED:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.ELECTRIC, 2, true);
|
||||
case BattlerTagType.FLOATING:
|
||||
return new FloatingTag(tagType, sourceMove);
|
||||
return new FloatingTag(tagType, sourceMove, turnCount);
|
||||
case BattlerTagType.MINIMIZED:
|
||||
return new MinimizeTag();
|
||||
case BattlerTagType.DESTINY_BOND:
|
||||
|
@ -2913,6 +3074,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||
return new IceFaceBlockDamageTag(tagType);
|
||||
case BattlerTagType.DISGUISE:
|
||||
return new FormBlockDamageTag(tagType);
|
||||
case BattlerTagType.COMMANDED:
|
||||
return new CommandedTag(sourceId);
|
||||
case BattlerTagType.STOCKPILING:
|
||||
return new StockpilingTag(sourceMove);
|
||||
case BattlerTagType.OCTOLOCK:
|
||||
|
@ -2934,6 +3097,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||
return new ThroatChoppedTag();
|
||||
case BattlerTagType.GORILLA_TACTICS:
|
||||
return new GorillaTacticsTag();
|
||||
case BattlerTagType.UNBURDEN:
|
||||
return new UnburdenTag();
|
||||
case BattlerTagType.SUBSTITUTE:
|
||||
return new SubstituteTag(sourceMove, sourceId);
|
||||
case BattlerTagType.AUTOTOMIZED:
|
||||
|
@ -2954,6 +3119,10 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||
return new TelekinesisTag(sourceMove);
|
||||
case BattlerTagType.POWER_TRICK:
|
||||
return new PowerTrickTag(sourceMove, sourceId);
|
||||
case BattlerTagType.GRUDGE:
|
||||
return new GrudgeTag();
|
||||
case BattlerTagType.PSYCHO_SHIFT:
|
||||
return new PsychoShiftTag();
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
|
|
|
@ -2,7 +2,7 @@ import { getPokemonNameWithAffix } from "../messages";
|
|||
import Pokemon, { HitResult } from "../field/pokemon";
|
||||
import { getStatusEffectHealText } from "./status-effect";
|
||||
import * as Utils from "../utils";
|
||||
import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability";
|
||||
import { DoubleBerryEffectAbAttr, PostItemLostAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs, applyPostItemLostAbAttrs } from "./ability";
|
||||
import i18next from "i18next";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
|
@ -61,13 +61,13 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
|
|||
}
|
||||
}
|
||||
|
||||
export type BerryEffectFunc = (pokemon: Pokemon) => void;
|
||||
export type BerryEffectFunc = (pokemon: Pokemon, berryOwner?: Pokemon) => void;
|
||||
|
||||
export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
||||
switch (berryType) {
|
||||
case BerryType.SITRUS:
|
||||
case BerryType.ENIGMA:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
|
@ -75,9 +75,10 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
|||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, hpHealed);
|
||||
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
|
||||
hpHealed.value, i18next.t("battle:hpHealBerry", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), berryName: getBerryName(berryType) }), true));
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
};
|
||||
case BerryType.LUM:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
|
@ -86,13 +87,14 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
|||
}
|
||||
pokemon.resetStatus(true, true);
|
||||
pokemon.updateInfo();
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
};
|
||||
case BerryType.LIECHI:
|
||||
case BerryType.GANLON:
|
||||
case BerryType.PETAYA:
|
||||
case BerryType.APICOT:
|
||||
case BerryType.SALAC:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
|
@ -101,16 +103,18 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
|||
const statStages = new Utils.NumberHolder(1);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, statStages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ stat ], statStages.value));
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
};
|
||||
case BerryType.LANSAT:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
pokemon.addTag(BattlerTagType.CRIT_BOOST);
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
};
|
||||
case BerryType.STARF:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
|
@ -118,9 +122,10 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
|||
const stages = new Utils.NumberHolder(2);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, stages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ randStat ], stages.value));
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
};
|
||||
case BerryType.LEPPA:
|
||||
return (pokemon: Pokemon) => {
|
||||
return (pokemon: Pokemon, berryOwner?: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
|
@ -128,6 +133,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
|||
if (ppRestoreMove !== undefined) {
|
||||
ppRestoreMove!.ppUsed = Math.max(ppRestoreMove!.ppUsed - 10, 0);
|
||||
pokemon.scene.queueMessage(i18next.t("battle:ppHealBerry", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: ppRestoreMove!.getName(), berryName: getBerryName(berryType) }));
|
||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ import Pokemon, { PokemonMove } from "#app/field/pokemon";
|
|||
import { BattleType, FixedBattleConfig } from "#app/battle";
|
||||
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
||||
import { GameMode } from "#app/game-mode";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
import { Species } from "#enums/species";
|
||||
import { TrainerType } from "#enums/trainer-type";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { TypeColor, TypeShadow } from "#enums/color";
|
||||
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
|
@ -653,7 +653,7 @@ export class FreshStartChallenge extends Challenge {
|
|||
pokemon.shiny = false; // Not shiny
|
||||
pokemon.variant = 0; // Not shiny
|
||||
pokemon.formIndex = 0; // Froakie should be base form
|
||||
pokemon.ivs = [ 10, 10, 10, 10, 10, 10 ]; // Default IVs of 10 for all stats
|
||||
pokemon.ivs = [ 15, 15, 15, 15, 15, 15 ]; // Default IVs of 15 for all stats (Updated to 15 from 10 in 1.2.0)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Abilities } from "#enums/abilities";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { Nature } from "#enums/nature";
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import { Starter } from "#app/ui/starter-select-ui-handler";
|
|||
import * as Utils from "#app/utils";
|
||||
import PokemonSpecies, { PokemonSpeciesForm, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
|
||||
export interface DailyRunConfig {
|
||||
seed: integer;
|
||||
|
@ -14,14 +15,9 @@ export interface DailyRunConfig {
|
|||
|
||||
export function fetchDailyRunSeed(): Promise<string | null> {
|
||||
return new Promise<string | null>((resolve, reject) => {
|
||||
Utils.apiFetch("daily/seed").then(response => {
|
||||
if (!response.ok) {
|
||||
resolve(null);
|
||||
return;
|
||||
}
|
||||
return response.text();
|
||||
}).then(seed => resolve(seed ?? null))
|
||||
.catch(err => reject(err));
|
||||
pokerogueApi.daily.getSeed().then(dailySeed => {
|
||||
resolve(dailySeed);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
857
src/data/move.ts
|
@ -18,7 +18,7 @@ import { randInt } from "#app/utils";
|
|||
import { BattlerIndex } from "#app/battle";
|
||||
import { applyModifierTypeToPlayerPokemon, catchPokemon, getHighestLevelPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import HeldModifierConfig from "#app/interfaces/held-modifier-config";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
|
@ -181,7 +181,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
|
||||
// Sort berries by party member ID to more easily re-add later if necessary
|
||||
const berryItemsMap = new Map<number, BerryModifier[]>();
|
||||
scene.getParty().forEach(pokemon => {
|
||||
scene.getPlayerParty().forEach(pokemon => {
|
||||
const pokemonBerries = berryItems.filter(b => b.pokemonId === pokemon.id);
|
||||
if (pokemonBerries?.length > 0) {
|
||||
berryItemsMap.set(pokemon.id, pokemonBerries);
|
||||
|
@ -267,7 +267,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
const revSeed = generateModifierType(scene, modifierTypes.REVIVER_SEED);
|
||||
encounter.setDialogueToken("foodReward", revSeed?.name ?? i18next.t("modifierType:ModifierType.REVIVER_SEED.name"));
|
||||
const givePartyPokemonReviverSeeds = () => {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
party.forEach(p => {
|
||||
const heldItems = p.getHeldItems();
|
||||
if (revSeed && !heldItems.some(item => item instanceof PokemonInstantReviveModifier)) {
|
||||
|
@ -308,7 +308,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
const berryMap = encounter.misc.berryItemsMap;
|
||||
|
||||
// Returns 2/5 of the berries stolen to each Pokemon
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
party.forEach(pokemon => {
|
||||
const stolenBerries: BerryModifier[] = berryMap.get(pokemon.id);
|
||||
const berryTypesAsArray: BerryType[] = [];
|
||||
|
|
|
@ -58,7 +58,7 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
|||
|
||||
// Calculate boss mon
|
||||
const level = getEncounterPokemonLevelForWave(scene, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
const bossPokemon = new EnemyPokemon(scene, bossSpecies, level, TrainerSlot.NONE, true);
|
||||
encounter.setDialogueToken("enemyPokemon", getPokemonNameWithAffix(bossPokemon));
|
||||
const config: EnemyPartyConfig = {
|
||||
|
@ -77,7 +77,7 @@ export const BerriesAboundEncounter: MysteryEncounter =
|
|||
scene.currentBattle.waveIndex > 160 ? 7
|
||||
: scene.currentBattle.waveIndex > 120 ? 5
|
||||
: scene.currentBattle.waveIndex > 40 ? 4 : 2;
|
||||
regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0);
|
||||
regenerateModifierPoolThresholds(scene.getPlayerParty(), ModifierPoolType.PLAYER, 0);
|
||||
encounter.misc = { numBerries };
|
||||
|
||||
const { spriteKey, fileRoot } = getSpriteKeysFromPokemon(bossPokemon);
|
||||
|
@ -253,7 +253,7 @@ function tryGiveBerry(scene: BattleScene, prioritizedPokemon?: PlayerPokemon) {
|
|||
const berryType = randSeedInt(Object.keys(BerryType).filter(s => !isNaN(Number(s))).length) as BerryType;
|
||||
const berry = generateModifierType(scene, modifierTypes.BERRY, [ berryType ]) as BerryModifierType;
|
||||
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
|
||||
// Will try to apply to prioritized pokemon first, then do normal application method if it fails
|
||||
if (prioritizedPokemon) {
|
||||
|
|
|
@ -36,7 +36,7 @@ import {
|
|||
HeldItemRequirement,
|
||||
TypeRequirement
|
||||
} from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { AttackTypeBoosterModifierType, ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import {
|
||||
AttackTypeBoosterModifier,
|
||||
|
@ -331,7 +331,7 @@ export const BugTypeSuperfanEncounter: MysteryEncounter =
|
|||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
|
||||
// Player gets different rewards depending on the number of bug types they have
|
||||
const numBugTypes = scene.getParty().filter(p => p.isOfType(Type.BUG, true)).length;
|
||||
const numBugTypes = scene.getPlayerParty().filter(p => p.isOfType(Type.BUG, true)).length;
|
||||
const numBugTypesText = i18next.t(`${namespace}:numBugTypes`, { count: numBugTypes });
|
||||
encounter.setDialogueToken("numBugTypes", numBugTypesText);
|
||||
|
||||
|
@ -477,12 +477,9 @@ export const BugTypeSuperfanEncounter: MysteryEncounter =
|
|||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const modifier = encounter.misc.chosenModifier;
|
||||
const chosenPokemon: PlayerPokemon = encounter.misc.chosenPokemon;
|
||||
|
||||
// Remove the modifier if its stacks go to 0
|
||||
modifier.stackCount -= 1;
|
||||
if (modifier.stackCount === 0) {
|
||||
scene.removeModifier(modifier);
|
||||
}
|
||||
chosenPokemon.loseHeldItem(modifier, false);
|
||||
scene.updateModifiers(true, true);
|
||||
|
||||
const bugNet = generateModifierTypeOption(scene, modifierTypes.MYSTERY_ENCOUNTER_GOLDEN_BUG_NET)!;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { EnemyPartyConfig, generateModifierType, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, loadCustomMovesForEncounter, selectPokemonForOption, setEncounterRewards, transitionMysteryEncounterIntroVisuals } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { trainerConfigs, TrainerPartyCompoundTemplate, TrainerPartyTemplate, } from "#app/data/trainer-config";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { ModifierPoolType, modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PartyMemberStrength } from "#enums/party-member-strength";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
|
@ -12,7 +12,7 @@ import { TrainerType } from "#enums/trainer-type";
|
|||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { applyAbilityOverrideToPokemon, applyModifierTypeToPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { randSeedInt, randSeedShuffle } from "#app/utils";
|
||||
|
@ -245,7 +245,7 @@ export const ClowningAroundEncounter: MysteryEncounter =
|
|||
// So Vitamins, form change items, etc. are not included
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let mostHeldItemsPokemon = party[0];
|
||||
let count = mostHeldItemsPokemon.getHeldItems()
|
||||
.filter(m => m.isTransferable && !(m instanceof BerryModifier))
|
||||
|
@ -280,7 +280,7 @@ export const ClowningAroundEncounter: MysteryEncounter =
|
|||
let numRogue = 0;
|
||||
items.filter(m => m.isTransferable && !(m instanceof BerryModifier))
|
||||
.forEach(m => {
|
||||
const type = m.type.withTierFromPool();
|
||||
const type = m.type.withTierFromPool(ModifierPoolType.PLAYER, party);
|
||||
const tier = type.tier ?? ModifierTier.ULTRA;
|
||||
if (type.id === "GOLDEN_EGG" || tier === ModifierTier.ROGUE) {
|
||||
numRogue += m.stackCount;
|
||||
|
@ -328,7 +328,7 @@ export const ClowningAroundEncounter: MysteryEncounter =
|
|||
.withPreOptionPhase(async (scene: BattleScene) => {
|
||||
// Randomize the second type of all player's pokemon
|
||||
// If the pokemon does not normally have a second type, it will gain 1
|
||||
for (const pokemon of scene.getParty()) {
|
||||
for (const pokemon of scene.getPlayerParty()) {
|
||||
const originalTypes = pokemon.getTypes(false, false, true);
|
||||
|
||||
// If the Pokemon has non-status moves that don't match the Pokemon's type, prioritizes those as the new type
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
import { EnemyPartyConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, selectPokemonForOption, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { EncounterBattleAnim } from "#app/data/battle-anims";
|
||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { EncounterBattleAnim } from "#app/data/battle-anims";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { getEncounterText, queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { MoveRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { DANCING_MOVES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { getEncounterText, queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { EnemyPartyConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, selectPokemonForOption, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { catchPokemon, getEncounterPokemonLevelForWave, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { Stat } from "#enums/stat";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { EncounterAnim } from "#enums/encounter-anims";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { Species } from "#enums/species";
|
||||
import { Stat } from "#enums/stat";
|
||||
import i18next from "i18next";
|
||||
|
||||
/** the i18n namespace for this encounter */
|
||||
|
@ -92,7 +92,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
|||
.withCatchAllowed(true)
|
||||
.withFleeAllowed(false)
|
||||
.withOnVisualsStart((scene: BattleScene) => {
|
||||
const danceAnim = new EncounterBattleAnim(EncounterAnim.DANCE, scene.getEnemyPokemon()!, scene.getParty()[0]);
|
||||
const danceAnim = new EncounterBattleAnim(EncounterAnim.DANCE, scene.getEnemyPokemon()!, scene.getPlayerPokemon()!);
|
||||
danceAnim.play(scene);
|
||||
|
||||
return true;
|
||||
|
@ -217,7 +217,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
|||
|
||||
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
||||
encounter.setDialogueToken("selectedPokemon", pokemon.getNameToRender());
|
||||
scene.unshiftPhase(new LearnMovePhase(scene, scene.getParty().indexOf(pokemon), Moves.REVELATION_DANCE));
|
||||
scene.unshiftPhase(new LearnMovePhase(scene, scene.getPlayerParty().indexOf(pokemon), Moves.REVELATION_DANCE));
|
||||
|
||||
// Play animation again to "learn" the dance
|
||||
const danceAnim = new EncounterBattleAnim(EncounterAnim.DANCE, scene.getEnemyPokemon()!, scene.getPlayerPokemon());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import { generateModifierType, leaveEncounterWithoutBattle, selectPokemonForOption, updatePlayerMoney, } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { CombinationPokemonRequirement, HeldItemRequirement, MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { getEncounterText, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { BerryModifier, HealingBoosterModifier, LevelIncrementBoosterModifier, MoneyMultiplierModifier, PokemonHeldItemModifier, PreserveBerryModifier } from "#app/modifier/modifier";
|
||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { generateModifierType, leaveEncounterWithoutBattle, selectPokemonForOption, updatePlayerMoney, } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { applyModifierTypeToPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { BerryModifier, HealingBoosterModifier, LevelIncrementBoosterModifier, MoneyMultiplierModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, PreserveBerryModifier } from "#app/modifier/modifier";
|
||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
/** the i18n namespace for this encounter */
|
||||
const namespace = "mysteryEncounters/delibirdy";
|
||||
|
@ -133,7 +133,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
if (existing && existing.getStackCount() >= existing.getMaxStackCount(scene)) {
|
||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||
const shellBell = generateModifierType(scene, modifierTypes.SHELL_BELL) as PokemonHeldItemModifierType;
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getParty()[0], shellBell);
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
} else {
|
||||
|
@ -197,7 +197,8 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const modifier: BerryModifier | HealingBoosterModifier = encounter.misc.chosenModifier;
|
||||
const modifier: BerryModifier | PokemonInstantReviveModifier = encounter.misc.chosenModifier;
|
||||
const chosenPokemon: PlayerPokemon = encounter.misc.chosenPokemon;
|
||||
|
||||
// Give the player a Candy Jar if they gave a Berry, and a Berry Pouch for Reviver Seed
|
||||
if (modifier instanceof BerryModifier) {
|
||||
|
@ -207,7 +208,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
if (existing && existing.getStackCount() >= existing.getMaxStackCount(scene)) {
|
||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||
const shellBell = generateModifierType(scene, modifierTypes.SHELL_BELL) as PokemonHeldItemModifierType;
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getParty()[0], shellBell);
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
} else {
|
||||
|
@ -220,7 +221,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
if (existing && existing.getStackCount() >= existing.getMaxStackCount(scene)) {
|
||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||
const shellBell = generateModifierType(scene, modifierTypes.SHELL_BELL) as PokemonHeldItemModifierType;
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getParty()[0], shellBell);
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
} else {
|
||||
|
@ -228,11 +229,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
}
|
||||
}
|
||||
|
||||
// Remove the modifier if its stacks go to 0
|
||||
modifier.stackCount -= 1;
|
||||
if (modifier.stackCount === 0) {
|
||||
scene.removeModifier(modifier);
|
||||
}
|
||||
chosenPokemon.loseHeldItem(modifier, false);
|
||||
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
|
@ -292,6 +289,7 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const modifier = encounter.misc.chosenModifier;
|
||||
const chosenPokemon: PlayerPokemon = encounter.misc.chosenPokemon;
|
||||
|
||||
// Check if the player has max stacks of Healing Charm already
|
||||
const existing = scene.findModifier(m => m instanceof HealingBoosterModifier) as HealingBoosterModifier;
|
||||
|
@ -299,18 +297,14 @@ export const DelibirdyEncounter: MysteryEncounter =
|
|||
if (existing && existing.getStackCount() >= existing.getMaxStackCount(scene)) {
|
||||
// At max stacks, give the first party pokemon a Shell Bell instead
|
||||
const shellBell = generateModifierType(scene, modifierTypes.SHELL_BELL) as PokemonHeldItemModifierType;
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getParty()[0], shellBell);
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerParty()[0], shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
} else {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.HEALING_CHARM));
|
||||
}
|
||||
|
||||
// Remove the modifier if its stacks go to 0
|
||||
modifier.stackCount -= 1;
|
||||
if (modifier.stackCount === 0) {
|
||||
scene.removeModifier(modifier);
|
||||
}
|
||||
chosenPokemon.loseHeldItem(modifier, false);
|
||||
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
|
|
|
@ -214,7 +214,7 @@ function pokemonAndMoveChosen(scene: BattleScene, pokemon: PlayerPokemon, move:
|
|||
text: `${namespace}:incorrect_exp`,
|
||||
},
|
||||
];
|
||||
setEncounterExp(scene, scene.getParty().map((p) => p.id), 50);
|
||||
setEncounterExp(scene, scene.getPlayerParty().map((p) => p.id), 50);
|
||||
} else {
|
||||
encounter.selectedOption!.dialogue!.selected = [
|
||||
{
|
||||
|
|
|
@ -8,14 +8,14 @@ import { AbilityRequirement, CombinationPokemonRequirement, TypeRequirement } fr
|
|||
import { Species } from "#enums/species";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Gender } from "#app/data/gender";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import Pokemon, { PokemonMove } from "#app/field/pokemon";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { EncounterBattleAnim } from "#app/data/battle-anims";
|
||||
import { WeatherType } from "#app/data/weather";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { applyAbilityOverrideToPokemon, applyDamageToPokemon, applyModifierTypeToPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
|
@ -184,7 +184,7 @@ export const FieryFalloutEncounter: MysteryEncounter =
|
|||
async (scene: BattleScene) => {
|
||||
// Damage non-fire types and burn 1 random non-fire type member + give it Heatproof
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const nonFireTypes = scene.getParty().filter((p) => p.isAllowedInBattle() && !p.getTypes().includes(Type.FIRE));
|
||||
const nonFireTypes = scene.getPlayerParty().filter((p) => p.isAllowedInBattle() && !p.getTypes().includes(Type.FIRE));
|
||||
|
||||
for (const pkm of nonFireTypes) {
|
||||
const percentage = DAMAGE_PERCENTAGE / 100;
|
||||
|
@ -257,7 +257,7 @@ export const FieryFalloutEncounter: MysteryEncounter =
|
|||
|
||||
function giveLeadPokemonAttackTypeBoostItem(scene: BattleScene) {
|
||||
// Give first party pokemon attack type boost item for free at end of battle
|
||||
const leadPokemon = scene.getParty()?.[0];
|
||||
const leadPokemon = scene.getPlayerParty()?.[0];
|
||||
if (leadPokemon) {
|
||||
// Generate type booster held item, default to Charcoal if item fails to generate
|
||||
let boosterModifierType = generateModifierType(scene, modifierTypes.ATTACK_TYPE_BOOSTER) as AttackTypeBoosterModifierType;
|
||||
|
|
|
@ -56,7 +56,7 @@ export const FightOrFlightEncounter: MysteryEncounter =
|
|||
|
||||
// Calculate boss mon
|
||||
const level = getEncounterPokemonLevelForWave(scene, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
const bossPokemon = new EnemyPokemon(scene, bossSpecies, level, TrainerSlot.NONE, true);
|
||||
encounter.setDialogueToken("enemyPokemon", bossPokemon.getNameToRender());
|
||||
const config: EnemyPartyConfig = {
|
||||
|
@ -86,11 +86,11 @@ export const FightOrFlightEncounter: MysteryEncounter =
|
|||
: scene.currentBattle.waveIndex > 40
|
||||
? ModifierTier.ULTRA
|
||||
: ModifierTier.GREAT;
|
||||
regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0);
|
||||
regenerateModifierPoolThresholds(scene.getPlayerParty(), ModifierPoolType.PLAYER, 0);
|
||||
let item: ModifierTypeOption | null = null;
|
||||
// TMs and Candy Jar excluded from possible rewards as they're too swingy in value for a singular item reward
|
||||
while (!item || item.type.id.includes("TM_") || item.type.id === "CANDY_JAR") {
|
||||
item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
||||
item = getPlayerModifierTypeOptions(1, scene.getPlayerParty(), [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
||||
}
|
||||
encounter.setDialogueToken("itemName", item.type.name);
|
||||
encounter.misc = item;
|
||||
|
|
|
@ -165,7 +165,7 @@ async function summonPlayerPokemon(scene: BattleScene) {
|
|||
|
||||
const playerPokemon = encounter.misc.playerPokemon;
|
||||
// Swaps the chosen Pokemon and the first player's lead Pokemon in the party
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
const chosenIndex = party.indexOf(playerPokemon);
|
||||
if (chosenIndex !== 0) {
|
||||
const leadPokemon = party[0];
|
||||
|
@ -305,7 +305,7 @@ async function showWobbuffetHealthBar(scene: BattleScene) {
|
|||
scene.field.add(wobbuffet);
|
||||
|
||||
const playerPokemon = scene.getPlayerPokemon() as Pokemon;
|
||||
if (playerPokemon?.visible) {
|
||||
if (playerPokemon?.isOnField()) {
|
||||
scene.field.moveBelow(wobbuffet, playerPokemon);
|
||||
}
|
||||
// Show health bar and trigger cry
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { leaveEncounterWithoutBattle, selectPokemonForOption, setEncounterRewards } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { TrainerSlot, } from "#app/data/trainer-config";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
import { getPlayerModifierTypeOptions, ModifierPoolType, ModifierTypeOption, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
|
@ -20,11 +21,12 @@ import PokemonData from "#app/system/pokemon-data";
|
|||
import i18next from "i18next";
|
||||
import { Gender, getGenderSymbol } from "#app/data/gender";
|
||||
import { getNatureName } from "#app/data/nature";
|
||||
import { getPokeballAtlasKey, getPokeballTintColor, PokeballType } from "#app/data/pokeball";
|
||||
import { getPokeballAtlasKey, getPokeballTintColor } from "#app/data/pokeball";
|
||||
import { getEncounterText, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { trainerNamePools } from "#app/data/trainer-names";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { addPokemonDataToDexAndValidateAchievements } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import type { PokeballType } from "#enums/pokeball";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/globalTradeSystem";
|
||||
|
@ -105,7 +107,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
|
||||
// Load bgm
|
||||
let bgmKey: string;
|
||||
if (scene.musicPreference === 0) {
|
||||
if (scene.musicPreference === MusicPreference.CONSISTENT) {
|
||||
bgmKey = "mystery_encounter_gen_5_gts";
|
||||
scene.loadBgm(bgmKey, `${bgmKey}.mp3`);
|
||||
} else {
|
||||
|
@ -191,7 +193,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
receivedPokemonData.pokeball = randInt(4) as PokeballType;
|
||||
const dataSource = new PokemonData(receivedPokemonData);
|
||||
const newPlayerPokemon = scene.addPlayerPokemon(receivedPokemonData.species, receivedPokemonData.level, dataSource.abilityIndex, dataSource.formIndex, dataSource.gender, dataSource.shiny, dataSource.variant, dataSource.ivs, dataSource.nature, dataSource);
|
||||
scene.getParty().push(newPlayerPokemon);
|
||||
scene.getPlayerParty().push(newPlayerPokemon);
|
||||
await newPlayerPokemon.loadAssets();
|
||||
|
||||
for (const mod of modifiers) {
|
||||
|
@ -224,7 +226,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const onPokemonSelected = (pokemon: PlayerPokemon) => {
|
||||
// Randomly generate a Wonder Trade pokemon
|
||||
const randomTradeOption = generateTradeOption(scene.getParty().map(p => p.species));
|
||||
const randomTradeOption = generateTradeOption(scene.getPlayerParty().map(p => p.species));
|
||||
const tradePokemon = new EnemyPokemon(scene, randomTradeOption, pokemon.level, TrainerSlot.NONE, false);
|
||||
// Extra shiny roll at 1/128 odds (boosted by events and charms)
|
||||
if (!tradePokemon.shiny) {
|
||||
|
@ -299,7 +301,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
receivedPokemonData.pokeball = randInt(4) as PokeballType;
|
||||
const dataSource = new PokemonData(receivedPokemonData);
|
||||
const newPlayerPokemon = scene.addPlayerPokemon(receivedPokemonData.species, receivedPokemonData.level, dataSource.abilityIndex, dataSource.formIndex, dataSource.gender, dataSource.shiny, dataSource.variant, dataSource.ivs, dataSource.nature, dataSource);
|
||||
scene.getParty().push(newPlayerPokemon);
|
||||
scene.getPlayerParty().push(newPlayerPokemon);
|
||||
await newPlayerPokemon.loadAssets();
|
||||
|
||||
for (const mod of modifiers) {
|
||||
|
@ -343,6 +345,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
// Pokemon and item selected
|
||||
encounter.setDialogueToken("chosenItem", modifier.type.name);
|
||||
encounter.misc.chosenModifier = modifier;
|
||||
encounter.misc.chosenPokemon = pokemon;
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
@ -366,10 +369,12 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
const modifier = encounter.misc.chosenModifier;
|
||||
const modifier = encounter.misc.chosenModifier as PokemonHeldItemModifier;
|
||||
const party = scene.getPlayerParty();
|
||||
const chosenPokemon: PlayerPokemon = encounter.misc.chosenPokemon;
|
||||
|
||||
// Check tier of the traded item, the received item will be one tier up
|
||||
const type = modifier.type.withTierFromPool();
|
||||
const type = modifier.type.withTierFromPool(ModifierPoolType.PLAYER, party);
|
||||
let tier = type.tier ?? ModifierTier.GREAT;
|
||||
// Eggs and White Herb are not in the pool
|
||||
if (type.id === "WHITE_HERB") {
|
||||
|
@ -384,21 +389,17 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
tier++;
|
||||
}
|
||||
|
||||
regenerateModifierPoolThresholds(scene.getParty(), ModifierPoolType.PLAYER, 0);
|
||||
regenerateModifierPoolThresholds(party, ModifierPoolType.PLAYER, 0);
|
||||
let item: ModifierTypeOption | null = null;
|
||||
// TMs excluded from possible rewards
|
||||
while (!item || item.type.id.includes("TM_")) {
|
||||
item = getPlayerModifierTypeOptions(1, scene.getParty(), [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
||||
item = getPlayerModifierTypeOptions(1, party, [], { guaranteedModifierTiers: [ tier ], allowLuckUpgrades: false })[0];
|
||||
}
|
||||
|
||||
encounter.setDialogueToken("itemName", item.type.name);
|
||||
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [ item ], fillRemaining: false });
|
||||
|
||||
// Remove the chosen modifier if its stacks go to 0
|
||||
modifier.stackCount -= 1;
|
||||
if (modifier.stackCount === 0) {
|
||||
scene.removeModifier(modifier);
|
||||
}
|
||||
chosenPokemon.loseHeldItem(modifier, false);
|
||||
await scene.updateModifiers(true, true);
|
||||
|
||||
// Generate a trainer name
|
||||
|
@ -430,9 +431,9 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
function getPokemonTradeOptions(scene: BattleScene): Map<number, EnemyPokemon[]> {
|
||||
const tradeOptionsMap: Map<number, EnemyPokemon[]> = new Map<number, EnemyPokemon[]>();
|
||||
// Starts by filtering out any current party members as valid resulting species
|
||||
const alreadyUsedSpecies: PokemonSpecies[] = scene.getParty().map(p => p.species);
|
||||
const alreadyUsedSpecies: PokemonSpecies[] = scene.getPlayerParty().map(p => p.species);
|
||||
|
||||
scene.getParty().forEach(pokemon => {
|
||||
scene.getPlayerParty().forEach(pokemon => {
|
||||
// If the party member is legendary/mythical, the only trade options available are always pulled from generation-specific legendary trade pools
|
||||
if (pokemon.species.legendary || pokemon.species.subLegendary || pokemon.species.mythical) {
|
||||
const generation = pokemon.species.generation;
|
||||
|
|
|
@ -104,7 +104,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||
],
|
||||
},
|
||||
async (scene: BattleScene) => {
|
||||
const allowedPokemon = scene.getParty().filter((p) => p.isAllowedInBattle());
|
||||
const allowedPokemon = scene.getPlayerParty().filter((p) => p.isAllowedInBattle());
|
||||
|
||||
for (const pkm of allowedPokemon) {
|
||||
const percentage = DAMAGE_PERCENTAGE / 100;
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { EnemyPartyConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, setEncounterRewards, transitionMysteryEncounterIntroVisuals } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { getHighestLevelPlayerPokemon, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { EnemyPartyConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, setEncounterRewards, transitionMysteryEncounterIntroVisuals } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { getHighestLevelPlayerPokemon, koPlayerPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Species } from "#enums/species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { GameOverPhase } from "#app/phases/game-over-phase";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { GameOverPhase } from "#app/phases/game-over-phase";
|
||||
import { randSeedInt } from "#app/utils";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
|
||||
/** i18n namespace for encounter */
|
||||
const namespace = "mysteryEncounters/mysteriousChest";
|
||||
|
@ -177,7 +177,7 @@ export const MysteriousChestEncounter: MysteryEncounter =
|
|||
await showEncounterText(scene, `${namespace}:option.1.bad`);
|
||||
|
||||
// Handle game over edge case
|
||||
const allowedPokemon = scene.getParty().filter(p => p.isAllowedInBattle());
|
||||
const allowedPokemon = scene.getPokemonAllowedInBattle();
|
||||
if (allowedPokemon.length === 0) {
|
||||
// If there are no longer any legal pokemon in the party, game over.
|
||||
scene.clearPhaseQueue();
|
||||
|
|
|
@ -6,7 +6,7 @@ import MysteryEncounterOption, { MysteryEncounterOptionBuilder } from "#app/data
|
|||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifier/modifier";
|
||||
import { EnemyPokemon } from "#app/field/pokemon";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { IntegerHolder, randSeedInt } from "#app/utils";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
|
|
|
@ -100,7 +100,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
|||
// Only Pokemon that can gain benefits are above half HP with no status
|
||||
const selectableFilter = (pokemon: Pokemon) => {
|
||||
// If pokemon meets primary pokemon reqs, it can be selected
|
||||
if (!pokemon.isAllowed()) {
|
||||
if (!pokemon.isAllowedInChallenge()) {
|
||||
return i18next.t("partyUiHandler:cantBeUsed", { pokemonName: pokemon.getNameToRender() }) ?? null;
|
||||
}
|
||||
if (!encounter.pokemonMeetsPrimaryRequirements(scene, pokemon)) {
|
||||
|
@ -138,7 +138,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
|||
newNature = randSeedInt(25) as Nature;
|
||||
}
|
||||
|
||||
chosenPokemon.customPokemonData.nature = newNature;
|
||||
chosenPokemon.setCustomNature(newNature);
|
||||
encounter.setDialogueToken("newNature", getNatureName(newNature));
|
||||
queueEncounterMessage(scene, `${namespace}:cheap_side_effects`);
|
||||
setEncounterExp(scene, [ chosenPokemon.id ], 100);
|
||||
|
|
|
@ -3,7 +3,7 @@ import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifi
|
|||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { MoveRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
|
|
|
@ -12,7 +12,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
|||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { getBiomeKey } from "#app/field/arena";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { getPartyLuckValue, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
|
@ -134,7 +134,7 @@ export const TeleportingHijinksEncounter: MysteryEncounter =
|
|||
|
||||
// Init enemy
|
||||
const level = getEncounterPokemonLevelForWave(scene, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
const bossPokemon = new EnemyPokemon(scene, bossSpecies, level, TrainerSlot.NONE, true);
|
||||
encounter.setDialogueToken("enemyPokemon", getPokemonNameWithAffix(bossPokemon));
|
||||
const config: EnemyPartyConfig = {
|
||||
|
@ -170,7 +170,7 @@ async function doBiomeTransitionDialogueAndBattleInit(scene: BattleScene) {
|
|||
|
||||
// Init enemy
|
||||
const level = getEncounterPokemonLevelForWave(scene, STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const bossSpecies = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
const bossPokemon = new EnemyPokemon(scene, bossSpecies, level, TrainerSlot.NONE, true);
|
||||
encounter.setDialogueToken("enemyPokemon", getPokemonNameWithAffix(bossPokemon));
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/myst
|
|||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifier-type";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { getPokeballTintColor } from "#app/data/pokeball";
|
||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
|
||||
|
@ -126,7 +126,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||
];
|
||||
|
||||
// Determine the 3 pokemon the player can battle with
|
||||
let partyCopy = scene.getParty().slice(0);
|
||||
let partyCopy = scene.getPlayerParty().slice(0);
|
||||
partyCopy = partyCopy
|
||||
.filter(p => p.isAllowedInBattle())
|
||||
.sort((a, b) => a.friendship - b.friendship);
|
||||
|
@ -508,11 +508,11 @@ function getEggOptions(scene: BattleScene, commonEggs: number, rareEggs: number)
|
|||
}
|
||||
|
||||
function removePokemonFromPartyAndStoreHeldItems(scene: BattleScene, encounter: MysteryEncounter, chosenPokemon: PlayerPokemon) {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
const chosenIndex = party.indexOf(chosenPokemon);
|
||||
party[chosenIndex] = party[0];
|
||||
party[0] = chosenPokemon;
|
||||
encounter.misc.originalParty = scene.getParty().slice(1);
|
||||
encounter.misc.originalParty = scene.getPlayerParty().slice(1);
|
||||
encounter.misc.originalPartyHeldItems = encounter.misc.originalParty
|
||||
.map(p => p.getHeldItems());
|
||||
scene["party"] = [
|
||||
|
@ -529,7 +529,7 @@ function checkAchievement(scene: BattleScene) {
|
|||
function restorePartyAndHeldItems(scene: BattleScene) {
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
// Restore original party
|
||||
scene.getParty().push(...encounter.misc.originalParty);
|
||||
scene.getPlayerParty().push(...encounter.misc.originalParty);
|
||||
|
||||
// Restore held items
|
||||
const originalHeldItems = encounter.misc.originalPartyHeldItems;
|
||||
|
|
|
@ -8,7 +8,7 @@ import { catchPokemon, getRandomSpeciesByStarterTier, getSpriteKeysFromPokemon }
|
|||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { Species } from "#enums/species";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
|
||||
import { showEncounterDialogue } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
|
|
|
@ -5,7 +5,7 @@ import BattleScene from "#app/battle-scene";
|
|||
import MysteryEncounter, { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
|
||||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Species } from "#enums/species";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { Nature } from "#enums/nature";
|
||||
import Pokemon, { PokemonMove } from "#app/field/pokemon";
|
||||
import { queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
import { modifyPlayerPokemonBST } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
|
@ -140,7 +140,7 @@ export const TheStrongStuffEncounter: MysteryEncounter =
|
|||
|
||||
// -15 to all base stats of highest BST (halved for HP), +10 to all base stats of rest of party (halved for HP)
|
||||
// Sort party by bst
|
||||
const sortedParty = scene.getParty().slice(0)
|
||||
const sortedParty = scene.getPlayerParty().slice(0)
|
||||
.sort((pokemon1, pokemon2) => {
|
||||
const pokemon1Bst = pokemon1.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
const pokemon2Bst = pokemon2.calculateBaseStats().reduce((a, b) => a + b, 0);
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Abilities } from "#enums/abilities";
|
|||
import { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { SpeciesFormChangeManualTrigger } from "#app/data/pokemon-forms";
|
||||
|
@ -23,6 +23,7 @@ import { ReturnPhase } from "#app/phases/return-phase";
|
|||
import i18next from "i18next";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/theWinstrateChallenge";
|
||||
|
@ -187,9 +188,10 @@ function endTrainerBattleAndShowDialogue(scene: BattleScene): Promise<void> {
|
|||
} else {
|
||||
scene.arena.resetArenaEffects();
|
||||
const playerField = scene.getPlayerField();
|
||||
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||
playerField.forEach((_, p) => scene.unshiftPhase(new ReturnPhase(scene, p)));
|
||||
|
||||
for (const pokemon of scene.getParty()) {
|
||||
for (const pokemon of scene.getPlayerParty()) {
|
||||
// Only trigger form change when Eiscue is in Noice form
|
||||
// Hardcoded Eiscue for now in case it is fused with another pokemon
|
||||
if (pokemon.species.speciesId === Species.EISCUE && pokemon.hasAbility(Abilities.ICE_FACE) && pokemon.formIndex === 1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Ability, allAbilities } from "#app/data/ability";
|
||||
import { EnemyPartyConfig, initBattleWithEnemyConfig, leaveEncounterWithoutBattle, selectPokemonForOption, setEncounterRewards, } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||
import { getNatureName, Nature } from "#app/data/nature";
|
||||
import { getNatureName } from "#app/data/nature";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
|
@ -21,6 +21,7 @@ import i18next from "i18next";
|
|||
import { getStatKey } from "#enums/stat";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import { isPokemonValidForEncounterOptionSelection } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import type { Nature } from "#enums/nature";
|
||||
|
||||
/** The i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/trainingSession";
|
||||
|
@ -152,7 +153,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
}
|
||||
|
||||
// Add pokemon and mods back
|
||||
scene.getParty().push(playerPokemon);
|
||||
scene.getPlayerParty().push(playerPokemon);
|
||||
for (const mod of modifiers.value) {
|
||||
mod.pokemonId = playerPokemon.id;
|
||||
scene.addModifier(mod, true, false, false, true);
|
||||
|
@ -225,11 +226,11 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
const onBeforeRewardsPhase = () => {
|
||||
queueEncounterMessage(scene, `${namespace}:option.2.finished`);
|
||||
// Add the pokemon back to party with Nature change
|
||||
playerPokemon.setNature(encounter.misc.chosenNature);
|
||||
scene.gameData.setPokemonCaught(playerPokemon, false);
|
||||
playerPokemon.setCustomNature(encounter.misc.chosenNature);
|
||||
scene.gameData.unlockSpeciesNature(playerPokemon.species, encounter.misc.chosenNature);
|
||||
|
||||
// Add pokemon and modifiers back
|
||||
scene.getParty().push(playerPokemon);
|
||||
scene.getPlayerParty().push(playerPokemon);
|
||||
for (const mod of modifiers.value) {
|
||||
mod.pokemonId = playerPokemon.id;
|
||||
scene.addModifier(mod, true, false, false, true);
|
||||
|
@ -342,7 +343,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
scene.gameData.setPokemonCaught(playerPokemon, false);
|
||||
|
||||
// Add pokemon and mods back
|
||||
scene.getParty().push(playerPokemon);
|
||||
scene.getPlayerParty().push(playerPokemon);
|
||||
for (const mod of modifiers.value) {
|
||||
mod.pokemonId = playerPokemon.id;
|
||||
scene.addModifier(mod, true, false, false, true);
|
||||
|
|
|
@ -164,7 +164,7 @@ async function tryApplyDigRewardItems(scene: BattleScene) {
|
|||
const shellBell = generateModifierType(scene, modifierTypes.SHELL_BELL) as PokemonHeldItemModifierType;
|
||||
const leftovers = generateModifierType(scene, modifierTypes.LEFTOVERS) as PokemonHeldItemModifierType;
|
||||
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
|
||||
// Iterate over the party until an item was successfully given
|
||||
// First leftovers
|
||||
|
|
|
@ -51,7 +51,7 @@ export const UncommonBreedEncounter: MysteryEncounter =
|
|||
// Calculate boss mon
|
||||
// Level equal to 2 below highest party member
|
||||
const level = getHighestLevelPlayerPokemon(scene, false, true).level - 2;
|
||||
const species = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getParty()), true);
|
||||
const species = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
const pokemon = new EnemyPokemon(scene, species, level, TrainerSlot.NONE, true);
|
||||
|
||||
// Pokemon will always have one of its egg moves in its moveset
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { Species } from "#enums/species";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
|
@ -176,7 +176,7 @@ export const WeirdDreamEncounter: MysteryEncounter =
|
|||
|
||||
for (const transformation of scene.currentBattle.mysteryEncounter!.misc.teamTransformations) {
|
||||
scene.removePokemonFromPlayerParty(transformation.previousPokemon, false);
|
||||
scene.getParty().push(transformation.newPokemon);
|
||||
scene.getPlayerParty().push(transformation.newPokemon);
|
||||
}
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
|
@ -280,7 +280,7 @@ export const WeirdDreamEncounter: MysteryEncounter =
|
|||
const onBeforeRewards = () => {
|
||||
// Before battle rewards, unlock the passive on a pokemon in the player's team for the rest of the run (not permanently)
|
||||
// One random pokemon will get its passive unlocked
|
||||
const passiveDisabledPokemon = scene.getParty().filter(p => !p.passive);
|
||||
const passiveDisabledPokemon = scene.getPlayerParty().filter(p => !p.passive);
|
||||
if (passiveDisabledPokemon?.length > 0) {
|
||||
const enablePassiveMon = passiveDisabledPokemon[randSeedInt(passiveDisabledPokemon.length)];
|
||||
enablePassiveMon.passive = true;
|
||||
|
@ -306,12 +306,13 @@ export const WeirdDreamEncounter: MysteryEncounter =
|
|||
},
|
||||
async (scene: BattleScene) => {
|
||||
// Leave, reduce party levels by 10%
|
||||
for (const pokemon of scene.getParty()) {
|
||||
for (const pokemon of scene.getPlayerParty()) {
|
||||
pokemon.level = Math.max(Math.ceil((100 - PERCENT_LEVEL_LOSS_ON_REFUSE) / 100 * pokemon.level), 1);
|
||||
pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate);
|
||||
pokemon.levelExp = 0;
|
||||
|
||||
pokemon.calculateStats();
|
||||
pokemon.getBattleInfo().setLevel(pokemon.level);
|
||||
await pokemon.updateInfo();
|
||||
}
|
||||
|
||||
|
@ -329,7 +330,7 @@ interface PokemonTransformation {
|
|||
}
|
||||
|
||||
function getTeamTransformations(scene: BattleScene): PokemonTransformation[] {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
// Removes all pokemon from the party
|
||||
const alreadyUsedSpecies: PokemonSpecies[] = party.map(p => p.species);
|
||||
const pokemonTransformations: PokemonTransformation[] = party.map(p => {
|
||||
|
@ -404,7 +405,7 @@ async function doNewTeamPostProcess(scene: BattleScene, transformations: Pokemon
|
|||
if (shouldGetOldGateau(newPokemon)) {
|
||||
const stats = getOldGateauBoostedStats(newPokemon);
|
||||
const modType = modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU()
|
||||
.generateType(scene.getParty(), [ OLD_GATEAU_STATS_UP, stats ])
|
||||
.generateType(scene.getPlayerParty(), [ OLD_GATEAU_STATS_UP, stats ])
|
||||
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU);
|
||||
const modifier = modType?.newModifier(newPokemon);
|
||||
if (modifier) {
|
||||
|
@ -417,7 +418,7 @@ async function doNewTeamPostProcess(scene: BattleScene, transformations: Pokemon
|
|||
}
|
||||
|
||||
// One random pokemon will get its passive unlocked
|
||||
const passiveDisabledPokemon = scene.getParty().filter(p => !p.passive);
|
||||
const passiveDisabledPokemon = scene.getPlayerParty().filter(p => !p.passive);
|
||||
if (passiveDisabledPokemon?.length > 0) {
|
||||
const enablePassiveMon = passiveDisabledPokemon[randSeedInt(passiveDisabledPokemon.length)];
|
||||
enablePassiveMon.passive = true;
|
||||
|
|
|
@ -2,7 +2,7 @@ import { OptionTextDisplay } from "#app/data/mystery-encounters/mystery-encounte
|
|||
import { Moves } from "#app/enums/moves";
|
||||
import Pokemon, { PlayerPokemon } from "#app/field/pokemon";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { Type } from "../type";
|
||||
import { Type } from "#enums/type";
|
||||
import { EncounterPokemonRequirement, EncounterSceneRequirement, MoneyRequirement, TypeRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
|
||||
import { CanLearnMoveRequirement, CanLearnMoveRequirementOptions } from "./requirements/can-learn-move-requirement";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
|
@ -88,7 +88,7 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
|||
* @param pokemon
|
||||
*/
|
||||
pokemonMeetsPrimaryRequirements(scene: BattleScene, pokemon: Pokemon): boolean {
|
||||
return !this.primaryPokemonRequirements.some(req => !req.queryParty(scene.getParty()).map(p => p.id).includes(pokemon.id));
|
||||
return !this.primaryPokemonRequirements.some(req => !req.queryParty(scene.getPlayerParty()).map(p => p.id).includes(pokemon.id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,10 +102,10 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
|||
if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) {
|
||||
return true;
|
||||
}
|
||||
let qualified: PlayerPokemon[] = scene.getParty();
|
||||
let qualified: PlayerPokemon[] = scene.getPlayerParty();
|
||||
for (const req of this.primaryPokemonRequirements) {
|
||||
if (req.meetsRequirement(scene)) {
|
||||
const queryParty = req.queryParty(scene.getParty());
|
||||
const queryParty = req.queryParty(scene.getPlayerParty());
|
||||
qualified = qualified.filter(pkmn => queryParty.includes(pkmn));
|
||||
} else {
|
||||
this.primaryPokemon = undefined;
|
||||
|
@ -162,10 +162,10 @@ export default class MysteryEncounterOption implements IMysteryEncounterOption {
|
|||
return true;
|
||||
}
|
||||
|
||||
let qualified: PlayerPokemon[] = scene.getParty();
|
||||
let qualified: PlayerPokemon[] = scene.getPlayerParty();
|
||||
for (const req of this.secondaryPokemonRequirements) {
|
||||
if (req.meetsRequirement(scene)) {
|
||||
const queryParty = req.queryParty(scene.getParty());
|
||||
const queryParty = req.queryParty(scene.getPlayerParty());
|
||||
qualified = qualified.filter(pkmn => queryParty.includes(pkmn));
|
||||
} else {
|
||||
this.secondaryPokemon = [];
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import { PlayerPokemon } from "#app/field/pokemon";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { allAbilities } from "#app/data/ability";
|
||||
import { EvolutionItem, pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "#app/data/pokemon-forms";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { Type } from "#enums/type";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { PlayerPokemon } from "#app/field/pokemon";
|
||||
import { AttackTypeBoosterModifier } from "#app/modifier/modifier";
|
||||
import { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { EvolutionItem, pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "#app/data/pokemon-forms";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { Type } from "#app/data/type";
|
||||
import { WeatherType } from "#app/data/weather";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { AttackTypeBoosterModifier } from "#app/modifier/modifier";
|
||||
import { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type";
|
||||
import { Species } from "#enums/species";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
import { allAbilities } from "#app/data/ability";
|
||||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
|
||||
export interface EncounterRequirement {
|
||||
meetsRequirement(scene: BattleScene): boolean; // Boolean to see if a requirement is met
|
||||
|
@ -333,7 +333,7 @@ export class PartySizeRequirement extends EncounterSceneRequirement {
|
|||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
if (!isNullOrUndefined(this.partySizeRange) && this.partySizeRange[0] <= this.partySizeRange[1]) {
|
||||
const partySize = this.excludeDisallowedPokemon ? scene.getParty().filter(p => p.isAllowedInBattle()).length : scene.getParty().length;
|
||||
const partySize = this.excludeDisallowedPokemon ? scene.getPokemonAllowedInBattle().length : scene.getPlayerParty().length;
|
||||
if (partySize >= 0 && (this.partySizeRange[0] >= 0 && this.partySizeRange[0] > partySize) || (this.partySizeRange[1] >= 0 && this.partySizeRange[1] < partySize)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ export class PartySizeRequirement extends EncounterSceneRequirement {
|
|||
}
|
||||
|
||||
override getDialogueToken(scene: BattleScene, pokemon?: PlayerPokemon): [string, string] {
|
||||
return [ "partySize", scene.getParty().length.toString() ];
|
||||
return [ "partySize", scene.getPlayerParty().length.toString() ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ export class PersistentModifierRequirement extends EncounterSceneRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredHeldItemModifiers?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ export class SpeciesRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredSpecies?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ export class NatureRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredNature?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ export class TypeRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
let partyPokemon = scene.getParty();
|
||||
let partyPokemon = scene.getPlayerParty();
|
||||
|
||||
if (isNullOrUndefined(partyPokemon)) {
|
||||
return false;
|
||||
|
@ -545,7 +545,7 @@ export class MoveRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredMoves?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ export class CompatibleMoveRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredMoves?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ export class AbilityRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredAbilities?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ export class StatusEffectRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredStatusEffect?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ export class CanFormChangeWithItemRequirement extends EncounterPokemonRequiremen
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredFormChangeItem?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ export class CanEvolveWithItemRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredEvolutionItem?.length < 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ export class HeldItemRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ export class AttackTypeBoosterHeldItemTypeRequirement extends EncounterPokemonRe
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
if (isNullOrUndefined(partyPokemon)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ export class LevelRequirement extends EncounterPokemonRequirement {
|
|||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
// Party Pokemon inside required level range
|
||||
if (!isNullOrUndefined(this.requiredLevelRange) && this.requiredLevelRange[0] <= this.requiredLevelRange[1]) {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
const pokemonInRange = this.queryParty(partyPokemon);
|
||||
if (pokemonInRange.length < this.minNumberOfPokemon) {
|
||||
return false;
|
||||
|
@ -995,7 +995,7 @@ export class FriendshipRequirement extends EncounterPokemonRequirement {
|
|||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
// Party Pokemon inside required friendship range
|
||||
if (!isNullOrUndefined(this.requiredFriendshipRange) && this.requiredFriendshipRange[0] <= this.requiredFriendshipRange[1]) {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
const pokemonInRange = this.queryParty(partyPokemon);
|
||||
if (pokemonInRange.length < this.minNumberOfPokemon) {
|
||||
return false;
|
||||
|
@ -1038,7 +1038,7 @@ export class HealthRatioRequirement extends EncounterPokemonRequirement {
|
|||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
// Party Pokemon's health inside required health range
|
||||
if (!isNullOrUndefined(this.requiredHealthRange) && this.requiredHealthRange[0] <= this.requiredHealthRange[1]) {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
const pokemonInRange = this.queryParty(partyPokemon);
|
||||
if (pokemonInRange.length < this.minNumberOfPokemon) {
|
||||
return false;
|
||||
|
@ -1082,7 +1082,7 @@ export class WeightRequirement extends EncounterPokemonRequirement {
|
|||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
// Party Pokemon's weight inside required weight range
|
||||
if (!isNullOrUndefined(this.requiredWeightRange) && this.requiredWeightRange[0] <= this.requiredWeightRange[1]) {
|
||||
const partyPokemon = scene.getParty();
|
||||
const partyPokemon = scene.getPlayerParty();
|
||||
const pokemonInRange = this.queryParty(partyPokemon);
|
||||
if (pokemonInRange.length < this.minNumberOfPokemon) {
|
||||
return false;
|
||||
|
|
|
@ -5,7 +5,7 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import MysteryEncounterIntroVisuals, { MysteryEncounterSpriteConfig } from "#app/field/mystery-encounter-intro";
|
||||
import * as Utils from "#app/utils";
|
||||
import { StatusEffect } from "../status-effect";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import MysteryEncounterDialogue, { OptionTextDisplay } from "./mystery-encounter-dialogue";
|
||||
import MysteryEncounterOption, { MysteryEncounterOptionBuilder, OptionPhaseCallback } from "./mystery-encounter-option";
|
||||
import { EncounterPokemonRequirement, EncounterSceneRequirement, HealthRatioRequirement, PartySizeRequirement, StatusEffectRequirement, WaveRangeRequirement } from "./mystery-encounter-requirements";
|
||||
|
@ -314,7 +314,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
* @param pokemon
|
||||
*/
|
||||
pokemonMeetsPrimaryRequirements(scene: BattleScene, pokemon: Pokemon): boolean {
|
||||
return !this.primaryPokemonRequirements.some(req => !req.queryParty(scene.getParty()).map(p => p.id).includes(pokemon.id));
|
||||
return !this.primaryPokemonRequirements.some(req => !req.queryParty(scene.getPlayerParty()).map(p => p.id).includes(pokemon.id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -326,18 +326,18 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
*/
|
||||
private meetsPrimaryRequirementAndPrimaryPokemonSelected(scene: BattleScene): boolean {
|
||||
if (!this.primaryPokemonRequirements || this.primaryPokemonRequirements.length === 0) {
|
||||
const activeMon = scene.getParty().filter(p => p.isActive(true));
|
||||
const activeMon = scene.getPlayerParty().filter(p => p.isActive(true));
|
||||
if (activeMon.length > 0) {
|
||||
this.primaryPokemon = activeMon[0];
|
||||
} else {
|
||||
this.primaryPokemon = scene.getParty().filter(p => p.isAllowedInBattle())[0];
|
||||
this.primaryPokemon = scene.getPlayerParty().filter(p => p.isAllowedInBattle())[0];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
let qualified: PlayerPokemon[] = scene.getParty();
|
||||
let qualified: PlayerPokemon[] = scene.getPlayerParty();
|
||||
for (const req of this.primaryPokemonRequirements) {
|
||||
if (req.meetsRequirement(scene)) {
|
||||
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
|
||||
qualified = qualified.filter(pkmn => req.queryParty(scene.getPlayerParty()).includes(pkmn));
|
||||
} else {
|
||||
this.primaryPokemon = undefined;
|
||||
return false;
|
||||
|
@ -394,10 +394,10 @@ export default class MysteryEncounter implements IMysteryEncounter {
|
|||
return true;
|
||||
}
|
||||
|
||||
let qualified: PlayerPokemon[] = scene.getParty();
|
||||
let qualified: PlayerPokemon[] = scene.getPlayerParty();
|
||||
for (const req of this.secondaryPokemonRequirements) {
|
||||
if (req.meetsRequirement(scene)) {
|
||||
qualified = qualified.filter(pkmn => req.queryParty(scene.getParty()).includes(pkmn));
|
||||
qualified = qualified.filter(pkmn => req.queryParty(scene.getPlayerParty()).includes(pkmn));
|
||||
} else {
|
||||
this.secondaryPokemon = [];
|
||||
return false;
|
||||
|
|
|
@ -39,7 +39,7 @@ export class CanLearnMoveRequirement extends EncounterPokemonRequirement {
|
|||
}
|
||||
|
||||
override meetsRequirement(scene: BattleScene): boolean {
|
||||
const partyPokemon = scene.getParty().filter((pkm) => (this.includeFainted ? pkm.isAllowed() : pkm.isAllowedInBattle()));
|
||||
const partyPokemon = scene.getPlayerParty().filter((pkm) => (this.includeFainted ? pkm.isAllowedInChallenge() : pkm.isAllowedInBattle()));
|
||||
|
||||
if (isNullOrUndefined(partyPokemon) || this.requiredMoves?.length < 0) {
|
||||
return false;
|
||||
|
|
|
@ -7,22 +7,22 @@ import i18next from "i18next";
|
|||
/**
|
||||
* Will inject all relevant dialogue tokens that exist in the {@linkcode BattleScene.currentBattle.mysteryEncounter.dialogueTokens}, into i18n text.
|
||||
* Also adds BBCodeText fragments for colored text, if applicable
|
||||
* @param scene
|
||||
* @param keyOrString
|
||||
* @param primaryStyle Can define a text style to be applied to the entire string. Must be defined for BBCodeText styles to be applied correctly
|
||||
* @param uiTheme
|
||||
*/
|
||||
export function getEncounterText(scene: BattleScene, keyOrString?: string, primaryStyle?: TextStyle, uiTheme: UiTheme = UiTheme.DEFAULT): string | null {
|
||||
export function getEncounterText(scene: BattleScene, keyOrString?: string, primaryStyle?: TextStyle): string | null {
|
||||
if (isNullOrUndefined(keyOrString)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const uiTheme = scene.uiTheme ?? UiTheme.DEFAULT;
|
||||
|
||||
let textString: string | null = getTextWithDialogueTokens(scene, keyOrString);
|
||||
|
||||
// Can only color the text if a Primary Style is defined
|
||||
// primaryStyle is applied to all text that does not have its own specified style
|
||||
if (primaryStyle && textString) {
|
||||
textString = getTextWithColors(textString, primaryStyle, uiTheme);
|
||||
textString = getTextWithColors(textString, primaryStyle, uiTheme, true);
|
||||
}
|
||||
|
||||
return textString;
|
||||
|
|
|
@ -19,11 +19,11 @@ import i18next from "i18next";
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
||||
import { Gender } from "#app/data/gender";
|
||||
import { Nature } from "#app/data/nature";
|
||||
import { Nature } from "#enums/nature";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { Status, StatusEffect } from "#app/data/status-effect";
|
||||
import { Status } from "#app/data/status-effect";
|
||||
import { TrainerConfig, trainerConfigs, TrainerSlot } from "#app/data/trainer-config";
|
||||
import PokemonSpecies from "#app/data/pokemon-species";
|
||||
import { Egg, IEggOptions } from "#app/data/egg";
|
||||
|
@ -37,6 +37,7 @@ import { GameOverPhase } from "#app/phases/game-over-phase";
|
|||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { PartyExpPhase } from "#app/phases/party-exp-phase";
|
||||
import { Variant } from "#app/data/variant";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
|
||||
/**
|
||||
* Animates exclamation sprite over trainer's head at start of encounter
|
||||
|
@ -418,9 +419,9 @@ export function generateModifierType(scene: BattleScene, modifier: () => Modifie
|
|||
// Populates item id and tier (order matters)
|
||||
result = result
|
||||
.withIdFromFunc(modifierTypes[modifierId])
|
||||
.withTierFromPool();
|
||||
.withTierFromPool(ModifierPoolType.PLAYER, scene.getPlayerParty());
|
||||
|
||||
return result instanceof ModifierTypeGenerator ? result.generateType(scene.getParty(), pregenArgs) : result;
|
||||
return result instanceof ModifierTypeGenerator ? result.generateType(scene.getPlayerParty(), pregenArgs) : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -451,9 +452,9 @@ export function selectPokemonForOption(scene: BattleScene, onPokemonSelected: (p
|
|||
|
||||
// Open party screen to choose pokemon
|
||||
scene.ui.setMode(Mode.PARTY, PartyUiMode.SELECT, -1, (slotIndex: number, option: PartyOption) => {
|
||||
if (slotIndex < scene.getParty().length) {
|
||||
if (slotIndex < scene.getPlayerParty().length) {
|
||||
scene.ui.setMode(modeToSetOnExit).then(() => {
|
||||
const pokemon = scene.getParty()[slotIndex];
|
||||
const pokemon = scene.getPlayerParty()[slotIndex];
|
||||
const secondaryOptions = onPokemonSelected(pokemon);
|
||||
if (!secondaryOptions) {
|
||||
scene.currentBattle.mysteryEncounter!.setDialogueToken("selectedPokemon", pokemon.getNameToRender());
|
||||
|
@ -563,7 +564,7 @@ export function selectOptionThenPokemon(scene: BattleScene, options: OptionSelec
|
|||
const selectPokemonAfterOption = (selectedOptionIndex: number) => {
|
||||
// Open party screen to choose a Pokemon
|
||||
scene.ui.setMode(Mode.PARTY, PartyUiMode.SELECT, -1, (slotIndex: number, option: PartyOption) => {
|
||||
if (slotIndex < scene.getParty().length) {
|
||||
if (slotIndex < scene.getPlayerParty().length) {
|
||||
// Pokemon and option selected
|
||||
scene.ui.setMode(modeToSetOnExit).then(() => {
|
||||
const result: PokemonAndOptionSelected = { selectedPokemonIndex: slotIndex, selectedOptionIndex: selectedOptionIndex };
|
||||
|
@ -713,7 +714,7 @@ export function leaveEncounterWithoutBattle(scene: BattleScene, addHealPhase: bo
|
|||
* @param doNotContinue - default `false`. If set to true, will not end the battle and continue to next wave
|
||||
*/
|
||||
export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase: boolean = false, doNotContinue: boolean = false) {
|
||||
const allowedPkm = scene.getParty().filter((pkm) => pkm.isAllowedInBattle());
|
||||
const allowedPkm = scene.getPlayerParty().filter((pkm) => pkm.isAllowedInBattle());
|
||||
|
||||
if (allowedPkm.length === 0) {
|
||||
scene.clearPhaseQueue();
|
||||
|
@ -750,7 +751,7 @@ export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase:
|
|||
* @param addHealPhase
|
||||
*/
|
||||
export function handleMysteryEncounterBattleFailed(scene: BattleScene, addHealPhase: boolean = false, doNotContinue: boolean = false) {
|
||||
const allowedPkm = scene.getParty().filter((pkm) => pkm.isAllowedInBattle());
|
||||
const allowedPkm = scene.getPlayerParty().filter((pkm) => pkm.isAllowedInBattle());
|
||||
|
||||
if (allowedPkm.length === 0) {
|
||||
scene.clearPhaseQueue();
|
||||
|
|
|
@ -3,15 +3,15 @@ import i18next from "i18next";
|
|||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import Pokemon, { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "#app/data/pokeball";
|
||||
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor } from "#app/data/pokeball";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims";
|
||||
import { getStatusEffectCatchRateMultiplier, StatusEffect } from "#app/data/status-effect";
|
||||
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
|
||||
import { achvs } from "#app/system/achv";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { PartyOption, PartyUiMode } from "#app/ui/party-ui-handler";
|
||||
import { Species } from "#enums/species";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { getEncounterText, queueEncounterMessage, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||
|
@ -23,6 +23,8 @@ import { VictoryPhase } from "#app/phases/victory-phase";
|
|||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import type { PokeballType } from "#enums/pokeball";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
|
||||
/** Will give +1 level every 10 waves */
|
||||
export const STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER = 1;
|
||||
|
@ -53,24 +55,24 @@ export function getSpriteKeysFromPokemon(pokemon: Pokemon): { spriteKey: string,
|
|||
}
|
||||
|
||||
/**
|
||||
* Will never remove the player's last non-fainted Pokemon (if they only have 1)
|
||||
* Will never remove the player's last non-fainted Pokemon (if they only have 1).
|
||||
* Otherwise, picks a Pokemon completely at random and removes from the party
|
||||
* @param scene
|
||||
* @param isAllowed Default false. If true, only picks from legal mons. If no legal mons are found (or there is 1, with `doNotReturnLastAllowedMon = true), will return a mon that is not allowed.
|
||||
* @param isFainted Default false. If true, includes fainted mons.
|
||||
* @param doNotReturnLastAllowedMon Default false. If true, will never return the last unfainted pokemon in the party. Useful when this function is being used to determine what Pokemon to remove from the party (Don't want to remove last unfainted)
|
||||
* @param isAllowed Default `false`. If `true`, only picks from legal mons. If no legal mons are found (or there is 1, with `doNotReturnLastAllowedMon = true`), will return a mon that is not allowed.
|
||||
* @param isFainted Default `false`. If `true`, includes fainted mons.
|
||||
* @param doNotReturnLastAllowedMon Default `false`. If `true`, will never return the last unfainted pokemon in the party. Useful when this function is being used to determine what Pokemon to remove from the party (Don't want to remove last unfainted)
|
||||
* @returns
|
||||
*/
|
||||
export function getRandomPlayerPokemon(scene: BattleScene, isAllowed: boolean = false, isFainted: boolean = false, doNotReturnLastAllowedMon: boolean = false): PlayerPokemon {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let chosenIndex: number;
|
||||
let chosenPokemon: PlayerPokemon | null = null;
|
||||
const fullyLegalMons = party.filter(p => (!isAllowed || p.isAllowed()) && (isFainted || !p.isFainted()));
|
||||
const allowedOnlyMons = party.filter(p => p.isAllowed());
|
||||
const fullyLegalMons = party.filter(p => (!isAllowed || p.isAllowedInChallenge()) && (isFainted || !p.isFainted()));
|
||||
const allowedOnlyMons = party.filter(p => p.isAllowedInChallenge());
|
||||
|
||||
if (doNotReturnLastAllowedMon && fullyLegalMons.length === 1) {
|
||||
// If there is only 1 legal/unfainted mon left, select from fainted legal mons
|
||||
const faintedLegalMons = party.filter(p => (!isAllowed || p.isAllowed()) && p.isFainted());
|
||||
const faintedLegalMons = party.filter(p => (!isAllowed || p.isAllowedInChallenge()) && p.isFainted());
|
||||
if (faintedLegalMons.length > 0) {
|
||||
chosenIndex = randSeedInt(faintedLegalMons.length);
|
||||
chosenPokemon = faintedLegalMons[chosenIndex];
|
||||
|
@ -101,11 +103,11 @@ export function getRandomPlayerPokemon(scene: BattleScene, isAllowed: boolean =
|
|||
* @returns
|
||||
*/
|
||||
export function getHighestLevelPlayerPokemon(scene: BattleScene, isAllowed: boolean = false, isFainted: boolean = false): PlayerPokemon {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let pokemon: PlayerPokemon | null = null;
|
||||
|
||||
for (const p of party) {
|
||||
if (isAllowed && !p.isAllowed()) {
|
||||
if (isAllowed && !p.isAllowedInChallenge()) {
|
||||
continue;
|
||||
}
|
||||
if (!isFainted && p.isFainted()) {
|
||||
|
@ -127,11 +129,11 @@ export function getHighestLevelPlayerPokemon(scene: BattleScene, isAllowed: bool
|
|||
* @returns
|
||||
*/
|
||||
export function getHighestStatPlayerPokemon(scene: BattleScene, stat: PermanentStat, isAllowed: boolean = false, isFainted: boolean = false): PlayerPokemon {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let pokemon: PlayerPokemon | null = null;
|
||||
|
||||
for (const p of party) {
|
||||
if (isAllowed && !p.isAllowed()) {
|
||||
if (isAllowed && !p.isAllowedInChallenge()) {
|
||||
continue;
|
||||
}
|
||||
if (!isFainted && p.isFainted()) {
|
||||
|
@ -152,11 +154,11 @@ export function getHighestStatPlayerPokemon(scene: BattleScene, stat: PermanentS
|
|||
* @returns
|
||||
*/
|
||||
export function getLowestLevelPlayerPokemon(scene: BattleScene, isAllowed: boolean = false, isFainted: boolean = false): PlayerPokemon {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let pokemon: PlayerPokemon | null = null;
|
||||
|
||||
for (const p of party) {
|
||||
if (isAllowed && !p.isAllowed()) {
|
||||
if (isAllowed && !p.isAllowedInChallenge()) {
|
||||
continue;
|
||||
}
|
||||
if (!isFainted && p.isFainted()) {
|
||||
|
@ -177,11 +179,11 @@ export function getLowestLevelPlayerPokemon(scene: BattleScene, isAllowed: boole
|
|||
* @returns
|
||||
*/
|
||||
export function getHighestStatTotalPlayerPokemon(scene: BattleScene, isAllowed: boolean = false, isFainted: boolean = false): PlayerPokemon {
|
||||
const party = scene.getParty();
|
||||
const party = scene.getPlayerParty();
|
||||
let pokemon: PlayerPokemon | null = null;
|
||||
|
||||
for (const p of party) {
|
||||
if (isAllowed && !p.isAllowed()) {
|
||||
if (isAllowed && !p.isAllowedInChallenge()) {
|
||||
continue;
|
||||
}
|
||||
if (!isFainted && p.isFainted()) {
|
||||
|
@ -315,7 +317,7 @@ export function applyHealToPokemon(scene: BattleScene, pokemon: PlayerPokemon, h
|
|||
*/
|
||||
export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, value: number) {
|
||||
const modType = modifierTypes.MYSTERY_ENCOUNTER_SHUCKLE_JUICE()
|
||||
.generateType(pokemon.scene.getParty(), [ value ])
|
||||
.generateType(pokemon.scene.getPlayerParty(), [ value ])
|
||||
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_SHUCKLE_JUICE);
|
||||
const modifier = modType?.newModifier(pokemon);
|
||||
if (modifier) {
|
||||
|
@ -591,7 +593,7 @@ export async function catchPokemon(scene: BattleScene, pokemon: EnemyPokemon, po
|
|||
const addToParty = (slotIndex?: number) => {
|
||||
const newPokemon = pokemon.addToParty(pokeballType, slotIndex);
|
||||
const modifiers = scene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
|
||||
if (scene.getParty().filter(p => p.isShiny()).length === 6) {
|
||||
if (scene.getPlayerParty().filter(p => p.isShiny()).length === 6) {
|
||||
scene.validateAchv(achvs.SHINY_PARTY);
|
||||
}
|
||||
Promise.all(modifiers.map(m => scene.addModifier(m, true))).then(() => {
|
||||
|
@ -605,7 +607,7 @@ export async function catchPokemon(scene: BattleScene, pokemon: EnemyPokemon, po
|
|||
});
|
||||
};
|
||||
Promise.all([ pokemon.hideInfo(), scene.gameData.setPokemonCaught(pokemon) ]).then(() => {
|
||||
if (scene.getParty().length === 6) {
|
||||
if (scene.getPlayerParty().length === 6) {
|
||||
const promptRelease = () => {
|
||||
scene.ui.showText(i18next.t("battle:partyFull", { pokemonName: pokemon.getNameToRender() }), null, () => {
|
||||
scene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
|
||||
|
@ -826,7 +828,7 @@ export async function addPokemonDataToDexAndValidateAchievements(scene: BattleSc
|
|||
* @param invalidSelectionKey
|
||||
*/
|
||||
export function isPokemonValidForEncounterOptionSelection(pokemon: Pokemon, scene: BattleScene, invalidSelectionKey: string): string | null {
|
||||
if (!pokemon.isAllowed()) {
|
||||
if (!pokemon.isAllowedInChallenge()) {
|
||||
return i18next.t("partyUiHandler:cantBeUsed", { pokemonName: pokemon.getNameToRender() }) ?? null;
|
||||
}
|
||||
if (!pokemon.isAllowedInBattle()) {
|
||||
|
|
|
@ -3,9 +3,7 @@ import { TextStyle, getBBCodeFrag } from "../ui/text";
|
|||
import { Nature } from "#enums/nature";
|
||||
import { UiTheme } from "#enums/ui-theme";
|
||||
import i18next from "i18next";
|
||||
import { Stat, EFFECTIVE_STATS, getShortenedStatKey } from "#app/enums/stat";
|
||||
|
||||
export { Nature };
|
||||
import { Stat, EFFECTIVE_STATS, getShortenedStatKey } from "#enums/stat";
|
||||
|
||||
export function getNatureName(nature: Nature, includeStatEffects: boolean = false, forStarterSelect: boolean = false, ignoreBBCode: boolean = false, uiTheme: UiTheme = UiTheme.DEFAULT): string {
|
||||
let ret = Utils.toReadableString(Nature[nature]);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { CriticalCatchChanceBoosterModifier } from "#app/modifier/modifier";
|
||||
import { NumberHolder } from "#app/utils";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import BattleScene from "../battle-scene";
|
||||
import i18next from "i18next";
|
||||
|
||||
export { PokeballType };
|
||||
|
||||
export const MAX_PER_TYPE_POKEBALLS: integer = 99;
|
||||
|
||||
export function getPokeballAtlasKey(type: PokeballType): string {
|
||||
|
@ -82,11 +82,38 @@ export function getPokeballTintColor(type: PokeballType): number {
|
|||
}
|
||||
}
|
||||
|
||||
export function doPokeballBounceAnim(scene: BattleScene, pokeball: Phaser.GameObjects.Sprite, y1: number, y2: number, baseBounceDuration: integer, callback: Function) {
|
||||
/**
|
||||
* Gets the critical capture chance based on number of mons registered in Dex and modified {@link https://bulbapedia.bulbagarden.net/wiki/Catch_rate Catch rate}
|
||||
* Formula from {@link https://www.dragonflycave.com/mechanics/gen-vi-vii-capturing Dragonfly Cave Gen 6 Capture Mechanics page}
|
||||
* @param scene {@linkcode BattleScene} current BattleScene
|
||||
* @param modifiedCatchRate the modified catch rate as calculated in {@linkcode AttemptCapturePhase}
|
||||
* @returns the chance of getting a critical capture, out of 256
|
||||
*/
|
||||
export function getCriticalCaptureChance(scene: BattleScene, modifiedCatchRate: number): number {
|
||||
if (scene.gameMode.isFreshStartChallenge()) {
|
||||
return 0;
|
||||
}
|
||||
const dexCount = scene.gameData.getSpeciesCount(d => !!d.caughtAttr);
|
||||
const catchingCharmMultiplier = new NumberHolder(1);
|
||||
scene.findModifier(m => m instanceof CriticalCatchChanceBoosterModifier)?.apply(catchingCharmMultiplier);
|
||||
const dexMultiplier = scene.gameMode.isDaily || dexCount > 800 ? 2.5
|
||||
: dexCount > 600 ? 2
|
||||
: dexCount > 400 ? 1.5
|
||||
: dexCount > 200 ? 1
|
||||
: dexCount > 100 ? 0.5
|
||||
: 0;
|
||||
return Math.floor(catchingCharmMultiplier.value * dexMultiplier * Math.min(255, modifiedCatchRate) / 6);
|
||||
}
|
||||
|
||||
export function doPokeballBounceAnim(scene: BattleScene, pokeball: Phaser.GameObjects.Sprite, y1: number, y2: number, baseBounceDuration: number, callback: Function, isCritical: boolean = false) {
|
||||
let bouncePower = 1;
|
||||
let bounceYOffset = y1;
|
||||
let bounceY = y2;
|
||||
const yd = y2 - y1;
|
||||
const x0 = pokeball.x;
|
||||
const x1 = x0 + 3;
|
||||
const x2 = x0 - 3;
|
||||
let critShakes = 4;
|
||||
|
||||
const doBounce = () => {
|
||||
scene.tweens.add({
|
||||
|
@ -117,5 +144,40 @@ export function doPokeballBounceAnim(scene: BattleScene, pokeball: Phaser.GameOb
|
|||
});
|
||||
};
|
||||
|
||||
const doCritShake = () => {
|
||||
scene.tweens.add({
|
||||
targets: pokeball,
|
||||
x: x2,
|
||||
duration: 125,
|
||||
ease: "Linear",
|
||||
onComplete: () => {
|
||||
scene.tweens.add({
|
||||
targets: pokeball,
|
||||
x: x1,
|
||||
duration: 125,
|
||||
ease: "Linear",
|
||||
onComplete: () => {
|
||||
critShakes--;
|
||||
if (critShakes > 0) {
|
||||
doCritShake();
|
||||
} else {
|
||||
scene.tweens.add({
|
||||
targets: pokeball,
|
||||
x: x0,
|
||||
duration: 60,
|
||||
ease: "Linear",
|
||||
onComplete: () => scene.time.delayedCall(500, doBounce)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (isCritical) {
|
||||
scene.time.delayedCall(500, doCritShake);
|
||||
} else {
|
||||
doBounce();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { PokemonFormChangeItemModifier, TerastallizeModifier } from "../modifier/modifier";
|
||||
import Pokemon from "../field/pokemon";
|
||||
import { StatusEffect } from "./status-effect";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { MoveCategory, allMoves } from "./move";
|
||||
import { Type } from "./type";
|
||||
import { Type } from "#enums/type";
|
||||
import { Constructor, nil } from "#app/utils";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { Moves } from "#enums/moves";
|
||||
|
@ -10,7 +10,7 @@ import { Species } from "#enums/species";
|
|||
import { TimeOfDay } from "#enums/time-of-day";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import i18next from "i18next";
|
||||
import { WeatherType } from "./weather";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { Challenges } from "#app/enums/challenges";
|
||||
import { SpeciesFormKey } from "#enums/species-form-key";
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { uncatchableSpecies } from "#app/data/balance/biomes";
|
|||
import { speciesEggMoves } from "#app/data/balance/egg-moves";
|
||||
import { GrowthRate } from "#app/data/exp";
|
||||
import { EvolutionLevel, SpeciesWildEvolutionDelay, pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { LevelMoves, pokemonFormLevelMoves, pokemonFormLevelMoves as pokemonSpeciesFormLevelMoves, pokemonSpeciesLevelMoves } from "#app/data/balance/pokemon-level-moves";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { Variant, VariantSet, variantColorCache, variantData } from "#app/data/variant";
|
||||
|
@ -47,7 +47,7 @@ export function getPokemonSpecies(species: Species | Species[] | undefined): Pok
|
|||
return allSpecies[species - 1];
|
||||
}
|
||||
|
||||
export function getPokemonSpeciesForm(species: Species, formIndex: integer): PokemonSpeciesForm {
|
||||
export function getPokemonSpeciesForm(species: Species, formIndex: number): PokemonSpeciesForm {
|
||||
const retSpecies: PokemonSpecies = species >= 2000
|
||||
? allSpecies.find(s => s.speciesId === species)! // TODO: is the bang correct?
|
||||
: allSpecies[species - 1];
|
||||
|
@ -129,26 +129,27 @@ export type PokemonSpeciesFilter = (species: PokemonSpecies) => boolean;
|
|||
|
||||
export abstract class PokemonSpeciesForm {
|
||||
public speciesId: Species;
|
||||
public formIndex: integer;
|
||||
public generation: integer;
|
||||
public type1: Type;
|
||||
public type2: Type | null;
|
||||
public height: number;
|
||||
public weight: number;
|
||||
public ability1: Abilities;
|
||||
public ability2: Abilities;
|
||||
public abilityHidden: Abilities;
|
||||
public baseTotal: integer;
|
||||
public baseStats: integer[];
|
||||
public catchRate: integer;
|
||||
public baseFriendship: integer;
|
||||
public baseExp: integer;
|
||||
public genderDiffs: boolean;
|
||||
public isStarterSelectable: boolean;
|
||||
protected _formIndex: number;
|
||||
protected _generation: number;
|
||||
readonly type1: Type;
|
||||
readonly type2: Type | null;
|
||||
readonly height: number;
|
||||
readonly weight: number;
|
||||
readonly ability1: Abilities;
|
||||
readonly ability2: Abilities;
|
||||
readonly abilityHidden: Abilities;
|
||||
readonly baseTotal: number;
|
||||
readonly baseStats: number[];
|
||||
readonly catchRate: number;
|
||||
readonly baseFriendship: number;
|
||||
readonly baseExp: number;
|
||||
readonly genderDiffs: boolean;
|
||||
readonly isStarterSelectable: boolean;
|
||||
|
||||
constructor(type1: Type, type2: Type | null, height: number, weight: number, ability1: Abilities, ability2: Abilities, abilityHidden: Abilities,
|
||||
baseTotal: integer, baseHp: integer, baseAtk: integer, baseDef: integer, baseSpatk: integer, baseSpdef: integer, baseSpd: integer,
|
||||
catchRate: integer, baseFriendship: integer, baseExp: integer, genderDiffs: boolean, isStarterSelectable: boolean) {
|
||||
baseTotal: number, baseHp: number, baseAtk: number, baseDef: number, baseSpatk: number, baseSpdef: number, baseSpd: number,
|
||||
catchRate: number, baseFriendship: number, baseExp: number, genderDiffs: boolean, isStarterSelectable: boolean
|
||||
) {
|
||||
this.type1 = type1;
|
||||
this.type2 = type2;
|
||||
this.height = height;
|
||||
|
@ -180,7 +181,23 @@ export abstract class PokemonSpeciesForm {
|
|||
return ret;
|
||||
}
|
||||
|
||||
isOfType(type: integer): boolean {
|
||||
get generation(): number {
|
||||
return this._generation;
|
||||
}
|
||||
|
||||
set generation(generation: number) {
|
||||
this._generation = generation;
|
||||
}
|
||||
|
||||
get formIndex(): number {
|
||||
return this._formIndex;
|
||||
}
|
||||
|
||||
set formIndex(formIndex: number) {
|
||||
this._formIndex = formIndex;
|
||||
}
|
||||
|
||||
isOfType(type: number): boolean {
|
||||
return this.type1 === type || (this.type2 !== null && this.type2 === type);
|
||||
}
|
||||
|
||||
|
@ -188,7 +205,7 @@ export abstract class PokemonSpeciesForm {
|
|||
* Method to get the total number of abilities a Pokemon species has.
|
||||
* @returns Number of abilities
|
||||
*/
|
||||
getAbilityCount(): integer {
|
||||
getAbilityCount(): number {
|
||||
return this.abilityHidden !== Abilities.NONE ? 3 : 2;
|
||||
}
|
||||
|
||||
|
@ -197,7 +214,7 @@ export abstract class PokemonSpeciesForm {
|
|||
* @param abilityIndex Which ability to get (should only be 0-2)
|
||||
* @returns The id of the Ability
|
||||
*/
|
||||
getAbility(abilityIndex: integer): Abilities {
|
||||
getAbility(abilityIndex: number): Abilities {
|
||||
let ret: Abilities;
|
||||
if (abilityIndex === 0) {
|
||||
ret = this.ability1;
|
||||
|
@ -277,12 +294,12 @@ export abstract class PokemonSpeciesForm {
|
|||
return ret;
|
||||
}
|
||||
|
||||
getSpriteAtlasPath(female: boolean, formIndex?: integer, shiny?: boolean, variant?: integer): string {
|
||||
getSpriteAtlasPath(female: boolean, formIndex?: number, shiny?: boolean, variant?: number): string {
|
||||
const spriteId = this.getSpriteId(female, formIndex, shiny, variant).replace(/\_{2}/g, "/");
|
||||
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
|
||||
}
|
||||
|
||||
getSpriteId(female: boolean, formIndex?: integer, shiny?: boolean, variant: integer = 0, back?: boolean): string {
|
||||
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant: number = 0, back?: boolean): string {
|
||||
if (formIndex === undefined || this instanceof PokemonForm) {
|
||||
formIndex = this.formIndex;
|
||||
}
|
||||
|
@ -299,11 +316,11 @@ export abstract class PokemonSpeciesForm {
|
|||
return `${back ? "back__" : ""}${shiny && (!variantSet || (!variant && !variantSet[variant || 0])) ? "shiny__" : ""}${baseSpriteKey}${shiny && variantSet && variantSet[variant] === 2 ? `_${variant + 1}` : ""}`;
|
||||
}
|
||||
|
||||
getSpriteKey(female: boolean, formIndex?: integer, shiny?: boolean, variant?: integer): string {
|
||||
getSpriteKey(female: boolean, formIndex?: number, shiny?: boolean, variant?: number): string {
|
||||
return `pkmn__${this.getSpriteId(female, formIndex, shiny, variant)}`;
|
||||
}
|
||||
|
||||
abstract getFormSpriteKey(formIndex?: integer): string;
|
||||
abstract getFormSpriteKey(formIndex?: number): string;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -311,9 +328,9 @@ export abstract class PokemonSpeciesForm {
|
|||
* @param formIndex optional form index for pokemon with different forms
|
||||
* @returns species id if no additional forms, index with formkey if a pokemon with a form
|
||||
*/
|
||||
getVariantDataIndex(formIndex?: integer) {
|
||||
getVariantDataIndex(formIndex?: number) {
|
||||
let formkey: string | null = null;
|
||||
let variantDataIndex: integer | string = this.speciesId;
|
||||
let variantDataIndex: number | string = this.speciesId;
|
||||
const species = getPokemonSpecies(this.speciesId);
|
||||
if (species.forms.length > 0 && formIndex !== undefined) {
|
||||
formkey = species.forms[formIndex]?.getFormSpriteKey(formIndex);
|
||||
|
@ -324,13 +341,13 @@ export abstract class PokemonSpeciesForm {
|
|||
return variantDataIndex;
|
||||
}
|
||||
|
||||
getIconAtlasKey(formIndex?: integer, shiny?: boolean, variant?: integer): string {
|
||||
getIconAtlasKey(formIndex?: number, shiny?: boolean, variant?: number): string {
|
||||
const variantDataIndex = this.getVariantDataIndex(formIndex);
|
||||
const isVariant = shiny && variantData[variantDataIndex] && (variant !== undefined && variantData[variantDataIndex][variant]);
|
||||
return `pokemon_icons_${this.generation}${isVariant ? "v" : ""}`;
|
||||
}
|
||||
|
||||
getIconId(female: boolean, formIndex?: integer, shiny?: boolean, variant?: integer): string {
|
||||
getIconId(female: boolean, formIndex?: number, shiny?: boolean, variant?: number): string {
|
||||
if (formIndex === undefined) {
|
||||
formIndex = this.formIndex;
|
||||
}
|
||||
|
@ -346,6 +363,12 @@ export abstract class PokemonSpeciesForm {
|
|||
}
|
||||
|
||||
switch (this.speciesId) {
|
||||
case Species.DODUO:
|
||||
case Species.DODRIO:
|
||||
case Species.MEGANIUM:
|
||||
case Species.TORCHIC:
|
||||
case Species.COMBUSKEN:
|
||||
case Species.BLAZIKEN:
|
||||
case Species.HIPPOPOTAS:
|
||||
case Species.HIPPOWDON:
|
||||
case Species.UNFEZANT:
|
||||
|
@ -379,7 +402,7 @@ export abstract class PokemonSpeciesForm {
|
|||
return ret;
|
||||
}
|
||||
|
||||
getCryKey(formIndex?: integer): string {
|
||||
getCryKey(formIndex?: number): string {
|
||||
let speciesId = this.speciesId;
|
||||
if (this.speciesId > 2000) {
|
||||
switch (this.speciesId) {
|
||||
|
@ -443,10 +466,10 @@ export abstract class PokemonSpeciesForm {
|
|||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return `cry/${ret}`;
|
||||
}
|
||||
|
||||
validateStarterMoveset(moveset: StarterMoveset, eggMoves: integer): boolean {
|
||||
validateStarterMoveset(moveset: StarterMoveset, eggMoves: number): boolean {
|
||||
const rootSpeciesId = this.getRootSpeciesId();
|
||||
for (const moveId of moveset) {
|
||||
if (speciesEggMoves.hasOwnProperty(rootSpeciesId)) {
|
||||
|
@ -467,11 +490,11 @@ export abstract class PokemonSpeciesForm {
|
|||
return true;
|
||||
}
|
||||
|
||||
loadAssets(scene: BattleScene, female: boolean, formIndex?: integer, shiny?: boolean, variant?: Variant, startLoad?: boolean): Promise<void> {
|
||||
loadAssets(scene: BattleScene, female: boolean, formIndex?: number, shiny?: boolean, variant?: Variant, startLoad?: boolean): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant);
|
||||
scene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant));
|
||||
scene.load.audio(`cry/${this.getCryKey(formIndex)}`, `audio/cry/${this.getCryKey(formIndex)}.m4a`);
|
||||
scene.load.audio(`${this.getCryKey(formIndex)}`, `audio/${this.getCryKey(formIndex)}.m4a`);
|
||||
scene.load.once(Phaser.Loader.Events.COMPLETE, () => {
|
||||
const originalWarn = console.warn;
|
||||
// Ignore warnings for missing frames, because there will be a lot
|
||||
|
@ -482,11 +505,11 @@ export abstract class PokemonSpeciesForm {
|
|||
scene.anims.create({
|
||||
key: this.getSpriteKey(female, formIndex, shiny, variant),
|
||||
frames: frameNames,
|
||||
frameRate: 12,
|
||||
frameRate: 10,
|
||||
repeat: -1
|
||||
});
|
||||
} else {
|
||||
scene.anims.get(spriteKey).frameRate = 12;
|
||||
scene.anims.get(spriteKey).frameRate = 10;
|
||||
}
|
||||
let spritePath = this.getSpriteAtlasPath(female, formIndex, shiny, variant).replace("variant/", "").replace(/_[1-3]$/, "");
|
||||
const useExpSprite = scene.experimentalSprites && scene.hasExpSprite(spriteKey);
|
||||
|
@ -529,14 +552,14 @@ export abstract class PokemonSpeciesForm {
|
|||
if (cry?.pendingRemove) {
|
||||
cry = null;
|
||||
}
|
||||
cry = scene.playSound(`cry/${(cry ?? cryKey)}`, soundConfig);
|
||||
cry = scene.playSound(cry ?? cryKey, soundConfig);
|
||||
if (ignorePlay) {
|
||||
cry.stop();
|
||||
}
|
||||
return cry;
|
||||
}
|
||||
|
||||
generateCandyColors(scene: BattleScene): integer[][] {
|
||||
generateCandyColors(scene: BattleScene): number[][] {
|
||||
const sourceTexture = scene.textures.get(this.getSpriteKey(false));
|
||||
|
||||
const sourceFrame = sourceTexture.frames[sourceTexture.firstFrame];
|
||||
|
@ -544,7 +567,7 @@ export abstract class PokemonSpeciesForm {
|
|||
|
||||
const canvas = document.createElement("canvas");
|
||||
|
||||
const spriteColors: integer[][] = [];
|
||||
const spriteColors: number[][] = [];
|
||||
|
||||
const context = canvas.getContext("2d");
|
||||
const frame = sourceFrame;
|
||||
|
@ -567,7 +590,7 @@ export abstract class PokemonSpeciesForm {
|
|||
}
|
||||
|
||||
for (let i = 0; i < pixelData.length; i += 4) {
|
||||
const total = pixelData.slice(i, i + 3).reduce((total: integer, value: integer) => total + value, 0);
|
||||
const total = pixelData.slice(i, i + 3).reduce((total: number, value: number) => total + value, 0);
|
||||
if (!total) {
|
||||
continue;
|
||||
}
|
||||
|
@ -586,27 +609,28 @@ export abstract class PokemonSpeciesForm {
|
|||
|
||||
Math.random = originalRandom;
|
||||
|
||||
return Array.from(paletteColors.keys()).map(c => Object.values(rgbaFromArgb(c)) as integer[]);
|
||||
return Array.from(paletteColors.keys()).map(c => Object.values(rgbaFromArgb(c)) as number[]);
|
||||
}
|
||||
}
|
||||
|
||||
export default class PokemonSpecies extends PokemonSpeciesForm implements Localizable {
|
||||
public name: string;
|
||||
public subLegendary: boolean;
|
||||
public legendary: boolean;
|
||||
public mythical: boolean;
|
||||
public species: string;
|
||||
public growthRate: GrowthRate;
|
||||
public malePercent: number | null;
|
||||
public genderDiffs: boolean;
|
||||
public canChangeForm: boolean;
|
||||
public forms: PokemonForm[];
|
||||
readonly subLegendary: boolean;
|
||||
readonly legendary: boolean;
|
||||
readonly mythical: boolean;
|
||||
readonly species: string;
|
||||
readonly growthRate: GrowthRate;
|
||||
readonly malePercent: number | null;
|
||||
readonly genderDiffs: boolean;
|
||||
readonly canChangeForm: boolean;
|
||||
readonly forms: PokemonForm[];
|
||||
|
||||
constructor(id: Species, generation: integer, subLegendary: boolean, legendary: boolean, mythical: boolean, species: string,
|
||||
constructor(id: Species, generation: number, subLegendary: boolean, legendary: boolean, mythical: boolean, species: string,
|
||||
type1: Type, type2: Type | null, height: number, weight: number, ability1: Abilities, ability2: Abilities, abilityHidden: Abilities,
|
||||
baseTotal: integer, baseHp: integer, baseAtk: integer, baseDef: integer, baseSpatk: integer, baseSpdef: integer, baseSpd: integer,
|
||||
catchRate: integer, baseFriendship: integer, baseExp: integer, growthRate: GrowthRate, malePercent: number | null,
|
||||
genderDiffs: boolean, canChangeForm?: boolean, ...forms: PokemonForm[]) {
|
||||
baseTotal: number, baseHp: number, baseAtk: number, baseDef: number, baseSpatk: number, baseSpdef: number, baseSpd: number,
|
||||
catchRate: number, baseFriendship: number, baseExp: number, growthRate: GrowthRate, malePercent: number | null,
|
||||
genderDiffs: boolean, canChangeForm?: boolean, ...forms: PokemonForm[]
|
||||
) {
|
||||
super(type1, type2, height, weight, ability1, ability2, abilityHidden, baseTotal, baseHp, baseAtk, baseDef, baseSpatk, baseSpdef, baseSpd,
|
||||
catchRate, baseFriendship, baseExp, genderDiffs, false);
|
||||
this.speciesId = id;
|
||||
|
@ -631,7 +655,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
});
|
||||
}
|
||||
|
||||
getName(formIndex?: integer): string {
|
||||
getName(formIndex?: number): string {
|
||||
if (formIndex !== undefined && this.forms.length) {
|
||||
const form = this.forms[formIndex];
|
||||
let key: string | null;
|
||||
|
@ -662,11 +686,11 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
this.name = i18next.t(`pokemon:${Species[this.speciesId].toLowerCase()}`);
|
||||
}
|
||||
|
||||
getWildSpeciesForLevel(level: integer, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): Species {
|
||||
getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): Species {
|
||||
return this.getSpeciesForLevel(level, allowEvolving, false, (isBoss ? PartyMemberStrength.WEAKER : PartyMemberStrength.AVERAGE) + (gameMode?.isEndless ? 1 : 0));
|
||||
}
|
||||
|
||||
getTrainerSpeciesForLevel(level: integer, allowEvolving: boolean = false, strength: PartyMemberStrength, currentWave: number = 0): Species {
|
||||
getTrainerSpeciesForLevel(level: number, allowEvolving: boolean = false, strength: PartyMemberStrength, currentWave: number = 0): Species {
|
||||
return this.getSpeciesForLevel(level, allowEvolving, true, strength, currentWave);
|
||||
}
|
||||
|
||||
|
@ -688,7 +712,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
* @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.
|
||||
*/
|
||||
private getStrengthLevelDiff(strength: PartyMemberStrength): integer {
|
||||
private getStrengthLevelDiff(strength: PartyMemberStrength): number {
|
||||
switch (Math.min(strength, PartyMemberStrength.STRONGER)) {
|
||||
case PartyMemberStrength.WEAKEST:
|
||||
return 60;
|
||||
|
@ -705,7 +729,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
}
|
||||
}
|
||||
|
||||
getSpeciesForLevel(level: integer, allowEvolving: boolean = false, forTrainer: boolean = false, strength: PartyMemberStrength = PartyMemberStrength.WEAKER, currentWave: number = 0): Species {
|
||||
getSpeciesForLevel(level: number, allowEvolving: boolean = false, forTrainer: boolean = false, strength: PartyMemberStrength = PartyMemberStrength.WEAKER, currentWave: number = 0): Species {
|
||||
const prevolutionLevels = this.getPrevolutionLevels();
|
||||
|
||||
if (prevolutionLevels.length) {
|
||||
|
@ -847,7 +871,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
}
|
||||
|
||||
// This could definitely be written better and more accurate to the getSpeciesForLevel logic, but it is only for generating movesets for evolved Pokemon
|
||||
getSimulatedEvolutionChain(currentLevel: integer, forTrainer: boolean = false, isBoss: boolean = false, player: boolean = false): EvolutionLevel[] {
|
||||
getSimulatedEvolutionChain(currentLevel: number, forTrainer: boolean = false, isBoss: boolean = false, player: boolean = false): EvolutionLevel[] {
|
||||
const ret: EvolutionLevel[] = [];
|
||||
if (pokemonPrevolutions.hasOwnProperty(this.speciesId)) {
|
||||
const prevolutionLevels = this.getPrevolutionLevels().reverse();
|
||||
|
@ -870,17 +894,24 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
getCompatibleFusionSpeciesFilter(): PokemonSpeciesFilter {
|
||||
const hasEvolution = pokemonEvolutions.hasOwnProperty(this.speciesId);
|
||||
const hasPrevolution = pokemonPrevolutions.hasOwnProperty(this.speciesId);
|
||||
const pseudoLegendary = this.subLegendary;
|
||||
const subLegendary = this.subLegendary;
|
||||
const legendary = this.legendary;
|
||||
const mythical = this.mythical;
|
||||
return species => {
|
||||
return (pseudoLegendary || legendary || mythical ||
|
||||
(pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
||||
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution))
|
||||
&& species.subLegendary === pseudoLegendary
|
||||
return (
|
||||
subLegendary
|
||||
|| legendary
|
||||
|| mythical
|
||||
|| (
|
||||
pokemonEvolutions.hasOwnProperty(species.speciesId) === hasEvolution
|
||||
&& pokemonPrevolutions.hasOwnProperty(species.speciesId) === hasPrevolution
|
||||
)
|
||||
)
|
||||
&& species.subLegendary === subLegendary
|
||||
&& species.legendary === legendary
|
||||
&& species.mythical === mythical
|
||||
&& (this.isTrainerForbidden() || !species.isTrainerForbidden());
|
||||
&& (this.isTrainerForbidden() || !species.isTrainerForbidden())
|
||||
&& species.speciesId !== Species.DITTO;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -899,7 +930,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
return variantData.hasOwnProperty(variantDataIndex) || variantData.hasOwnProperty(this.speciesId);
|
||||
}
|
||||
|
||||
getFormSpriteKey(formIndex?: integer) {
|
||||
getFormSpriteKey(formIndex?: number) {
|
||||
if (this.forms.length && (formIndex !== undefined && formIndex >= this.forms.length)) {
|
||||
console.warn(`Attempted accessing form with index ${formIndex} of species ${this.getName()} with only ${this.forms.length || 0} forms`);
|
||||
formIndex = Math.min(formIndex, this.forms.length - 1);
|
||||
|
@ -919,16 +950,17 @@ export class PokemonForm extends PokemonSpeciesForm {
|
|||
private starterSelectableKeys: string[] = [ "10", "50", "10-pc", "50-pc", "red", "orange", "yellow", "green", "blue", "indigo", "violet" ];
|
||||
|
||||
constructor(formName: string, formKey: string, type1: Type, type2: Type | null, height: number, weight: number, ability1: Abilities, ability2: Abilities, abilityHidden: Abilities,
|
||||
baseTotal: integer, baseHp: integer, baseAtk: integer, baseDef: integer, baseSpatk: integer, baseSpdef: integer, baseSpd: integer,
|
||||
catchRate: integer, baseFriendship: integer, baseExp: integer, genderDiffs?: boolean, formSpriteKey?: string | null, isStarterSelectable?: boolean, ) {
|
||||
baseTotal: number, baseHp: number, baseAtk: number, baseDef: number, baseSpatk: number, baseSpdef: number, baseSpd: number,
|
||||
catchRate: number, baseFriendship: number, baseExp: number, genderDiffs: boolean = false, formSpriteKey: string | null = null, isStarterSelectable: boolean = false
|
||||
) {
|
||||
super(type1, type2, height, weight, ability1, ability2, abilityHidden, baseTotal, baseHp, baseAtk, baseDef, baseSpatk, baseSpdef, baseSpd,
|
||||
catchRate, baseFriendship, baseExp, !!genderDiffs, (!!isStarterSelectable || !formKey));
|
||||
catchRate, baseFriendship, baseExp, genderDiffs, (isStarterSelectable || !formKey));
|
||||
this.formName = formName;
|
||||
this.formKey = formKey;
|
||||
this.formSpriteKey = formSpriteKey !== undefined ? formSpriteKey : null;
|
||||
this.formSpriteKey = formSpriteKey;
|
||||
}
|
||||
|
||||
getFormSpriteKey(_formIndex?: integer) {
|
||||
getFormSpriteKey(_formIndex?: number) {
|
||||
return this.formSpriteKey !== null ? this.formSpriteKey : this.formKey;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ import { randIntRange } from "#app/utils";
|
|||
import { StatusEffect } from "#enums/status-effect";
|
||||
import i18next, { ParseKeys } from "i18next";
|
||||
|
||||
export { StatusEffect };
|
||||
|
||||
export class Status {
|
||||
public effect: StatusEffect;
|
||||
/** Toxic damage is `1/16 max HP * toxicTurnCount` */
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import Pokemon from "../field/pokemon";
|
||||
import Move from "./move";
|
||||
import { Type } from "./type";
|
||||
import * as Utils from "../utils";
|
||||
import { ChangeMovePriorityAbAttr, applyAbAttrs } from "./ability";
|
||||
import { Type } from "#enums/type";
|
||||
import { ProtectAttr } from "./move";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import i18next from "i18next";
|
||||
|
@ -58,10 +56,8 @@ export class Terrain {
|
|||
switch (this.terrainType) {
|
||||
case TerrainType.PSYCHIC:
|
||||
if (!move.hasAttr(ProtectAttr)) {
|
||||
const priority = new Utils.IntegerHolder(move.priority);
|
||||
applyAbAttrs(ChangeMovePriorityAbAttr, user, null, false, move, priority);
|
||||
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
||||
return priority.value > 0 && user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded());
|
||||
return move.getPriority(user) > 0 && user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ import BattleScene, { startingWave } from "#app/battle-scene";
|
|||
import { ModifierTypeFunc, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
|
||||
import * as Utils from "#app/utils";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
|
||||
import PokemonSpecies, { getPokemonSpecies, PokemonSpeciesFilter } from "#app/data/pokemon-species";
|
||||
import { tmSpecies } from "#app/data/balance/tms";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import { doubleBattleDialogue } from "#app/data/dialogue";
|
||||
import { PersistentModifier } from "#app/modifier/modifier";
|
||||
import { TrainerVariant } from "#app/field/trainer";
|
||||
|
@ -1841,21 +1841,25 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
[TrainerType.RIVAL]: new TrainerConfig((t = TrainerType.RIVAL)).setName("Finn").setHasGenders("Ivy").setHasCharSprite().setTitle("Rival").setStaticParty().setEncounterBgm(TrainerType.RIVAL).setBattleBgm("battle_rival").setMixedBattleBgm("battle_rival").setPartyTemplates(trainerPartyTemplates.RIVAL)
|
||||
.setModifierRewardFuncs(() => modifierTypes.SUPER_EXP_CHARM, () => modifierTypes.EXP_SHARE)
|
||||
.setEventModifierRewardFuncs(() => modifierTypes.SHINY_CHARM, () => modifierTypes.ABILITY_CHARM)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT, Species.CHESPIN, Species.FENNEKIN, Species.FROAKIE, Species.ROWLET, Species.LITTEN, Species.POPPLIO, Species.GROOKEY, Species.SCORBUNNY, Species.SOBBLE, Species.SPRIGATITO, Species.FUECOCO, Species.QUAXLY ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE, Species.CHIKORITA, Species.CYNDAQUIL, Species.TOTODILE, Species.TREECKO, Species.TORCHIC, Species.MUDKIP, Species.TURTWIG, Species.CHIMCHAR, Species.PIPLUP, Species.SNIVY, Species.TEPIG, Species.OSHAWOTT, Species.CHESPIN, Species.FENNEKIN, Species.FROAKIE, Species.ROWLET, Species.LITTEN, Species.POPPLIO, Species.GROOKEY, Species.SCORBUNNY, Species.SOBBLE, Species.SPRIGATITO, Species.FUECOCO, Species.QUAXLY ], TrainerSlot.TRAINER, true,
|
||||
(p => p.abilityIndex = 0)))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEY, Species.HOOTHOOT, Species.TAILLOW, Species.STARLY, Species.PIDOVE, Species.FLETCHLING, Species.PIKIPEK, Species.ROOKIDEE, Species.WATTREL ], TrainerSlot.TRAINER, true)),
|
||||
[TrainerType.RIVAL_2]: new TrainerConfig(++t).setName("Finn").setHasGenders("Ivy").setHasCharSprite().setTitle("Rival").setStaticParty().setMoneyMultiplier(1.25).setEncounterBgm(TrainerType.RIVAL).setBattleBgm("battle_rival").setMixedBattleBgm("battle_rival").setPartyTemplates(trainerPartyTemplates.RIVAL_2)
|
||||
.setModifierRewardFuncs(() => modifierTypes.EXP_SHARE)
|
||||
.setEventModifierRewardFuncs(() => modifierTypes.SHINY_CHARM)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.IVYSAUR, Species.CHARMELEON, Species.WARTORTLE, Species.BAYLEEF, Species.QUILAVA, Species.CROCONAW, Species.GROVYLE, Species.COMBUSKEN, Species.MARSHTOMP, Species.GROTLE, Species.MONFERNO, Species.PRINPLUP, Species.SERVINE, Species.PIGNITE, Species.DEWOTT, Species.QUILLADIN, Species.BRAIXEN, Species.FROGADIER, Species.DARTRIX, Species.TORRACAT, Species.BRIONNE, Species.THWACKEY, Species.RABOOT, Species.DRIZZILE, Species.FLORAGATO, Species.CROCALOR, Species.QUAXWELL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.IVYSAUR, Species.CHARMELEON, Species.WARTORTLE, Species.BAYLEEF, Species.QUILAVA, Species.CROCONAW, Species.GROVYLE, Species.COMBUSKEN, Species.MARSHTOMP, Species.GROTLE, Species.MONFERNO, Species.PRINPLUP, Species.SERVINE, Species.PIGNITE, Species.DEWOTT, Species.QUILLADIN, Species.BRAIXEN, Species.FROGADIER, Species.DARTRIX, Species.TORRACAT, Species.BRIONNE, Species.THWACKEY, Species.RABOOT, Species.DRIZZILE, Species.FLORAGATO, Species.CROCALOR, Species.QUAXWELL ], TrainerSlot.TRAINER, true,
|
||||
(p => p.abilityIndex = 0)))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOTTO, Species.HOOTHOOT, Species.TAILLOW, Species.STARAVIA, Species.TRANQUILL, Species.FLETCHINDER, Species.TRUMBEAK, Species.CORVISQUIRE, Species.WATTREL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450)),
|
||||
[TrainerType.RIVAL_3]: new TrainerConfig(++t).setName("Finn").setHasGenders("Ivy").setHasCharSprite().setTitle("Rival").setStaticParty().setMoneyMultiplier(1.5).setEncounterBgm(TrainerType.RIVAL).setBattleBgm("battle_rival").setMixedBattleBgm("battle_rival").setPartyTemplates(trainerPartyTemplates.RIVAL_3)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true,
|
||||
(p => p.abilityIndex = 0)))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT, Species.TALONFLAME, Species.TOUCANNON, Species.CORVIKNIGHT, Species.KILOWATTREL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540),
|
||||
[TrainerType.RIVAL_4]: new TrainerConfig(++t).setName("Finn").setHasGenders("Ivy").setHasCharSprite().setTitle("Rival").setBoss().setStaticParty().setMoneyMultiplier(1.75).setEncounterBgm(TrainerType.RIVAL).setBattleBgm("battle_rival_2").setMixedBattleBgm("battle_rival_2").setPartyTemplates(trainerPartyTemplates.RIVAL_4)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true,
|
||||
(p => p.abilityIndex = 0)))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT, Species.TALONFLAME, Species.TOUCANNON, Species.CORVIKNIGHT, Species.KILOWATTREL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
||||
|
@ -1865,7 +1869,10 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
}),
|
||||
[TrainerType.RIVAL_5]: new TrainerConfig(++t).setName("Finn").setHasGenders("Ivy").setHasCharSprite().setTitle("Rival").setBoss().setStaticParty().setMoneyMultiplier(2.25).setEncounterBgm(TrainerType.RIVAL).setBattleBgm("battle_rival_3").setMixedBattleBgm("battle_rival_3").setPartyTemplates(trainerPartyTemplates.RIVAL_5)
|
||||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true,
|
||||
p => p.setBoss(true, 2)))
|
||||
p => {
|
||||
p.setBoss(true, 2);
|
||||
p.abilityIndex = 0;
|
||||
}))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT, Species.TALONFLAME, Species.TOUCANNON, Species.CORVIKNIGHT, Species.KILOWATTREL ], TrainerSlot.TRAINER, true))
|
||||
.setPartyMemberFunc(2, getSpeciesFilterRandomPartyMemberFunc((species: PokemonSpecies) => !pokemonEvolutions.hasOwnProperty(species.speciesId) && !pokemonPrevolutions.hasOwnProperty(species.speciesId) && species.baseTotal >= 450))
|
||||
.setSpeciesFilter(species => species.baseTotal >= 540)
|
||||
|
@ -1883,6 +1890,7 @@ export const trainerConfigs: TrainerConfigs = {
|
|||
.setPartyMemberFunc(0, getRandomPartyMemberFunc([ Species.VENUSAUR, Species.CHARIZARD, Species.BLASTOISE, Species.MEGANIUM, Species.TYPHLOSION, Species.FERALIGATR, Species.SCEPTILE, Species.BLAZIKEN, Species.SWAMPERT, Species.TORTERRA, Species.INFERNAPE, Species.EMPOLEON, Species.SERPERIOR, Species.EMBOAR, Species.SAMUROTT, Species.CHESNAUGHT, Species.DELPHOX, Species.GRENINJA, Species.DECIDUEYE, Species.INCINEROAR, Species.PRIMARINA, Species.RILLABOOM, Species.CINDERACE, Species.INTELEON, Species.MEOWSCARADA, Species.SKELEDIRGE, Species.QUAQUAVAL ], TrainerSlot.TRAINER, true,
|
||||
p => {
|
||||
p.setBoss(true, 3);
|
||||
p.abilityIndex = 0;
|
||||
p.generateAndPopulateMoveset();
|
||||
}))
|
||||
.setPartyMemberFunc(1, getRandomPartyMemberFunc([ Species.PIDGEOT, Species.NOCTOWL, Species.SWELLOW, Species.STARAPTOR, Species.UNFEZANT, Species.TALONFLAME, Species.TOUCANNON, Species.CORVIKNIGHT, Species.KILOWATTREL ], TrainerSlot.TRAINER, true,
|
||||
|
|
|
@ -1,25 +1,4 @@
|
|||
export enum Type {
|
||||
UNKNOWN = -1,
|
||||
NORMAL = 0,
|
||||
FIGHTING,
|
||||
FLYING,
|
||||
POISON,
|
||||
GROUND,
|
||||
ROCK,
|
||||
BUG,
|
||||
GHOST,
|
||||
STEEL,
|
||||
FIRE,
|
||||
WATER,
|
||||
GRASS,
|
||||
ELECTRIC,
|
||||
PSYCHIC,
|
||||
ICE,
|
||||
DRAGON,
|
||||
DARK,
|
||||
FAIRY,
|
||||
STELLAR
|
||||
}
|
||||
import { Type } from "#enums/type";
|
||||
|
||||
export type TypeDamageMultiplier = 0 | 0.125 | 0.25 | 0.5 | 1 | 2 | 4 | 8;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Biome } from "#enums/biome";
|
|||
import { WeatherType } from "#enums/weather-type";
|
||||
import { getPokemonNameWithAffix } from "../messages";
|
||||
import Pokemon from "../field/pokemon";
|
||||
import { Type } from "./type";
|
||||
import { Type } from "#enums/type";
|
||||
import Move, { AttackMove } from "./move";
|
||||
import * as Utils from "../utils";
|
||||
import BattleScene from "../battle-scene";
|
||||
|
@ -10,7 +10,6 @@ import { SuppressWeatherEffectAbAttr } from "./ability";
|
|||
import { TerrainType, getTerrainName } from "./terrain";
|
||||
import i18next from "i18next";
|
||||
|
||||
export { WeatherType };
|
||||
export class Weather {
|
||||
public weatherType: WeatherType;
|
||||
public turnsLeft: integer;
|
||||
|
|
|
@ -28,4 +28,5 @@ export enum ArenaTagType {
|
|||
FIRE_GRASS_PLEDGE = "FIRE_GRASS_PLEDGE",
|
||||
WATER_FIRE_PLEDGE = "WATER_FIRE_PLEDGE",
|
||||
GRASS_WATER_PLEDGE = "GRASS_WATER_PLEDGE",
|
||||
FAIRY_LOCK = "FAIRY_LOCK",
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ export enum BattlerTagType {
|
|||
DRAGON_CHEER = "DRAGON_CHEER",
|
||||
NO_RETREAT = "NO_RETREAT",
|
||||
GORILLA_TACTICS = "GORILLA_TACTICS",
|
||||
UNBURDEN = "UNBURDEN",
|
||||
THROAT_CHOPPED = "THROAT_CHOPPED",
|
||||
TAR_SHOT = "TAR_SHOT",
|
||||
BURNED_UP = "BURNED_UP",
|
||||
|
@ -87,5 +88,9 @@ export enum BattlerTagType {
|
|||
IMPRISON = "IMPRISON",
|
||||
SYRUP_BOMB = "SYRUP_BOMB",
|
||||
ELECTRIFIED = "ELECTRIFIED",
|
||||
TELEKINESIS = "TELEKINESIS"
|
||||
TELEKINESIS = "TELEKINESIS",
|
||||
COMMANDED = "COMMANDED",
|
||||
GRUDGE = "GRUDGE",
|
||||
PSYCHO_SHIFT = "PSYCHO_SHIFT",
|
||||
ENDURE_TOKEN = "ENDURE_TOKEN",
|
||||
}
|
||||
|
|
|
@ -12,5 +12,15 @@ export enum PokemonAnimType {
|
|||
* Removes a Pokemon's Substitute doll from the field.
|
||||
* The Pokemon then moves back to its original position.
|
||||
*/
|
||||
SUBSTITUTE_REMOVE
|
||||
SUBSTITUTE_REMOVE,
|
||||
/**
|
||||
* Brings Tatsugiri and Dondozo to the center of the field, with
|
||||
* Tatsugiri jumping into the Dondozo's mouth
|
||||
*/
|
||||
COMMANDER_APPLY,
|
||||
/**
|
||||
* Dondozo "spits out" Tatsugiri, moving Tatsugiri back to its original
|
||||
* field position.
|
||||
*/
|
||||
COMMANDER_REMOVE
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* or {@linkcode SwitchSummonPhase} will carry out.
|
||||
*/
|
||||
export enum SwitchType {
|
||||
/** Switchout specifically for when combat starts and the player is prompted if they will switch Pokemon */
|
||||
INITIAL_SWITCH,
|
||||
/** Basic switchout where the Pokemon to switch in is selected */
|
||||
SWITCH,
|
||||
/** Transfers stat stages and other effects from the returning Pokemon to the switched in Pokemon */
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
export enum Type {
|
||||
UNKNOWN = -1,
|
||||
NORMAL = 0,
|
||||
FIGHTING,
|
||||
FLYING,
|
||||
POISON,
|
||||
GROUND,
|
||||
ROCK,
|
||||
BUG,
|
||||
GHOST,
|
||||
STEEL,
|
||||
FIRE,
|
||||
WATER,
|
||||
GRASS,
|
||||
ELECTRIC,
|
||||
PSYCHIC,
|
||||
ICE,
|
||||
DRAGON,
|
||||
DARK,
|
||||
FAIRY,
|
||||
STELLAR
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { WeatherType } from "#app/data/weather";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
|
||||
/** Alias for all {@linkcode ArenaEvent} type strings */
|
||||
export enum ArenaEventType {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import BattleScene from "../battle-scene";
|
||||
import { PokeballType } from "../data/pokeball";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import * as Utils from "../utils";
|
||||
|
||||
export function addPokeballOpenParticles(scene: BattleScene, x: number, y: number, pokeballType: PokeballType): void {
|
||||
|
|
|
@ -3,14 +3,21 @@ import { biomePokemonPools, BiomePoolTier, BiomeTierTrainerPools, biomeTrainerPo
|
|||
import { Constructor } from "#app/utils";
|
||||
import * as Utils from "#app/utils";
|
||||
import PokemonSpecies, { getPokemonSpecies } from "#app/data/pokemon-species";
|
||||
import { getTerrainClearMessage, getTerrainStartMessage, getWeatherClearMessage, getWeatherStartMessage, Weather, WeatherType } from "#app/data/weather";
|
||||
import { getTerrainClearMessage, getTerrainStartMessage, getWeatherClearMessage, getWeatherStartMessage, Weather } from "#app/data/weather";
|
||||
import { CommonAnim } from "#app/data/battle-anims";
|
||||
import { Type } from "#app/data/type";
|
||||
import { Type } from "#enums/type";
|
||||
import Move from "#app/data/move";
|
||||
import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Terrain, TerrainType } from "#app/data/terrain";
|
||||
import { applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs, PostTerrainChangeAbAttr, PostWeatherChangeAbAttr } from "#app/data/ability";
|
||||
import {
|
||||
applyAbAttrs,
|
||||
applyPostTerrainChangeAbAttrs,
|
||||
applyPostWeatherChangeAbAttrs,
|
||||
PostTerrainChangeAbAttr,
|
||||
PostWeatherChangeAbAttr,
|
||||
TerrainEventTypeChangeAbAttr
|
||||
} from "#app/data/ability";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import Overrides from "#app/overrides";
|
||||
import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
|
||||
|
@ -24,6 +31,7 @@ import { Abilities } from "#enums/abilities";
|
|||
import { SpeciesFormChangeRevertWeatherFormTrigger, SpeciesFormChangeWeatherTrigger } from "#app/data/pokemon-forms";
|
||||
import { CommonAnimPhase } from "#app/phases/common-anim-phase";
|
||||
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
|
||||
export class Arena {
|
||||
public scene: BattleScene;
|
||||
|
@ -217,66 +225,6 @@ export class Arena {
|
|||
return 0;
|
||||
}
|
||||
|
||||
getTypeForBiome() {
|
||||
switch (this.biomeType) {
|
||||
case Biome.TOWN:
|
||||
case Biome.PLAINS:
|
||||
case Biome.METROPOLIS:
|
||||
return Type.NORMAL;
|
||||
case Biome.GRASS:
|
||||
case Biome.TALL_GRASS:
|
||||
return Type.GRASS;
|
||||
case Biome.FOREST:
|
||||
case Biome.JUNGLE:
|
||||
return Type.BUG;
|
||||
case Biome.SLUM:
|
||||
case Biome.SWAMP:
|
||||
return Type.POISON;
|
||||
case Biome.SEA:
|
||||
case Biome.BEACH:
|
||||
case Biome.LAKE:
|
||||
case Biome.SEABED:
|
||||
return Type.WATER;
|
||||
case Biome.MOUNTAIN:
|
||||
return Type.FLYING;
|
||||
case Biome.BADLANDS:
|
||||
return Type.GROUND;
|
||||
case Biome.CAVE:
|
||||
case Biome.DESERT:
|
||||
return Type.ROCK;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.SNOWY_FOREST:
|
||||
return Type.ICE;
|
||||
case Biome.MEADOW:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.ISLAND:
|
||||
return Type.FAIRY;
|
||||
case Biome.POWER_PLANT:
|
||||
return Type.ELECTRIC;
|
||||
case Biome.VOLCANO:
|
||||
return Type.FIRE;
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.TEMPLE:
|
||||
return Type.GHOST;
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return Type.FIGHTING;
|
||||
case Biome.FACTORY:
|
||||
case Biome.LABORATORY:
|
||||
return Type.STEEL;
|
||||
case Biome.RUINS:
|
||||
case Biome.SPACE:
|
||||
return Type.PSYCHIC;
|
||||
case Biome.WASTELAND:
|
||||
case Biome.END:
|
||||
return Type.DRAGON;
|
||||
case Biome.ABYSS:
|
||||
return Type.DARK;
|
||||
default:
|
||||
return Type.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
getBgTerrainColorRatioForBiome(): number {
|
||||
switch (this.biomeType) {
|
||||
case Biome.SPACE:
|
||||
|
@ -387,6 +335,7 @@ export class Arena {
|
|||
this.scene.getField(true).filter(p => p.isOnField()).map(pokemon => {
|
||||
pokemon.findAndRemoveTags(t => "terrainTypes" in t && !(t.terrainTypes as TerrainType[]).find(t => t === terrain));
|
||||
applyPostTerrainChangeAbAttrs(PostTerrainChangeAbAttr, pokemon, terrain);
|
||||
applyAbAttrs(TerrainEventTypeChangeAbAttr, pokemon, null, false);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
@ -786,7 +735,7 @@ export class Arena {
|
|||
case Biome.VOLCANO:
|
||||
return 17.637;
|
||||
case Biome.GRAVEYARD:
|
||||
return 3.232;
|
||||
return 13.711;
|
||||
case Biome.DOJO:
|
||||
return 6.205;
|
||||
case Biome.FACTORY:
|
||||
|
|