Merge branch 'beta' into suppress-ooze

This commit is contained in:
Dean 2025-04-23 14:41:03 -07:00
commit 20dc23cded
661 changed files with 9501 additions and 7207 deletions

View File

@ -15,7 +15,7 @@ jobs:
submodules: 'recursive'
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Build

View File

@ -18,7 +18,7 @@ jobs:
submodules: 'recursive'
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Build

View File

@ -24,7 +24,7 @@ jobs:
steps:
- name: Checkout repository for Typedoc
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: 'recursive'
path: pokerogue_docs
@ -34,14 +34,14 @@ jobs:
sudo apt update
sudo apt install -y git openssh-client
- name: Setup Node 20.13.1
uses: actions/setup-node@v1
- name: Setup Node 22.14.1
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: "pokerogue_docs/.nvmrc"
- name: Checkout repository for Github Pages
if: github.event_name == 'push'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: pokerogue_gh
ref: gh-pages

View File

@ -29,6 +29,7 @@ jobs:
uses: actions/setup-node@v4 # Use the setup-node action version 4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Node.js dependencies # Step to install Node.js dependencies
run: npm ci # Use 'npm ci' to install dependencies

View File

@ -19,13 +19,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
uses: actions/checkout@v4.2.2
with:
submodules: 'recursive'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Node.js dependencies
run: npm ci
- name: Run tests

View File

@ -7,10 +7,50 @@ on:
branches:
- main # Trigger on push events to the main branch
- beta # Trigger on push events to the beta branch
# go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft until they fix this or ditch yml for workflows
paths:
# src and test files
- "src/**"
- "test/**"
- "public/**"
# Workflows that can impact tests
- ".github/workflows/test*.yml"
# top-level files
- "package*.json"
- ".nvrmc" # Updates to node version can break tests
- "vite.*.ts" # vite.config.ts, vite.vitest.config.ts, vitest.workspace.ts
- "tsconfig*.json" # tsconfig.json tweaking can impact compilation
- "global.d.ts"
- ".env.*"
# Blanket negations for files that cannot impact tests
- "!**/*.py" # No .py files
- "!**/*.sh" # No .sh files
- "!**/*.md" # No .md files
- "!**/.git*" # .gitkeep and family
pull_request:
branches:
- main # Trigger on pull request events targeting the main branch
- beta # Trigger on pull request events targeting the beta branch
paths: # go upvote https://github.com/actions/runner/issues/1182 and yell at microsoft because until then we have to duplicate this
# src and test files
- "src/**"
- "test/**"
- "public/**"
# Workflows that can impact tests
- ".github/workflows/test*.yml"
# top-level files
- "package*.json"
- ".nvrmc" # Updates to node version can break tests
- "vite*" # vite.config.ts, vite.vitest.config.ts, vitest.workspace.ts
- "tsconfig*.json" # tsconfig.json tweaking can impact compilation
- "global.d.ts"
- ".env.*"
# Blanket negations for files that cannot impact tests
- "!**/*.py" # No .py files
- "!**/*.sh" # No .sh files
- "!**/*.md" # No .md files
- "!**/.git*" # .gitkeep and family
merge_group:
types: [checks_requested]

2
.nvmrc
View File

@ -1 +1 @@
v20.13.1
v22.14.0

View File

@ -12,7 +12,7 @@ If you have the motivation and experience with Typescript/Javascript (or are wil
#### Prerequisites
- node: 20.13.1
- node: 22.14.0
- npm: [how to install](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
#### Running Locally

View File

@ -31,7 +31,7 @@
"src/overrides.ts",
// TODO: these files are too big and complex, ignore them until their respective refactors
"src/data/moves/move.ts",
"src/data/ability.ts",
"src/data/abilities/ability.ts",
"src/field/pokemon.ts",
// this file is just too big:
@ -65,7 +65,8 @@
"useDefaultParameterLast": "off", // TODO: Fix spots in the codebase where this flag would be triggered, and then enable
"useSingleVarDeclarator": "off",
"useNodejsImportProtocol": "off",
"useTemplate": "off" // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation
"useTemplate": "off", // string concatenation is faster: https://stackoverflow.com/questions/29055518/are-es6-template-literals-faster-than-string-concatenation
"noNamespaceImport": "error"
},
"suspicious": {
"noDoubleEquals": "error",
@ -99,6 +100,9 @@
"rules": {
"performance": {
"noDelete": "off"
},
"style": {
"noNamespaceImport": "off"
}
}
}

24
package-lock.json generated
View File

@ -10,6 +10,7 @@
"hasInstallScript": true,
"dependencies": {
"@material/material-color-utilities": "^0.2.7",
"compare-versions": "^6.1.1",
"crypto-js": "^4.2.0",
"i18next": "^24.2.2",
"i18next-browser-languagedetector": "^8.0.4",
@ -26,7 +27,7 @@
"@hpcc-js/wasm": "^2.22.4",
"@stylistic/eslint-plugin-ts": "^4.1.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.12.13",
"@types/node": "^22.13.14",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@vitest/coverage-istanbul": "^3.0.9",
@ -2581,12 +2582,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "20.14.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.11.tgz",
"integrity": "sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==",
"version": "22.13.14",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz",
"integrity": "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~5.26.4"
"undici-types": "~6.20.0"
}
},
"node_modules/@types/statuses": {
@ -3605,6 +3607,12 @@
"node": ">=18"
}
},
"node_modules/compare-versions": {
"version": "6.1.1",
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz",
"integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==",
"license": "MIT"
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -7305,9 +7313,9 @@
"dev": true
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"version": "6.20.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
"dev": true,
"license": "MIT"
},

View File

@ -33,7 +33,7 @@
"@hpcc-js/wasm": "^2.22.4",
"@stylistic/eslint-plugin-ts": "^4.1.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.12.13",
"@types/node": "^22.13.14",
"@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.28.0",
"@vitest/coverage-istanbul": "^3.0.9",
@ -55,6 +55,7 @@
},
"dependencies": {
"@material/material-color-utilities": "^0.2.7",
"compare-versions": "^6.1.1",
"crypto-js": "^4.2.0",
"i18next": "^24.2.2",
"i18next-browser-languagedetector": "^8.0.4",
@ -66,6 +67,6 @@
"phaser3-rex-plugins": "^1.80.14"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
}
}

View File

@ -0,0 +1,656 @@
{
"3-mega": [0, 2, 2],
"6-mega-x": [0, 2, 2],
"6-mega-y": [0, 2, 2],
"80-mega": [0, 1, 1],
"94-mega": [2, 2, 2],
"127-mega": [0, 1, 1],
"130-mega": [0, 1, 1],
"142-mega": [0, 1, 1],
"150-mega-x": [0, 1, 1],
"150-mega-y": [0, 1, 1],
"181-mega": [0, 1, 2],
"212-mega": [1, 1, 2],
"229-mega": [0, 1, 1],
"248-mega": [0, 1, 1],
"257-mega": [0, 1, 1],
"282-mega": [0, 2, 2],
"302-mega": [0, 1, 1],
"303-mega": [0, 1, 1],
"306-mega": [1, 1, 1],
"308-mega": [0, 1, 1],
"310-mega": [0, 1, 1],
"334-mega": [0, 2, 1],
"354-mega": [0, 1, 1],
"359-mega": [0, 1, 1],
"362-mega": [0, 1, 1],
"373-mega": [0, 1, 1],
"376-mega": [0, 1, 1],
"380-mega": [0, 1, 1],
"381-mega": [0, 1, 1],
"382-primal": [0, 1, 1],
"383-primal": [0, 1, 1],
"384-mega": [0, 2, 1],
"428-mega": [0, 1, 1],
"445-mega": [1, 1, 1],
"448-mega": [1, 1, 1],
"475-mega": [0, 2, 2],
"531-mega": [0, 1, 1],
"653": [0, 1, 1],
"654": [0, 1, 1],
"655": [0, 1, 1],
"656": [0, 1, 1],
"657": [0, 1, 1],
"658": [0, 1, 1],
"658-ash": [0, 1, 1],
"664": [0, 1, 1],
"665": [0, 1, 1],
"666-archipelago": [0, 1, 1],
"666-continental": [0, 1, 1],
"666-elegant": [0, 1, 1],
"666-fancy": [0, 1, 1],
"666-garden": [0, 1, 1],
"666-high-plains": [0, 1, 1],
"666-icy-snow": [0, 1, 1],
"666-jungle": [0, 1, 1],
"666-marine": [0, 1, 1],
"666-meadow": [0, 1, 1],
"666-modern": [0, 1, 1],
"666-monsoon": [0, 1, 1],
"666-ocean": [0, 1, 1],
"666-poke-ball": [0, 1, 1],
"666-polar": [0, 1, 1],
"666-river": [0, 1, 1],
"666-sandstorm": [0, 1, 1],
"666-savanna": [0, 1, 1],
"666-sun": [0, 1, 1],
"666-tundra": [0, 1, 1],
"669-red": [0, 2, 2],
"669-blue": [0, 1, 1],
"669-white": [0, 1, 1],
"669-yellow": [0, 1, 1],
"669-orange": [0, 2, 2],
"670-white": [0, 1, 1],
"670-blue": [0, 1, 1],
"670-orange": [0, 1, 1],
"670-red": [0, 1, 1],
"670-yellow": [0, 1, 1],
"671-red": [0, 1, 2],
"671-blue": [0, 1, 2],
"671-yellow": [0, 1, 1],
"671-white": [0, 1, 2],
"671-orange": [0, 1, 2],
"672": [0, 1, 1],
"673": [0, 1, 1],
"676": [0, 1, 1],
"677": [0, 1, 1],
"678-female": [0, 1, 1],
"678": [0, 1, 1],
"682": [0, 1, 1],
"683": [0, 1, 1],
"684": [0, 1, 1],
"685": [0, 1, 1],
"688": [0, 1, 1],
"689": [0, 1, 1],
"690": [0, 1, 1],
"691": [0, 1, 1],
"696": [0, 1, 1],
"697": [0, 1, 1],
"699": [0, 1, 1],
"700": [0, 1, 1],
"702": [0, 1, 1],
"704": [0, 1, 1],
"705": [0, 1, 1],
"706": [0, 1, 1],
"709": [0, 1, 1],
"710": [0, 1, 1],
"711": [1, 1, 1],
"712": [0, 1, 1],
"713": [0, 1, 1],
"715": [0, 1, 1],
"716-active": [0, 1, 1],
"716-neutral": [0, 1, 1],
"717": [0, 2, 2],
"720-unbound": [1, 1, 1],
"720": [1, 1, 1],
"728": [0, 1, 1],
"729": [0, 1, 1],
"730": [0, 1, 1],
"734": [0, 1, 1],
"735": [0, 1, 1],
"742": [0, 2, 2],
"743": [0, 2, 2],
"747": [0, 2, 2],
"748": [0, 1, 1],
"751": [0, 1, 1],
"752": [0, 1, 1],
"753": [0, 1, 1],
"754": [0, 2, 2],
"755": [0, 1, 1],
"756": [0, 1, 1],
"761": [0, 1, 1],
"762": [0, 1, 1],
"763": [0, 1, 1],
"767": [0, 1, 1],
"768": [0, 1, 1],
"770": [0, 0, 0],
"771": [0, 2, 2],
"772": [0, 1, 1],
"773-fighting": [0, 1, 1],
"773-psychic": [0, 1, 1],
"773-poison": [0, 1, 1],
"773-ground": [0, 1, 1],
"773-ghost": [0, 1, 1],
"773-steel": [0, 1, 1],
"773-rock": [0, 1, 1],
"773-grass": [0, 1, 1],
"773-dragon": [0, 1, 1],
"773-bug": [0, 1, 1],
"773-ice": [0, 1, 1],
"773-dark": [0, 1, 1],
"773": [0, 1, 1],
"773-fairy": [0, 1, 1],
"773-water": [0, 1, 1],
"773-electric": [0, 1, 1],
"773-flying": [0, 1, 1],
"773-fire": [0, 1, 1],
"776": [0, 1, 1],
"777": [0, 1, 1],
"778-busted": [0, 1, 1],
"778-disguised": [0, 1, 1],
"779": [0, 1, 1],
"789": [1, 1, 1],
"790": [0, 1, 1],
"791": [2, 1, 1],
"792": [0, 1, 1],
"793": [0, 2, 2],
"797": [0, 1, 1],
"798": [0, 1, 1],
"800-dawn-wings": [0, 1, 1],
"800-dusk-mane": [0, 1, 1],
"800-ultra": [0, 1, 1],
"800": [0, 1, 1],
"802": [1, 1, 1],
"803": [0, 1, 1],
"804": [0, 1, 1],
"807": [0, 1, 1],
"808": [0, 1, 1],
"809": [0, 1, 1],
"816": [0, 1, 1],
"817": [0, 1, 1],
"818": [1, 1, 1],
"821": [0, 2, 2],
"822": [0, 1, 1],
"823": [0, 1, 1],
"829": [0, 1, 1],
"830": [0, 1, 1],
"835": [0, 1, 1],
"836": [0, 2, 2],
"850": [0, 1, 1],
"851": [0, 1, 1],
"854": [0, 1, 1],
"855": [0, 1, 1],
"856": [0, 1, 1],
"857": [0, 2, 2],
"858": [0, 1, 1],
"859": [0, 1, 1],
"860": [0, 1, 1],
"861": [0, 1, 1],
"862": [0, 1, 1],
"863": [0, 1, 1],
"864": [0, 1, 1],
"867": [0, 1, 1],
"872": [1, 1, 1],
"873": [1, 1, 1],
"876-female": [0, 1, 1],
"876": [0, 1, 1],
"877-hangry": [1, 1, 1],
"877": [1, 1, 1],
"880": [0, 1, 1],
"881": [0, 1, 1],
"882": [0, 2, 1],
"883": [0, 1, 1],
"884": [0, 1, 1],
"885": [1, 1, 1],
"886": [1, 1, 1],
"887": [1, 1, 1],
"888": [0, 1, 1],
"888-crowned": [0, 1, 1],
"889": [0, 1, 1],
"889-crowned": [0, 1, 1],
"890": [0, 2, 1],
"890-eternamax": [0, 1, 1],
"891": [1, 1, 1],
"892-rapid-strike": [1, 1, 1],
"892": [1, 1, 1],
"894": [0, 1, 1],
"895": [0, 1, 1],
"896": [1, 1, 1],
"897": [1, 1, 1],
"898": [1, 1, 1],
"898-ice": [1, 1, 1],
"898-shadow": [1, 1, 1],
"900": [0, 1, 1],
"901": [0, 1, 1],
"903": [0, 1, 1],
"909": [0, 1, 1],
"910": [0, 2, 2],
"911": [0, 2, 2],
"912": [0, 1, 2],
"913": [0, 1, 2],
"914": [0, 2, 1],
"919": [1, 1, 1],
"920": [1, 1, 1],
"924": [1, 1, 1],
"925-four": [1, 2, 2],
"925-three": [1, 2, 2],
"932": [0, 2, 2],
"933": [0, 2, 2],
"934": [0, 1, 1],
"935": [1, 1, 2],
"936": [2, 2, 2],
"937": [2, 2, 2],
"940": [0, 1, 1],
"941": [0, 1, 1],
"944": [0, 1, 1],
"945": [0, 1, 1],
"948": [0, 1, 1],
"949": [0, 1, 1],
"951": [0, 1, 1],
"952": [0, 1, 1],
"953": [0, 1, 1],
"954": [0, 1, 1],
"957": [2, 2, 2],
"958": [2, 2, 2],
"959": [2, 2, 2],
"962": [1, 1, 1],
"967": [0, 1, 1],
"968": [0, 1, 1],
"969": [0, 1, 1],
"970": [0, 1, 1],
"973": [1, 1, 1],
"974": [0, 1, 1],
"975": [0, 1, 1],
"978-curly": [0, 2, 2],
"978-droopy": [0, 2, 2],
"978-stretchy": [0, 2, 2],
"979": [2, 2, 2],
"981": [0, 1, 1],
"982": [0, 1, 1],
"982-three-segment": [0, 1, 1],
"987": [1, 1, 1],
"988": [0, 1, 2],
"993": [0, 1, 1],
"994": [0, 1, 2],
"995": [0, 1, 1],
"996": [0, 1, 1],
"997": [0, 2, 2],
"998": [0, 2, 2],
"999": [2, 1, 1],
"1000": [1, 1, 1],
"1001": [0, 1, 1],
"1003": [0, 1, 1],
"1004": [0, 1, 1],
"1006": [0, 2, 1],
"1007-apex-build": [0, 2, 2],
"1008-ultimate-mode": [1, 1, 1],
"2026": [0, 1, 1],
"2027": [0, 1, 1],
"2028": [0, 1, 1],
"2052": [0, 1, 1],
"2053": [0, 1, 0],
"2103": [0, 1, 1],
"4052": [0, 1, 1],
"4077": [0, 1, 1],
"4078": [0, 1, 1],
"4079": [0, 1, 1],
"4080": [2, 1, 1],
"4144": [0, 1, 1],
"4145": [0, 1, 1],
"4146": [0, 1, 1],
"4199": [2, 1, 1],
"4222": [0, 1, 1],
"4263": [0, 1, 1],
"4264": [0, 1, 1],
"4562": [0, 1, 1],
"6100": [0, 1, 1],
"6101": [0, 1, 1],
"6215": [0, 1, 1],
"6503": [0, 1, 1],
"6549": [0, 1, 1],
"6570": [0, 1, 1],
"6571": [0, 1, 1],
"6705": [0, 1, 1],
"6706": [0, 1, 1],
"6713": [0, 1, 1],
"female": {
"6215": [0, 1, 1]
},
"back": {
"3-mega": [0, 2, 2],
"6-mega-x": [0, 2, 2],
"6-mega-y": [0, 1, 2],
"80-mega": [0, 1, 1],
"94-mega": [1, 1, 1],
"127-mega": [0, 1, 1],
"130-mega": [0, 1, 1],
"142-mega": [0, 1, 1],
"150-mega-x": [0, 1, 1],
"150-mega-y": [0, 1, 1],
"181-mega": [0, 1, 2],
"212-mega": [1, 2, 2],
"229-mega": [0, 1, 1],
"248-mega": [0, 1, 1],
"257-mega": [0, 1, 1],
"282-mega": [0, 1, 1],
"302-mega": [0, 1, 1],
"303-mega": [0, 1, 1],
"306-mega": [1, 1, 1],
"308-mega": [0, 1, 1],
"310-mega": [0, 1, 1],
"334-mega": [0, 1, 1],
"354-mega": [0, 1, 1],
"359-mega": [0, 1, 1],
"362-mega": [0, 1, 1],
"373-mega": [0, 1, 1],
"376-mega": [0, 1, 1],
"380-mega": [0, 1, 1],
"381-mega": [0, 1, 1],
"382-primal": [0, 1, 1],
"383-primal": [0, 1, 1],
"384-mega": [0, 1, 1],
"428-mega": [0, 1, 1],
"445-mega": [1, 1, 1],
"448-mega": [1, 1, 1],
"475-mega": [0, 2, 2],
"531-mega": [0, 1, 1],
"653": [0, 1, 1],
"654": [0, 1, 1],
"655": [0, 1, 1],
"656": [0, 1, 1],
"657": [0, 1, 1],
"658": [0, 1, 1],
"658-ash": [0, 1, 1],
"664": [0, 1, 1],
"665": [0, 1, 1],
"666-archipelago": [0, 1, 1],
"666-continental": [0, 1, 1],
"666-elegant": [0, 1, 1],
"666-fancy": [0, 1, 1],
"666-garden": [0, 1, 1],
"666-high-plains": [0, 1, 1],
"666-icy-snow": [0, 1, 1],
"666-jungle": [0, 1, 1],
"666-marine": [0, 1, 1],
"666-meadow": [0, 1, 1],
"666-modern": [0, 1, 1],
"666-monsoon": [0, 1, 1],
"666-ocean": [0, 1, 1],
"666-poke-ball": [0, 1, 1],
"666-polar": [0, 1, 1],
"666-river": [0, 1, 1],
"666-sandstorm": [0, 1, 1],
"666-savanna": [0, 1, 1],
"666-sun": [0, 1, 1],
"666-tundra": [0, 1, 1],
"669-red": [0, 2, 2],
"669-blue": [0, 2, 2],
"669-white": [0, 2, 2],
"669-yellow": [0, 2, 2],
"669-orange": [0, 2, 2],
"670-white": [0, 1, 1],
"670-blue": [0, 2, 2],
"670-orange": [0, 1, 1],
"670-red": [0, 1, 1],
"670-yellow": [0, 1, 1],
"671-red": [0, 1, 1],
"671-blue": [0, 1, 1],
"671-yellow": [0, 1, 1],
"671-white": [0, 1, 1],
"671-orange": [0, 1, 1],
"672": [0, 1, 1],
"673": [0, 1, 1],
"676": [0, 1, 1],
"677": [0, 1, 1],
"678-female": [0, 1, 1],
"678": [0, 1, 1],
"682": [0, 1, 1],
"683": [0, 1, 1],
"684": [0, 1, 1],
"685": [0, 1, 1],
"688": [0, 1, 1],
"689": [0, 1, 1],
"690": [0, 1, 1],
"691": [0, 1, 1],
"696": [0, 1, 1],
"697": [0, 1, 1],
"699": [0, 2, 2],
"700": [0, 1, 1],
"702": [0, 1, 1],
"704": [0, 1, 1],
"705": [0, 1, 1],
"706": [0, 1, 1],
"709": [0, 1, 1],
"710": [0, 1, 1],
"711": [1, 1, 1],
"712": [0, 1, 1],
"713": [0, 1, 1],
"715": [0, 1, 1],
"716-active": [0, 1, 1],
"716-neutral": [0, 1, 1],
"717": [0, 1, 1],
"720-unbound": [1, 1, 1],
"720": [1, 1, 1],
"728": [0, 1, 1],
"729": [0, 1, 1],
"730": [0, 1, 1],
"734": [0, 1, 1],
"735": [0, 1, 1],
"742": [0, 2, 2],
"743": [0, 2, 2],
"747": [0, 2, 2],
"748": [0, 1, 1],
"751": [0, 1, 1],
"752": [0, 1, 1],
"753": [0, 1, 1],
"754": [0, 2, 2],
"755": [0, 1, 1],
"756": [0, 1, 1],
"761": [0, 1, 1],
"762": [0, 1, 1],
"763": [0, 1, 1],
"767": [0, 1, 1],
"768": [0, 1, 1],
"771": [0, 1, 1],
"772": [0, 1, 1],
"773-fighting": [0, 1, 1],
"773-psychic": [0, 1, 1],
"773-poison": [0, 1, 1],
"773-ground": [0, 1, 1],
"773-ghost": [0, 1, 1],
"773-steel": [0, 1, 1],
"773-rock": [0, 1, 1],
"773-grass": [0, 1, 1],
"773-dragon": [0, 1, 1],
"773-bug": [0, 1, 1],
"773-ice": [0, 1, 1],
"773-dark": [0, 1, 1],
"773": [0, 1, 1],
"773-fairy": [0, 1, 1],
"773-water": [0, 1, 1],
"773-electric": [0, 1, 1],
"773-flying": [0, 1, 1],
"773-fire": [0, 1, 1],
"776": [0, 2, 2],
"777": [0, 1, 1],
"778-busted": [0, 1, 1],
"778-disguised": [0, 1, 1],
"779": [0, 1, 1],
"789": [1, 1, 1],
"790": [0, 1, 1],
"791": [1, 1, 1],
"792": [0, 1, 1],
"793": [0, 1, 1],
"797": [0, 1, 1],
"798": [0, 1, 1],
"800-dawn-wings": [0, 1, 1],
"800-dusk-mane": [0, 1, 1],
"800-ultra": [0, 1, 1],
"800": [0, 1, 1],
"802": [1, 1, 1],
"803": [0, 1, 1],
"804": [0, 1, 1],
"807": [0, 1, 1],
"808": [0, 1, 1],
"809": [0, 1, 1],
"816": [0, 1, 1],
"817": [0, 1, 1],
"818": [0, 1, 1],
"821": [0, 1, 1],
"822": [0, 1, 1],
"823": [0, 1, 1],
"829": [0, 1, 1],
"830": [0, 1, 1],
"835": [0, 1, 1],
"836": [0, 1, 1],
"850": [0, 1, 1],
"851": [0, 1, 1],
"854": [0, 1, 1],
"855": [0, 1, 1],
"856": [0, 1, 1],
"857": [0, 2, 2],
"858": [0, 1, 1],
"859": [0, 1, 1],
"860": [0, 1, 1],
"861": [0, 1, 1],
"862": [0, 1, 1],
"863": [0, 1, 1],
"864": [0, 1, 1],
"867": [0, 1, 1],
"872": [1, 1, 1],
"873": [1, 1, 1],
"876-female": [0, 1, 1],
"876": [0, 1, 1],
"877-hangry": [1, 1, 1],
"877": [1, 1, 1],
"880": [0, 1, 1],
"881": [0, 1, 1],
"882": [0, 1, 1],
"883": [0, 1, 1],
"884": [0, 1, 1],
"885": [1, 1, 1],
"886": [1, 1, 1],
"887": [1, 1, 1],
"888": [0, 1, 1],
"888-crowned": [0, 1, 1],
"889": [0, 1, 1],
"889-crowned": [0, 1, 1],
"890": [0, 1, 1],
"891": [1, 1, 1],
"892-rapid-strike": [1, 1, 1],
"892": [1, 1, 1],
"894": [0, 1, 1],
"895": [0, 1, 1],
"896": [1, 1, 1],
"897": [1, 1, 1],
"898": [1, 1, 1],
"898-ice": [1, 1, 1],
"898-shadow": [1, 1, 1],
"900": [0, 1, 1],
"901": [0, 1, 1],
"903": [0, 1, 1],
"909": [0, 1, 1],
"910": [0, 2, 2],
"911": [0, 1, 1],
"912": [0, 1, 1],
"913": [0, 1, 1],
"914": [0, 2, 2],
"919": [1, 1, 1],
"920": [1, 1, 1],
"924": [1, 1, 1],
"925-four": [1, 2, 2],
"925-three": [1, 2, 2],
"932": [0, 1, 1],
"933": [0, 1, 1],
"934": [0, 1, 1],
"935": [2, 2, 2],
"936": [2, 2, 2],
"937": [2, 2, 2],
"940": [0, 1, 1],
"941": [0, 1, 1],
"944": [0, 1, 1],
"945": [0, 1, 1],
"948": [0, 1, 1],
"949": [0, 1, 1],
"951": [0, 1, 1],
"952": [0, 2, 1],
"953": [0, 1, 1],
"954": [0, 1, 1],
"957": [1, 1, 1],
"958": [1, 1, 1],
"959": [1, 1, 1],
"962": [1, 1, 1],
"967": [0, 1, 1],
"968": [0, 2, 2],
"969": [0, 1, 1],
"970": [0, 1, 1],
"973": [1, 1, 1],
"974": [0, 1, 1],
"975": [0, 1, 1],
"978-curly": [0, 2, 2],
"978-droopy": [0, 2, 2],
"978-stretchy": [0, 1, 1],
"979": [1, 1, 1],
"981": [0, 1, 1],
"982": [0, 1, 1],
"982-three-segment": [0, 1, 1],
"987": [1, 1, 1],
"988": [0, 1, 1],
"993": [0, 1, 1],
"994": [0, 1, 1],
"995": [0, 1, 1],
"996": [0, 1, 1],
"997": [0, 1, 1],
"998": [0, 1, 1],
"999": [1, 1, 1],
"1000": [1, 1, 1],
"1001": [0, 1, 1],
"1003": [0, 1, 1],
"1004": [0, 1, 1],
"1006": [0, 2, 2],
"1007-apex-build": [0, 2, 2],
"1008-ultimate-mode": [1, 1, 1],
"2026": [0, 1, 1],
"2027": [0, 1, 1],
"2028": [0, 1, 1],
"2052": [0, 1, 1],
"2053": [0, 1, 1],
"2103": [0, 1, 1],
"4052": [0, 1, 1],
"4077": [0, 1, 1],
"4078": [0, 1, 1],
"4079": [0, 1, 1],
"4080": [2, 2, 2],
"4144": [0, 1, 1],
"4145": [0, 1, 1],
"4146": [0, 1, 1],
"4199": [2, 1, 1],
"4222": [0, 1, 1],
"4263": [0, 1, 1],
"4264": [0, 1, 1],
"4562": [0, 1, 1],
"6100": [0, 1, 1],
"6101": [0, 1, 1],
"6215": [0, 1, 1],
"6503": [0, 1, 1],
"6549": [0, 1, 1],
"6570": [0, 1, 1],
"6571": [0, 1, 1],
"6705": [0, 1, 1],
"6706": [0, 1, 1],
"6713": [0, 1, 1],
"female": {
"6215": [0, 1, 1]
}
}
}

View File

@ -1813,669 +1813,5 @@
"593": [1, 1, 1],
"6215": [0, 1, 1]
}
},
"exp": {
"3-mega": [0, 2, 2],
"6-mega-x": [0, 2, 2],
"6-mega-y": [0, 2, 2],
"80-mega": [0, 1, 1],
"94-mega": [2, 2, 2],
"127-mega": [0, 1, 1],
"130-mega": [0, 1, 1],
"142-mega": [0, 1, 1],
"150-mega-x": [0, 1, 1],
"150-mega-y": [0, 1, 1],
"181-mega": [0, 1, 2],
"212-mega": [1, 1, 2],
"229-mega": [0, 1, 1],
"248-mega": [0, 1, 1],
"257-mega": [0, 1, 1],
"282-mega": [0, 2, 2],
"302-mega": [0, 1, 1],
"303-mega": [0, 1, 1],
"306-mega": [1, 1, 1],
"308-mega": [0, 1, 1],
"310-mega": [0, 1, 1],
"334-mega": [0, 2, 1],
"354-mega": [0, 1, 1],
"359-mega": [0, 1, 1],
"362-mega": [0, 1, 1],
"373-mega": [0, 1, 1],
"376-mega": [0, 1, 1],
"380-mega": [0, 1, 1],
"381-mega": [0, 1, 1],
"382-primal": [0, 1, 1],
"383-primal": [0, 1, 1],
"384-mega": [0, 2, 1],
"428-mega": [0, 1, 1],
"445-mega": [1, 1, 1],
"448-mega": [1, 1, 1],
"475-mega": [0, 2, 2],
"531-mega": [0, 1, 1],
"653": [0, 1, 1],
"654": [0, 1, 1],
"655": [0, 1, 1],
"656": [0, 1, 1],
"657": [0, 1, 1],
"658": [0, 1, 1],
"658-ash": [0, 1, 1],
"664": [0, 1, 1],
"665": [0, 1, 1],
"666-archipelago": [0, 1, 1],
"666-continental": [0, 1, 1],
"666-elegant": [0, 1, 1],
"666-fancy": [0, 1, 1],
"666-garden": [0, 1, 1],
"666-high-plains": [0, 1, 1],
"666-icy-snow": [0, 1, 1],
"666-jungle": [0, 1, 1],
"666-marine": [0, 1, 1],
"666-meadow": [0, 1, 1],
"666-modern": [0, 1, 1],
"666-monsoon": [0, 1, 1],
"666-ocean": [0, 1, 1],
"666-poke-ball": [0, 1, 1],
"666-polar": [0, 1, 1],
"666-river": [0, 1, 1],
"666-sandstorm": [0, 1, 1],
"666-savanna": [0, 1, 1],
"666-sun": [0, 1, 1],
"666-tundra": [0, 1, 1],
"669-red": [0, 2, 2],
"669-blue": [0, 1, 1],
"669-white": [0, 1, 1],
"669-yellow": [0, 1, 1],
"669-orange": [0, 2, 2],
"670-white": [0, 1, 1],
"670-blue": [0, 1, 1],
"670-orange": [0, 1, 1],
"670-red": [0, 1, 1],
"670-yellow": [0, 1, 1],
"671-red": [0, 1, 2],
"671-blue": [0, 1, 2],
"671-yellow": [0, 1, 1],
"671-white": [0, 1, 2],
"671-orange": [0, 1, 2],
"672": [0, 1, 1],
"673": [0, 1, 1],
"676": [0, 1, 1],
"677": [0, 1, 1],
"678-female": [0, 1, 1],
"678": [0, 1, 1],
"682": [0, 1, 1],
"683": [0, 1, 1],
"684": [0, 1, 1],
"685": [0, 1, 1],
"688": [0, 1, 1],
"689": [0, 1, 1],
"690": [0, 1, 1],
"691": [0, 1, 1],
"696": [0, 1, 1],
"697": [0, 1, 1],
"698": [0, 1, 1],
"699": [0, 1, 1],
"700": [0, 1, 1],
"702": [0, 1, 1],
"703": [0, 1, 1],
"704": [0, 1, 1],
"705": [0, 1, 1],
"706": [0, 1, 1],
"708": [0, 1, 1],
"709": [0, 1, 1],
"710": [0, 1, 1],
"711": [1, 1, 1],
"712": [0, 1, 1],
"713": [0, 1, 1],
"714": [0, 1, 1],
"715": [0, 1, 1],
"716-active": [0, 1, 1],
"716-neutral": [0, 1, 1],
"717": [0, 2, 2],
"720-unbound": [1, 1, 1],
"720": [1, 1, 1],
"728": [0, 1, 1],
"729": [0, 1, 1],
"730": [0, 1, 1],
"734": [0, 1, 1],
"735": [0, 1, 1],
"742": [0, 2, 2],
"743": [0, 2, 2],
"747": [0, 2, 2],
"748": [0, 1, 1],
"751": [0, 1, 1],
"752": [0, 1, 1],
"753": [0, 1, 1],
"754": [0, 2, 2],
"755": [0, 1, 1],
"756": [0, 1, 1],
"761": [0, 1, 1],
"762": [0, 1, 1],
"763": [0, 1, 1],
"767": [0, 1, 1],
"768": [0, 1, 1],
"770": [0, 0, 0],
"771": [0, 2, 2],
"772": [0, 1, 1],
"773-fighting": [0, 1, 1],
"773-psychic": [0, 1, 1],
"773-poison": [0, 1, 1],
"773-ground": [0, 1, 1],
"773-ghost": [0, 1, 1],
"773-steel": [0, 1, 1],
"773-rock": [0, 1, 1],
"773-grass": [0, 1, 1],
"773-dragon": [0, 1, 1],
"773-bug": [0, 1, 1],
"773-ice": [0, 1, 1],
"773-dark": [0, 1, 1],
"773": [0, 1, 1],
"773-fairy": [0, 1, 1],
"773-water": [0, 1, 1],
"773-electric": [0, 1, 1],
"773-flying": [0, 1, 1],
"773-fire": [0, 1, 1],
"776": [0, 1, 1],
"777": [0, 1, 1],
"778-busted": [0, 1, 1],
"778-disguised": [0, 1, 1],
"779": [0, 1, 1],
"789": [1, 1, 1],
"790": [0, 1, 1],
"791": [2, 1, 1],
"792": [0, 1, 1],
"793": [0, 2, 2],
"797": [0, 1, 1],
"798": [0, 1, 1],
"800-dawn-wings": [0, 1, 1],
"800-dusk-mane": [0, 1, 1],
"800-ultra": [0, 1, 1],
"800": [0, 1, 1],
"802": [1, 1, 1],
"803": [0, 1, 1],
"804": [0, 1, 1],
"807": [0, 1, 1],
"808": [0, 1, 1],
"809": [0, 1, 1],
"816": [0, 1, 1],
"817": [0, 1, 1],
"818": [1, 1, 1],
"821": [0, 2, 2],
"822": [0, 1, 1],
"823": [0, 1, 1],
"829": [0, 1, 1],
"830": [0, 1, 1],
"835": [0, 1, 1],
"836": [0, 2, 2],
"850": [0, 1, 1],
"851": [0, 1, 1],
"854": [0, 1, 1],
"855": [0, 1, 1],
"856": [0, 1, 1],
"857": [0, 2, 2],
"858": [0, 1, 1],
"859": [0, 1, 1],
"860": [0, 1, 1],
"861": [0, 1, 1],
"862": [0, 1, 1],
"863": [0, 1, 1],
"864": [0, 1, 1],
"867": [0, 1, 1],
"872": [1, 1, 1],
"873": [1, 1, 1],
"876-female": [0, 1, 1],
"876": [0, 1, 1],
"877-hangry": [1, 1, 1],
"877": [1, 1, 1],
"880": [0, 1, 1],
"881": [0, 1, 1],
"882": [0, 2, 1],
"883": [0, 1, 1],
"884": [0, 1, 1],
"885": [1, 1, 1],
"886": [1, 1, 1],
"887": [1, 1, 1],
"888": [0, 1, 1],
"888-crowned": [0, 1, 1],
"889": [0, 1, 1],
"889-crowned": [0, 1, 1],
"890": [0, 2, 1],
"890-eternamax": [0, 1, 1],
"891": [1, 1, 1],
"892-rapid-strike": [1, 1, 1],
"892": [1, 1, 1],
"894": [0, 1, 1],
"895": [0, 1, 1],
"896": [1, 1, 1],
"897": [1, 1, 1],
"898": [1, 1, 1],
"898-ice": [1, 1, 1],
"898-shadow": [1, 1, 1],
"900": [0, 1, 1],
"901": [0, 1, 1],
"903": [0, 1, 1],
"909": [0, 1, 1],
"910": [0, 2, 2],
"911": [0, 2, 2],
"912": [0, 1, 2],
"913": [0, 1, 2],
"914": [0, 2, 1],
"919": [1, 1, 1],
"920": [1, 1, 1],
"924": [1, 1, 1],
"925-four": [1, 2, 2],
"925-three": [1, 2, 2],
"932": [0, 2, 2],
"933": [0, 2, 2],
"934": [0, 1, 1],
"935": [1, 1, 2],
"936": [2, 2, 2],
"937": [2, 2, 2],
"940": [0, 1, 1],
"941": [0, 1, 1],
"944": [0, 1, 1],
"945": [0, 1, 1],
"948": [0, 1, 1],
"949": [0, 1, 1],
"951": [0, 1, 1],
"952": [0, 1, 1],
"953": [0, 1, 1],
"954": [0, 1, 1],
"957": [2, 2, 2],
"958": [2, 2, 2],
"959": [2, 2, 2],
"962": [1, 1, 1],
"967": [0, 1, 1],
"968": [0, 1, 1],
"969": [0, 1, 1],
"970": [0, 1, 1],
"973": [1, 1, 1],
"974": [0, 1, 1],
"975": [0, 1, 1],
"978-curly": [0, 2, 2],
"978-droopy": [0, 2, 2],
"978-stretchy": [0, 2, 2],
"979": [2, 2, 2],
"981": [0, 1, 1],
"982": [0, 1, 1],
"982-three-segment": [0, 1, 1],
"987": [1, 1, 1],
"988": [0, 1, 2],
"993": [0, 1, 1],
"994": [0, 1, 2],
"995": [0, 1, 1],
"996": [0, 1, 1],
"997": [0, 2, 2],
"998": [0, 2, 2],
"999": [2, 1, 1],
"1000": [1, 1, 1],
"1001": [0, 1, 1],
"1003": [0, 1, 1],
"1004": [0, 1, 1],
"1006": [0, 2, 1],
"1007-apex-build": [0, 2, 2],
"1008-ultimate-mode": [1, 1, 1],
"2026": [0, 1, 1],
"2027": [0, 1, 1],
"2028": [0, 1, 1],
"2052": [0, 1, 1],
"2053": [0, 1, 0],
"2103": [0, 1, 1],
"4052": [0, 1, 1],
"4077": [0, 1, 1],
"4078": [0, 1, 1],
"4079": [0, 1, 1],
"4080": [2, 1, 1],
"4144": [0, 1, 1],
"4145": [0, 1, 1],
"4146": [0, 1, 1],
"4199": [2, 1, 1],
"4222": [0, 1, 1],
"4263": [0, 1, 1],
"4264": [0, 1, 1],
"4562": [0, 1, 1],
"6100": [0, 1, 1],
"6101": [0, 1, 1],
"6215": [0, 1, 1],
"6503": [0, 1, 1],
"6549": [0, 1, 1],
"6570": [0, 1, 1],
"6571": [0, 1, 1],
"6705": [0, 1, 1],
"6706": [0, 1, 1],
"6713": [0, 1, 1],
"female": {
"6215": [0, 1, 1]
},
"back": {
"3-mega": [0, 2, 2],
"6-mega-x": [0, 2, 2],
"6-mega-y": [0, 1, 2],
"80-mega": [0, 1, 1],
"94-mega": [1, 1, 1],
"127-mega": [0, 1, 1],
"130-mega": [0, 1, 1],
"142-mega": [0, 1, 1],
"150-mega-x": [0, 1, 1],
"150-mega-y": [0, 1, 1],
"181-mega": [0, 1, 2],
"212-mega": [1, 2, 2],
"229-mega": [0, 1, 1],
"248-mega": [0, 1, 1],
"257-mega": [0, 1, 1],
"282-mega": [0, 1, 1],
"302-mega": [0, 1, 1],
"303-mega": [0, 1, 1],
"306-mega": [1, 1, 1],
"308-mega": [0, 1, 1],
"310-mega": [0, 1, 1],
"334-mega": [0, 1, 1],
"354-mega": [0, 1, 1],
"359-mega": [0, 1, 1],
"362-mega": [0, 1, 1],
"373-mega": [0, 1, 1],
"376-mega": [0, 1, 1],
"380-mega": [0, 1, 1],
"381-mega": [0, 1, 1],
"382-primal": [0, 1, 1],
"383-primal": [0, 1, 1],
"384-mega": [0, 1, 1],
"428-mega": [0, 1, 1],
"445-mega": [1, 1, 1],
"448-mega": [1, 1, 1],
"475-mega": [0, 2, 2],
"531-mega": [0, 1, 1],
"653": [0, 1, 1],
"654": [0, 1, 1],
"655": [0, 1, 1],
"656": [0, 1, 1],
"657": [0, 1, 1],
"658": [0, 1, 1],
"658-ash": [0, 1, 1],
"664": [0, 1, 1],
"665": [0, 1, 1],
"666-archipelago": [0, 1, 1],
"666-continental": [0, 1, 1],
"666-elegant": [0, 1, 1],
"666-fancy": [0, 1, 1],
"666-garden": [0, 1, 1],
"666-high-plains": [0, 1, 1],
"666-icy-snow": [0, 1, 1],
"666-jungle": [0, 1, 1],
"666-marine": [0, 1, 1],
"666-meadow": [0, 1, 1],
"666-modern": [0, 1, 1],
"666-monsoon": [0, 1, 1],
"666-ocean": [0, 1, 1],
"666-poke-ball": [0, 1, 1],
"666-polar": [0, 1, 1],
"666-river": [0, 1, 1],
"666-sandstorm": [0, 1, 1],
"666-savanna": [0, 1, 1],
"666-sun": [0, 1, 1],
"666-tundra": [0, 1, 1],
"669-red": [0, 2, 2],
"669-blue": [0, 2, 2],
"669-white": [0, 2, 2],
"669-yellow": [0, 2, 2],
"669-orange": [0, 2, 2],
"670-white": [0, 1, 1],
"670-blue": [0, 2, 2],
"670-orange": [0, 1, 1],
"670-red": [0, 1, 1],
"670-yellow": [0, 1, 1],
"671-red": [0, 1, 1],
"671-blue": [0, 1, 1],
"671-yellow": [0, 1, 1],
"671-white": [0, 1, 1],
"671-orange": [0, 1, 1],
"672": [0, 1, 1],
"673": [0, 1, 1],
"676": [0, 1, 1],
"677": [0, 1, 1],
"678-female": [0, 1, 1],
"678": [0, 1, 1],
"682": [0, 1, 1],
"683": [0, 1, 1],
"684": [0, 1, 1],
"685": [0, 1, 1],
"688": [0, 1, 1],
"689": [0, 1, 1],
"690": [0, 1, 1],
"691": [0, 1, 1],
"696": [0, 1, 1],
"697": [0, 1, 1],
"698": [0, 1, 1],
"699": [0, 2, 2],
"700": [0, 1, 1],
"702": [0, 1, 1],
"703": [0, 1, 1],
"704": [0, 1, 1],
"705": [0, 1, 1],
"706": [0, 1, 1],
"708": [0, 1, 1],
"709": [0, 1, 1],
"710": [0, 1, 1],
"711": [1, 1, 1],
"712": [0, 1, 1],
"713": [0, 1, 1],
"714": [0, 1, 1],
"715": [0, 1, 1],
"716-active": [0, 1, 1],
"716-neutral": [0, 1, 1],
"717": [0, 1, 1],
"720-unbound": [1, 1, 1],
"720": [1, 1, 1],
"728": [0, 1, 1],
"729": [0, 1, 1],
"730": [0, 1, 1],
"734": [0, 1, 1],
"735": [0, 1, 1],
"742": [0, 2, 2],
"743": [0, 2, 2],
"747": [0, 2, 2],
"748": [0, 1, 1],
"751": [0, 1, 1],
"752": [0, 1, 1],
"753": [0, 1, 1],
"754": [0, 2, 2],
"755": [0, 1, 1],
"756": [0, 1, 1],
"761": [0, 1, 1],
"762": [0, 1, 1],
"763": [0, 1, 1],
"767": [0, 1, 1],
"768": [0, 1, 1],
"771": [0, 1, 1],
"772": [0, 1, 1],
"773-fighting": [0, 1, 1],
"773-psychic": [0, 1, 1],
"773-poison": [0, 1, 1],
"773-ground": [0, 1, 1],
"773-ghost": [0, 1, 1],
"773-steel": [0, 1, 1],
"773-rock": [0, 1, 1],
"773-grass": [0, 1, 1],
"773-dragon": [0, 1, 1],
"773-bug": [0, 1, 1],
"773-ice": [0, 1, 1],
"773-dark": [0, 1, 1],
"773": [0, 1, 1],
"773-fairy": [0, 1, 1],
"773-water": [0, 1, 1],
"773-electric": [0, 1, 1],
"773-flying": [0, 1, 1],
"773-fire": [0, 1, 1],
"776": [0, 2, 2],
"777": [0, 1, 1],
"778-busted": [0, 1, 1],
"778-disguised": [0, 1, 1],
"779": [0, 1, 1],
"789": [1, 1, 1],
"790": [0, 1, 1],
"791": [1, 1, 1],
"792": [0, 1, 1],
"793": [0, 1, 1],
"797": [0, 1, 1],
"798": [0, 1, 1],
"800-dawn-wings": [0, 1, 1],
"800-dusk-mane": [0, 1, 1],
"800-ultra": [0, 1, 1],
"800": [0, 1, 1],
"802": [1, 1, 1],
"803": [0, 1, 1],
"804": [0, 1, 1],
"807": [0, 1, 1],
"808": [0, 1, 1],
"809": [0, 1, 1],
"816": [0, 1, 1],
"817": [0, 1, 1],
"818": [0, 1, 1],
"821": [0, 1, 1],
"822": [0, 1, 1],
"823": [0, 1, 1],
"829": [0, 1, 1],
"830": [0, 1, 1],
"835": [0, 1, 1],
"836": [0, 1, 1],
"850": [0, 1, 1],
"851": [0, 1, 1],
"854": [0, 1, 1],
"855": [0, 1, 1],
"856": [0, 1, 1],
"857": [0, 2, 2],
"858": [0, 1, 1],
"859": [0, 1, 1],
"860": [0, 1, 1],
"861": [0, 1, 1],
"862": [0, 1, 1],
"863": [0, 1, 1],
"864": [0, 1, 1],
"867": [0, 1, 1],
"872": [1, 1, 1],
"873": [1, 1, 1],
"876-female": [0, 1, 1],
"876": [0, 1, 1],
"877-hangry": [1, 1, 1],
"877": [1, 1, 1],
"880": [0, 1, 1],
"881": [0, 1, 1],
"882": [0, 1, 1],
"883": [0, 1, 1],
"884": [0, 1, 1],
"885": [1, 1, 1],
"886": [1, 1, 1],
"887": [1, 1, 1],
"888": [0, 1, 1],
"888-crowned": [0, 1, 1],
"889": [0, 1, 1],
"889-crowned": [0, 1, 1],
"890": [0, 1, 1],
"891": [1, 1, 1],
"892-rapid-strike": [1, 1, 1],
"892": [1, 1, 1],
"894": [0, 1, 1],
"895": [0, 1, 1],
"896": [1, 1, 1],
"897": [1, 1, 1],
"898": [1, 1, 1],
"898-ice": [1, 1, 1],
"898-shadow": [1, 1, 1],
"900": [0, 1, 1],
"901": [0, 1, 1],
"903": [0, 1, 1],
"909": [0, 1, 1],
"910": [0, 2, 2],
"911": [0, 1, 1],
"912": [0, 1, 1],
"913": [0, 1, 1],
"914": [0, 2, 2],
"919": [1, 1, 1],
"920": [1, 1, 1],
"924": [1, 1, 1],
"925-four": [1, 2, 2],
"925-three": [1, 2, 2],
"932": [0, 1, 1],
"933": [0, 1, 1],
"934": [0, 1, 1],
"935": [2, 2, 2],
"936": [2, 2, 2],
"937": [2, 2, 2],
"940": [0, 1, 1],
"941": [0, 1, 1],
"944": [0, 1, 1],
"945": [0, 1, 1],
"948": [0, 1, 1],
"949": [0, 1, 1],
"951": [0, 1, 1],
"952": [0, 2, 1],
"953": [0, 1, 1],
"954": [0, 1, 1],
"957": [1, 1, 1],
"958": [1, 1, 1],
"959": [1, 1, 1],
"962": [1, 1, 1],
"967": [0, 1, 1],
"968": [0, 2, 2],
"969": [0, 1, 1],
"970": [0, 1, 1],
"973": [1, 1, 1],
"974": [0, 1, 1],
"975": [0, 1, 1],
"978-curly": [0, 2, 2],
"978-droopy": [0, 2, 2],
"978-stretchy": [0, 1, 1],
"979": [1, 1, 1],
"981": [0, 1, 1],
"982": [0, 1, 1],
"982-three-segment": [0, 1, 1],
"987": [1, 1, 1],
"988": [0, 1, 1],
"993": [0, 1, 1],
"994": [0, 1, 1],
"995": [0, 1, 1],
"996": [0, 1, 1],
"997": [0, 1, 1],
"998": [0, 1, 1],
"999": [1, 1, 1],
"1000": [1, 1, 1],
"1001": [0, 1, 1],
"1003": [0, 1, 1],
"1004": [0, 1, 1],
"1006": [0, 2, 2],
"1007-apex-build": [0, 2, 2],
"1008-ultimate-mode": [1, 1, 1],
"2026": [0, 1, 1],
"2027": [0, 1, 1],
"2028": [0, 1, 1],
"2052": [0, 1, 1],
"2053": [0, 1, 1],
"2103": [0, 1, 1],
"4052": [0, 1, 1],
"4077": [0, 1, 1],
"4078": [0, 1, 1],
"4079": [0, 1, 1],
"4080": [2, 2, 2],
"4144": [0, 1, 1],
"4145": [0, 1, 1],
"4146": [0, 1, 1],
"4199": [2, 1, 1],
"4222": [0, 1, 1],
"4263": [0, 1, 1],
"4264": [0, 1, 1],
"4562": [0, 1, 1],
"6100": [0, 1, 1],
"6101": [0, 1, 1],
"6215": [0, 1, 1],
"6503": [0, 1, 1],
"6549": [0, 1, 1],
"6570": [0, 1, 1],
"6571": [0, 1, 1],
"6705": [0, 1, 1],
"6706": [0, 1, 1],
"6713": [0, 1, 1],
"female": {
"6215": [0, 1, 1]
}
}
}
}

View File

@ -1,48 +0,0 @@
{
"1": {
"cbaa84": "44827c",
"b3747e": "4b7465",
"eeffbf": "cdffb5",
"dcffb2": "8eeab9",
"ffbfca": "43bf8d",
"b7ffb2": "72d8ce",
"fff2b2": "9bffa9",
"85b4cc": "cf755d",
"a6e1ff": "efab87",
"101010": "101010",
"cacaca": "cacaca",
"537180": "b04f4b",
"2eaeec": "4dc796",
"1f75a0": "29988e",
"fdfdfd": "fdfdfd",
"d197a1": "d197a1",
"ffdce6": "ffdce6",
"217aa6": "7f99e1",
"30b2f2": "b5dcff",
"f9f9f9": "e6e3b4",
"c0c0c0": "d7cca0"
},
"2": {
"cbaa84": "cc78db",
"b3747e": "c452a6",
"eeffbf": "ed9ff2",
"dcffb2": "d7bbf4",
"ffbfca": "faccff",
"b7ffb2": "dceeff",
"fff2b2": "eb88b9",
"85b4cc": "654a8a",
"a6e1ff": "936daa",
"101010": "101010",
"cacaca": "cacaca",
"537180": "392d65",
"2eaeec": "ad4e6e",
"1f75a0": "8d2656",
"fdfdfd": "fdfdfd",
"d197a1": "d197a1",
"ffdce6": "ffdce6",
"217aa6": "efaa51",
"30b2f2": "ffd169",
"f9f9f9": "373453",
"c0c0c0": "282747"
}
}

View File

@ -1,32 +0,0 @@
{
"1": {
"535763": "292638",
"306090": "c35b2a",
"c3c7d3": "68638e",
"88aacc": "e67c37",
"fefefe": "fefefe",
"a3a7b3": "4d496b",
"737783": "37344e",
"101010": "101010",
"bbddff": "ffa633",
"1fbfdf": "ff9b44",
"5f6060": "e6ac60",
"fcfefe": "ffeed6",
"bfbbbb": "ffd3a1"
},
"2": {
"535763": "976ba9",
"306090": "a03c69",
"c3c7d3": "faecff",
"88aacc": "e25493",
"fefefe": "ffe2ee",
"a3a7b3": "e4cdf9",
"737783": "cca1db",
"101010": "101010",
"bbddff": "f591bd",
"1fbfdf": "de5f8e",
"5f6060": "5a3d84",
"fcfefe": "a473bf",
"bfbbbb": "8359a7"
}
}

View File

@ -1,28 +0,0 @@
{
"1": {
"101010": "101010",
"2b2a3a": "722023",
"603d2b": "36384f",
"215738": "4d362e",
"48484a": "a14743",
"c18760": "7c808c",
"3fa76c": "907f76",
"915e45": "575a6a",
"0b0c0b": "0b0c0b",
"da585b": "5996d2",
"ff8c8f": "87d1ff"
},
"2": {
"101010": "101010",
"2b2a3a": "6f5f80",
"603d2b": "31161d",
"215738": "a94079",
"48484a": "9c92a4",
"c18760": "7e5658",
"3fa76c": "da7ea8",
"915e45": "56323a",
"0b0c0b": "0b0c0b",
"da585b": "e18933",
"ff8c8f": "ffc875"
}
}

View File

@ -1,32 +0,0 @@
{
"1": {
"6a3f73": "731338",
"bd70cc": "a42c54",
"101010": "101010",
"bfacbf": "7047ba",
"8e5499": "8e1d4b",
"f2daf2": "8d7be3",
"404040": "202558",
"665c66": "2f386b",
"ccb43d": "ff8a58",
"f8f8f8": "8d7be3",
"595959": "2f386b",
"ffe14c": "ffc182",
"000000": "101010"
},
"2": {
"6a3f73": "5f151c",
"bd70cc": "c24430",
"101010": "101010",
"bfacbf": "f9e8dd",
"8e5499": "882c27",
"f2daf2": "f8f8f8",
"404040": "5b1922",
"665c66": "7c2928",
"ccb43d": "33d8d0",
"f8f8f8": "f8f8f8",
"595959": "7c2928",
"ffe14c": "49ffcd",
"000000": "101010"
}
}

View File

@ -1,38 +0,0 @@
{
"1": {
"b3747e": "4b7465",
"ffbfca": "43bf8d",
"fff2b2": "9bffa9",
"537180": "b04f4b",
"a6e1ff": "efab87",
"101010": "101010",
"85b4cc": "cf755d",
"217aa6": "7f99e1",
"30b2f2": "b5dcff",
"fdfdfd": "fdfdfd",
"c0c0c0": "d7cca0",
"cacaca": "cacaca",
"cbaa84": "44827c",
"dcffb2": "8eeab9",
"eeffbf": "cdffb5",
"b7ffb2": "72d8ce"
},
"2": {
"b3747e": "c452a6",
"ffbfca": "faccff",
"fff2b2": "eb88b9",
"537180": "392d65",
"a6e1ff": "936daa",
"101010": "101010",
"85b4cc": "654a8a",
"217aa6": "efaa51",
"30b2f2": "ffd169",
"fdfdfd": "fdfdfd",
"c0c0c0": "282747",
"cacaca": "cacaca",
"cbaa84": "cc78db",
"dcffb2": "d7bbf4",
"eeffbf": "ed9ff2",
"b7ffb2": "dceeff"
}
}

View File

@ -1,28 +0,0 @@
{
"1": {
"306090": "c35b2a",
"88aacc": "e67c37",
"fefefe": "fefefe",
"535763": "292638",
"a3a7b3": "4d496b",
"737783": "37344e",
"bbddff": "ffa633",
"101010": "101010",
"5f6060": "e6ac60",
"bfbbbb": "ffd3a1",
"fcfefe": "ffeed6"
},
"2": {
"306090": "a03c69",
"88aacc": "e25493",
"fefefe": "ffe2ee",
"535763": "976ba9",
"a3a7b3": "e4cdf9",
"737783": "cca1db",
"bbddff": "f591bd",
"101010": "101010",
"5f6060": "5a3d84",
"bfbbbb": "8359a7",
"fcfefe": "a473bf"
}
}

View File

@ -1,40 +0,0 @@
{
"1": {
"1a1a1c": "1a1a1c",
"686665": "646085",
"103222": "802c26",
"221b17": "221b17",
"090606": "090606",
"4ab38e": "a14743",
"38956f": "a14743",
"ab9074": "7c808c",
"4e4e4e": "494e5b",
"917860": "7c808c",
"424244": "2b303c",
"78604c": "575a6a",
"6b5442": "40435a",
"5f4939": "36384f",
"4f2a09": "292929",
"6c4513": "36384f",
"353638": "353638"
},
"2": {
"1a1a1c": "1a1a1c",
"686665": "ccc3cf",
"103222": "a94079",
"221b17": "221b17",
"090606": "090606",
"4ab38e": "da7ea8",
"38956f": "da7ea8",
"ab9074": "7e5658",
"4e4e4e": "9c92a4",
"917860": "7e5658",
"424244": "6f5f80",
"78604c": "56323a",
"6b5442": "47232b",
"5f4939": "31161d",
"4f2a09": "250e14",
"6c4513": "31161d",
"353638": "57496b"
}
}

View File

@ -1,24 +0,0 @@
{
"1": {
"101010": "101010",
"6a3f73": "500a25",
"bd70cc": "a42c54",
"8e5499": "8e1d4b",
"404040": "202558",
"595959": "2f386b",
"bfacbf": "8d7be3",
"665c66": "2f386b",
"f2daf2": "8d7be3"
},
"2": {
"101010": "101010",
"6a3f73": "5f151c",
"bd70cc": "c24430",
"8e5499": "882c27",
"404040": "5b1922",
"595959": "7c2928",
"bfacbf": "f9e8dd",
"665c66": "7c2928",
"f2daf2": "f9e8dd"
}
}

View File

@ -22,6 +22,9 @@ from typing import Literal as L
MASTERLIST_PATH = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "public", "images", "pokemon", "variant", "_masterlist.json"
)
EXP_MASTERLIST_PATH = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "public", "images", "pokemon", "variant", "_exp_masterlist.json"
)
DEFAULT_OUTPUT_PATH = "sprite-mismatches.csv"
@ -93,6 +96,7 @@ if __name__ == "__main__":
help=f"The path to a file to save the output file. If not specified, will write to {DEFAULT_OUTPUT_PATH}.",
)
p.add_argument("--masterlist", default=MASTERLIST_PATH, help=f"The path to the masterlist file to validate. Defaults to {MASTERLIST_PATH}.")
p.add_argument("--exp-masterlist", default=EXP_MASTERLIST_PATH, help=f"The path to the exp masterlist file to validate against. Defaults to {EXP_MASTERLIST_PATH}.")
args = p.parse_args()
mismatches = make_mismatch_sprite_list(args.masterlist)
write_mismatch_csv(args.output, mismatches)

View File

@ -0,0 +1,6 @@
import type { SessionSaveData } from "#app/system/game-data";
export interface SessionSaveMigrator {
version: string;
migrate: (data: SessionSaveData) => void;
}

View File

@ -0,0 +1,5 @@
export interface SettingsSaveMigrator {
version: string;
// biome-ignore lint/complexity/noBannedTypes: TODO - refactor settings
migrate: (data: Object) => void;
}

View File

@ -0,0 +1,6 @@
import type { SystemSaveData } from "#app/system/game-data";
export interface SystemSaveMigrator {
version: string;
migrate: (data: SystemSaveData) => void;
}

View File

@ -0,0 +1,11 @@
import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
import type Move from "#app/data/moves/move";
import type Pokemon from "#app/field/pokemon";
import type { BattleStat } from "#enums/stat";
export type AbAttrApplyFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => void;
export type AbAttrSuccessFunc<TAttr extends AbAttr> = (attr: TAttr, passive: boolean) => boolean;
export type AbAttrCondition = (pokemon: Pokemon) => boolean;
export type PokemonAttackCondition = (user: Pokemon | null, target: Pokemon | null, move: Move) => boolean;
export type PokemonDefendCondition = (target: Pokemon, user: Pokemon, move: Move) => boolean;
export type PokemonStatStageChangeCondition = (target: Pokemon, statsChanged: BattleStat[], stages: number) => boolean;

View File

@ -1,11 +1,11 @@
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";
import { bypassLogin } from "./global-vars/bypass-login";
import { randomString } from "#app/utils/common";
export let loggedInUser: UserInfo | null = null;
// This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting
export const clientSessionId = Utils.randomString(32);
export const clientSessionId = randomString(32);
export function initLoggedInUser(): void {
loggedInUser = {

View File

@ -5,9 +5,20 @@ import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import type { PokemonSpeciesFilter } from "#app/data/pokemon-species";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import type { Constructor } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import * as Utils from "#app/utils";
import {
fixedInt,
deepMergeObjects,
getIvsFromId,
randSeedInt,
getEnumValues,
randomString,
NumberHolder,
shiftCharCodes,
formatMoney,
isNullOrUndefined,
BooleanHolder,
type Constructor,
} from "#app/utils/common";
import type { Modifier, ModifierPredicate, TurnHeldItemTransferModifier } from "./modifier/modifier";
import {
ConsumableModifier,
@ -56,7 +67,6 @@ import {
} from "#app/modifier/modifier-type";
import AbilityBar from "#app/ui/ability-bar";
import {
allAbilities,
applyAbAttrs,
applyPostBattleInitAbAttrs,
applyPostItemLostAbAttrs,
@ -64,9 +74,11 @@ import {
DoubleBattleChanceAbAttr,
PostBattleInitAbAttr,
PostItemLostAbAttr,
} from "#app/data/ability";
} from "#app/data/abilities/ability";
import { allAbilities } from "./data/data-lists";
import type { FixedBattleConfig } from "#app/battle";
import Battle, { BattleType } from "#app/battle";
import Battle from "#app/battle";
import { BattleType } from "#enums/battle-type";
import type { GameMode } from "#app/game-mode";
import { GameModes, getGameMode } from "#app/game-mode";
import FieldSpritePipeline from "#app/pipelines/field-sprite";
@ -106,8 +118,8 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container";
import { biomeDepths, getBiomeName } from "#app/data/balance/biomes";
import { SceneBase } from "#app/scene-base";
import CandyBar from "#app/ui/candy-bar";
import type { Variant, VariantSet } from "#app/data/variant";
import { variantColorCache, variantData } from "#app/data/variant";
import type { Variant } from "#app/sprites/variant";
import { variantData, clearVariantData } from "#app/sprites/variant";
import type { Localizable } from "#app/interfaces/locales";
import Overrides from "#app/overrides";
import { InputsController } from "#app/inputs-controller";
@ -139,7 +151,6 @@ import { NextEncounterPhase } from "#app/phases/next-encounter-phase";
import { PokemonAnimPhase } from "#app/phases/pokemon-anim-phase";
import { QuietFormChangePhase } from "#app/phases/quiet-form-change-phase";
import { ReturnPhase } from "#app/phases/return-phase";
import { SelectBiomePhase } from "#app/phases/select-biome-phase";
import { ShowTrainerPhase } from "#app/phases/show-trainer-phase";
import { SummonPhase } from "#app/phases/summon-phase";
import { SwitchPhase } from "#app/phases/switch-phase";
@ -170,9 +181,11 @@ import { StatusEffect } from "#enums/status-effect";
import { initGlobalScene } from "#app/global-scene";
import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
import { HideAbilityPhase } from "#app/phases/hide-ability-phase";
import { expSpriteKeys } from "./sprites/sprite-keys";
import { hasExpSprite } from "./sprites/sprite-utils";
import { timedEventManager } from "./global-event-manager";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
import { starterColors } from "./global-vars/starter-colors";
import { startingWave } from "./starting-wave";
const DEBUG_RNG = false;
@ -180,15 +193,6 @@ const OPP_IVS_OVERRIDE_VALIDATED: number[] = (
Array.isArray(Overrides.OPP_IVS_OVERRIDE) ? Overrides.OPP_IVS_OVERRIDE : new Array(6).fill(Overrides.OPP_IVS_OVERRIDE)
).map(iv => (Number.isNaN(iv) || iv === null || iv > 31 ? -1 : iv));
export const startingWave = Overrides.STARTING_WAVE_OVERRIDE || 1;
const expSpriteKeys: string[] = [];
export let starterColors: StarterColors;
interface StarterColors {
[key: string]: [string, string];
}
export interface PokeballCounts {
[pb: string]: number;
}
@ -409,7 +413,7 @@ export default class BattleScene extends SceneBase {
}
const variant = atlasPath.includes("variant/") || /_[0-3]$/.test(atlasPath);
if (experimental) {
experimental = this.hasExpSprite(key);
experimental = hasExpSprite(key);
}
if (variant) {
atlasPath = atlasPath.replace("variant/", "");
@ -421,35 +425,6 @@ export default class BattleScene extends SceneBase {
);
}
/**
* Load the variant assets for the given sprite and stores them in {@linkcode variantColorCache}
*/
public async loadPokemonVariantAssets(spriteKey: string, fileRoot: string, variant?: Variant): Promise<void> {
const useExpSprite = this.experimentalSprites && this.hasExpSprite(spriteKey);
if (useExpSprite) {
fileRoot = `exp/${fileRoot}`;
}
let variantConfig = variantData;
fileRoot.split("/").map(p => (variantConfig ? (variantConfig = variantConfig[p]) : null));
const variantSet = variantConfig as VariantSet;
return new Promise<void>(resolve => {
if (variantSet && variant !== undefined && variantSet[variant] === 1) {
if (variantColorCache.hasOwnProperty(spriteKey)) {
return resolve();
}
this.cachedFetch(`./images/pokemon/variant/${fileRoot}.json`)
.then(res => res.json())
.then(c => {
variantColorCache[spriteKey] = c;
resolve();
});
} else {
resolve();
}
});
}
async preload() {
if (DEBUG_RNG) {
const originalRealInRange = Phaser.Math.RND.realInRange;
@ -762,7 +737,7 @@ export default class BattleScene extends SceneBase {
}
this.playTimeTimer = this.time.addEvent({
delay: Utils.fixedInt(1000),
delay: fixedInt(1000),
repeat: -1,
callback: () => {
if (this.gameData) {
@ -783,53 +758,36 @@ export default class BattleScene extends SceneBase {
}
async initExpSprites(): Promise<void> {
if (expSpriteKeys.length) {
if (expSpriteKeys.size > 0) {
return;
}
this.cachedFetch("./exp-sprites.json")
.then(res => res.json())
.then(keys => {
if (Array.isArray(keys)) {
expSpriteKeys.push(...keys);
for (const key of keys) {
expSpriteKeys.add(key);
}
}
Promise.resolve();
});
}
/**
* Initialize the variant data.
* If experimental sprites are enabled, their entries are replaced via this method.
*/
async initVariantData(): Promise<void> {
for (const key of Object.keys(variantData)) {
delete variantData[key];
clearVariantData();
const otherVariantData = await this.cachedFetch("./images/pokemon/variant/_masterlist.json").then(r => r.json());
for (const k of Object.keys(otherVariantData)) {
variantData[k] = otherVariantData[k];
}
await this.cachedFetch("./images/pokemon/variant/_masterlist.json")
.then(res => res.json())
.then(v => {
for (const k of Object.keys(v)) {
variantData[k] = v[k];
if (!this.experimentalSprites) {
return;
}
if (this.experimentalSprites) {
const expVariantData = variantData["exp"];
const traverseVariantData = (keys: string[]) => {
let variantTree = variantData;
let expTree = expVariantData;
keys.map((k: string, i: number) => {
if (i < keys.length - 1) {
variantTree = variantTree[k];
expTree = expTree[k];
} else if (variantTree.hasOwnProperty(k) && expTree.hasOwnProperty(k)) {
if (["back", "female"].includes(k)) {
traverseVariantData(keys.concat(k));
} else {
variantTree[k] = expTree[k];
}
}
});
};
for (const ek of Object.keys(expVariantData)) {
traverseVariantData([ek]);
}
}
Promise.resolve();
});
const expVariantData = await this.cachedFetch("./images/pokemon/variant/_exp_masterlist.json").then(r => r.json());
deepMergeObjects(variantData, expVariantData);
}
cachedFetch(url: string, init?: RequestInit): Promise<Response> {
@ -843,48 +801,15 @@ export default class BattleScene extends SceneBase {
return fetch(url, init);
}
initStarterColors(): Promise<void> {
return new Promise(resolve => {
if (starterColors) {
return resolve();
async initStarterColors(): Promise<void> {
if (Object.keys(starterColors).length > 0) {
// already initialized
return;
}
this.cachedFetch("./starter-colors.json")
.then(res => res.json())
.then(sc => {
starterColors = {};
const sc = await this.cachedFetch("./starter-colors.json").then(res => res.json());
for (const key of Object.keys(sc)) {
starterColors[key] = sc[key];
}
resolve();
});
});
}
hasExpSprite(key: string): boolean {
const keyMatch = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/g.exec(key);
if (!keyMatch) {
return false;
}
let k = keyMatch[4]!;
if (keyMatch[2]) {
k += "s";
}
if (keyMatch[1]) {
k += "b";
}
if (keyMatch[3]) {
k += "f";
}
if (keyMatch[5]) {
k += keyMatch[5];
}
if (!expSpriteKeys.includes(k)) {
return false;
}
return true;
}
public getPlayerParty(): PlayerPokemon[] {
@ -1067,7 +992,7 @@ export default class BattleScene extends SceneBase {
}
if (boss && !dataSource) {
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967296));
const secondaryIvs = getIvsFromId(randSeedInt(4294967296));
for (let s = 0; s < pokemon.ivs.length; s++) {
pokemon.ivs[s] = Math.round(
@ -1140,7 +1065,7 @@ export default class BattleScene extends SceneBase {
container.add(icon);
if (pokemon.isFusion()) {
if (pokemon.isFusion(true)) {
const fusionIcon = this.add.sprite(0, 0, pokemon.getFusionIconAtlasKey(ignoreOverride));
fusionIcon.setName("sprite-fusion-icon");
fusionIcon.setOrigin(0.5, 0);
@ -1226,7 +1151,7 @@ export default class BattleScene extends SceneBase {
* Generates a random number using the current battle's seed
*
* This calls {@linkcode Battle.randSeedInt}({@linkcode range}, {@linkcode min}) in `src/battle.ts`
* which calls {@linkcode Utils.randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`
* which calls {@linkcode randSeedInt randSeedInt}({@linkcode range}, {@linkcode min}) in `src/utils.ts`
*
* @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min}
* @param min The minimum integer to pick, default `0`
@ -1251,7 +1176,7 @@ export default class BattleScene extends SceneBase {
this.lockModifierTiers = false;
this.pokeballCounts = Object.fromEntries(
Utils.getEnumValues(PokeballType)
getEnumValues(PokeballType)
.filter(p => p <= PokeballType.MASTER_BALL)
.map(t => [t, 0]),
);
@ -1283,7 +1208,7 @@ export default class BattleScene extends SceneBase {
// Reset RNG after end of game or save & quit.
// This needs to happen after clearing this.currentBattle or the seed will be affected by the last wave played
this.setSeed(Overrides.SEED_OVERRIDE || Utils.randomString(24));
this.setSeed(Overrides.SEED_OVERRIDE || randomString(24));
console.log("Seed:", this.seed);
this.resetSeed();
@ -1324,7 +1249,7 @@ export default class BattleScene extends SceneBase {
...allSpecies,
...allMoves,
...allAbilities,
...Utils.getEnumValues(ModifierPoolType)
...getEnumValues(ModifierPoolType)
.map(mpt => getModifierPoolForType(mpt))
.flatMap(mp =>
Object.values(mp)
@ -1364,7 +1289,7 @@ export default class BattleScene extends SceneBase {
}
getDoubleBattleChance(newWaveIndex: number, playerField: PlayerPokemon[]) {
const doubleChance = new Utils.NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
const doubleChance = new NumberHolder(newWaveIndex % 10 === 0 ? 32 : 8);
this.applyModifiers(DoubleBattleChanceBoosterModifier, true, doubleChance);
for (const p of playerField) {
applyAbAttrs(DoubleBattleChanceAbAttr, p, null, false, doubleChance);
@ -1372,6 +1297,16 @@ export default class BattleScene extends SceneBase {
return Math.max(doubleChance.value, 1);
}
isNewBiome(currentBattle = this.currentBattle) {
const isWaveIndexMultipleOfTen = !(currentBattle.waveIndex % 10);
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
const isEndlessFifthWave = this.gameMode.hasShortBiomes && currentBattle.waveIndex % 5 === 0;
const isWaveIndexMultipleOfFiftyMinusOne = currentBattle.waveIndex % 50 === 49;
const isNewBiome =
isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne);
return isNewBiome;
}
// TODO: ...this never actually returns `null`, right?
newBattle(
waveIndex?: number,
@ -1406,22 +1341,27 @@ export default class BattleScene extends SceneBase {
} else {
if (
!this.gameMode.hasTrainers ||
Overrides.BATTLE_TYPE_OVERRIDE === BattleType.WILD ||
(Overrides.DISABLE_STANDARD_TRAINERS_OVERRIDE && isNullOrUndefined(trainerData))
) {
newBattleType = BattleType.WILD;
} else if (battleType === undefined) {
newBattleType = this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD;
} else {
newBattleType = battleType;
newBattleType =
Overrides.BATTLE_TYPE_OVERRIDE ??
battleType ??
(this.gameMode.isWaveTrainer(newWaveIndex, this.arena) ? BattleType.TRAINER : BattleType.WILD);
}
if (newBattleType === BattleType.TRAINER) {
const trainerType = this.arena.randomTrainerType(newWaveIndex);
const trainerType =
Overrides.RANDOM_TRAINER_OVERRIDE?.trainerType ?? this.arena.randomTrainerType(newWaveIndex);
let doubleTrainer = false;
if (trainerConfigs[trainerType].doubleOnly) {
doubleTrainer = true;
} else if (trainerConfigs[trainerType].hasDouble) {
doubleTrainer = !Utils.randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
doubleTrainer =
Overrides.RANDOM_TRAINER_OVERRIDE?.alwaysDouble ||
!randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
if (
trainerConfigs[trainerType].trainerTypeDouble &&
@ -1432,7 +1372,7 @@ export default class BattleScene extends SceneBase {
}
const variant = doubleTrainer
? TrainerVariant.DOUBLE
: Utils.randSeedInt(2)
: randSeedInt(2)
? TrainerVariant.FEMALE
: TrainerVariant.DEFAULT;
newTrainer = trainerData !== undefined ? trainerData.toTrainer() : new Trainer(trainerType, variant);
@ -1441,7 +1381,10 @@ export default class BattleScene extends SceneBase {
// Check for mystery encounter
// Can only occur in place of a standard (non-boss) wild battle, waves 10-180
if (this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER) {
if (
!Overrides.BATTLE_TYPE_OVERRIDE &&
(this.isWaveMysteryEncounter(newBattleType, newWaveIndex) || newBattleType === BattleType.MYSTERY_ENCOUNTER)
) {
newBattleType = BattleType.MYSTERY_ENCOUNTER;
// Reset to base spawn weight
this.mysteryEncounterSaveData.encounterSpawnChance = BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT;
@ -1450,10 +1393,10 @@ export default class BattleScene extends SceneBase {
if (double === undefined && newWaveIndex > 1) {
if (newBattleType === BattleType.WILD && !this.gameMode.isWaveFinal(newWaveIndex)) {
newDouble = !Utils.randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
} else if (newBattleType === BattleType.TRAINER) {
newDouble = newTrainer?.variant === TrainerVariant.DOUBLE;
newDouble = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
}
} else if (double === undefined && newBattleType === BattleType.TRAINER) {
newDouble = newTrainer?.variant === TrainerVariant.DOUBLE;
} else if (!battleConfig) {
newDouble = !!double;
}
@ -1463,10 +1406,10 @@ export default class BattleScene extends SceneBase {
newDouble = false;
}
if (!isNullOrUndefined(Overrides.BATTLE_TYPE_OVERRIDE)) {
if (!isNullOrUndefined(Overrides.BATTLE_STYLE_OVERRIDE)) {
let doubleOverrideForWave: "single" | "double" | null = null;
switch (Overrides.BATTLE_TYPE_OVERRIDE) {
switch (Overrides.BATTLE_STYLE_OVERRIDE) {
case "double":
doubleOverrideForWave = "double";
break;
@ -1486,7 +1429,7 @@ export default class BattleScene extends SceneBase {
}
/**
* Override battles into single only if not fighting with trainers.
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 | GitHub Issue #1948}
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/1948 GitHub Issue #1948}
*/
if (newBattleType !== BattleType.TRAINER && doubleOverrideForWave === "single") {
newDouble = false;
@ -1526,15 +1469,8 @@ export default class BattleScene extends SceneBase {
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
}
//this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6));
if (!waveIndex && lastBattle) {
const isWaveIndexMultipleOfTen = !(lastBattle.waveIndex % 10);
const isEndlessOrDaily = this.gameMode.hasShortBiomes || this.gameMode.isDaily;
const isEndlessFifthWave = this.gameMode.hasShortBiomes && lastBattle.waveIndex % 5 === 0;
const isWaveIndexMultipleOfFiftyMinusOne = lastBattle.waveIndex % 50 === 49;
const isNewBiome =
isWaveIndexMultipleOfTen || isEndlessFifthWave || (isEndlessOrDaily && isWaveIndexMultipleOfFiftyMinusOne);
const isNewBiome = this.isNewBiome(lastBattle);
const resetArenaState =
isNewBiome ||
[BattleType.TRAINER, BattleType.MYSTERY_ENCOUNTER].includes(this.currentBattle.battleType) ||
@ -1583,7 +1519,6 @@ export default class BattleScene extends SceneBase {
if (!this.gameMode.hasRandomBiomes && !isNewBiome) {
this.pushPhase(new NextEncounterPhase());
} else {
this.pushPhase(new SelectBiomePhase());
this.pushPhase(new NewBiomeEncounterPhase());
const newMaxExpLevel = this.getMaxExpLevel();
@ -1640,7 +1575,7 @@ export default class BattleScene extends SceneBase {
scale: scale,
x: (defaultWidth - scaledWidth) / 2,
y: defaultHeight - scaledHeight,
duration: !instant ? Utils.fixedInt(Math.abs(this.field.scale - scale) * 200) : 0,
duration: !instant ? fixedInt(Math.abs(this.field.scale - scale) * 200) : 0,
ease: "Sine.easeInOut",
onComplete: () => resolve(),
});
@ -1737,12 +1672,12 @@ export default class BattleScene extends SceneBase {
case Species.SQUAWKABILLY:
case Species.TATSUGIRI:
case Species.PALDEA_TAUROS:
return Utils.randSeedInt(species.forms.length);
return 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);
return randSeedInt(8);
case Species.EEVEE:
if (
this.currentBattle?.battleType === BattleType.TRAINER &&
@ -1751,22 +1686,22 @@ export default class BattleScene extends SceneBase {
) {
return 0; // No Partner Eevee for Wave 12 Preschoolers
}
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.FROAKIE:
case Species.FROGADIER:
case Species.GRENINJA:
if (this.currentBattle?.battleType === BattleType.TRAINER && !isEggPhase) {
return 0; // Don't give trainers Battle Bond Greninja, Froakie or Frogadier
}
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.URSHIFU:
return Utils.randSeedInt(2);
return randSeedInt(2);
case Species.ZYGARDE:
return Utils.randSeedInt(4);
return randSeedInt(4);
case Species.MINIOR:
return Utils.randSeedInt(7);
return randSeedInt(7);
case Species.ALCREMIE:
return Utils.randSeedInt(9);
return randSeedInt(9);
case Species.MEOWSTIC:
case Species.INDEEDEE:
case Species.BASCULEGION:
@ -1797,7 +1732,7 @@ export default class BattleScene extends SceneBase {
if (this.gameMode.hasMysteryEncounters && !isEggPhase) {
return 1; // Wandering form
}
return Utils.randSeedInt(species.forms.length);
return randSeedInt(species.forms.length);
}
if (ignoreArena) {
@ -1806,7 +1741,7 @@ export default class BattleScene extends SceneBase {
case Species.WORMADAM:
case Species.ROTOM:
case Species.LYCANROC:
return Utils.randSeedInt(species.forms.length);
return randSeedInt(species.forms.length);
}
return 0;
}
@ -1818,7 +1753,7 @@ export default class BattleScene extends SceneBase {
let ret = false;
this.executeWithSeedOffset(
() => {
ret = !Utils.randSeedInt(2);
ret = !randSeedInt(2);
},
0,
this.seed.toString(),
@ -1830,7 +1765,7 @@ export default class BattleScene extends SceneBase {
let ret = 0;
this.executeWithSeedOffset(
() => {
ret = Utils.randSeedInt(8) * 5;
ret = randSeedInt(8) * 5;
},
0,
this.seed.toString(),
@ -1859,7 +1794,7 @@ export default class BattleScene extends SceneBase {
isBoss =
waveIndex % 10 === 0 ||
(this.gameMode.hasRandomBosses &&
Utils.randSeedInt(100) < Math.min(Math.max(Math.ceil((waveIndex - 250) / 50), 0) * 2, 30));
randSeedInt(100) < Math.min(Math.max(Math.ceil((waveIndex - 250) / 50), 0) * 2, 30));
}, waveIndex << 2);
}
if (!isBoss) {
@ -1886,7 +1821,7 @@ export default class BattleScene extends SceneBase {
const infectedIndexes: number[] = [];
const spread = (index: number, spreadTo: number) => {
const partyMember = party[index + spreadTo];
if (!partyMember.pokerus && !Utils.randSeedInt(10)) {
if (!partyMember.pokerus && !randSeedInt(10)) {
partyMember.pokerus = true;
infectedIndexes.push(index + spreadTo);
}
@ -1912,7 +1847,7 @@ export default class BattleScene extends SceneBase {
resetSeed(waveIndex?: number): void {
const wave = waveIndex || this.currentBattle?.waveIndex || 0;
this.waveSeed = Utils.shiftCharCodes(this.seed, wave);
this.waveSeed = shiftCharCodes(this.seed, wave);
Phaser.Math.RND.sow([this.waveSeed]);
console.log("Wave Seed:", this.waveSeed, wave);
this.rngCounter = 0;
@ -1931,7 +1866,7 @@ export default class BattleScene extends SceneBase {
const tempRngOffset = this.rngOffset;
const tempRngSeedOverride = this.rngSeedOverride;
const state = Phaser.Math.RND.state();
Phaser.Math.RND.sow([Utils.shiftCharCodes(seedOverride || this.seed, offset)]);
Phaser.Math.RND.sow([shiftCharCodes(seedOverride || this.seed, offset)]);
this.rngCounter = 0;
this.rngOffset = offset;
this.rngSeedOverride = seedOverride || "";
@ -2076,7 +2011,7 @@ export default class BattleScene extends SceneBase {
if (this.money === undefined) {
return;
}
const formattedMoney = Utils.formatMoney(this.moneyFormat, this.money);
const formattedMoney = formatMoney(this.moneyFormat, this.money);
this.moneyText.setText(i18next.t("battleScene:moneyOwned", { formattedMoney }));
this.fieldUI.moveAbove(this.moneyText, this.luckText);
if (forceVisible) {
@ -2233,12 +2168,12 @@ export default class BattleScene extends SceneBase {
),
]
: allSpecies.filter(s => s.isCatchable());
return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)];
return filteredSpecies[randSeedInt(filteredSpecies.length)];
}
generateRandomBiome(waveIndex: number): Biome {
const relWave = waveIndex % 250;
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const biomes = getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const maxDepth = biomeDepths[Biome.END][0] - 2;
const depthWeights = new Array(maxDepth + 1)
.fill(null)
@ -2250,7 +2185,7 @@ export default class BattleScene extends SceneBase {
biomeThresholds.push(totalWeight);
}
const randInt = Utils.randSeedInt(totalWeight);
const randInt = randSeedInt(totalWeight);
for (let i = 0; i < biomes.length; i++) {
if (randInt < biomeThresholds[i]) {
@ -2258,7 +2193,7 @@ export default class BattleScene extends SceneBase {
}
}
return biomes[Utils.randSeedInt(biomes.length)];
return biomes[randSeedInt(biomes.length)];
}
isBgmPlaying(): boolean {
@ -2443,7 +2378,7 @@ export default class BattleScene extends SceneBase {
this.bgmResumeTimer.destroy();
}
if (resumeBgm) {
this.bgmResumeTimer = this.time.delayedCall(pauseDuration || Utils.fixedInt(sound.totalDuration * 1000), () => {
this.bgmResumeTimer = this.time.delayedCall(pauseDuration || fixedInt(sound.totalDuration * 1000), () => {
this.resumeBgm();
this.bgmResumeTimer = null;
});
@ -3036,7 +2971,7 @@ export default class BattleScene extends SceneBase {
const args: unknown[] = [];
if (modifier instanceof PokemonHpRestoreModifier) {
if (!(modifier as PokemonHpRestoreModifier).fainted) {
const hpRestoreMultiplier = new Utils.NumberHolder(1);
const hpRestoreMultiplier = new NumberHolder(1);
this.applyModifiers(HealingBoosterModifier, true, hpRestoreMultiplier);
args.push(hpRestoreMultiplier.value);
} else {
@ -3044,7 +2979,7 @@ export default class BattleScene extends SceneBase {
}
} else if (modifier instanceof FusePokemonModifier) {
args.push(this.getPokemonById(modifier.fusePokemonId) as PlayerPokemon);
} else if (modifier instanceof RememberMoveModifier && !Utils.isNullOrUndefined(cost)) {
} else if (modifier instanceof RememberMoveModifier && !isNullOrUndefined(cost)) {
args.push(cost);
}
@ -3113,7 +3048,7 @@ export default class BattleScene extends SceneBase {
itemLost = true,
): boolean {
const source = itemModifier.pokemonId ? itemModifier.getPokemon() : null;
const cancelled = new Utils.BooleanHolder(false);
const cancelled = new BooleanHolder(false);
if (source && source.isPlayer() !== target.isPlayer()) {
applyAbAttrs(BlockItemTheftAbAttr, source, cancelled);
@ -3182,7 +3117,7 @@ export default class BattleScene extends SceneBase {
canTransferHeldItemModifier(itemModifier: PokemonHeldItemModifier, target: Pokemon, transferQuantity = 1): boolean {
const mod = itemModifier.clone() as PokemonHeldItemModifier;
const source = mod.pokemonId ? mod.getPokemon() : null;
const cancelled = new Utils.BooleanHolder(false);
const cancelled = new BooleanHolder(false);
if (source && source.isPlayer() !== target.isPlayer()) {
applyAbAttrs(BlockItemTheftAbAttr, source, cancelled);
@ -3276,7 +3211,7 @@ export default class BattleScene extends SceneBase {
}
let count = 0;
for (let c = 0; c < chances; c++) {
if (!Utils.randSeedInt(this.gameMode.getEnemyModifierChance(isBoss))) {
if (!randSeedInt(this.gameMode.getEnemyModifierChance(isBoss))) {
count++;
}
}
@ -3452,7 +3387,7 @@ export default class BattleScene extends SceneBase {
if (mods.length < 1) {
return mods;
}
const rand = Utils.randSeedInt(mods.length);
const rand = randSeedInt(mods.length);
return [mods[rand], ...shuffleModifiers(mods.filter((_, i) => i !== rand))];
};
modifiers = shuffleModifiers(modifiers);
@ -3678,7 +3613,7 @@ export default class BattleScene extends SceneBase {
*/
initFinalBossPhaseTwo(pokemon: Pokemon): void {
if (pokemon instanceof EnemyPokemon && pokemon.isBoss() && !pokemon.formIndex && pokemon.bossSegmentIndex < 1) {
this.fadeOutBgm(Utils.fixedInt(2000), false);
this.fadeOutBgm(fixedInt(2000), false);
this.ui.showDialogue(
battleSpecDialogue[BattleSpec.FINAL_BOSS].firstStageWin,
pokemon.species.name,
@ -3781,7 +3716,7 @@ export default class BattleScene extends SceneBase {
if (Overrides.XP_MULTIPLIER_OVERRIDE !== null) {
expMultiplier = Overrides.XP_MULTIPLIER_OVERRIDE;
}
const pokemonExp = new Utils.NumberHolder(expValue * expMultiplier);
const pokemonExp = new NumberHolder(expValue * expMultiplier);
this.applyModifiers(PokemonExpBoosterModifier, true, partyMember, pokemonExp);
partyMemberExp.push(Math.floor(pokemonExp.value));
}
@ -3930,7 +3865,7 @@ export default class BattleScene extends SceneBase {
while (i < this.mysteryEncounterSaveData.queuedEncounters.length && !!encounter) {
const candidate = this.mysteryEncounterSaveData.queuedEncounters[i];
const forcedChance = candidate.spawnPercent;
if (Utils.randSeedInt(100) < forcedChance) {
if (randSeedInt(100) < forcedChance) {
encounter = allMysteryEncounters[candidate.type];
}
@ -3963,7 +3898,7 @@ export default class BattleScene extends SceneBase {
}
const totalWeight = tierWeights.reduce((a, b) => a + b);
const tierValue = Utils.randSeedInt(totalWeight);
const tierValue = randSeedInt(totalWeight);
const commonThreshold = totalWeight - tierWeights[0];
const greatThreshold = totalWeight - tierWeights[0] - tierWeights[1];
const ultraThreshold = totalWeight - tierWeights[0] - tierWeights[1] - tierWeights[2];
@ -4055,7 +3990,7 @@ export default class BattleScene extends SceneBase {
console.log("No Mystery Encounters found, falling back to Mysterious Challengers.");
return allMysteryEncounters[MysteryEncounterType.MYSTERIOUS_CHALLENGERS];
}
encounter = availableEncounters[Utils.randSeedInt(availableEncounters.length)];
encounter = availableEncounters[randSeedInt(availableEncounters.length)];
// New encounter object to not dirty flags
encounter = new MysteryEncounter(encounter);
encounter.populateDialogueTokensFromRequirements();

View File

@ -1,6 +1,14 @@
import { globalScene } from "#app/global-scene";
import type { Command } from "./ui/command-ui-handler";
import * as Utils from "./utils";
import {
randomString,
getEnumValues,
NumberHolder,
randSeedInt,
shiftCharCodes,
randSeedItem,
randInt,
} from "#app/utils/common";
import Trainer, { TrainerVariant } from "./field/trainer";
import type { GameMode } from "./game-mode";
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
@ -22,36 +30,8 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import type { CustomModifierSettings } from "#app/modifier/modifier-type";
import { ModifierTier } from "#app/modifier/modifier-tier";
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
export enum ClassicFixedBossWaves {
TOWN_YOUNGSTER = 5,
RIVAL_1 = 8,
RIVAL_2 = 25,
EVIL_GRUNT_1 = 35,
RIVAL_3 = 55,
EVIL_GRUNT_2 = 62,
EVIL_GRUNT_3 = 64,
EVIL_ADMIN_1 = 66,
RIVAL_4 = 95,
EVIL_GRUNT_4 = 112,
EVIL_ADMIN_2 = 114,
EVIL_BOSS_1 = 115,
RIVAL_5 = 145,
EVIL_BOSS_2 = 165,
ELITE_FOUR_1 = 182,
ELITE_FOUR_2 = 184,
ELITE_FOUR_3 = 186,
ELITE_FOUR_4 = 188,
CHAMPION = 190,
RIVAL_6 = 195,
}
export enum BattleType {
WILD,
TRAINER,
CLEAR,
MYSTERY_ENCOUNTER,
}
import { BattleType } from "#enums/battle-type";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
export enum BattlerIndex {
ATTACKER = -1,
@ -99,7 +79,7 @@ export default class Battle {
public postBattleLoot: PokemonHeldItemModifier[] = [];
public escapeAttempts = 0;
public lastMove: Moves;
public battleSeed: string = Utils.randomString(16, true);
public battleSeed: string = randomString(16, true);
private battleSeedState: string | null = null;
public moneyScattered = 0;
/** Primarily for double battles, keeps track of last enemy and player pokemon that triggered its ability or used a move */
@ -181,8 +161,8 @@ export default class Battle {
incrementTurn(): void {
this.turn++;
this.turnCommands = Object.fromEntries(Utils.getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.preTurnCommands = Object.fromEntries(Utils.getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.turnCommands = Object.fromEntries(getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.preTurnCommands = Object.fromEntries(getEnumValues(BattlerIndex).map(bt => [bt, null]));
this.battleSeedState = null;
}
@ -211,7 +191,7 @@ export default class Battle {
}
pickUpScatteredMoney(): void {
const moneyAmount = new Utils.NumberHolder(globalScene.currentBattle.moneyScattered);
const moneyAmount = new NumberHolder(globalScene.currentBattle.moneyScattered);
globalScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount);
if (globalScene.arena.getTag(ArenaTagType.HAPPY_HOUR)) {
@ -448,7 +428,7 @@ export default class Battle {
}
/**
* Generates a random number using the current battle's seed. Calls {@linkcode Utils.randSeedInt}
* Generates a random number using the current battle's seed. Calls {@linkcode randSeedInt}
* @param range How large of a range of random numbers to choose from. If {@linkcode range} <= 1, returns {@linkcode min}
* @param min The minimum integer to pick, default `0`
* @returns A random integer between {@linkcode min} and ({@linkcode min} + {@linkcode range} - 1)
@ -463,12 +443,12 @@ export default class Battle {
if (this.battleSeedState) {
Phaser.Math.RND.state(this.battleSeedState);
} else {
Phaser.Math.RND.sow([Utils.shiftCharCodes(this.battleSeed, this.turn << 6)]);
Phaser.Math.RND.sow([shiftCharCodes(this.battleSeed, this.turn << 6)]);
console.log("Battle Seed:", this.battleSeed);
}
globalScene.rngCounter = this.rngCounter++;
globalScene.rngSeedOverride = this.battleSeed;
const ret = Utils.randSeedInt(range, min);
const ret = randSeedInt(range, min);
this.battleSeedState = Phaser.Math.RND.state();
Phaser.Math.RND.state(state);
globalScene.rngCounter = tempRngCounter;
@ -554,19 +534,19 @@ export function getRandomTrainerFunc(
seedOffset = 0,
): GetTrainerFunc {
return () => {
const rand = Utils.randSeedInt(trainerPool.length);
const rand = randSeedInt(trainerPool.length);
const trainerTypes: TrainerType[] = [];
globalScene.executeWithSeedOffset(() => {
for (const trainerPoolEntry of trainerPool) {
const trainerType = Array.isArray(trainerPoolEntry) ? Utils.randSeedItem(trainerPoolEntry) : trainerPoolEntry;
const trainerType = Array.isArray(trainerPoolEntry) ? randSeedItem(trainerPoolEntry) : trainerPoolEntry;
trainerTypes.push(trainerType);
}
}, seedOffset);
let trainerGender = TrainerVariant.DEFAULT;
if (randomGender) {
trainerGender = Utils.randInt(2) === 0 ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
trainerGender = randInt(2) === 0 ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT;
}
/* 1/3 chance for evil team grunts to be double battles */
@ -585,7 +565,7 @@ export function getRandomTrainerFunc(
const isEvilTeamGrunt = evilTeamGrunts.includes(trainerTypes[rand]);
if (trainerConfigs[trainerTypes[rand]].hasDouble && isEvilTeamGrunt) {
return new Trainer(trainerTypes[rand], Utils.randInt(3) === 0 ? TrainerVariant.DOUBLE : trainerGender);
return new Trainer(trainerTypes[rand], randInt(3) === 0 ? TrainerVariant.DOUBLE : trainerGender);
}
return new Trainer(trainerTypes[rand], trainerGender);
@ -608,7 +588,7 @@ export const classicFixedBattles: FixedBattleConfigs = {
[ClassicFixedBossWaves.TOWN_YOUNGSTER]: new FixedBattleConfig()
.setBattleType(BattleType.TRAINER)
.setGetTrainerFunc(
() => new Trainer(TrainerType.YOUNGSTER, Utils.randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT),
() => new Trainer(TrainerType.YOUNGSTER, randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT),
),
[ClassicFixedBossWaves.RIVAL_1]: new FixedBattleConfig()
.setBattleType(BattleType.TRAINER)

View File

@ -9,3 +9,8 @@ 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;
/** The min and max waves for mystery encounters to spawn in classic mode */
export const CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES: [number, number] = [10, 180] as const;
/** The min and max waves for mystery encounters to spawn in challenge mode */
export const CHALLENGE_MODE_MYSTERY_ENCOUNTER_WAVES: [number, number] = [10, 180] as const;

View File

@ -0,0 +1,54 @@
import type { AbAttrCondition } from "#app/@types/ability-types";
import type Pokemon from "#app/field/pokemon";
import type { BooleanHolder } from "#app/utils/common";
export abstract class AbAttr {
public showAbility: boolean;
private extraCondition: AbAttrCondition;
constructor(showAbility = true) {
this.showAbility = showAbility;
}
/**
* Applies ability effects without checking conditions
* @param _pokemon - The pokemon to apply this ability to
* @param _passive - Whether or not the ability is a passive
* @param _simulated - Whether the call is simulated
* @param _args - Extra args passed to the function. Handled by child classes.
* @see {@linkcode canApply}
*/
apply(
_pokemon: Pokemon,
_passive: boolean,
_simulated: boolean,
_cancelled: BooleanHolder | null,
_args: any[],
): void {}
getTriggerMessage(_pokemon: Pokemon, _abilityName: string, ..._args: any[]): string | null {
return null;
}
getCondition(): AbAttrCondition | null {
return this.extraCondition || null;
}
addCondition(condition: AbAttrCondition): AbAttr {
this.extraCondition = condition;
return this;
}
/**
* Returns a boolean describing whether the ability can be applied under current conditions
* @param _pokemon - The pokemon to apply this ability to
* @param _passive - Whether or not the ability is a passive
* @param _simulated - Whether the call is simulated
* @param _args - Extra args passed to the function. Handled by child classes.
* @returns `true` if the ability can be applied, `false` otherwise
* @see {@linkcode apply}
*/
canApply(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, _args: any[]): boolean {
return true;
}
}

View File

@ -0,0 +1,137 @@
import { Abilities } from "#enums/abilities";
import type { AbAttrCondition } from "#app/@types/ability-types";
import type { AbAttr } from "#app/data/abilities/ab-attrs/ab-attr";
import i18next from "i18next";
import type { Localizable } from "#app/interfaces/locales";
import type { Constructor } from "#app/utils/common";
export class Ability implements Localizable {
public id: Abilities;
private nameAppend: string;
public name: string;
public description: string;
public generation: number;
public isBypassFaint: boolean;
public isIgnorable: boolean;
public isSuppressable = true;
public isCopiable = true;
public isReplaceable = true;
public attrs: AbAttr[];
public conditions: AbAttrCondition[];
constructor(id: Abilities, generation: number) {
this.id = id;
this.nameAppend = "";
this.generation = generation;
this.attrs = [];
this.conditions = [];
this.isSuppressable = true;
this.isCopiable = true;
this.isReplaceable = true;
this.localize();
}
public get isSwappable(): boolean {
return this.isCopiable && this.isReplaceable;
}
localize(): void {
const i18nKey = Abilities[this.id]
.split("_")
.filter(f => f)
.map((f, i) => (i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()))
.join("") as string;
this.name = this.id ? `${i18next.t(`ability:${i18nKey}.name`) as string}${this.nameAppend}` : "";
this.description = this.id ? (i18next.t(`ability:${i18nKey}.description`) as string) : "";
}
/**
* Get all ability attributes that match `attrType`
* @param attrType any attribute that extends {@linkcode AbAttr}
* @returns Array of attributes that match `attrType`, Empty Array if none match.
*/
getAttrs<T extends AbAttr>(attrType: Constructor<T>): T[] {
return this.attrs.filter((a): a is T => a instanceof attrType);
}
/**
* Check if an ability has an attribute that matches `attrType`
* @param attrType any attribute that extends {@linkcode AbAttr}
* @returns true if the ability has attribute `attrType`
*/
hasAttr<T extends AbAttr>(attrType: Constructor<T>): boolean {
return this.attrs.some(attr => attr instanceof attrType);
}
attr<T extends Constructor<AbAttr>>(AttrType: T, ...args: ConstructorParameters<T>): Ability {
const attr = new AttrType(...args);
this.attrs.push(attr);
return this;
}
conditionalAttr<T extends Constructor<AbAttr>>(
condition: AbAttrCondition,
AttrType: T,
...args: ConstructorParameters<T>
): Ability {
const attr = new AttrType(...args);
attr.addCondition(condition);
this.attrs.push(attr);
return this;
}
bypassFaint(): Ability {
this.isBypassFaint = true;
return this;
}
ignorable(): Ability {
this.isIgnorable = true;
return this;
}
unsuppressable(): Ability {
this.isSuppressable = false;
return this;
}
uncopiable(): Ability {
this.isCopiable = false;
return this;
}
unreplaceable(): Ability {
this.isReplaceable = false;
return this;
}
condition(condition: AbAttrCondition): Ability {
this.conditions.push(condition);
return this;
}
partial(): this {
this.nameAppend += " (P)";
return this;
}
unimplemented(): this {
this.nameAppend += " (N)";
return this;
}
/**
* Internal flag used for developers to document edge cases. When using this, please be sure to document the edge case.
* @returns the ability
*/
edgeCase(): this {
return this;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
import { globalScene } from "#app/global-scene";
import type { Arena } from "#app/field/arena";
import { PokemonType } from "#enums/pokemon-type";
import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils";
import { BooleanHolder, NumberHolder, toDmgValue } from "#app/utils/common";
import { allMoves } from "#app/data/moves/move";
import { MoveTarget } from "#enums/MoveTarget";
import { MoveCategory } from "#enums/MoveCategory";
import { getPokemonNameWithAffix } from "#app/messages";
import type Pokemon from "#app/field/pokemon";
import { HitResult, PokemonMove } from "#app/field/pokemon";
import { HitResult } from "#app/field/pokemon";
import { StatusEffect } from "#enums/status-effect";
import type { BattlerIndex } from "#app/battle";
import {
@ -18,7 +18,7 @@ import {
applyAbAttrs,
applyOnGainAbAttrs,
applyOnLoseAbAttrs,
} from "#app/data/ability";
} from "#app/data/abilities/ability";
import { Stat } from "#enums/stat";
import { CommonAnim, CommonBattleAnim } from "#app/data/battle-anims";
import i18next from "i18next";
@ -335,7 +335,7 @@ export class ConditionalProtectTag extends ArenaTag {
* @param arena the {@linkcode Arena} containing this tag
* @param simulated `true` if the tag is applied quietly; `false` otherwise.
* @param isProtected a {@linkcode BooleanHolder} used to flag if the move is protected against
* @param attacker the attacking {@linkcode Pokemon}
* @param _attacker the attacking {@linkcode Pokemon}
* @param defender the defending {@linkcode Pokemon}
* @param moveId the {@linkcode Moves | identifier} for the move being used
* @param ignoresProtectBypass a {@linkcode BooleanHolder} used to flag if a protection effect supercedes effects that ignore protection
@ -345,7 +345,7 @@ export class ConditionalProtectTag extends ArenaTag {
arena: Arena,
simulated: boolean,
isProtected: BooleanHolder,
attacker: Pokemon,
_attacker: Pokemon,
defender: Pokemon,
moveId: Moves,
ignoresProtectBypass: BooleanHolder,
@ -354,8 +354,6 @@ export class ConditionalProtectTag extends ArenaTag {
if (!isProtected.value) {
isProtected.value = true;
if (!simulated) {
attacker.stopMultiHit(defender);
new CommonBattleAnim(CommonAnim.PROTECT, defender).play();
globalScene.queueMessage(
i18next.t("arenaTag:conditionalProtectApply", {
@ -899,7 +897,7 @@ export class DelayedAttackTag extends ArenaTag {
if (!ret) {
globalScene.unshiftPhase(
new MoveEffectPhase(this.sourceId!, [this.targetIndex], new PokemonMove(this.sourceMove!, 0, 0, true)),
new MoveEffectPhase(this.sourceId!, [this.targetIndex], allMoves[this.sourceMove!], false, true),
); // TODO: are those bangs correct?
}

View File

@ -1,5 +1,5 @@
import { PokemonType } from "#enums/pokemon-type";
import * as Utils from "#app/utils";
import { randSeedInt, getEnumValues } from "#app/utils/common";
import type { SpeciesFormEvolution } from "#app/data/balance/pokemon-evolutions";
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import i18next from "i18next";
@ -7710,7 +7710,7 @@ export function initBiomes() {
if (biome === Biome.END) {
const biomeList = Object.keys(Biome).filter(key => !Number.isNaN(Number(key)));
biomeList.pop(); // Removes Biome.END from the list
const randIndex = Utils.randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
const randIndex = randSeedInt(biomeList.length, 1); // Will never be Biome.TOWN
biome = Biome[biomeList[randIndex]];
}
const linkedBiomes: (Biome | [ Biome, number ])[] = Array.isArray(biomeLinks[biome])
@ -7733,15 +7733,15 @@ export function initBiomes() {
traverseBiome(Biome.TOWN, 0);
biomeDepths[Biome.END] = [ Object.values(biomeDepths).map(d => d[0]).reduce((max: number, value: number) => Math.max(max, value), 0) + 1, 1 ];
for (const biome of Utils.getEnumValues(Biome)) {
for (const biome of getEnumValues(Biome)) {
biomePokemonPools[biome] = {};
biomeTrainerPools[biome] = {};
for (const tier of Utils.getEnumValues(BiomePoolTier)) {
for (const tier of getEnumValues(BiomePoolTier)) {
biomePokemonPools[biome][tier] = {};
biomeTrainerPools[biome][tier] = [];
for (const tod of Utils.getEnumValues(TimeOfDay)) {
for (const tod of getEnumValues(TimeOfDay)) {
biomePokemonPools[biome][tier][tod] = [];
}
}

View File

@ -1,5 +1,5 @@
import { allMoves } from "#app/data/moves/move";
import * as Utils from "#app/utils";
import { getEnumKeys, getEnumValues } from "#app/utils/common";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
@ -587,8 +587,8 @@ export const speciesEggMoves = {
function parseEggMoves(content: string): void {
let output = "";
const speciesNames = Utils.getEnumKeys(Species);
const speciesValues = Utils.getEnumValues(Species);
const speciesNames = getEnumKeys(Species);
const speciesValues = getEnumValues(Species);
const lines = content.split(/\n/g);
for (const line of lines) {

View File

@ -3,7 +3,7 @@ import { Gender } from "#app/data/gender";
import { PokeballType } from "#enums/pokeball";
import type Pokemon from "#app/field/pokemon";
import { PokemonType } from "#enums/pokemon-type";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { WeatherType } from "#enums/weather-type";
import { Nature } from "#enums/nature";
import { Biome } from "#enums/biome";
@ -14,6 +14,7 @@ import { DamageMoneyRewardModifier, ExtraModifierModifier, MoneyMultiplierModifi
import { SpeciesFormKey } from "#enums/species-form-key";
import { speciesStarterCosts } from "./starters";
import i18next from "i18next";
import { initI18n } from "#app/plugins/i18n";
export enum SpeciesWildEvolutionDelay {
@ -95,6 +96,9 @@ export class SpeciesFormEvolution {
public description = "";
constructor(speciesId: Species, preFormKey: string | null, evoFormKey: string | null, level: number, item: EvolutionItem | null, condition: SpeciesEvolutionCondition | null, wildDelay?: SpeciesWildEvolutionDelay) {
if (!i18next.isInitialized) {
initI18n();
}
this.speciesId = speciesId;
this.preFormKey = preFormKey;
this.evoFormKey = evoFormKey;
@ -333,7 +337,7 @@ class DunsparceEvolutionCondition extends SpeciesEvolutionCondition {
super(p => {
let ret = false;
if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0) {
globalScene.executeWithSeedOffset(() => ret = !Utils.randSeedInt(4), p.id);
globalScene.executeWithSeedOffset(() => ret = !randSeedInt(4), p.id);
}
return ret;
});
@ -346,7 +350,7 @@ class TandemausEvolutionCondition extends SpeciesEvolutionCondition {
constructor() {
super(p => {
let ret = false;
globalScene.executeWithSeedOffset(() => ret = !Utils.randSeedInt(4), p.id);
globalScene.executeWithSeedOffset(() => ret = !randSeedInt(4), p.id);
return ret;
});
}

View File

@ -11,87 +11,87 @@ export type SignatureSpecies = {
*/
export const signatureSpecies: SignatureSpecies = {
// Gym Leaders- Kanto
BROCK: [Species.GEODUDE, Species.ONIX],
MISTY: [Species.STARYU, Species.PSYDUCK],
LT_SURGE: [Species.VOLTORB, Species.PIKACHU, Species.ELECTABUZZ],
BROCK: [Species.ONIX, Species.GEODUDE, [Species.OMANYTE, Species.KABUTO], Species.AERODACTYL],
MISTY: [Species.STARYU, Species.PSYDUCK, Species.WOOPER, Species.LAPRAS],
LT_SURGE: [Species.PICHU, Species.VOLTORB, Species.ELEKID, Species.JOLTEON],
ERIKA: [Species.ODDISH, Species.BELLSPROUT, Species.TANGELA, Species.HOPPIP],
JANINE: [Species.VENONAT, Species.SPINARAK, Species.ZUBAT],
SABRINA: [Species.ABRA, Species.MR_MIME, Species.ESPEON],
BLAINE: [Species.GROWLITHE, Species.PONYTA, Species.MAGMAR],
GIOVANNI: [Species.SANDILE, Species.MURKROW, Species.NIDORAN_M, Species.NIDORAN_F],
JANINE: [Species.VENONAT, Species.SPINARAK, Species.ZUBAT, Species.KOFFING],
SABRINA: [Species.ABRA, Species.MR_MIME, Species.SMOOCHUM, Species.ESPEON],
BLAINE: [Species.GROWLITHE, Species.PONYTA, Species.MAGBY, Species.VULPIX],
GIOVANNI: [Species.RHYHORN, Species.MEOWTH, [Species.NIDORAN_F, Species.NIDORAN_M], Species.DIGLETT], // Tera Ground Meowth
// Gym Leaders- Johto
FALKNER: [Species.PIDGEY, Species.HOOTHOOT, Species.DODUO],
BUGSY: [Species.SCYTHER, Species.HERACROSS, Species.SHUCKLE, Species.PINSIR],
WHITNEY: [Species.JIGGLYPUFF, Species.MILTANK, Species.AIPOM, Species.GIRAFARIG],
MORTY: [Species.GASTLY, Species.MISDREAVUS, Species.SABLEYE],
CHUCK: [Species.POLIWRATH, Species.MANKEY],
JASMINE: [Species.MAGNEMITE, Species.STEELIX],
PRYCE: [Species.SEEL, Species.SWINUB],
CLAIR: [Species.DRATINI, Species.HORSEA, Species.GYARADOS],
FALKNER: [Species.PIDGEY, Species.HOOTHOOT, Species.NATU, Species.MURKROW],
BUGSY: [Species.SCYTHER, Species.SHUCKLE, Species.YANMA, [Species.PINSIR, Species.HERACROSS]],
WHITNEY: [Species.MILTANK, Species.AIPOM, Species.IGGLYBUFF, [Species.GIRAFARIG, Species.STANTLER]],
MORTY: [Species.GASTLY, Species.MISDREAVUS, Species.DUSKULL, Species.SABLEYE],
CHUCK: [Species.POLIWRATH, Species.MANKEY, Species.TYROGUE, Species.MACHOP],
JASMINE: [Species.STEELIX, Species.MAGNEMITE, Species.PINECO, Species.SKARMORY],
PRYCE: [Species.SWINUB, Species.SEEL, Species.SHELLDER, Species.SNEASEL],
CLAIR: [Species.HORSEA, Species.DRATINI, Species.MAGIKARP, Species.DRUDDIGON], // Tera Dragon Magikarp
// Gym Leaders- Hoenn
ROXANNE: [Species.GEODUDE, Species.NOSEPASS],
BRAWLY: [Species.MACHOP, Species.MAKUHITA],
WATTSON: [Species.MAGNEMITE, Species.VOLTORB, Species.ELECTRIKE],
FLANNERY: [Species.SLUGMA, Species.TORKOAL, Species.NUMEL],
NORMAN: [Species.SLAKOTH, Species.SPINDA, Species.ZIGZAGOON, Species.KECLEON],
ROXANNE: [Species.NOSEPASS, Species.GEODUDE, [Species.LILEEP, Species.ANORITH], Species.ARON],
BRAWLY: [Species.MAKUHITA, Species.MACHOP, Species.MEDITITE, Species.SHROOMISH],
WATTSON: [Species.ELECTRIKE, Species.VOLTORB, Species.MAGNEMITE, [Species.PLUSLE, Species.MINUN]],
FLANNERY: [Species.TORKOAL, Species.SLUGMA, Species.NUMEL, Species.HOUNDOUR],
NORMAN: [Species.SLAKOTH, Species.KECLEON, Species.WHISMUR, Species.ZANGOOSE],
WINONA: [Species.SWABLU, Species.WINGULL, Species.TROPIUS, Species.SKARMORY],
TATE: [Species.SOLROCK, Species.NATU, Species.CHIMECHO, Species.GALLADE],
LIZA: [Species.LUNATONE, Species.SPOINK, Species.BALTOY, Species.GARDEVOIR],
JUAN: [Species.HORSEA, Species.BARBOACH, Species.SPHEAL, Species.RELICANTH],
TATE: [Species.SOLROCK, Species.NATU, Species.CHINGLING, Species.GALLADE],
LIZA: [Species.LUNATONE, Species.BALTOY, Species.SPOINK, Species.GARDEVOIR],
JUAN: [Species.HORSEA, Species.SPHEAL, Species.BARBOACH, Species.CORPHISH],
// Gym Leaders- Sinnoh
ROARK: [Species.CRANIDOS, Species.LARVITAR, Species.GEODUDE],
GARDENIA: [Species.ROSELIA, Species.TANGELA, Species.TURTWIG],
MAYLENE: [Species.LUCARIO, Species.MEDITITE, Species.CHIMCHAR],
ROARK: [Species.CRANIDOS, Species.GEODUDE, Species.NOSEPASS, Species.LARVITAR],
GARDENIA: [Species.BUDEW, Species.CHERUBI, Species.TURTWIG, Species.LEAFEON],
MAYLENE: [Species.RIOLU, Species.MEDITITE, Species.CHIMCHAR, Species.CROAGUNK],
CRASHER_WAKE: [Species.BUIZEL, Species.WOOPER, Species.PIPLUP, Species.MAGIKARP],
FANTINA: [Species.MISDREAVUS, Species.DRIFLOON, Species.SPIRITOMB],
BYRON: [Species.SHIELDON, Species.BRONZOR, Species.AGGRON],
CANDICE: [Species.SNEASEL, Species.SNOVER, Species.SNORUNT],
VOLKNER: [Species.SHINX, Species.CHINCHOU, Species.ROTOM],
FANTINA: [Species.MISDREAVUS, Species.DRIFLOON, Species.DUSKULL, Species.SPIRITOMB],
BYRON: [Species.SHIELDON, Species.BRONZOR, Species.ARON, Species.SKARMORY],
CANDICE: [Species.FROSLASS, Species.SNOVER, Species.SNEASEL, Species.GLACEON],
VOLKNER: [Species.ELEKID, Species.SHINX, Species.CHINCHOU, Species.ROTOM],
// Gym Leaders- Unova
CILAN: [Species.PANSAGE, Species.FOONGUS, Species.PETILIL],
CHILI: [Species.PANSEAR, Species.DARUMAKA, Species.NUMEL],
CRESS: [Species.PANPOUR, Species.TYMPOLE, Species.SLOWPOKE],
CHEREN: [Species.LILLIPUP, Species.MINCCINO, Species.PIDOVE],
LENORA: [Species.PATRAT, Species.DEERLING, Species.AUDINO],
ROXIE: [Species.VENIPEDE, Species.TRUBBISH, Species.SKORUPI],
BURGH: [Species.SEWADDLE, Species.SHELMET, Species.KARRABLAST],
ELESA: [Species.EMOLGA, Species.BLITZLE, Species.JOLTIK],
CLAY: [Species.DRILBUR, Species.SANDILE, Species.GOLETT],
SKYLA: [Species.DUCKLETT, Species.WOOBAT, Species.RUFFLET],
BRYCEN: [Species.CRYOGONAL, Species.VANILLITE, Species.CUBCHOO],
DRAYDEN: [Species.DRUDDIGON, Species.AXEW, Species.DEINO],
MARLON: [Species.WAILMER, Species.FRILLISH, Species.TIRTOUGA],
CILAN: [Species.PANSAGE, Species.SNIVY, Species.MARACTUS, Species.FERROSEED],
CHILI: [Species.PANSEAR, Species.TEPIG, Species.HEATMOR, Species.DARUMAKA],
CRESS: [Species.PANPOUR, Species.OSHAWOTT, Species.BASCULIN, Species.TYMPOLE],
CHEREN: [Species.LILLIPUP, Species.MINCCINO, Species.PIDOVE, Species.BOUFFALANT],
LENORA: [Species.PATRAT, Species.DEERLING, Species.AUDINO, Species.BRAVIARY],
ROXIE: [Species.VENIPEDE, Species.KOFFING, Species.TRUBBISH, Species.TOXEL],
BURGH: [Species.SEWADDLE, Species.DWEBBLE, [Species.KARRABLAST, Species.SHELMET], Species.DURANT],
ELESA: [Species.BLITZLE, Species.EMOLGA, Species.JOLTIK, Species.TYNAMO],
CLAY: [Species.DRILBUR, Species.SANDILE, Species.TYMPOLE, Species.GOLETT],
SKYLA: [Species.DUCKLETT, Species.WOOBAT, [Species.RUFFLET, Species.VULLABY], Species.ARCHEN],
BRYCEN: [Species.CRYOGONAL, Species.VANILLITE, Species.CUBCHOO, Species.GALAR_DARUMAKA],
DRAYDEN: [Species.AXEW, Species.DRUDDIGON, Species.TRAPINCH, Species.DEINO],
MARLON: [Species.FRILLISH, Species.TIRTOUGA, Species.WAILMER, Species.MANTYKE],
// Gym Leaders- Kalos
VIOLA: [Species.SURSKIT, Species.SCATTERBUG],
GRANT: [Species.AMAURA, Species.TYRUNT],
KORRINA: [Species.HAWLUCHA, Species.LUCARIO, Species.MIENFOO],
RAMOS: [Species.SKIDDO, Species.HOPPIP, Species.BELLSPROUT],
CLEMONT: [Species.HELIOPTILE, Species.MAGNEMITE, Species.EMOLGA],
VALERIE: [Species.SYLVEON, Species.MAWILE, Species.MR_MIME],
OLYMPIA: [Species.ESPURR, Species.SIGILYPH, Species.SLOWKING],
WULFRIC: [Species.BERGMITE, Species.SNOVER, Species.CRYOGONAL],
VIOLA: [Species.SCATTERBUG, Species.SURSKIT, Species.CUTIEFLY, Species.BLIPBUG],
GRANT: [Species.TYRUNT, Species.AMAURA, Species.BINACLE, Species.DWEBBLE],
KORRINA: [Species.RIOLU, Species.MIENFOO, Species.HAWLUCHA, Species.PANCHAM],
RAMOS: [Species.SKIDDO, Species.HOPPIP, Species.BELLSPROUT, [Species.PHANTUMP, Species.PUMPKABOO]],
CLEMONT: [Species.HELIOPTILE, Species.MAGNEMITE, Species.DEDENNE, Species.ROTOM],
VALERIE: [Species.SYLVEON, Species.MAWILE, Species.MR_MIME, [Species.SPRITZEE, Species.SWIRLIX]],
OLYMPIA: [Species.ESPURR, Species.SIGILYPH, Species.INKAY, Species.SLOWKING],
WULFRIC: [Species.BERGMITE, Species.SNOVER, Species.CRYOGONAL, Species.SWINUB],
// Gym Leaders- Galar
MILO: [Species.GOSSIFLEUR, Species.APPLIN, Species.BOUNSWEET],
NESSA: [Species.CHEWTLE, Species.ARROKUDA, Species.WIMPOD],
KABU: [Species.SIZZLIPEDE, Species.VULPIX, Species.TORKOAL],
BEA: [Species.GALAR_FARFETCHD, Species.MACHOP, Species.CLOBBOPUS],
ALLISTER: [Species.GALAR_YAMASK, Species.GALAR_CORSOLA, Species.GASTLY],
OPAL: [Species.MILCERY, Species.TOGETIC, Species.GALAR_WEEZING],
BEDE: [Species.HATENNA, Species.GALAR_PONYTA, Species.GARDEVOIR],
GORDIE: [Species.ROLYCOLY, Species.STONJOURNER, Species.BINACLE],
MELONY: [Species.SNOM, Species.GALAR_DARUMAKA, Species.GALAR_MR_MIME],
PIERS: [Species.GALAR_ZIGZAGOON, Species.SCRAGGY, Species.INKAY],
MARNIE: [Species.IMPIDIMP, Species.PURRLOIN, Species.MORPEKO],
RAIHAN: [Species.DURALUDON, Species.TURTONATOR, Species.GOOMY],
MILO: [Species.GOSSIFLEUR, Species.SEEDOT, Species.APPLIN, Species.LOTAD],
NESSA: [Species.CHEWTLE, Species.WIMPOD, Species.ARROKUDA, Species.MAREANIE],
KABU: [Species.SIZZLIPEDE, Species.VULPIX, Species.GROWLITHE, Species.TORKOAL],
BEA: [Species.MACHOP, Species.GALAR_FARFETCHD, Species.CLOBBOPUS, Species.FALINKS],
ALLISTER: [Species.GASTLY, Species.GALAR_YAMASK, Species.GALAR_CORSOLA, Species.SINISTEA],
OPAL: [Species.MILCERY, Species.GALAR_WEEZING, Species.TOGEPI, Species.MAWILE],
BEDE: [Species.HATENNA, Species.GALAR_PONYTA, Species.GARDEVOIR, Species.SYLVEON],
GORDIE: [Species.ROLYCOLY, [Species.SHUCKLE, Species.BINACLE], Species.STONJOURNER, Species.LARVITAR],
MELONY: [Species.LAPRAS, Species.SNOM, Species.EISCUE, [Species.GALAR_MR_MIME, Species.GALAR_DARUMAKA]],
PIERS: [Species.GALAR_ZIGZAGOON, Species.SCRAGGY, Species.TOXEL, Species.INKAY], // Tera Dark Toxel
MARNIE: [Species.IMPIDIMP, Species.MORPEKO, Species.PURRLOIN, Species.CROAGUNK], // Tera Dark Croagunk
RAIHAN: [Species.DURALUDON, Species.TRAPINCH, Species.GOOMY, Species.TURTONATOR],
// Gym Leaders- Paldea; First slot is Tera
KATY: [Species.TEDDIURSA, Species.NYMBLE, Species.TAROUNTULA], // Tera Bug Teddiursa
BRASSIUS: [Species.SUDOWOODO, Species.BRAMBLIN, Species.SMOLIV], // Tera Grass Sudowoodo
IONO: [Species.MISDREAVUS, Species.TADBULB, Species.WATTREL], // Tera Ghost Misdreavus
KATY: [Species.TEDDIURSA, Species.NYMBLE, Species.TAROUNTULA, Species.RELLOR], // Tera Bug Teddiursa
BRASSIUS: [Species.BONSLY, Species.SMOLIV, Species.BRAMBLIN, Species.SUNKERN], // Tera Grass Bonsly
IONO: [Species.MISDREAVUS, Species.TADBULB, Species.WATTREL, Species.MAGNEMITE], // Tera Ghost Misdreavus
KOFU: [Species.CRABRAWLER, Species.VELUZA, Species.WIGLETT, Species.WINGULL], // Tera Water Crabrawler
LARRY: [Species.STARLY, Species.DUNSPARCE, Species.LECHONK, Species.KOMALA], // Tera Normal Starly
RYME: [Species.TOXEL, Species.GREAVARD, Species.SHUPPET, Species.MIMIKYU], // Tera Ghost Toxel
TULIP: [Species.FLABEBE, Species.FLITTLE, Species.RALTS, Species.GIRAFARIG], // Tera Psychic Flabebe
GRUSHA: [Species.SWABLU, Species.CETODDLE, Species.CUBCHOO, Species.ALOLA_VULPIX], // Tera Ice Swablu
GRUSHA: [Species.SWABLU, Species.CETODDLE, Species.SNOM, Species.CUBCHOO], // Tera Ice Swablu
// Elite Four- Kanto
LORELEI: [

View File

@ -19126,6 +19126,8 @@ export const tmSpecies: TmSpecies = {
Species.KROOKODILE,
Species.SCRAGGY,
Species.SCRAFTY,
Species.YAMASK,
Species.COFAGRIGUS,
Species.SAWSBUCK,
Species.LITWICK,
Species.LAMPENT,
@ -19163,6 +19165,7 @@ export const tmSpecies: TmSpecies = {
Species.SINISTEA,
Species.POLTEAGEIST,
Species.PERRSERKER,
Species.RUNERIGUS,
Species.PINCURCHIN,
Species.STONJOURNER,
Species.CUFANT,
@ -19228,6 +19231,7 @@ export const tmSpecies: TmSpecies = {
Species.GALAR_SLOWBRO,
Species.GALAR_WEEZING,
Species.GALAR_SLOWKING,
Species.GALAR_YAMASK,
Species.HISUI_ELECTRODE,
Species.HISUI_TYPHLOSION,
Species.HISUI_QWILFISH,
@ -30922,6 +30926,7 @@ export const tmSpecies: TmSpecies = {
Species.MURKROW,
Species.SLOWKING,
Species.MISDREAVUS,
Species.UNOWN,
Species.GIRAFARIG,
Species.PINECO,
Species.FORRETRESS,
@ -40134,6 +40139,8 @@ export const tmSpecies: TmSpecies = {
Species.MEOWSTIC,
Species.SPRITZEE,
Species.AROMATISSE,
Species.INKAY,
Species.MALAMAR,
Species.SYLVEON,
Species.CARBINK,
Species.PHANTUMP,
@ -49173,6 +49180,7 @@ export const tmSpecies: TmSpecies = {
Species.KANGASKHAN,
Species.GOLDEEN,
Species.SEAKING,
Species.GYARADOS,
Species.LAPRAS,
Species.VAPOREON,
Species.KABUTOPS,
@ -52587,6 +52595,7 @@ export const tmSpecies: TmSpecies = {
Species.SNORLAX,
Species.MEWTWO,
Species.MEW,
Species.MEGANIUM,
Species.CYNDAQUIL,
Species.QUILAVA,
Species.TYPHLOSION,
@ -66205,7 +66214,11 @@ export const tmSpecies: TmSpecies = {
Species.SQUIRTLE,
Species.WARTORTLE,
Species.BLASTOISE,
Species.CATERPIE,
Species.METAPOD,
Species.BUTTERFREE,
Species.WEEDLE,
Species.KAKUNA,
Species.BEEDRILL,
Species.PIDGEY,
Species.PIDGEOTTO,
@ -66451,7 +66464,10 @@ export const tmSpecies: TmSpecies = {
Species.MIGHTYENA,
Species.ZIGZAGOON,
Species.LINOONE,
Species.WURMPLE,
Species.SILCOON,
Species.BEAUTIFLY,
Species.CASCOON,
Species.DUSTOX,
Species.LOTAD,
Species.LOMBRE,
@ -66987,6 +67003,8 @@ export const tmSpecies: TmSpecies = {
Species.STAKATAKA,
Species.BLACEPHALON,
Species.ZERAORA,
Species.MELTAN,
Species.MELMETAL,
Species.ALOLA_RATTATA,
Species.ALOLA_RATICATE,
Species.ALOLA_RAICHU,
@ -67020,8 +67038,19 @@ export const tmSpecies: TmSpecies = {
Species.ROOKIDEE,
Species.CORVISQUIRE,
Species.CORVIKNIGHT,
Species.BLIPBUG,
Species.DOTTLER,
Species.ORBEETLE,
Species.NICKIT,
Species.THIEVUL,
Species.GOSSIFLEUR,
Species.ELDEGOSS,
Species.WOOLOO,
Species.DUBWOOL,
Species.CHEWTLE,
Species.DREDNAW,
Species.YAMPER,
Species.BOLTUND,
Species.ROLYCOLY,
Species.CARKOL,
Species.COALOSSAL,
@ -67035,6 +67064,10 @@ export const tmSpecies: TmSpecies = {
Species.BARRASKEWDA,
Species.TOXEL,
Species.TOXTRICITY,
Species.SIZZLIPEDE,
Species.CENTISKORCH,
Species.CLOBBOPUS,
Species.GRAPPLOCT,
Species.SINISTEA,
Species.POLTEAGEIST,
Species.HATENNA,
@ -67043,7 +67076,14 @@ export const tmSpecies: TmSpecies = {
Species.IMPIDIMP,
Species.MORGREM,
Species.GRIMMSNARL,
Species.OBSTAGOON,
Species.PERRSERKER,
Species.CURSOLA,
Species.SIRFETCHD,
Species.MR_RIME,
Species.RUNERIGUS,
Species.MILCERY,
Species.ALCREMIE,
Species.FALINKS,
Species.PINCURCHIN,
Species.SNOM,
@ -67054,6 +67094,11 @@ export const tmSpecies: TmSpecies = {
Species.MORPEKO,
Species.CUFANT,
Species.COPPERAJAH,
Species.DRACOZOLT,
Species.ARCTOZOLT,
Species.DRACOVISH,
Species.ARCTOVISH,
Species.DURALUDON,
Species.DREEPY,
Species.DRAKLOAK,
Species.DRAGAPULT,
@ -67195,13 +67240,24 @@ export const tmSpecies: TmSpecies = {
Species.IRON_CROWN,
Species.PECHARUNT,
Species.GALAR_MEOWTH,
Species.GALAR_PONYTA,
Species.GALAR_RAPIDASH,
Species.GALAR_SLOWPOKE,
Species.GALAR_SLOWBRO,
Species.GALAR_FARFETCHD,
Species.GALAR_WEEZING,
Species.GALAR_MR_MIME,
Species.GALAR_ARTICUNO,
Species.GALAR_ZAPDOS,
Species.GALAR_MOLTRES,
Species.GALAR_SLOWKING,
Species.GALAR_CORSOLA,
Species.GALAR_ZIGZAGOON,
Species.GALAR_LINOONE,
Species.GALAR_DARUMAKA,
Species.GALAR_DARMANITAN,
Species.GALAR_YAMASK,
Species.GALAR_STUNFISK,
Species.HISUI_GROWLITHE,
Species.HISUI_ARCANINE,
Species.HISUI_VOLTORB,

View File

@ -2,11 +2,11 @@ import { globalScene } from "#app/global-scene";
import { AttackMove, BeakBlastHeaderAttr, DelayedAttackAttr, SelfStatusMove, allMoves } from "./moves/move";
import { MoveFlags } from "#enums/MoveFlags";
import type Pokemon from "../field/pokemon";
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils";
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils/common";
import type { BattlerIndex } from "../battle";
import { Moves } from "#enums/moves";
import { SubstituteTag } from "./battler-tags";
import { isNullOrUndefined } from "../utils";
import { isNullOrUndefined } from "../utils/common";
import Phaser from "phaser";
import { EncounterAnim } from "#enums/encounter-anims";
@ -1428,7 +1428,8 @@ export class MoveAnim extends BattleAnim {
public move: Moves;
constructor(move: Moves, user: Pokemon, target: BattlerIndex, playOnEmptyField = false) {
super(user, globalScene.getField()[target], playOnEmptyField);
// Set target to the user pokemon if no target is found to avoid crashes
super(user, globalScene.getField()[target] ?? user, playOnEmptyField);
this.move = move;
}

View File

@ -1,13 +1,13 @@
import { globalScene } from "#app/global-scene";
import {
allAbilities,
applyAbAttrs,
BlockNonDirectDamageAbAttr,
FlinchEffectAbAttr,
ProtectStatAbAttr,
ConditionalUserFieldProtectStatAbAttr,
ReverseDrainAbAttr,
} from "#app/data/ability";
} from "#app/data/abilities/ability";
import { allAbilities } from "./data-lists";
import { ChargeAnim, CommonAnim, CommonBattleAnim, MoveChargeAnim } from "#app/data/battle-anims";
import type Move from "#app/data/moves/move";
import {
@ -33,7 +33,7 @@ import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
import type { StatStageChangeCallback } from "#app/phases/stat-stage-change-phase";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import i18next from "#app/plugins/i18n";
import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils";
import { BooleanHolder, getFrameMs, NumberHolder, toDmgValue } from "#app/utils/common";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves";
@ -42,7 +42,7 @@ import { Species } from "#enums/species";
import { EFFECTIVE_STATS, getStatKey, Stat, type BattleStat, type EffectiveStat } from "#enums/stat";
import { StatusEffect } from "#enums/status-effect";
import { WeatherType } from "#enums/weather-type";
import * as Utils from "../utils";
import { isNullOrUndefined } from "#app/utils/common";
export enum BattlerTagLapseType {
FAINT,
@ -52,6 +52,7 @@ export enum BattlerTagLapseType {
MOVE_EFFECT,
TURN_END,
HIT,
/** Tag lapses AFTER_HIT, applying its effects even if the user faints */
AFTER_HIT,
CUSTOM,
}
@ -302,7 +303,7 @@ export class DisabledTag extends MoveRestrictionBattlerTag {
super.onAdd(pokemon);
const move = pokemon.getLastXMoves(-1).find(m => !m.virtual);
if (Utils.isNullOrUndefined(move) || move.move === Moves.STRUGGLE || move.move === Moves.NONE) {
if (isNullOrUndefined(move) || move.move === Moves.STRUGGLE || move.move === Moves.NONE) {
return;
}
@ -498,7 +499,13 @@ export class BeakBlastChargingTag extends BattlerTag {
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
if (lapseType === BattlerTagLapseType.AFTER_HIT) {
const phaseData = getMoveEffectPhaseData(pokemon);
if (phaseData?.move.hasFlag(MoveFlags.MAKES_CONTACT)) {
if (
phaseData?.move.doesFlagEffectApply({
flag: MoveFlags.MAKES_CONTACT,
user: phaseData.attacker,
target: pokemon,
})
) {
phaseData.attacker.trySetStatus(StatusEffect.BURN, true, pokemon);
}
return true;
@ -1611,19 +1618,50 @@ export class ProtectedTag extends BattlerTag {
}
}
/** Base class for `BattlerTag`s that block damaging moves but not status moves */
export class DamageProtectedTag extends ProtectedTag {}
/** Class for `BattlerTag`s that apply some effect when hit by a contact move */
export class ContactProtectedTag extends ProtectedTag {
/**
* Function to call when a contact move hits the pokemon with this tag.
* @param _attacker - The pokemon using the contact move
* @param _user - The pokemon that is being attacked and has the tag
* @param _move - The move used by the attacker
*/
onContact(_attacker: Pokemon, _user: Pokemon) {}
/**
* Lapse the tag and apply `onContact` if the move makes contact and
* `lapseType` is custom, respecting the move's flags and the pokemon's
* abilities, and whether the lapseType is custom.
*
* @param pokemon - The pokemon with the tag
* @param lapseType - The type of lapse to apply. If this is not {@linkcode BattlerTagLapseType.CUSTOM CUSTOM}, no effect will be applied.
* @returns Whether the tag continues to exist after the lapse.
*/
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType);
const moveData = getMoveEffectPhaseData(pokemon);
if (
lapseType === BattlerTagLapseType.CUSTOM &&
moveData &&
moveData.move.doesFlagEffectApply({ flag: MoveFlags.MAKES_CONTACT, user: moveData.attacker, target: pokemon })
) {
this.onContact(moveData.attacker, pokemon);
}
return ret;
}
}
/**
* `BattlerTag` class for moves that block damaging moves damage the enemy if the enemy's move makes contact
* Used by {@linkcode Moves.SPIKY_SHIELD}
*/
export class ContactDamageProtectedTag extends ProtectedTag {
export class ContactDamageProtectedTag extends ContactProtectedTag {
private damageRatio: number;
constructor(sourceMove: Moves, damageRatio: number) {
super(sourceMove, BattlerTagType.SPIKY_SHIELD);
this.damageRatio = damageRatio;
}
@ -1636,22 +1674,46 @@ export class ContactDamageProtectedTag extends ProtectedTag {
this.damageRatio = source.damageRatio;
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType);
if (lapseType === BattlerTagLapseType.CUSTOM) {
const effectPhase = globalScene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon();
if (!attacker.hasAbilityWithAttr(BlockNonDirectDamageAbAttr)) {
/**
* Damage the attacker by `this.damageRatio` of the target's max HP
* @param attacker - The pokemon using the contact move
* @param user - The pokemon that is being attacked and has the tag
*/
override onContact(attacker: Pokemon, user: Pokemon): void {
const cancelled = new BooleanHolder(false);
applyAbAttrs(BlockNonDirectDamageAbAttr, user, cancelled);
if (!cancelled.value) {
attacker.damageAndUpdate(toDmgValue(attacker.getMaxHp() * (1 / this.damageRatio)), {
result: HitResult.INDIRECT,
});
}
}
}
/** Base class for `BattlerTag`s that block damaging moves but not status moves */
export class DamageProtectedTag extends ContactProtectedTag {}
export class ContactSetStatusProtectedTag extends DamageProtectedTag {
/**
* @param sourceMove The move that caused the tag to be applied
* @param tagType The type of the tag
* @param statusEffect The status effect to apply to the attacker
*/
constructor(
sourceMove: Moves,
tagType: BattlerTagType,
private statusEffect: StatusEffect,
) {
super(sourceMove, tagType);
}
return ret;
/**
* Set the status effect on the attacker
* @param attacker - The pokemon using the contact move
* @param user - The pokemon that is being attacked and has the tag
*/
override onContact(attacker: Pokemon, user: Pokemon): void {
attacker.trySetStatus(this.statusEffect, true, user);
}
}
@ -1674,68 +1736,19 @@ export class ContactStatStageChangeProtectedTag extends DamageProtectedTag {
* When given a battler tag or json representing one, load the data for it.
* @param {BattlerTag | any} source A battler tag
*/
loadTag(source: BattlerTag | any): void {
override loadTag(source: BattlerTag | any): void {
super.loadTag(source);
this.stat = source.stat;
this.levels = source.levels;
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType);
if (lapseType === BattlerTagLapseType.CUSTOM) {
const effectPhase = globalScene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon();
globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels));
}
}
return ret;
}
}
export class ContactPoisonProtectedTag extends ProtectedTag {
constructor(sourceMove: Moves) {
super(sourceMove, BattlerTagType.BANEFUL_BUNKER);
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType);
if (lapseType === BattlerTagLapseType.CUSTOM) {
const effectPhase = globalScene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon();
attacker.trySetStatus(StatusEffect.POISON, true, pokemon);
}
}
return ret;
}
}
/**
* `BattlerTag` class for moves that block damaging moves and burn the enemy if the enemy's move makes contact
* Used by {@linkcode Moves.BURNING_BULWARK}
/**
* Initiate the stat stage change on the attacker
* @param attacker - The pokemon using the contact move
* @param user - The pokemon that is being attacked and has the tag
*/
export class ContactBurnProtectedTag extends DamageProtectedTag {
constructor(sourceMove: Moves) {
super(sourceMove, BattlerTagType.BURNING_BULWARK);
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = super.lapse(pokemon, lapseType);
if (lapseType === BattlerTagLapseType.CUSTOM) {
const effectPhase = globalScene.getCurrentPhase();
if (effectPhase instanceof MoveEffectPhase && effectPhase.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT)) {
const attacker = effectPhase.getPokemon();
attacker.trySetStatus(StatusEffect.BURN, true);
}
}
return ret;
override onContact(attacker: Pokemon, _user: Pokemon): void {
globalScene.unshiftPhase(new StatStageChangePhase(attacker.getBattlerIndex(), false, [this.stat], this.levels));
}
}
@ -2624,7 +2637,7 @@ export class GulpMissileTag extends BattlerTag {
return false;
}
if (moveEffectPhase.move.getMove().hitsSubstitute(attacker, pokemon)) {
if (moveEffectPhase.move.hitsSubstitute(attacker, pokemon)) {
return true;
}
@ -2980,7 +2993,7 @@ export class SubstituteTag extends BattlerTag {
if (!attacker) {
return;
}
const move = moveEffectPhase.move.getMove();
const move = moveEffectPhase.move;
const firstHit = attacker.turnData.hitCount === attacker.turnData.hitsLeft;
if (firstHit && move.hitsSubstitute(attacker, pokemon)) {
@ -3518,9 +3531,9 @@ export function getBattlerTag(
case BattlerTagType.SILK_TRAP:
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.SPD, -1);
case BattlerTagType.BANEFUL_BUNKER:
return new ContactPoisonProtectedTag(sourceMove);
return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.POISON);
case BattlerTagType.BURNING_BULWARK:
return new ContactBurnProtectedTag(sourceMove);
return new ContactSetStatusProtectedTag(sourceMove, tagType, StatusEffect.BURN);
case BattlerTagType.ENDURING:
return new EnduringTag(tagType, BattlerTagLapseType.TURN_END, sourceMove);
case BattlerTagType.ENDURE_TOKEN:
@ -3668,7 +3681,7 @@ function getMoveEffectPhaseData(_pokemon: Pokemon): { phase: MoveEffectPhase; at
return {
phase: phase,
attacker: phase.getPokemon(),
move: phase.move.getMove(),
move: phase.move,
};
}
return null;

View File

@ -2,14 +2,14 @@ import { getPokemonNameWithAffix } from "../messages";
import type Pokemon from "../field/pokemon";
import { HitResult } from "../field/pokemon";
import { getStatusEffectHealText } from "./status-effect";
import * as Utils from "../utils";
import { NumberHolder, toDmgValue, randSeedInt } from "#app/utils/common";
import {
DoubleBerryEffectAbAttr,
PostItemLostAbAttr,
ReduceBerryUseThresholdAbAttr,
applyAbAttrs,
applyPostItemLostAbAttrs,
} from "./ability";
} from "./abilities/ability";
import i18next from "i18next";
import { BattlerTagType } from "#enums/battler-tag-type";
import { BerryType } from "#enums/berry-type";
@ -43,7 +43,7 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
case BerryType.APICOT:
case BerryType.SALAC:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
// Offset BerryType such that LIECHI -> Stat.ATK = 1, GANLON -> Stat.DEF = 2, so on and so forth
const stat: BattleStat = berryType - BerryType.ENIGMA;
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
@ -51,19 +51,19 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
};
case BerryType.LANSAT:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return pokemon.getHpRatio() < 0.25 && !pokemon.getTag(BattlerTagType.CRIT_BOOST);
};
case BerryType.STARF:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return pokemon.getHpRatio() < 0.25;
};
case BerryType.LEPPA:
return (pokemon: Pokemon) => {
const threshold = new Utils.NumberHolder(0.25);
const threshold = new NumberHolder(0.25);
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
return !!pokemon.getMoveset().find(m => !m.getPpRatio());
};
@ -80,7 +80,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
if (pokemon.battleData) {
pokemon.battleData.berriesEaten.push(berryType);
}
const hpHealed = new Utils.NumberHolder(Utils.toDmgValue(pokemon.getMaxHp() / 4));
const hpHealed = new NumberHolder(toDmgValue(pokemon.getMaxHp() / 4));
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, hpHealed);
globalScene.unshiftPhase(
new PokemonHealPhase(
@ -118,7 +118,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
}
// Offset BerryType such that LIECHI -> Stat.ATK = 1, GANLON -> Stat.DEF = 2, so on and so forth
const stat: BattleStat = berryType - BerryType.ENIGMA;
const statStages = new Utils.NumberHolder(1);
const statStages = new NumberHolder(1);
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, statStages);
globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), true, [stat], statStages.value));
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);
@ -136,8 +136,8 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
if (pokemon.battleData) {
pokemon.battleData.berriesEaten.push(berryType);
}
const randStat = Utils.randSeedInt(Stat.SPD, Stat.ATK);
const stages = new Utils.NumberHolder(2);
const randStat = randSeedInt(Stat.SPD, Stat.ATK);
const stages = new NumberHolder(2);
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, stages);
globalScene.unshiftPhase(new StatStageChangePhase(pokemon.getBattlerIndex(), true, [randStat], stages.value));
applyPostItemLostAbAttrs(PostItemLostAbAttr, berryOwner ?? pokemon, false);

View File

@ -1,4 +1,4 @@
import * as Utils from "#app/utils";
import { BooleanHolder, type NumberHolder, randSeedItem, deepCopy } from "#app/utils/common";
import i18next from "i18next";
import type { DexAttrProps, GameData } from "#app/system/game-data";
import { defaultStarterSpecies } from "#app/system/game-data";
@ -8,7 +8,9 @@ import { speciesStarterCosts } from "#app/data/balance/starters";
import type Pokemon from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import type { FixedBattleConfig } from "#app/battle";
import { ClassicFixedBossWaves, BattleType, getRandomTrainerFunc } from "#app/battle";
import { getRandomTrainerFunc } from "#app/battle";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
import { BattleType } from "#enums/battle-type";
import Trainer, { TrainerVariant } from "#app/field/trainer";
import { PokemonType } from "#enums/pokemon-type";
import { Challenges } from "#enums/challenges";
@ -283,30 +285,30 @@ export abstract class Challenge {
/**
* An apply function for STARTER_CHOICE challenges. Derived classes should alter this.
* @param _pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param _valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterChoice(_pokemon: PokemonSpecies, _valid: Utils.BooleanHolder, _dexAttr: DexAttrProps): boolean {
applyStarterChoice(_pokemon: PokemonSpecies, _valid: BooleanHolder, _dexAttr: DexAttrProps): boolean {
return false;
}
/**
* An apply function for STARTER_POINTS challenges. Derived classes should alter this.
* @param _points {@link Utils.NumberHolder} The amount of points you have available.
* @param _points {@link NumberHolder} The amount of points you have available.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterPoints(_points: Utils.NumberHolder): boolean {
applyStarterPoints(_points: NumberHolder): boolean {
return false;
}
/**
* An apply function for STARTER_COST challenges. Derived classes should alter this.
* @param _species {@link Species} The pokemon to change the cost of.
* @param _cost {@link Utils.NumberHolder} The cost of the starter.
* @param _cost {@link NumberHolder} The cost of the starter.
* @returns {@link boolean} Whether this function did anything.
*/
applyStarterCost(_species: Species, _cost: Utils.NumberHolder): boolean {
applyStarterCost(_species: Species, _cost: NumberHolder): boolean {
return false;
}
@ -322,10 +324,10 @@ export abstract class Challenge {
/**
* An apply function for POKEMON_IN_BATTLE challenges. Derived classes should alter this.
* @param _pokemon {@link Pokemon} The pokemon to check the validity of.
* @param _valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param _valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @returns {@link boolean} Whether this function did anything.
*/
applyPokemonInBattle(_pokemon: Pokemon, _valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(_pokemon: Pokemon, _valid: BooleanHolder): boolean {
return false;
}
@ -341,42 +343,42 @@ export abstract class Challenge {
/**
* An apply function for TYPE_EFFECTIVENESS challenges. Derived classes should alter this.
* @param _effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @param _effectiveness {@linkcode NumberHolder} The current effectiveness of the move.
* @returns Whether this function did anything.
*/
applyTypeEffectiveness(_effectiveness: Utils.NumberHolder): boolean {
applyTypeEffectiveness(_effectiveness: NumberHolder): boolean {
return false;
}
/**
* An apply function for AI_LEVEL challenges. Derived classes should alter this.
* @param _level {@link Utils.NumberHolder} The generated level.
* @param _level {@link NumberHolder} The generated level.
* @param _levelCap {@link Number} The current level cap.
* @param _isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param _isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
* @returns {@link boolean} Whether this function did anything.
*/
applyLevelChange(_level: Utils.NumberHolder, _levelCap: number, _isTrainer: boolean, _isBoss: boolean): boolean {
applyLevelChange(_level: NumberHolder, _levelCap: number, _isTrainer: boolean, _isBoss: boolean): boolean {
return false;
}
/**
* An apply function for AI_MOVE_SLOTS challenges. Derived classes should alter this.
* @param pokemon {@link Pokemon} The pokemon that is being considered.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @param moveSlots {@link NumberHolder} The amount of move slots.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveSlot(_pokemon: Pokemon, _moveSlots: Utils.NumberHolder): boolean {
applyMoveSlot(_pokemon: Pokemon, _moveSlots: NumberHolder): boolean {
return false;
}
/**
* An apply function for PASSIVE_ACCESS challenges. Derived classes should alter this.
* @param pokemon {@link Pokemon} The pokemon to change.
* @param hasPassive {@link Utils.BooleanHolder} Whether it should have its passive.
* @param hasPassive {@link BooleanHolder} Whether it should have its passive.
* @returns {@link boolean} Whether this function did anything.
*/
applyPassiveAccess(_pokemon: Pokemon, _hasPassive: Utils.BooleanHolder): boolean {
applyPassiveAccess(_pokemon: Pokemon, _hasPassive: BooleanHolder): boolean {
return false;
}
@ -393,15 +395,10 @@ export abstract class Challenge {
* @param _pokemon {@link Pokemon} What pokemon would learn the move.
* @param _moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param _move {@link Moves} The move in question.
* @param _level {@link Utils.NumberHolder} The level threshold for access.
* @param _level {@link NumberHolder} The level threshold for access.
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveAccessLevel(
_pokemon: Pokemon,
_moveSource: MoveSourceType,
_move: Moves,
_level: Utils.NumberHolder,
): boolean {
applyMoveAccessLevel(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: NumberHolder): boolean {
return false;
}
@ -410,10 +407,10 @@ export abstract class Challenge {
* @param _pokemon {@link Pokemon} What pokemon would learn the move.
* @param _moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param _move {@link Moves} The move in question.
* @param _weight {@link Utils.NumberHolder} The base weight of the move
* @param _weight {@link NumberHolder} The base weight of the move
* @returns {@link boolean} Whether this function did anything.
*/
applyMoveWeight(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: Utils.NumberHolder): boolean {
applyMoveWeight(_pokemon: Pokemon, _moveSource: MoveSourceType, _move: Moves, _level: NumberHolder): boolean {
return false;
}
@ -438,7 +435,7 @@ export class SingleGenerationChallenge extends Challenge {
super(Challenges.SINGLE_GENERATION, 9);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (pokemon.generation !== this.value) {
valid.value = false;
return true;
@ -446,7 +443,7 @@ export class SingleGenerationChallenge extends Challenge {
return false;
}
applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean {
const baseGeneration = getPokemonSpecies(pokemon.species.speciesId).generation;
const fusionGeneration = pokemon.isFusion() ? getPokemonSpecies(pokemon.fusionSpecies!.speciesId).generation : 0;
if (
@ -575,7 +572,7 @@ export class SingleGenerationChallenge extends Challenge {
TrainerType.AARON,
TrainerType.SHAUNTAL,
TrainerType.MALVA,
Utils.randSeedItem([TrainerType.HALA, TrainerType.MOLAYNE]),
randSeedItem([TrainerType.HALA, TrainerType.MOLAYNE]),
TrainerType.MARNIE_ELITE,
TrainerType.RIKA,
];
@ -602,7 +599,7 @@ export class SingleGenerationChallenge extends Challenge {
TrainerType.GRIMSLEY,
TrainerType.WIKSTROM,
TrainerType.ACEROLA,
Utils.randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]),
randSeedItem([TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE]),
TrainerType.LARRY_ELITE,
];
break;
@ -622,14 +619,14 @@ export class SingleGenerationChallenge extends Challenge {
case ClassicFixedBossWaves.CHAMPION:
trainerTypes = [
TrainerType.BLUE,
Utils.randSeedItem([TrainerType.RED, TrainerType.LANCE_CHAMPION]),
Utils.randSeedItem([TrainerType.STEVEN, TrainerType.WALLACE]),
randSeedItem([TrainerType.RED, TrainerType.LANCE_CHAMPION]),
randSeedItem([TrainerType.STEVEN, TrainerType.WALLACE]),
TrainerType.CYNTHIA,
Utils.randSeedItem([TrainerType.ALDER, TrainerType.IRIS]),
randSeedItem([TrainerType.ALDER, TrainerType.IRIS]),
TrainerType.DIANTHA,
Utils.randSeedItem([TrainerType.KUKUI, TrainerType.HAU]),
Utils.randSeedItem([TrainerType.LEON, TrainerType.MUSTARD]),
Utils.randSeedItem([TrainerType.GEETA, TrainerType.NEMONA]),
randSeedItem([TrainerType.KUKUI, TrainerType.HAU]),
randSeedItem([TrainerType.LEON, TrainerType.MUSTARD]),
randSeedItem([TrainerType.GEETA, TrainerType.NEMONA]),
];
break;
}
@ -718,7 +715,7 @@ export class SingleTypeChallenge extends Challenge {
super(Challenges.SINGLE_TYPE, 18);
}
override applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder, dexAttr: DexAttrProps): boolean {
override applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder, dexAttr: DexAttrProps): boolean {
const speciesForm = getPokemonSpeciesForm(pokemon.speciesId, dexAttr.formIndex);
const types = [speciesForm.type1, speciesForm.type2];
if (!types.includes(this.value - 1)) {
@ -728,7 +725,7 @@ export class SingleTypeChallenge extends Challenge {
return false;
}
applyPokemonInBattle(pokemon: Pokemon, valid: Utils.BooleanHolder): boolean {
applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean {
if (
pokemon.isPlayer() &&
!pokemon.isOfType(this.value - 1, false, false, true) &&
@ -798,7 +795,7 @@ export class FreshStartChallenge extends Challenge {
super(Challenges.FRESH_START, 1);
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (!defaultStarterSpecies.includes(pokemon.speciesId)) {
valid.value = false;
return true;
@ -806,7 +803,7 @@ export class FreshStartChallenge extends Challenge {
return false;
}
applyStarterCost(species: Species, cost: Utils.NumberHolder): boolean {
applyStarterCost(species: Species, cost: NumberHolder): boolean {
if (defaultStarterSpecies.includes(species)) {
cost.value = speciesStarterCosts[species];
return true;
@ -864,7 +861,7 @@ export class InverseBattleChallenge extends Challenge {
return 0;
}
applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean {
applyTypeEffectiveness(effectiveness: NumberHolder): boolean {
if (effectiveness.value < 1) {
effectiveness.value = 2;
return true;
@ -887,7 +884,7 @@ export class FlipStatChallenge extends Challenge {
}
override applyFlipStat(_pokemon: Pokemon, baseStats: number[]) {
const origStats = Utils.deepCopy(baseStats);
const origStats = deepCopy(baseStats);
baseStats[0] = origStats[5];
baseStats[1] = origStats[4];
baseStats[2] = origStats[3];
@ -923,7 +920,7 @@ export class LowerStarterMaxCostChallenge extends Challenge {
return (DEFAULT_PARTY_MAX_COST - overrideValue).toString();
}
applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean {
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
if (speciesStarterCosts[pokemon.speciesId] > DEFAULT_PARTY_MAX_COST - this.value) {
valid.value = false;
return true;
@ -957,7 +954,7 @@ export class LowerStarterPointsChallenge extends Challenge {
return (DEFAULT_PARTY_MAX_COST - overrideValue).toString();
}
applyStarterPoints(points: Utils.NumberHolder): boolean {
applyStarterPoints(points: NumberHolder): boolean {
points.value -= this.value;
return true;
}
@ -974,34 +971,34 @@ export class LowerStarterPointsChallenge extends Challenge {
* Apply all challenges that modify starter choice.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
* @param pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_CHOICE,
pokemon: PokemonSpecies,
valid: Utils.BooleanHolder,
valid: BooleanHolder,
dexAttr: DexAttrProps,
): boolean;
/**
* Apply all challenges that modify available total starter points.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS
* @param points {@link Utils.NumberHolder} The amount of points you have available.
* @param points {@link NumberHolder} The amount of points you have available.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: Utils.NumberHolder): boolean;
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: NumberHolder): boolean;
/**
* Apply all challenges that modify the cost of a starter.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_COST
* @param species {@link Species} The pokemon to change the cost of.
* @param points {@link Utils.NumberHolder} The cost of the pokemon.
* @param points {@link NumberHolder} The cost of the pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_COST,
species: Species,
cost: Utils.NumberHolder,
cost: NumberHolder,
): boolean;
/**
* Apply all challenges that modify a starter after selection.
@ -1014,13 +1011,13 @@ export function applyChallenges(challengeType: ChallengeType.STARTER_MODIFY, pok
* Apply all challenges that what pokemon you can have in battle.
* @param challengeType {@link ChallengeType} ChallengeType.POKEMON_IN_BATTLE
* @param pokemon {@link Pokemon} The pokemon to check the validity of.
* @param valid {@link Utils.BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.POKEMON_IN_BATTLE,
pokemon: Pokemon,
valid: Utils.BooleanHolder,
valid: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify what fixed battles there are.
@ -1037,17 +1034,14 @@ export function applyChallenges(
/**
* Apply all challenges that modify type effectiveness.
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @param effectiveness {@linkcode NumberHolder} The current effectiveness of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.TYPE_EFFECTIVENESS,
effectiveness: Utils.NumberHolder,
): boolean;
export function applyChallenges(challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: NumberHolder): boolean;
/**
* Apply all challenges that modify what level AI are.
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
* @param level {@link Utils.NumberHolder} The generated level of the pokemon.
* @param level {@link NumberHolder} The generated level of the pokemon.
* @param levelCap {@link Number} The maximum level cap for the current wave.
* @param isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
@ -1055,7 +1049,7 @@ export function applyChallenges(
*/
export function applyChallenges(
challengeType: ChallengeType.AI_LEVEL,
level: Utils.NumberHolder,
level: NumberHolder,
levelCap: number,
isTrainer: boolean,
isBoss: boolean,
@ -1064,25 +1058,25 @@ export function applyChallenges(
* Apply all challenges that modify how many move slots the AI has.
* @param challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS
* @param pokemon {@link Pokemon} The pokemon being considered.
* @param moveSlots {@link Utils.NumberHolder} The amount of move slots.
* @param moveSlots {@link NumberHolder} The amount of move slots.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.AI_MOVE_SLOTS,
pokemon: Pokemon,
moveSlots: Utils.NumberHolder,
moveSlots: NumberHolder,
): boolean;
/**
* Apply all challenges that modify whether a pokemon has its passive.
* @param challengeType {@link ChallengeType} ChallengeType.PASSIVE_ACCESS
* @param pokemon {@link Pokemon} The pokemon to modify.
* @param hasPassive {@link Utils.BooleanHolder} Whether it has its passive.
* @param hasPassive {@link BooleanHolder} Whether it has its passive.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.PASSIVE_ACCESS,
pokemon: Pokemon,
hasPassive: Utils.BooleanHolder,
hasPassive: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify the game modes settings.
@ -1096,7 +1090,7 @@ export function applyChallenges(challengeType: ChallengeType.GAME_MODE_MODIFY):
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param level {@link Utils.NumberHolder} The level threshold for access.
* @param level {@link NumberHolder} The level threshold for access.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
@ -1104,7 +1098,7 @@ export function applyChallenges(
pokemon: Pokemon,
moveSource: MoveSourceType,
move: Moves,
level: Utils.NumberHolder,
level: NumberHolder,
): boolean;
/**
* Apply all challenges that modify what weight a pokemon gives to move generation
@ -1112,7 +1106,7 @@ export function applyChallenges(
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link Moves} The move in question.
* @param weight {@link Utils.NumberHolder} The weight of the move.
* @param weight {@link NumberHolder} The weight of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
@ -1120,7 +1114,7 @@ export function applyChallenges(
pokemon: Pokemon,
moveSource: MoveSourceType,
move: Moves,
weight: Utils.NumberHolder,
weight: NumberHolder,
): boolean;
export function applyChallenges(challengeType: ChallengeType.FLIP_STAT, pokemon: Pokemon, baseStats: number[]): boolean;
@ -1225,7 +1219,7 @@ export function initChallenges() {
*/
export function checkStarterValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
if (!soft) {
const isValidForChallenge = new Utils.BooleanHolder(true);
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
return isValidForChallenge.value;
}
@ -1263,7 +1257,7 @@ export function checkStarterValidForChallenge(species: PokemonSpecies, props: De
* @returns `true` if the species is considered valid.
*/
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
const isValidForChallenge = new Utils.BooleanHolder(true);
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
return isValidForChallenge.value;
@ -1282,7 +1276,7 @@ function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrPr
return species.forms.some((f2, formIndex) => {
if (f1.formKey === f2.formKey) {
const formProps = { ...props, formIndex };
const isFormValidForChallenge = new Utils.BooleanHolder(true);
const isFormValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isFormValidForChallenge, formProps);
return isFormValidForChallenge.value;
}

View File

@ -1,6 +1,6 @@
import type { Abilities } from "#enums/abilities";
import type { PokemonType } from "#enums/pokemon-type";
import { isNullOrUndefined } from "#app/utils";
import { isNullOrUndefined } from "#app/utils/common";
import type { Nature } from "#enums/nature";
/**

View File

@ -3,7 +3,7 @@ import type { Species } from "#enums/species";
import { globalScene } from "#app/global-scene";
import { PlayerPokemon } from "#app/field/pokemon";
import type { Starter } from "#app/ui/starter-select-ui-handler";
import * as Utils from "#app/utils";
import { randSeedGauss, randSeedInt, randSeedItem, getEnumValues } from "#app/utils/common";
import type { PokemonSpeciesForm } from "#app/data/pokemon-species";
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
import { speciesStarterCosts } from "#app/data/balance/starters";
@ -43,8 +43,8 @@ export function getDailyRunStarters(seed: string): Starter[] {
}
const starterCosts: number[] = [];
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(Utils.randSeedGauss(1))), 8));
starterCosts.push(Utils.randSeedInt(9 - starterCosts[0], 1));
starterCosts.push(Math.min(Math.round(3.5 + Math.abs(randSeedGauss(1))), 8));
starterCosts.push(randSeedInt(9 - starterCosts[0], 1));
starterCosts.push(10 - (starterCosts[0] + starterCosts[1]));
for (let c = 0; c < starterCosts.length; c++) {
@ -52,7 +52,7 @@ export function getDailyRunStarters(seed: string): Starter[] {
const costSpecies = Object.keys(speciesStarterCosts)
.map(s => Number.parseInt(s) as Species)
.filter(s => speciesStarterCosts[s] === cost);
const randPkmSpecies = getPokemonSpecies(Utils.randSeedItem(costSpecies));
const randPkmSpecies = getPokemonSpecies(randSeedItem(costSpecies));
const starterSpecies = getPokemonSpecies(
randPkmSpecies.getTrainerSpeciesForLevel(startingLevel, true, PartyMemberStrength.STRONGER),
);
@ -143,7 +143,7 @@ const dailyBiomeWeights: BiomeWeights = {
};
export function getDailyStartingBiome(): Biome {
const biomes = Utils.getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
const biomes = getEnumValues(Biome).filter(b => b !== Biome.TOWN && b !== Biome.END);
let totalWeight = 0;
const biomeThresholds: number[] = [];
@ -155,7 +155,7 @@ export function getDailyStartingBiome(): Biome {
biomeThresholds.push(totalWeight);
}
const randInt = Utils.randSeedInt(totalWeight);
const randInt = randSeedInt(totalWeight);
for (let i = 0; i < biomes.length; i++) {
if (randInt < biomeThresholds[i]) {
@ -164,5 +164,5 @@ export function getDailyStartingBiome(): Biome {
}
// Fallback in case something went wrong
return biomes[Utils.randSeedInt(biomes.length)];
return biomes[randSeedInt(biomes.length)];
}

3
src/data/data-lists.ts Normal file
View File

@ -0,0 +1,3 @@
import type { Ability } from "./abilities/ability-class";
export const allAbilities: Ability[] = [];

View File

@ -4,7 +4,7 @@ import type PokemonSpecies from "#app/data/pokemon-species";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { speciesStarterCosts } from "#app/data/balance/starters";
import { VariantTier } from "#enums/variant-tier";
import * as Utils from "#app/utils";
import { randInt, randomString, randSeedInt, getIvsFromId } from "#app/utils/common";
import Overrides from "#app/overrides";
import { pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import type { PlayerPokemon } from "#app/field/pokemon";
@ -171,7 +171,7 @@ export class Egg {
this.checkForPityTierOverrides();
}
this._id = eggOptions?.id ?? Utils.randInt(EGG_SEED, EGG_SEED * this._tier);
this._id = eggOptions?.id ?? randInt(EGG_SEED, EGG_SEED * this._tier);
this._sourceType = eggOptions?.sourceType ?? undefined;
this._hatchWaves = eggOptions?.hatchWaves ?? this.getEggTierDefaultHatchWaves();
@ -203,7 +203,7 @@ export class Egg {
}
};
const seedOverride = Utils.randomString(24);
const seedOverride = randomString(24);
globalScene.executeWithSeedOffset(
() => {
generateEggProperties(eggOptions);
@ -248,18 +248,15 @@ export class Egg {
let pokemonSpecies = getPokemonSpecies(this._species);
// Special condition to have Phione eggs also have a chance of generating Manaphy
if (this._species === Species.PHIONE && this._sourceType === EggSourceType.SAME_SPECIES_EGG) {
pokemonSpecies = getPokemonSpecies(
Utils.randSeedInt(MANAPHY_EGG_MANAPHY_RATE) ? Species.PHIONE : Species.MANAPHY,
);
pokemonSpecies = getPokemonSpecies(randSeedInt(MANAPHY_EGG_MANAPHY_RATE) ? Species.PHIONE : Species.MANAPHY);
}
// Sets the hidden ability if a hidden ability exists and
// the override is set or the egg hits the chance
let abilityIndex: number | undefined = undefined;
const sameSpeciesEggHACheck =
this._sourceType === EggSourceType.SAME_SPECIES_EGG && !Utils.randSeedInt(SAME_SPECIES_EGG_HA_RATE);
const gachaEggHACheck =
!(this._sourceType === EggSourceType.SAME_SPECIES_EGG) && !Utils.randSeedInt(GACHA_EGG_HA_RATE);
this._sourceType === EggSourceType.SAME_SPECIES_EGG && !randSeedInt(SAME_SPECIES_EGG_HA_RATE);
const gachaEggHACheck = !(this._sourceType === EggSourceType.SAME_SPECIES_EGG) && !randSeedInt(GACHA_EGG_HA_RATE);
if (pokemonSpecies.abilityHidden && (this._overrideHiddenAbility || sameSpeciesEggHACheck || gachaEggHACheck)) {
abilityIndex = 2;
}
@ -269,7 +266,7 @@ export class Egg {
ret.shiny = this._isShiny;
ret.variant = this._variantTier;
const secondaryIvs = Utils.getIvsFromId(Utils.randSeedInt(4294967295));
const secondaryIvs = getIvsFromId(randSeedInt(4294967295));
for (let s = 0; s < ret.ivs.length; s++) {
ret.ivs[s] = Math.max(ret.ivs[s], secondaryIvs[s]);
@ -370,7 +367,7 @@ export class Egg {
}
const tierMultiplier = this.isManaphyEgg() ? 2 : Math.pow(2, 3 - this.tier);
return Utils.randSeedInt(baseChance * tierMultiplier) ? Utils.randSeedInt(3) : 3;
return randSeedInt(baseChance * tierMultiplier) ? randSeedInt(3) : 3;
}
private getEggTierDefaultHatchWaves(eggTier?: EggTier): number {
@ -392,7 +389,7 @@ export class Egg {
private rollEggTier(): EggTier {
const tierValueOffset =
this._sourceType === EggSourceType.GACHA_LEGENDARY ? GACHA_LEGENDARY_UP_THRESHOLD_OFFSET : 0;
const tierValue = Utils.randInt(256);
const tierValue = randInt(256);
return tierValue >= GACHA_DEFAULT_COMMON_EGG_THRESHOLD + tierValueOffset
? EggTier.COMMON
: tierValue >= GACHA_DEFAULT_RARE_EGG_THRESHOLD + tierValueOffset
@ -417,11 +414,11 @@ export class Egg {
* when Utils.randSeedInt(8) = 1, and by making the generatePlayerPokemon() species
* check pass when Utils.randSeedInt(8) = 0, we can tell them apart during tests.
*/
const rand = Utils.randSeedInt(MANAPHY_EGG_MANAPHY_RATE) !== 1;
const rand = randSeedInt(MANAPHY_EGG_MANAPHY_RATE) !== 1;
return rand ? Species.PHIONE : Species.MANAPHY;
}
if (this.tier === EggTier.LEGENDARY && this._sourceType === EggSourceType.GACHA_LEGENDARY) {
if (!Utils.randSeedInt(2)) {
if (!randSeedInt(2)) {
return getLegendaryGachaSpeciesForTimestamp(this.timestamp);
}
}
@ -501,7 +498,7 @@ export class Egg {
let species: Species;
const rand = Utils.randSeedInt(totalWeight);
const rand = randSeedInt(totalWeight);
for (let s = 0; s < speciesWeights.length; s++) {
if (rand < speciesWeights[s]) {
species = speciesPool[s];
@ -539,7 +536,7 @@ export class Egg {
break;
}
return !Utils.randSeedInt(shinyChance);
return !randSeedInt(shinyChance);
}
// Uses the same logic as pokemon.generateVariant(). I would like to only have this logic in one
@ -550,7 +547,7 @@ export class Egg {
return VariantTier.STANDARD;
}
const rand = Utils.randSeedInt(10);
const rand = randSeedInt(10);
if (rand >= SHINY_VARIANT_CHANCE) {
return VariantTier.STANDARD; // 6/10
}

View File

@ -0,0 +1,20 @@
import { MoveTarget } from "#enums/MoveTarget";
import type Move from "./move";
/**
* Return whether the move targets the field
*
* Examples include
* - Hazard moves like spikes
* - Weather moves like rain dance
* - User side moves like reflect and safeguard
*/
export function isFieldTargeted(move: Move): boolean {
switch (move.moveTarget) {
case MoveTarget.BOTH_SIDES:
case MoveTarget.USER_SIDE:
case MoveTarget.ENEMY_SIDE:
return true;
}
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { TrainerType } from "#enums/trainer-type";
import { Species } from "#enums/species";
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import i18next from "i18next";
import type { IEggOptions } from "#app/data/egg";
import { EggSourceType } from "#enums/egg-source-types";
@ -22,7 +22,7 @@ import { EggTier } from "#enums/egg-type";
import { PartyHealPhase } from "#app/phases/party-heal-phase";
import { ModifierTier } from "#app/modifier/modifier-tier";
import { modifierTypes } from "#app/modifier/modifier-type";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/aTrainersTest";

View File

@ -24,7 +24,7 @@ import { BerryModifier, PokemonInstantReviveModifier } from "#app/modifier/modif
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { Moves } from "#enums/moves";
import { BattlerTagType } from "#enums/battler-tag-type";
import { randInt } from "#app/utils";
import { randInt } from "#app/utils/common";
import { BattlerIndex } from "#app/battle";
import {
applyModifierTypeToPlayerPokemon,
@ -37,7 +37,7 @@ import type HeldModifierConfig from "#app/interfaces/held-modifier-config";
import type { BerryType } from "#enums/berry-type";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { Stat } from "#enums/stat";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import i18next from "i18next";
/** the i18n namespace for this encounter */

View File

@ -23,7 +23,7 @@ import { speciesStarterCosts } from "#app/data/balance/starters";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import i18next from "i18next";
/** the i18n namespace for this encounter */

View File

@ -13,7 +13,7 @@ import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import type { BerryModifierType, ModifierTypeOption } from "#app/modifier/modifier-type";
import { ModifierPoolType, modifierTypes, regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { globalScene } from "#app/global-scene";
@ -36,7 +36,7 @@ import i18next from "#app/plugins/i18n";
import { BerryType } from "#enums/berry-type";
import { PERMANENT_STATS, Stat } from "#enums/stat";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/berriesAbound";

View File

@ -16,7 +16,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { PartyMemberStrength } from "#enums/party-member-strength";
import { globalScene } from "#app/global-scene";
import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
@ -52,7 +52,7 @@ import i18next from "i18next";
import MoveInfoOverlay from "#app/ui/move-info-overlay";
import { allMoves } from "#app/data/moves/move";
import { ModifierTier } from "#app/modifier/modifier-tier";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { getSpriteKeysFromSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
/** the i18n namespace for the encounter */

View File

@ -31,14 +31,14 @@ import {
import { PokemonType } from "#enums/pokemon-type";
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { randSeedInt, randSeedShuffle } from "#app/utils";
import { randSeedInt, randSeedShuffle } from "#app/utils/common";
import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { Mode } from "#app/ui/ui";
import { UiMode } from "#enums/ui-mode";
import i18next from "i18next";
import type { OptionSelectConfig } from "#app/ui/abstact-option-select-ui-handler";
import type { PlayerPokemon } from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import { Ability } from "#app/data/ability";
import { Ability } from "#app/data/abilities/ability-class";
import { BerryModifier } from "#app/modifier/modifier";
import { BerryType } from "#enums/berry-type";
import { BattlerIndex } from "#app/battle";
@ -46,7 +46,7 @@ import { Moves } from "#enums/moves";
import { EncounterBattleAnim } from "#app/data/battle-anims";
import { MoveCategory } from "#enums/MoveCategory";
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { EncounterAnim } from "#enums/encounter-anims";
import { Challenges } from "#enums/challenges";
@ -437,7 +437,7 @@ async function handleSwapAbility() {
await showEncounterDialogue(`${namespace}:option.1.apply_ability_dialogue`, `${namespace}:speaker`);
await showEncounterText(`${namespace}:option.1.apply_ability_message`);
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
displayYesNoOptions(resolve);
});
});
@ -467,7 +467,7 @@ function displayYesNoOptions(resolve) {
maxOptions: 7,
yOffset: 0,
};
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
}
function onYesAbilitySwap(resolve) {
@ -477,11 +477,11 @@ function onYesAbilitySwap(resolve) {
applyAbilityOverrideToPokemon(pokemon, encounter.misc.ability);
encounter.setDialogueToken("chosenPokemon", pokemon.getNameToRender());
globalScene.ui.setMode(Mode.MESSAGE).then(() => resolve(true));
globalScene.ui.setMode(UiMode.MESSAGE).then(() => resolve(true));
};
const onPokemonNotSelected = () => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
displayYesNoOptions(resolve);
});
};

View File

@ -24,7 +24,7 @@ import { TrainerSlot } from "#enums/trainer-slot";
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { modifierTypes } from "#app/modifier/modifier-type";
import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";

View File

@ -1,5 +1,5 @@
import type { PokemonType } from "#enums/pokemon-type";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { Species } from "#enums/species";
import { globalScene } from "#app/global-scene";
@ -19,7 +19,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
import { PokemonFormChangeItemModifier } from "#app/modifier/modifier";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { Challenges } from "#enums/challenges";
/** i18n namespace for encounter */

View File

@ -18,7 +18,7 @@ import { applyModifierTypeToPlayerPokemon } from "#app/data/mystery-encounters/u
import { getPokemonSpecies } from "#app/data/pokemon-species";
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import type { PokemonHeldItemModifier, PokemonInstantReviveModifier } from "#app/modifier/modifier";
import {
BerryModifier,
@ -32,7 +32,7 @@ import { modifierTypes } from "#app/modifier/modifier-type";
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
import i18next from "#app/plugins/i18n";
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import { randSeedItem } from "#app/utils";
import { randSeedItem } from "#app/utils/common";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";

View File

@ -4,13 +4,13 @@ import {
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import type { ModifierTypeFunc } from "#app/modifier/modifier-type";
import { modifierTypes } from "#app/modifier/modifier-type";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { Species } from "#enums/species";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** i18n namespace for encounter */
const namespace = "mysteryEncounters/departmentStoreSale";

View File

@ -18,7 +18,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { Stat } from "#enums/stat";
import i18next from "i18next";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** i18n namespace for the encounter */
const namespace = "mysteryEncounters/fieldTrip";

View File

@ -30,7 +30,7 @@ import { PokemonMove } from "#app/field/pokemon";
import { Moves } from "#enums/moves";
import { EncounterBattleAnim } from "#app/data/battle-anims";
import { WeatherType } from "#enums/weather-type";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
import { StatusEffect } from "#enums/status-effect";
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import {
@ -41,12 +41,12 @@ import {
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { EncounterAnim } from "#enums/encounter-anims";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { Stat } from "#enums/stat";
import { Ability } from "#app/data/ability";
import { Ability } from "#app/data/abilities/ability-class";
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
/** the i18n namespace for the encounter */

View File

@ -31,9 +31,9 @@ import {
import PokemonData from "#app/system/pokemon-data";
import { BattlerTagType } from "#enums/battler-tag-type";
import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/fightOrFlight";

View File

@ -30,7 +30,7 @@ import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms";
import { PostSummonPhase } from "#app/phases/post-summon-phase";
import { modifierTypes } from "#app/modifier/modifier-type";
import { Nature } from "#enums/nature";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { isPokemonValidForEncounterOptionSelection } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
/** the i18n namespace for the encounter */

View File

@ -23,7 +23,14 @@ import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import { getTypeRgb } from "#app/data/type";
import { MysteryEncounterOptionBuilder } from "#app/data/mystery-encounters/mystery-encounter-option";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { NumberHolder, isNullOrUndefined, randInt, randSeedInt, randSeedShuffle, randSeedItem } from "#app/utils";
import {
NumberHolder,
isNullOrUndefined,
randInt,
randSeedInt,
randSeedShuffle,
randSeedItem,
} from "#app/utils/common";
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { EnemyPokemon, PokemonMove } from "#app/field/pokemon";
@ -41,7 +48,7 @@ import { Gender, getGenderSymbol } from "#app/data/gender";
import { getNatureName } from "#app/data/nature";
import { getPokeballAtlasKey, getPokeballTintColor } from "#app/data/pokeball";
import { getEncounterText, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { addPokemonDataToDexAndValidateAchievements } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import type { PokeballType } from "#enums/pokeball";
import { doShinySparkleAnim } from "#app/field/anims";

View File

@ -10,7 +10,7 @@ import { leaveEncounterWithoutBattle, setEncounterExp } from "../utils/encounter
import { applyDamageToPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { PokemonMove } from "#app/field/pokemon";
const OPTION_1_REQUIRED_MOVE = Moves.SURF;

View File

@ -12,11 +12,11 @@ import { modifierTypes } from "#app/modifier/modifier-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { PartyMemberStrength } from "#enums/party-member-strength";
import { globalScene } from "#app/global-scene";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#app/data/mystery-encounters/mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/mysteriousChallengers";
@ -46,7 +46,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
const normalConfig = trainerConfigs[normalTrainerType].clone();
let female = false;
if (normalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const normalSpriteKey = normalConfig.getSpriteKey(female, normalConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
@ -76,7 +76,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
hardConfig.setPartyTemplates(hardTemplate);
female = false;
if (hardConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const hardSpriteKey = hardConfig.getSpriteKey(female, hardConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
@ -96,7 +96,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false;
if (brutalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
female = !!randSeedInt(2);
}
const brutalSpriteKey = brutalConfig.getSpriteKey(female, brutalConfig.doubleOnly);
encounter.enemyPartyConfigs.push({

View File

@ -15,10 +15,10 @@ import {
koPlayerPokemon,
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { ModifierTier } from "#app/modifier/modifier-tier";
import { GameOverPhase } from "#app/phases/game-over-phase";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { Moves } from "#enums/moves";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";

View File

@ -20,7 +20,7 @@ import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-enco
import i18next from "i18next";
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { isPokemonValidForEncounterOptionSelection } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
/** the i18n namespace for the encounter */

View File

@ -15,7 +15,7 @@ import { HiddenAbilityRateBoosterModifier, IvScannerModifier } from "#app/modifi
import type { EnemyPokemon } from "#app/field/pokemon";
import { PokeballType } from "#enums/pokeball";
import { PlayerGender } from "#enums/player-gender";
import { NumberHolder, randSeedInt } from "#app/utils";
import { NumberHolder, randSeedInt } from "#app/utils/common";
import type PokemonSpecies from "#app/data/pokemon-species";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
@ -31,7 +31,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { ScanIvsPhase } from "#app/phases/scan-ivs-phase";
import { SummonPhase } from "#app/phases/summon-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
/** the i18n namespace for the encounter */

View File

@ -8,7 +8,7 @@ import {
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { modifierTypes } from "#app/modifier/modifier-type";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { Species } from "#enums/species";
import { globalScene } from "#app/global-scene";
@ -26,7 +26,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import type { Nature } from "#enums/nature";
import { getNatureName } from "#app/data/nature";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import i18next from "i18next";
/** the i18n namespace for this encounter */

View File

@ -26,7 +26,7 @@ import { getPokemonSpecies } from "#app/data/pokemon-species";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { PartyHealPhase } from "#app/phases/party-heal-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { BerryType } from "#enums/berry-type";
import { CustomPokemonData } from "#app/data/custom-pokemon-data";

View File

@ -7,7 +7,7 @@ import {
transitionMysteryEncounterIntroVisuals,
updatePlayerMoney,
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { randSeedInt } from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { globalScene } from "#app/global-scene";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
@ -29,7 +29,7 @@ import { BattlerTagType } from "#enums/battler-tag-type";
import { getPokemonNameWithAffix } from "#app/messages";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { Stat } from "#enums/stat";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import {
getEncounterPokemonLevelForWave,
STANDARD_ENCOUNTER_BOOSTED_LEVEL_MODIFIER,

View File

@ -7,11 +7,11 @@ import {
import { trainerConfigs } from "#app/data/trainers/trainer-config";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { globalScene } from "#app/global-scene";
import { randSeedShuffle } from "#app/utils";
import { randSeedShuffle } from "#app/utils/common";
import type MysteryEncounter from "../mystery-encounter";
import { MysteryEncounterBuilder } from "../mystery-encounter";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { Biome } from "#enums/biome";
import { TrainerType } from "#enums/trainer-type";
import i18next from "i18next";

View File

@ -3,7 +3,7 @@ import {
transitionMysteryEncounterIntroVisuals,
updatePlayerMoney,
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, NumberHolder, randSeedInt, randSeedItem } from "#app/utils/common";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { globalScene } from "#app/global-scene";
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
@ -26,9 +26,10 @@ import { showEncounterDialogue } from "#app/data/mystery-encounters/utils/encoun
import PokemonData from "#app/system/pokemon-data";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { Abilities } from "#enums/abilities";
import { NON_LEGEND_PARADOX_POKEMON } from "#app/data/balance/special-species-groups";
import { NON_LEGEND_PARADOX_POKEMON, NON_LEGEND_ULTRA_BEASTS } from "#app/data/balance/special-species-groups";
import { timedEventManager } from "#app/global-event-manager";
/** the i18n namespace for this encounter */
const namespace = "mysteryEncounters/thePokemonSalesman";
@ -38,6 +39,9 @@ const MAX_POKEMON_PRICE_MULTIPLIER = 4;
/** Odds of shiny magikarp will be 1/value */
const SHINY_MAGIKARP_WEIGHT = 100;
/** Odds of event sale will be value/100 */
const EVENT_THRESHOLD = 50;
/**
* Pokemon Salesman encounter.
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/3799 | GitHub Issue #3799}
@ -82,15 +86,46 @@ export const ThePokemonSalesmanEncounter: MysteryEncounter = MysteryEncounterBui
tries++;
}
const r = randSeedInt(SHINY_MAGIKARP_WEIGHT);
const validEventEncounters = timedEventManager
.getEventEncounters()
.filter(
s =>
!getPokemonSpecies(s.species).legendary &&
!getPokemonSpecies(s.species).subLegendary &&
!getPokemonSpecies(s.species).mythical &&
!NON_LEGEND_PARADOX_POKEMON.includes(s.species) &&
!NON_LEGEND_ULTRA_BEASTS.includes(s.species),
);
let pokemon: PlayerPokemon;
/**
* Mon is determined as follows:
* If you roll the 1% for Shiny Magikarp, you get Magikarp with a random variant
* If an event with more than 1 valid event encounter species is active, you have 20% chance to get one of those
* If the rolled species has no HA, and there are valid event encounters, you will get one of those
* If the rolled species has no HA and there are no valid event encounters, you will get Shiny Magikarp
* Mons rolled from the event encounter pool get 2 extra shiny rolls
*/
if (
randSeedInt(SHINY_MAGIKARP_WEIGHT) === 0 ||
isNullOrUndefined(species.abilityHidden) ||
species.abilityHidden === Abilities.NONE
r === 0 ||
((isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE) &&
(validEventEncounters.length === 0))
) {
// If no HA mon found or you roll 1%, give shiny Magikarp with random variant
// If you roll 1%, give shiny Magikarp with random variant
species = getPokemonSpecies(Species.MAGIKARP);
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex, undefined, true);
pokemon = new PlayerPokemon(species, 5, 2, undefined, undefined, true);
} else if (
(validEventEncounters.length > 0 && (r <= EVENT_THRESHOLD ||
(isNullOrUndefined(species.abilityHidden) || species.abilityHidden === Abilities.NONE)))
) {
// If you roll 20%, give event encounter with 2 extra shiny rolls and its HA, if it has one
const enc = randSeedItem(validEventEncounters);
species = getPokemonSpecies(enc.species);
pokemon = new PlayerPokemon(species, 5, species.abilityHidden === Abilities.NONE ? undefined : 2, enc.formIndex);
pokemon.trySetShinySeed();
pokemon.trySetShinySeed();
} else {
pokemon = new PlayerPokemon(species, 5, 2, species.formIndex);
}

View File

@ -28,7 +28,7 @@ import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import { Stat } from "#enums/stat";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/theStrongStuff";

View File

@ -24,7 +24,7 @@ import { PokemonType } from "#enums/pokemon-type";
import { BerryType } from "#enums/berry-type";
import { Stat } from "#enums/stat";
import { SpeciesFormChangeAbilityTrigger } from "#app/data/pokemon-forms";
import { applyPostBattleInitAbAttrs, PostBattleInitAbAttr } from "#app/data/ability";
import { applyPostBattleInitAbAttrs, PostBattleInitAbAttr } from "#app/data/abilities/ability";
import { showEncounterDialogue, showEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import { PartyHealPhase } from "#app/phases/party-heal-phase";
@ -32,7 +32,7 @@ import { ShowTrainerPhase } from "#app/phases/show-trainer-phase";
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 { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { BattlerTagType } from "#enums/battler-tag-type";
/** the i18n namespace for the encounter */

View File

@ -1,5 +1,5 @@
import type { Ability } from "#app/data/ability";
import { allAbilities } from "#app/data/ability";
import type { Ability } from "#app/data/abilities/ability-class";
import { allAbilities } from "#app/data/data-lists";
import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import {
initBattleWithEnemyConfig,
@ -15,7 +15,7 @@ import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
import { AbilityAttr } from "#app/system/game-data";
import PokemonData from "#app/system/pokemon-data";
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import { isNullOrUndefined, randSeedShuffle } from "#app/utils";
import { isNullOrUndefined, randSeedShuffle } from "#app/utils/common";
import { BattlerTagType } from "#enums/battler-tag-type";
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { globalScene } from "#app/global-scene";
@ -28,7 +28,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import type HeldModifierConfig from "#app/interfaces/held-modifier-config";
import i18next from "i18next";
import { getStatKey } from "#enums/stat";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { isPokemonValidForEncounterOptionSelection } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import type { Nature } from "#enums/nature";

View File

@ -26,8 +26,8 @@ import { getPokemonSpecies } from "#app/data/pokemon-species";
import { Moves } from "#enums/moves";
import { BattlerIndex } from "#app/battle";
import { PokemonMove } from "#app/field/pokemon";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { randSeedInt } from "#app/utils";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { randSeedInt } from "#app/utils/common";
/** the i18n namespace for this encounter */
const namespace = "mysteryEncounters/trashToTreasure";

View File

@ -27,7 +27,7 @@ import {
getSpriteKeysFromPokemon,
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import PokemonData from "#app/system/pokemon-data";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
import type { Moves } from "#enums/moves";
import { BattlerIndex } from "#app/battle";
import { SelfStatusMove } from "#app/data/moves/move";
@ -37,7 +37,7 @@ import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encoun
import { BerryModifier } from "#app/modifier/modifier";
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { Stat } from "#enums/stat";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
/** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/uncommonBreed";

View File

@ -17,7 +17,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import type { PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils";
import { NumberHolder, isNullOrUndefined, randSeedInt, randSeedShuffle } from "#app/utils/common";
import type PokemonSpecies from "#app/data/pokemon-species";
import { allSpecies, getPokemonSpecies } from "#app/data/pokemon-species";
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";

View File

@ -12,7 +12,7 @@ import {
} from "#app/data/mystery-encounters/mystery-encounter-requirements";
import type { CanLearnMoveRequirementOptions } from "./requirements/can-learn-move-requirement";
import { CanLearnMoveRequirement } from "./requirements/can-learn-move-requirement";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
// biome-ignore lint/suspicious/noConfusingVoidType: void unions in callbacks are OK

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene";
import { allAbilities } from "#app/data/ability";
import { allAbilities } from "../data-lists";
import { EvolutionItem, pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import { Nature } from "#enums/nature";
import { FormChangeItem, pokemonFormChanges, SpeciesFormChangeItemTrigger } from "#app/data/pokemon-forms";
@ -9,7 +9,7 @@ import { WeatherType } from "#enums/weather-type";
import type { PlayerPokemon } from "#app/field/pokemon";
import { AttackTypeBoosterModifier } from "#app/modifier/modifier";
import type { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type";
import { isNullOrUndefined } from "#app/utils";
import { isNullOrUndefined } from "#app/utils/common";
import type { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";

View File

@ -1,6 +1,6 @@
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { BASE_MYSTERY_ENCOUNTER_SPAWN_WEIGHT } from "#app/data/mystery-encounters/mystery-encounters";
import { isNullOrUndefined } from "#app/utils";
import { isNullOrUndefined } from "#app/utils/common";
import type { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
export class SeenEncounterData {

View File

@ -1,11 +1,11 @@
import type { EnemyPartyConfig } from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import type { PlayerPokemon, PokemonMove } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils";
import { capitalizeFirstLetter, isNullOrUndefined } from "#app/utils/common";
import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
import type { MysteryEncounterSpriteConfig } from "#app/field/mystery-encounter-intro";
import MysteryEncounterIntroVisuals from "#app/field/mystery-encounter-intro";
import * as Utils from "#app/utils";
import { randSeedInt } from "#app/utils/common";
import type { StatusEffect } from "#enums/status-effect";
import type { OptionTextDisplay } from "./mystery-encounter-dialogue";
import type MysteryEncounterDialogue from "./mystery-encounter-dialogue";
@ -378,13 +378,13 @@ export default class MysteryEncounter implements IMysteryEncounter {
}
if (truePrimaryPool.length > 0) {
// Always choose from the non-overlapping pokemon first
this.primaryPokemon = truePrimaryPool[Utils.randSeedInt(truePrimaryPool.length, 0)];
this.primaryPokemon = truePrimaryPool[randSeedInt(truePrimaryPool.length, 0)];
return true;
}
// If there are multiple overlapping pokemon, we're okay - just choose one and take it out of the primary pokemon pool
if (overlap.length > 1 || this.secondaryPokemon.length - overlap.length >= 1) {
// is this working?
this.primaryPokemon = overlap[Utils.randSeedInt(overlap.length, 0)];
this.primaryPokemon = overlap[randSeedInt(overlap.length, 0)];
this.secondaryPokemon = this.secondaryPokemon.filter(supp => supp !== this.primaryPokemon);
return true;
}
@ -394,7 +394,7 @@ export default class MysteryEncounter implements IMysteryEncounter {
return false;
}
// this means we CAN have the same pokemon be a primary and secondary pokemon, so just choose any qualifying one randomly.
this.primaryPokemon = qualified[Utils.randSeedInt(qualified.length, 0)];
this.primaryPokemon = qualified[randSeedInt(qualified.length, 0)];
return true;
}

View File

@ -1,7 +1,7 @@
import type { Moves } from "#app/enums/moves";
import type { PlayerPokemon } from "#app/field/pokemon";
import { PokemonMove } from "#app/field/pokemon";
import { isNullOrUndefined } from "#app/utils";
import { isNullOrUndefined } from "#app/utils/common";
import { EncounterPokemonRequirement } from "#app/data/mystery-encounters/mystery-encounter-requirements";
import { globalScene } from "#app/global-scene";

View File

@ -2,7 +2,7 @@ import { globalScene } from "#app/global-scene";
import type { TextStyle } from "#app/ui/text";
import { getTextWithColors } from "#app/ui/text";
import { UiTheme } from "#enums/ui-theme";
import { isNullOrUndefined } from "#app/utils";
import { isNullOrUndefined } from "#app/utils/common";
import i18next from "i18next";
/**

View File

@ -1,5 +1,6 @@
import type Battle from "#app/battle";
import { BattlerIndex, BattleType } from "#app/battle";
import { BattlerIndex } from "#app/battle";
import { BattleType } from "#enums/battle-type";
import { biomeLinks, BiomePoolTier } from "#app/data/balance/biomes";
import type MysteryEncounterOption from "#app/data/mystery-encounters/mystery-encounter-option";
import {
@ -29,9 +30,8 @@ import type PokemonData from "#app/system/pokemon-data";
import type { OptionSelectConfig, OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import type { PartyOption, PokemonSelectFilter } from "#app/ui/party-ui-handler";
import { PartyUiMode } from "#app/ui/party-ui-handler";
import { Mode } from "#app/ui/ui";
import * as Utils from "#app/utils";
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
import { UiMode } from "#enums/ui-mode";
import { isNullOrUndefined, randSeedInt, randomString, randSeedItem } from "#app/utils/common";
import type { BattlerTagType } from "#enums/battler-tag-type";
import { Biome } from "#enums/biome";
import type { TrainerType } from "#enums/trainer-type";
@ -58,7 +58,7 @@ import { BattleEndPhase } from "#app/phases/battle-end-phase";
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 type { Variant } from "#app/data/variant";
import type { Variant } from "#app/sprites/variant";
import { StatusEffect } from "#enums/status-effect";
import { globalScene } from "#app/global-scene";
import { getPokemonSpecies } from "#app/data/pokemon-species";
@ -168,7 +168,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
const doubleTrainer = trainerConfig.doubleOnly || (trainerConfig.hasDouble && !!partyConfig.doubleBattle);
doubleBattle = doubleTrainer;
const trainerFemale = isNullOrUndefined(partyConfig.female) ? !!Utils.randSeedInt(2) : partyConfig.female;
const trainerFemale = isNullOrUndefined(partyConfig.female) ? !!randSeedInt(2) : partyConfig.female;
const newTrainer = new Trainer(
trainerConfig.trainerType,
doubleTrainer ? TrainerVariant.DOUBLE : trainerFemale ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT,
@ -286,7 +286,7 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
// Generate new id, reset status and HP in case using data source
if (config.dataSource) {
enemyPokemon.id = Utils.randSeedInt(4294967296);
enemyPokemon.id = randSeedInt(4294967296);
}
// Set form
@ -563,7 +563,7 @@ export function selectPokemonForOption(
// Open party screen to choose pokemon
globalScene.ui.setMode(
Mode.PARTY,
UiMode.PARTY,
PartyUiMode.SELECT,
-1,
(slotIndex: number, _option: PartyOption) => {
@ -581,7 +581,7 @@ export function selectPokemonForOption(
}
// There is a second option to choose after selecting the Pokemon
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
const displayOptions = () => {
// Always appends a cancel option to bottom of options
const fullOptions = secondaryOptions
@ -623,7 +623,7 @@ export function selectPokemonForOption(
if (fullOptions[0].onHover) {
fullOptions[0].onHover();
}
globalScene.ui.setModeWithoutClear(Mode.OPTION_SELECT, config, null, true);
globalScene.ui.setModeWithoutClear(UiMode.OPTION_SELECT, config, null, true);
};
const textPromptKey =
@ -673,20 +673,20 @@ export function selectOptionThenPokemon(
const modeToSetOnExit = globalScene.ui.getMode();
const displayOptions = (config: OptionSelectConfig) => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
if (!optionSelectPromptKey) {
// Do hover over the starting selection option
if (fullOptions[0].onHover) {
fullOptions[0].onHover();
}
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
} else {
showEncounterText(optionSelectPromptKey).then(() => {
// Do hover over the starting selection option
if (fullOptions[0].onHover) {
fullOptions[0].onHover();
}
globalScene.ui.setMode(Mode.OPTION_SELECT, config);
globalScene.ui.setMode(UiMode.OPTION_SELECT, config);
});
}
});
@ -695,7 +695,7 @@ export function selectOptionThenPokemon(
const selectPokemonAfterOption = (selectedOptionIndex: number) => {
// Open party screen to choose a Pokemon
globalScene.ui.setMode(
Mode.PARTY,
UiMode.PARTY,
PartyUiMode.SELECT,
-1,
(slotIndex: number, _option: PartyOption) => {
@ -1075,8 +1075,8 @@ export function getRandomEncounterSpecies(level: number, isBoss = false, rerollH
ret.formIndex = formIndex;
}
//Reroll shiny for event encounters
if (isEventEncounter && !ret.shiny) {
//Reroll shiny or variant for event encounters
if (isEventEncounter) {
ret.trySetShinySeed();
}
//Reroll hidden ability
@ -1115,7 +1115,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
const validMEfloorsByBiome = new Map<string, number>(biomes.map(b => [b, 0]));
let currentBiome = Biome.TOWN;
let currentArena = globalScene.newArena(currentBiome);
globalScene.setSeed(Utils.randomString(24));
globalScene.setSeed(randomString(24));
globalScene.resetSeed();
for (let i = 10; i < 180; i++) {
// Boss
@ -1130,16 +1130,16 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
globalScene.executeWithSeedOffset(() => {
biomes = (biomeLinks[currentBiome] as (Biome | [Biome, number])[])
.filter(b => {
return !Array.isArray(b) || !Utils.randSeedInt(b[1]);
return !Array.isArray(b) || !randSeedInt(b[1]);
})
.map(b => (!Array.isArray(b) ? b : b[0]));
}, i * 100);
if (biomes! && biomes.length > 0) {
const specialBiomes = biomes.filter(b => alwaysPickTheseBiomes.includes(b));
if (specialBiomes.length > 0) {
currentBiome = specialBiomes[Utils.randSeedInt(specialBiomes.length)];
currentBiome = specialBiomes[randSeedInt(specialBiomes.length)];
} else {
currentBiome = biomes[Utils.randSeedInt(biomes.length)];
currentBiome = biomes[randSeedInt(biomes.length)];
}
}
} else if (biomeLinks.hasOwnProperty(currentBiome)) {
@ -1167,7 +1167,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
// Otherwise, roll encounter
const roll = Utils.randSeedInt(256);
const roll = randSeedInt(256);
validMEfloorsByBiome.set(Biome[currentBiome], (validMEfloorsByBiome.get(Biome[currentBiome]) ?? 0) + 1);
// If total number of encounters is lower than expected for the run, slightly favor a new encounter
@ -1192,7 +1192,7 @@ export function calculateMEAggregateStats(baseSpawnWeight: number) {
tierWeights[1] = tierWeights[1] - 4 * numEncounters[1];
const totalWeight = tierWeights.reduce((a, b) => a + b);
const tierValue = Utils.randSeedInt(totalWeight);
const tierValue = randSeedInt(totalWeight);
const commonThreshold = totalWeight - tierWeights[0]; // 64 - 32 = 32
const uncommonThreshold = totalWeight - tierWeights[0] - tierWeights[1]; // 64 - 32 - 16 = 16
const rareThreshold = totalWeight - tierWeights[0] - tierWeights[1] - tierWeights[2]; // 64 - 32 - 16 - 10 = 6
@ -1281,7 +1281,7 @@ export function calculateRareSpawnAggregateStats(luckValue: number) {
const calculateNumRareEncounters = (): any[] => {
const bossEncountersByRarity = [0, 0, 0, 0];
globalScene.setSeed(Utils.randomString(24));
globalScene.setSeed(randomString(24));
globalScene.resetSeed();
// There are 12 wild boss floors
for (let i = 0; i < 12; i++) {
@ -1291,7 +1291,7 @@ export function calculateRareSpawnAggregateStats(luckValue: number) {
if (!Number.isNaN(luckValue)) {
luckModifier = luckValue * 0.5;
}
const tierValue = Utils.randSeedInt(64 - luckModifier);
const tierValue = randSeedInt(64 - luckModifier);
const tier =
tierValue >= 20
? BiomePoolTier.BOSS

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene";
import i18next from "i18next";
import { isNullOrUndefined, randSeedInt } from "#app/utils";
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import type Pokemon from "#app/field/pokemon";
@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender";
import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims";
import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { achvs } from "#app/system/achv";
import { Mode } from "#app/ui/ui";
import { UiMode } from "#enums/ui-mode";
import type { PartyOption } from "#app/ui/party-ui-handler";
import { PartyUiMode } from "#app/ui/party-ui-handler";
import { Species } from "#enums/species";
@ -714,7 +714,7 @@ export async function catchPokemon(
() => {
globalScene.pokemonInfoContainer.makeRoomForConfirmUi(1, true);
globalScene.ui.setMode(
Mode.CONFIRM,
UiMode.CONFIRM,
() => {
const newPokemon = globalScene.addPlayerPokemon(
pokemon.species,
@ -729,12 +729,12 @@ export async function catchPokemon(
pokemon,
);
globalScene.ui.setMode(
Mode.SUMMARY,
UiMode.SUMMARY,
newPokemon,
0,
SummaryUiMode.DEFAULT,
() => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
promptRelease();
});
},
@ -749,13 +749,13 @@ export async function catchPokemon(
female: pokemon.gender === Gender.FEMALE,
};
globalScene.ui.setOverlayMode(
Mode.POKEDEX_PAGE,
UiMode.POKEDEX_PAGE,
pokemon.species,
pokemon.formIndex,
attributes,
null,
() => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
promptRelease();
});
},
@ -763,11 +763,11 @@ export async function catchPokemon(
},
() => {
globalScene.ui.setMode(
Mode.PARTY,
UiMode.PARTY,
PartyUiMode.RELEASE,
0,
(slotIndex: number, _option: PartyOption) => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
if (slotIndex < 6) {
addToParty(slotIndex);
} else {
@ -778,7 +778,7 @@ export async function catchPokemon(
);
},
() => {
globalScene.ui.setMode(Mode.MESSAGE).then(() => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
removePokemon();
end();
});

View File

@ -1,5 +1,5 @@
import type { PlayerPokemon } from "#app/field/pokemon";
import { getFrameMs } from "#app/utils";
import { getFrameMs } from "#app/utils/common";
import { cos, sin } from "#app/field/anims";
import { getTypeRgb } from "#app/data/type";
import { globalScene } from "#app/global-scene";

View File

@ -1,4 +1,4 @@
import * as Utils from "../utils";
import { toReadableString } from "#app/utils/common";
import { TextStyle, getBBCodeFrag } from "../ui/text";
import { Nature } from "#enums/nature";
import { UiTheme } from "#enums/ui-theme";
@ -12,7 +12,7 @@ export function getNatureName(
ignoreBBCode = false,
uiTheme: UiTheme = UiTheme.DEFAULT,
): string {
let ret = Utils.toReadableString(Nature[nature]);
let ret = toReadableString(Nature[nature]);
//Translating nature
if (i18next.exists(`nature:${ret}`)) {
ret = i18next.t(`nature:${ret}` as any);

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene";
import { CriticalCatchChanceBoosterModifier } from "#app/modifier/modifier";
import { NumberHolder } from "#app/utils";
import { NumberHolder } from "#app/utils/common";
import { PokeballType } from "#enums/pokeball";
import i18next from "i18next";

View File

@ -3,7 +3,7 @@ import type Pokemon from "../field/pokemon";
import { StatusEffect } from "#enums/status-effect";
import { allMoves } from "./moves/move";
import { MoveCategory } from "#enums/MoveCategory";
import type { Constructor, nil } from "#app/utils";
import type { Constructor, nil } from "#app/utils/common";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";

View File

@ -8,7 +8,7 @@ import type { AnySound } from "#app/battle-scene";
import { globalScene } from "#app/global-scene";
import type { GameMode } from "#app/game-mode";
import { DexAttr, type StarterMoveset } from "#app/system/game-data";
import * as Utils from "#app/utils";
import { isNullOrUndefined, capitalizeString, randSeedInt, randSeedGauss, randSeedItem } from "#app/utils/common";
import { uncatchableSpecies } from "#app/data/balance/biomes";
import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { GrowthRate } from "#app/data/exp";
@ -26,11 +26,13 @@ import {
pokemonSpeciesLevelMoves,
} from "#app/data/balance/pokemon-level-moves";
import type { Stat } from "#enums/stat";
import type { Variant, VariantSet } from "#app/data/variant";
import { variantData } from "#app/data/variant";
import type { Variant, VariantSet } from "#app/sprites/variant";
import { populateVariantColorCache, variantColorCache, variantData } from "#app/sprites/variant";
import { speciesStarterCosts, POKERUS_STARTER_COUNT } from "#app/data/balance/starters";
import { SpeciesFormKey } from "#enums/species-form-key";
import { starterPassiveAbilities } from "#app/data/balance/passives";
import { loadPokemonVariantAssets } from "#app/sprites/pokemon-sprite";
import { hasExpSprite } from "#app/sprites/sprite-utils";
export enum Region {
NORMAL,
@ -289,7 +291,7 @@ export abstract class PokemonSpeciesForm {
* @returns The id of the ability
*/
getPassiveAbility(formIndex?: number): Abilities {
if (Utils.isNullOrUndefined(formIndex)) {
if (isNullOrUndefined(formIndex)) {
formIndex = this.formIndex;
}
let starterSpeciesId = this.speciesId;
@ -387,16 +389,23 @@ export abstract class PokemonSpeciesForm {
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
}
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back?: boolean): string {
getBaseSpriteKey(female: boolean, formIndex?: number): string {
if (formIndex === undefined || this instanceof PokemonForm) {
formIndex = this.formIndex;
}
const formSpriteKey = this.getFormSpriteKey(formIndex);
const showGenderDiffs =
this.genderDiffs && female && ![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].find(k => formSpriteKey === k);
this.genderDiffs &&
female &&
![SpeciesFormKey.MEGA, SpeciesFormKey.GIGANTAMAX].includes(formSpriteKey as SpeciesFormKey);
const baseSpriteKey = `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`;
return `${showGenderDiffs ? "female__" : ""}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ""}`;
}
/** Compute the sprite ID of the pokemon form. */
getSpriteId(female: boolean, formIndex?: number, shiny?: boolean, variant = 0, back = false): string {
const baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
let config = variantData;
`${back ? "back__" : ""}${baseSpriteKey}`.split("__").map(p => (config ? (config = config[p]) : null));
@ -585,18 +594,60 @@ export abstract class PokemonSpeciesForm {
return true;
}
loadAssets(
/**
* Load the variant colors for the species into the variant color cache
*
* @param spriteKey - The sprite key to use
* @param female - Whether to load female instead of male
* @param back - Whether the back sprite is being loaded
*
*/
async loadVariantColors(
spriteKey: string,
female: boolean,
variant: Variant,
back = false,
formIndex?: number,
): Promise<void> {
let baseSpriteKey = this.getBaseSpriteKey(female, formIndex);
if (back) {
baseSpriteKey = "back__" + baseSpriteKey;
}
if (variantColorCache.hasOwnProperty(baseSpriteKey)) {
// Variant colors have already been loaded
return;
}
const variantInfo = variantData[this.getVariantDataIndex(formIndex)];
// Do nothing if there is no variant information or the variant does not have color replacements
if (!variantInfo || variantInfo[variant] !== 1) {
return;
}
await populateVariantColorCache(
"pkmn__" + baseSpriteKey,
globalScene.experimentalSprites && hasExpSprite(spriteKey),
baseSpriteKey.replace("__", "/"),
);
}
async loadAssets(
female: boolean,
formIndex?: number,
shiny?: boolean,
shiny = false,
variant?: Variant,
startLoad?: boolean,
back?: boolean,
startLoad = false,
back = false,
): Promise<void> {
return new Promise(resolve => {
// We need to populate the color cache for this species' variant
const spriteKey = this.getSpriteKey(female, formIndex, shiny, variant, back);
globalScene.loadPokemonAtlas(spriteKey, this.getSpriteAtlasPath(female, formIndex, shiny, variant, back));
globalScene.load.audio(`${this.getCryKey(formIndex)}`, `audio/${this.getCryKey(formIndex)}.m4a`);
globalScene.load.audio(this.getCryKey(formIndex), `audio/${this.getCryKey(formIndex)}.m4a`);
if (!isNullOrUndefined(variant)) {
await this.loadVariantColors(spriteKey, female, variant, back, formIndex);
}
return new Promise<void>(resolve => {
globalScene.load.once(Phaser.Loader.Events.COMPLETE, () => {
const originalWarn = console.warn;
// Ignore warnings for missing frames, because there will be a lot
@ -621,7 +672,9 @@ export abstract class PokemonSpeciesForm {
const spritePath = this.getSpriteAtlasPath(female, formIndex, shiny, variant, back)
.replace("variant/", "")
.replace(/_[1-3]$/, "");
globalScene.loadPokemonVariantAssets(spriteKey, spritePath, variant).then(() => resolve());
if (!isNullOrUndefined(variant)) {
loadPokemonVariantAssets(spriteKey, spritePath, variant).then(() => resolve());
}
});
if (startLoad) {
if (!globalScene.load.isLoading()) {
@ -845,8 +898,8 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
*/
getFormNameToDisplay(formIndex = 0, append = false): string {
const formKey = this.forms?.[formIndex!]?.formKey;
const formText = Utils.capitalizeString(formKey, "-", false, false) || "";
const speciesName = Utils.capitalizeString(Species[this.speciesId], "_", true, false);
const formText = capitalizeString(formKey, "-", false, false) || "";
const speciesName = capitalizeString(Species[this.speciesId], "_", true, false);
let ret = "";
const region = this.getRegion();
@ -877,7 +930,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
if (i18next.exists(i18key)) {
ret = i18next.t(i18key);
} else {
const rootSpeciesName = Utils.capitalizeString(Species[this.getRootSpeciesId()], "_", true, false);
const rootSpeciesName = capitalizeString(Species[this.getRootSpeciesId()], "_", true, false);
const i18RootKey = `pokemonForm:${rootSpeciesName}${formText}`;
ret = i18next.exists(i18RootKey) ? i18next.t(i18RootKey) : formText;
}
@ -1072,7 +1125,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
return this.speciesId;
}
const randValue = evolutionPool.size === 1 ? 0 : Utils.randSeedInt(totalWeight);
const randValue = evolutionPool.size === 1 ? 0 : randSeedInt(totalWeight);
for (const weight of evolutionPool.keys()) {
if (randValue < weight) {
@ -1157,7 +1210,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
Math.min(
Math.max(
evolution?.level! +
Math.round(Utils.randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5) -
Math.round(randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5) -
1,
2,
evolution?.level!,
@ -1175,7 +1228,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
Math.min(
Math.max(
lastPrevolutionLevel +
Math.round(Utils.randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5),
Math.round(randSeedGauss(0.5, 1 + levelDiff * 0.2) * Math.max(evolution?.wildDelay!, 0.5) * 5),
lastPrevolutionLevel + 1,
evolution?.level!,
),
@ -1360,7 +1413,7 @@ export function getPokerusStarters(): PokemonSpecies[] {
globalScene.executeWithSeedOffset(
() => {
while (pokerusStarters.length < POKERUS_STARTER_COUNT) {
const randomSpeciesId = Number.parseInt(Utils.randSeedItem(Object.keys(speciesStarterCosts)), 10);
const randomSpeciesId = Number.parseInt(randSeedItem(Object.keys(speciesStarterCosts)), 10);
const species = getPokemonSpecies(randomSpeciesId);
if (!pokerusStarters.includes(species)) {
pokerusStarters.push(species);

View File

@ -1,4 +1,4 @@
import { randIntRange } from "#app/utils";
import { randIntRange } from "#app/utils/common";
import { StatusEffect } from "#enums/status-effect";
import type { ParseKeys } from "i18next";
import i18next from "i18next";

View File

@ -59,7 +59,7 @@ export class Terrain {
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
return (
move.getPriority(user) > 0 &&
user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
user.getOpponents(true).some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded())
);
}
}

View File

@ -1,12 +1,12 @@
import { TrainerType } from "#enums/trainer-type";
import * as Utils from "../utils";
import { toReadableString } from "#app/utils/common";
class TrainerNameConfig {
public urls: string[];
public femaleUrls: string[] | null;
constructor(type: TrainerType, ...urls: string[]) {
this.urls = urls.length ? urls : [Utils.toReadableString(TrainerType[type]).replace(/ /g, "_")];
this.urls = urls.length ? urls : [toReadableString(TrainerType[type]).replace(/ /g, "_")];
}
hasGenderVariant(...femaleUrls: string[]): TrainerNameConfig {

View File

@ -1,6 +1,8 @@
import { startingWave } from "#app/battle-scene";
import { startingWave } from "#app/starting-wave";
import { globalScene } from "#app/global-scene";
import { PartyMemberStrength } from "#enums/party-member-strength";
import { GameModes } from "#app/game-mode";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
export class TrainerPartyTemplate {
public size: number;
@ -222,19 +224,18 @@ export const trainerPartyTemplates = {
*/
export function getEvilGruntPartyTemplate(): TrainerPartyTemplate {
const waveIndex = globalScene.currentBattle?.waveIndex;
if (waveIndex < 40) {
switch (waveIndex) {
case ClassicFixedBossWaves.EVIL_GRUNT_1:
return trainerPartyTemplates.TWO_AVG;
}
if (waveIndex < 63) {
case ClassicFixedBossWaves.EVIL_GRUNT_2:
return trainerPartyTemplates.THREE_AVG;
}
if (waveIndex < 65) {
case ClassicFixedBossWaves.EVIL_GRUNT_3:
return trainerPartyTemplates.TWO_AVG_ONE_STRONG;
}
if (waveIndex < 112) {
case ClassicFixedBossWaves.EVIL_ADMIN_1:
return trainerPartyTemplates.GYM_LEADER_4; // 3avg 1 strong 1 stronger
}
default:
return trainerPartyTemplates.GYM_LEADER_5; // 3 avg 2 strong 1 stronger
}
}
export function getWavePartyTemplate(...templates: TrainerPartyTemplate[]) {
@ -245,6 +246,30 @@ export function getWavePartyTemplate(...templates: TrainerPartyTemplate[]) {
}
export function getGymLeaderPartyTemplate() {
const { currentBattle, gameMode } = globalScene;
switch (gameMode.modeId) {
case GameModes.DAILY:
if (currentBattle?.waveIndex <= 20) {
return trainerPartyTemplates.GYM_LEADER_2
}
return trainerPartyTemplates.GYM_LEADER_3;
case GameModes.CHALLENGE: // In the future, there may be a ChallengeType to call here. For now, use classic's.
case GameModes.CLASSIC:
if (currentBattle?.waveIndex <= 20) {
return trainerPartyTemplates.GYM_LEADER_1; // 1 avg 1 strong
}
else if (currentBattle?.waveIndex <= 30) {
return trainerPartyTemplates.GYM_LEADER_2; // 1 avg 1 strong 1 stronger
}
else if (currentBattle?.waveIndex <= 60) { // 50 and 60
return trainerPartyTemplates.GYM_LEADER_3; // 2 avg 1 strong 1 stronger
}
else if (currentBattle?.waveIndex <= 90) { // 80 and 90
return trainerPartyTemplates.GYM_LEADER_4; // 3 avg 1 strong 1 stronger
}
// 110+
return trainerPartyTemplates.GYM_LEADER_5; // 3 avg 2 strong 1 stronger
default:
return getWavePartyTemplate(
trainerPartyTemplates.GYM_LEADER_1,
trainerPartyTemplates.GYM_LEADER_2,
@ -252,4 +277,5 @@ export function getGymLeaderPartyTemplate() {
trainerPartyTemplates.GYM_LEADER_4,
trainerPartyTemplates.GYM_LEADER_5,
);
}
}

View File

@ -1,7 +1,7 @@
import { globalScene } from "#app/global-scene";
import { modifierTypes } from "#app/modifier/modifier-type";
import { PokemonMove } from "#app/field/pokemon";
import * as Utils from "#app/utils";
import { toReadableString, isNullOrUndefined, randSeedItem, randSeedInt } from "#app/utils/common";
import { pokemonEvolutions, pokemonPrevolutions } from "#app/data/balance/pokemon-evolutions";
import { getPokemonSpecies } from "#app/data/pokemon-species";
import { tmSpecies } from "#app/data/balance/tms";
@ -116,7 +116,6 @@ export class TrainerConfig {
public modifierRewardFuncs: ModifierTypeFunc[] = [];
public partyTemplates: TrainerPartyTemplate[];
public partyTemplateFunc: PartyTemplateFunc;
public eventRewardFuncs: ModifierTypeFunc[] = [];
public partyMemberFuncs: PartyMemberFuncs = {};
public speciesPools: TrainerTierPools;
public speciesFilter: PokemonSpeciesFilter;
@ -139,7 +138,7 @@ export class TrainerConfig {
constructor(trainerType: TrainerType, allowLegendaries?: boolean) {
this.trainerType = trainerType;
this.trainerAI = new TrainerAI();
this.name = Utils.toReadableString(TrainerType[this.getDerivedType()]);
this.name = toReadableString(TrainerType[this.getDerivedType()]);
this.battleBgm = "battle_trainer";
this.mixedBattleBgm = "battle_trainer";
this.victoryBgm = "victory_trainer";
@ -482,10 +481,10 @@ export class TrainerConfig {
.fill(null)
.map((_, i) => i)
.filter(i => shedinjaCanTera || party[i].species.speciesId !== Species.SHEDINJA); // Shedinja can only Tera on Bug specialty type (or no specialty type)
const setPartySlot = !Utils.isNullOrUndefined(slot) ? Phaser.Math.Wrap(slot, 0, party.length) : -1; // If we have a tera slot defined, wrap it to party size.
const setPartySlot = !isNullOrUndefined(slot) ? Phaser.Math.Wrap(slot, 0, party.length) : -1; // If we have a tera slot defined, wrap it to party size.
for (let t = 0; t < Math.min(count(), party.length); t++) {
const randomIndex =
partyMemberIndexes.indexOf(setPartySlot) > -1 ? setPartySlot : Utils.randSeedItem(partyMemberIndexes);
partyMemberIndexes.indexOf(setPartySlot) > -1 ? setPartySlot : randSeedItem(partyMemberIndexes);
partyMemberIndexes.splice(partyMemberIndexes.indexOf(randomIndex), 1);
if (this.hasSpecialtyType()) {
party[randomIndex].teraType = this.specialtyType;
@ -517,16 +516,6 @@ export class TrainerConfig {
// return ret;
// }
/**
* Sets eventRewardFuncs to the active event rewards for the specified wave
* @param wave Associated with {@linkcode getFixedBattleEventRewards}
* @returns this
*/
setEventModifierRewardFuncs(wave: number): TrainerConfig {
this.eventRewardFuncs = timedEventManager.getFixedBattleEventRewards(wave).map(r => modifierTypes[r]);
return this;
}
setModifierRewardFuncs(...modifierTypeFuncs: (() => ModifierTypeFunc)[]): TrainerConfig {
this.modifierRewardFuncs = modifierTypeFuncs.map(func => () => {
const modifierTypeFunc = func();
@ -555,7 +544,7 @@ export class TrainerConfig {
initI18n();
}
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpecialtyType(specialtyType);
}
@ -636,7 +625,7 @@ export class TrainerConfig {
}
this.setPartyMemberFunc(-(s + 1), getRandomPartyMemberFunc(speciesPool));
});
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpeciesFilter(p => p.isOfType(specialtyType));
this.setSpecialtyType(specialtyType);
}
@ -749,7 +738,7 @@ export class TrainerConfig {
});
// Set species filter and specialty type if provided, otherwise filter by base total.
if (!Utils.isNullOrUndefined(specialtyType)) {
if (!isNullOrUndefined(specialtyType)) {
this.setSpeciesFilter(p => p.isOfType(specialtyType) && p.baseTotal >= ELITE_FOUR_MINIMUM_BST);
this.setSpecialtyType(specialtyType);
} else {
@ -927,7 +916,7 @@ export class TrainerConfig {
* @returns true if specialtyType is defined and not Type.UNKNOWN
*/
hasSpecialtyType(): boolean {
return !Utils.isNullOrUndefined(this.specialtyType) && this.specialtyType !== PokemonType.UNKNOWN;
return !isNullOrUndefined(this.specialtyType) && this.specialtyType !== PokemonType.UNKNOWN;
}
/**
@ -1006,7 +995,7 @@ export function getRandomPartyMemberFunc(
postProcess?: (enemyPokemon: EnemyPokemon) => void,
) {
return (level: number, strength: PartyMemberStrength) => {
let species = Utils.randSeedItem(speciesPool);
let species = randSeedItem(speciesPool);
if (!ignoreEvolution) {
species = getPokemonSpecies(species).getTrainerSpeciesForLevel(
level,
@ -1329,7 +1318,16 @@ export const trainerConfigs: TrainerConfigs = {
[TrainerPoolTier.RARE]: [Species.BELLOSSOM, Species.HITMONTOP, Species.MIME_JR, Species.ORICORIO],
[TrainerPoolTier.SUPER_RARE]: [Species.QUAXLY, Species.JANGMO_O],
}),
[TrainerType.DEPOT_AGENT]: new TrainerConfig(++t).setMoneyMultiplier(1.45).setEncounterBgm(TrainerType.CLERK),
[TrainerType.DEPOT_AGENT]: new TrainerConfig(++t)
.setMoneyMultiplier(1.45)
.setEncounterBgm(TrainerType.CLERK)
.setPartyTemplates(
trainerPartyTemplates.TWO_AVG,
trainerPartyTemplates.THREE_WEAK,
trainerPartyTemplates.THREE_AVG,
trainerPartyTemplates.FOUR_WEAK,
)
.setSpeciesFilter(s => s.isOfType(PokemonType.GROUND)),
[TrainerType.DOCTOR]: new TrainerConfig(++t)
.setHasGenders("Nurse", "lass")
.setHasDouble("Medical Team")
@ -1380,7 +1378,6 @@ export const trainerConfigs: TrainerConfigs = {
Species.CHINCHOU,
Species.CORSOLA,
Species.WAILMER,
Species.BARBOACH,
Species.CLAMPERL,
Species.LUVDISC,
Species.MANTYKE,
@ -2236,12 +2233,7 @@ export const trainerConfigs: TrainerConfigs = {
Species.PHANTUMP,
Species.PUMPKABOO,
],
[TrainerPoolTier.RARE]: [
Species.SNEASEL,
Species.LITWICK,
Species.PAWNIARD,
Species.NOIBAT,
],
[TrainerPoolTier.RARE]: [Species.SNEASEL, Species.LITWICK, Species.PAWNIARD, Species.NOIBAT],
[TrainerPoolTier.SUPER_RARE]: [Species.SLIGGOO, Species.HISUI_SLIGGOO, Species.HISUI_AVALUGG],
}),
[TrainerType.BRYONY]: new TrainerConfig(++t)
@ -2587,252 +2579,252 @@ export const trainerConfigs: TrainerConfigs = {
),
[TrainerType.BROCK]: new TrainerConfig((t = TrainerType.BROCK))
.initForGymLeader(signatureSpecies["BROCK"], true, PokemonType.ROCK)
.initForGymLeader(signatureSpecies["BROCK"], true, PokemonType.ROCK, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.MISTY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MISTY"], false, PokemonType.WATER)
.initForGymLeader(signatureSpecies["MISTY"], false, PokemonType.WATER, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.LT_SURGE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["LT_SURGE"], true, PokemonType.ELECTRIC)
.initForGymLeader(signatureSpecies["LT_SURGE"], true, PokemonType.ELECTRIC, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.ERIKA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["ERIKA"], false, PokemonType.GRASS)
.initForGymLeader(signatureSpecies["ERIKA"], false, PokemonType.GRASS, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.JANINE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["JANINE"], false, PokemonType.POISON)
.initForGymLeader(signatureSpecies["JANINE"], false, PokemonType.POISON, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.SABRINA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["SABRINA"], false, PokemonType.PSYCHIC)
.initForGymLeader(signatureSpecies["SABRINA"], false, PokemonType.PSYCHIC, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.BLAINE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BLAINE"], true, PokemonType.FIRE)
.initForGymLeader(signatureSpecies["BLAINE"], true, PokemonType.FIRE, false, -1)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.GIOVANNI]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["GIOVANNI"], true, PokemonType.DARK)
.initForGymLeader(signatureSpecies["GIOVANNI"], true, PokemonType.GROUND, false, -2)
.setBattleBgm("battle_kanto_gym")
.setMixedBattleBgm("battle_kanto_gym"),
[TrainerType.FALKNER]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["FALKNER"], true, PokemonType.FLYING)
.initForGymLeader(signatureSpecies["FALKNER"], true, PokemonType.FLYING, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.BUGSY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BUGSY"], true, PokemonType.BUG)
.initForGymLeader(signatureSpecies["BUGSY"], true, PokemonType.BUG, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.WHITNEY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["WHITNEY"], false, PokemonType.NORMAL)
.initForGymLeader(signatureSpecies["WHITNEY"], false, PokemonType.NORMAL, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.MORTY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MORTY"], true, PokemonType.GHOST)
.initForGymLeader(signatureSpecies["MORTY"], true, PokemonType.GHOST, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.CHUCK]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CHUCK"], true, PokemonType.FIGHTING)
.initForGymLeader(signatureSpecies["CHUCK"], true, PokemonType.FIGHTING, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.JASMINE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["JASMINE"], false, PokemonType.STEEL)
.initForGymLeader(signatureSpecies["JASMINE"], false, PokemonType.STEEL, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.PRYCE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["PRYCE"], true, PokemonType.ICE)
.initForGymLeader(signatureSpecies["PRYCE"], true, PokemonType.ICE, false, -1)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.CLAIR]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CLAIR"], false, PokemonType.DRAGON)
.initForGymLeader(signatureSpecies["CLAIR"], false, PokemonType.DRAGON, false, -3)
.setBattleBgm("battle_johto_gym")
.setMixedBattleBgm("battle_johto_gym"),
[TrainerType.ROXANNE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["ROXANNE"], false, PokemonType.ROCK)
.initForGymLeader(signatureSpecies["ROXANNE"], false, PokemonType.ROCK, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.BRAWLY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BRAWLY"], true, PokemonType.FIGHTING)
.initForGymLeader(signatureSpecies["BRAWLY"], true, PokemonType.FIGHTING, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.WATTSON]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["WATTSON"], true, PokemonType.ELECTRIC)
.initForGymLeader(signatureSpecies["WATTSON"], true, PokemonType.ELECTRIC, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.FLANNERY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["FLANNERY"], false, PokemonType.FIRE)
.initForGymLeader(signatureSpecies["FLANNERY"], false, PokemonType.FIRE, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.NORMAN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["NORMAN"], true, PokemonType.NORMAL)
.initForGymLeader(signatureSpecies["NORMAN"], true, PokemonType.NORMAL, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.WINONA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["WINONA"], false, PokemonType.FLYING)
.initForGymLeader(signatureSpecies["WINONA"], false, PokemonType.FLYING, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.TATE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["TATE"], true, PokemonType.PSYCHIC)
.initForGymLeader(signatureSpecies["TATE"], true, PokemonType.PSYCHIC, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym")
.setHasDouble("tate_liza_double")
.setDoubleTrainerType(TrainerType.LIZA)
.setDoubleTitle("gym_leader_double"),
[TrainerType.LIZA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["LIZA"], false, PokemonType.PSYCHIC)
.initForGymLeader(signatureSpecies["LIZA"], false, PokemonType.PSYCHIC, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym")
.setHasDouble("liza_tate_double")
.setDoubleTrainerType(TrainerType.TATE)
.setDoubleTitle("gym_leader_double"),
[TrainerType.JUAN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["JUAN"], true, PokemonType.WATER)
.initForGymLeader(signatureSpecies["JUAN"], true, PokemonType.WATER, false, -1)
.setBattleBgm("battle_hoenn_gym")
.setMixedBattleBgm("battle_hoenn_gym"),
[TrainerType.ROARK]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["ROARK"], true, PokemonType.ROCK)
.initForGymLeader(signatureSpecies["ROARK"], true, PokemonType.ROCK, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.GARDENIA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["GARDENIA"], false, PokemonType.GRASS)
.initForGymLeader(signatureSpecies["GARDENIA"], false, PokemonType.GRASS, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.MAYLENE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MAYLENE"], false, PokemonType.FIGHTING)
.initForGymLeader(signatureSpecies["MAYLENE"], false, PokemonType.FIGHTING, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.CRASHER_WAKE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CRASHER_WAKE"], true, PokemonType.WATER)
.initForGymLeader(signatureSpecies["CRASHER_WAKE"], true, PokemonType.WATER, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.FANTINA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["FANTINA"], false, PokemonType.GHOST)
.initForGymLeader(signatureSpecies["FANTINA"], false, PokemonType.GHOST, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.BYRON]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BYRON"], true, PokemonType.STEEL)
.initForGymLeader(signatureSpecies["BYRON"], true, PokemonType.STEEL, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.CANDICE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CANDICE"], false, PokemonType.ICE)
.initForGymLeader(signatureSpecies["CANDICE"], false, PokemonType.ICE, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.VOLKNER]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["VOLKNER"], true, PokemonType.ELECTRIC)
.initForGymLeader(signatureSpecies["VOLKNER"], true, PokemonType.ELECTRIC, false, -1)
.setBattleBgm("battle_sinnoh_gym")
.setMixedBattleBgm("battle_sinnoh_gym"),
[TrainerType.CILAN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CILAN"], true, PokemonType.GRASS)
.initForGymLeader(signatureSpecies["CILAN"], true, PokemonType.GRASS, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.CHILI]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CHILI"], true, PokemonType.FIRE)
.initForGymLeader(signatureSpecies["CHILI"], true, PokemonType.FIRE, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.CRESS]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CRESS"], true, PokemonType.WATER)
.initForGymLeader(signatureSpecies["CRESS"], true, PokemonType.WATER, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.CHEREN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CHEREN"], true, PokemonType.NORMAL)
.initForGymLeader(signatureSpecies["CHEREN"], true, PokemonType.NORMAL, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.LENORA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["LENORA"], false, PokemonType.NORMAL)
.initForGymLeader(signatureSpecies["LENORA"], false, PokemonType.NORMAL, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.ROXIE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["ROXIE"], false, PokemonType.POISON)
.initForGymLeader(signatureSpecies["ROXIE"], false, PokemonType.POISON, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.BURGH]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BURGH"], true, PokemonType.BUG)
.initForGymLeader(signatureSpecies["BURGH"], true, PokemonType.BUG, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.ELESA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["ELESA"], false, PokemonType.ELECTRIC)
.initForGymLeader(signatureSpecies["ELESA"], false, PokemonType.ELECTRIC, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.CLAY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CLAY"], true, PokemonType.GROUND)
.initForGymLeader(signatureSpecies["CLAY"], true, PokemonType.GROUND, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.SKYLA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["SKYLA"], false, PokemonType.FLYING)
.initForGymLeader(signatureSpecies["SKYLA"], false, PokemonType.FLYING, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.BRYCEN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BRYCEN"], true, PokemonType.ICE)
.initForGymLeader(signatureSpecies["BRYCEN"], true, PokemonType.ICE, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.DRAYDEN]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["DRAYDEN"], true, PokemonType.DRAGON)
.initForGymLeader(signatureSpecies["DRAYDEN"], true, PokemonType.DRAGON, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.MARLON]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MARLON"], true, PokemonType.WATER)
.initForGymLeader(signatureSpecies["MARLON"], true, PokemonType.WATER, false, -1)
.setMixedBattleBgm("battle_unova_gym"),
[TrainerType.VIOLA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["VIOLA"], false, PokemonType.BUG)
.initForGymLeader(signatureSpecies["VIOLA"], false, PokemonType.BUG, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.GRANT]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["GRANT"], true, PokemonType.ROCK)
.initForGymLeader(signatureSpecies["GRANT"], true, PokemonType.ROCK, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.KORRINA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["KORRINA"], false, PokemonType.FIGHTING)
.initForGymLeader(signatureSpecies["KORRINA"], false, PokemonType.FIGHTING, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.RAMOS]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["RAMOS"], true, PokemonType.GRASS)
.initForGymLeader(signatureSpecies["RAMOS"], true, PokemonType.GRASS, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.CLEMONT]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["CLEMONT"], true, PokemonType.ELECTRIC)
.initForGymLeader(signatureSpecies["CLEMONT"], true, PokemonType.ELECTRIC, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.VALERIE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["VALERIE"], false, PokemonType.FAIRY)
.initForGymLeader(signatureSpecies["VALERIE"], false, PokemonType.FAIRY, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.OLYMPIA]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["OLYMPIA"], false, PokemonType.PSYCHIC)
.initForGymLeader(signatureSpecies["OLYMPIA"], false, PokemonType.PSYCHIC, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.WULFRIC]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["WULFRIC"], true, PokemonType.ICE)
.initForGymLeader(signatureSpecies["WULFRIC"], true, PokemonType.ICE, false, -1)
.setMixedBattleBgm("battle_kalos_gym"),
[TrainerType.MILO]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MILO"], true, PokemonType.GRASS)
.initForGymLeader(signatureSpecies["MILO"], true, PokemonType.GRASS, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.NESSA]: new TrainerConfig(++t)
.setName("Nessa")
.initForGymLeader(signatureSpecies["NESSA"], false, PokemonType.WATER)
.initForGymLeader(signatureSpecies["NESSA"], false, PokemonType.WATER, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.KABU]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["KABU"], true, PokemonType.FIRE)
.initForGymLeader(signatureSpecies["KABU"], true, PokemonType.FIRE, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.BEA]: new TrainerConfig(++t)
.setName("Bea")
.initForGymLeader(signatureSpecies["BEA"], false, PokemonType.FIGHTING)
.initForGymLeader(signatureSpecies["BEA"], false, PokemonType.FIGHTING, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.ALLISTER]: new TrainerConfig(++t)
.setName("Allister")
.initForGymLeader(signatureSpecies["ALLISTER"], true, PokemonType.GHOST)
.initForGymLeader(signatureSpecies["ALLISTER"], true, PokemonType.GHOST, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.OPAL]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["OPAL"], false, PokemonType.FAIRY)
.initForGymLeader(signatureSpecies["OPAL"], false, PokemonType.FAIRY, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.BEDE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["BEDE"], true, PokemonType.FAIRY)
.initForGymLeader(signatureSpecies["BEDE"], true, PokemonType.FAIRY, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.GORDIE]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["GORDIE"], true, PokemonType.ROCK)
.initForGymLeader(signatureSpecies["GORDIE"], true, PokemonType.ROCK, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.MELONY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["MELONY"], false, PokemonType.ICE)
.initForGymLeader(signatureSpecies["MELONY"], false, PokemonType.ICE, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.PIERS]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["PIERS"], true, PokemonType.DARK)
.initForGymLeader(signatureSpecies["PIERS"], true, PokemonType.DARK, false, -3)
.setHasDouble("piers_marnie_double")
.setDoubleTrainerType(TrainerType.MARNIE)
.setDoubleTitle("gym_leader_double")
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.MARNIE]: new TrainerConfig(++t)
.setName("Marnie")
.initForGymLeader(signatureSpecies["MARNIE"], false, PokemonType.DARK)
.initForGymLeader(signatureSpecies["MARNIE"], false, PokemonType.DARK, false, -4)
.setHasDouble("marnie_piers_double")
.setDoubleTrainerType(TrainerType.PIERS)
.setDoubleTitle("gym_leader_double")
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.RAIHAN]: new TrainerConfig(++t)
.setName("Raihan")
.initForGymLeader(signatureSpecies["RAIHAN"], true, PokemonType.DRAGON)
.initForGymLeader(signatureSpecies["RAIHAN"], true, PokemonType.DRAGON, false, -1)
.setMixedBattleBgm("battle_galar_gym"),
[TrainerType.KATY]: new TrainerConfig(++t)
.initForGymLeader(signatureSpecies["KATY"], false, PokemonType.BUG, true, -1)
@ -3554,7 +3546,7 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
5,
getRandomPartyMemberFunc([Species.URSHIFU], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(2, 2); // Random G-Max Urshifu
p.formIndex = randSeedInt(2, 2); // Random G-Max Urshifu
p.generateAndPopulateMoveset();
p.generateName();
p.gender = Gender.MALE;
@ -3664,10 +3656,10 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
4,
getRandomPartyMemberFunc([Species.OGERPON], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(4); // Random Ogerpon Tera Mask
p.formIndex = randSeedInt(4); // Random Ogerpon Tera Mask
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ULTRA_BALL;
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.IVY_CUDGEL)) {
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.IVY_CUDGEL)) {
// Check if Ivy Cudgel is in the moveset, if not, replace the first move with Ivy Cudgel.
p.moveset[0] = new PokemonMove(Moves.IVY_CUDGEL);
}
@ -3697,7 +3689,6 @@ export const trainerConfigs: TrainerConfigs = {
() => modifierTypes.SUPER_EXP_CHARM,
() => modifierTypes.EXP_SHARE,
)
.setEventModifierRewardFuncs(8)
.setPartyMemberFunc(
0,
getRandomPartyMemberFunc(
@ -3765,7 +3756,6 @@ export const trainerConfigs: TrainerConfigs = {
.setMixedBattleBgm("battle_rival")
.setPartyTemplates(trainerPartyTemplates.RIVAL_2)
.setModifierRewardFuncs(() => modifierTypes.EXP_SHARE)
.setEventModifierRewardFuncs(25)
.setPartyMemberFunc(
0,
getRandomPartyMemberFunc(
@ -4718,10 +4708,10 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
2,
getRandomPartyMemberFunc([Species.SILVALLY], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(18); // Random Silvally Form
p.formIndex = randSeedInt(18); // Random Silvally Form
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ROGUE_BALL;
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.MULTI_ATTACK)) {
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.MULTI_ATTACK)) {
// Check if Multi Attack is in the moveset, if not, replace the first move with Multi Attack.
p.moveset[0] = new PokemonMove(Moves.MULTI_ATTACK);
}
@ -4838,8 +4828,8 @@ export const trainerConfigs: TrainerConfigs = {
p.setBoss(true, 2);
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ULTRA_BALL;
p.formIndex = Utils.randSeedInt(4, 1); // Shock, Burn, Chill, or Douse Drive
if (!p.moveset.some(move => !Utils.isNullOrUndefined(move) && move.moveId === Moves.TECHNO_BLAST)) {
p.formIndex = randSeedInt(4, 1); // Shock, Burn, Chill, or Douse Drive
if (!p.moveset.some(move => !isNullOrUndefined(move) && move.moveId === Moves.TECHNO_BLAST)) {
// Check if Techno Blast is in the moveset, if not, replace the first move with Techno Blast.
p.moveset[2] = new PokemonMove(Moves.TECHNO_BLAST);
}
@ -5011,7 +5001,7 @@ export const trainerConfigs: TrainerConfigs = {
1,
getRandomPartyMemberFunc([Species.ROTOM], TrainerSlot.TRAINER, true, p => {
p.generateAndPopulateMoveset();
p.formIndex = Utils.randSeedInt(5, 1); // Heat, Wash, Frost, Fan, or Mow
p.formIndex = randSeedInt(5, 1); // Heat, Wash, Frost, Fan, or Mow
}),
)
.setPartyMemberFunc(
@ -5024,7 +5014,7 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc(
3,
getRandomPartyMemberFunc([Species.REVAVROOM], TrainerSlot.TRAINER, true, p => {
p.formIndex = Utils.randSeedInt(5, 1); // Random Starmobile form
p.formIndex = randSeedInt(5, 1); // Random Starmobile form
p.generateAndPopulateMoveset();
p.pokeball = PokeballType.ROGUE_BALL;
}),

View File

@ -1,31 +0,0 @@
import { VariantTier } from "#app/enums/variant-tier";
export type Variant = 0 | 1 | 2;
export type VariantSet = [Variant, Variant, Variant];
export const variantData: any = {};
export const variantColorCache = {};
export function getVariantTint(variant: Variant): number {
switch (variant) {
case 0:
return 0xf8c020;
case 1:
return 0x20f8f0;
case 2:
return 0xe81048;
}
}
export function getVariantIcon(variant: Variant): number {
switch (variant) {
case 0:
return VariantTier.STANDARD;
case 1:
return VariantTier.RARE;
case 2:
return VariantTier.EPIC;
}
}

View File

@ -5,8 +5,8 @@ import type Pokemon from "../field/pokemon";
import { PokemonType } from "#enums/pokemon-type";
import type Move from "./moves/move";
import { AttackMove } from "./moves/move";
import * as Utils from "../utils";
import { SuppressWeatherEffectAbAttr } from "./ability";
import { randSeedInt } from "#app/utils/common";
import { SuppressWeatherEffectAbAttr } from "./abilities/ability";
import { TerrainType, getTerrainName } from "./terrain";
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
@ -416,7 +416,7 @@ export function getRandomWeatherType(arena: Arena): WeatherType {
totalWeight += w.weight;
}
const rand = Utils.randSeedInt(totalWeight);
const rand = randSeedInt(totalWeight);
let w = 0;
for (const weather of weatherPool) {
w += weather.weight;

Some files were not shown because too many files have changed in this diff Show More