Merge branch 'beta' into evil-team-monogen
|
@ -1,5 +1,5 @@
|
|||
import tseslint from '@typescript-eslint/eslint-plugin';
|
||||
import stylisticTs from '@stylistic/eslint-plugin-ts'
|
||||
import stylisticTs from '@stylistic/eslint-plugin-ts';
|
||||
import parser from '@typescript-eslint/parser';
|
||||
import importX from 'eslint-plugin-import-x';
|
||||
|
||||
|
@ -16,15 +16,15 @@ export default [
|
|||
'@typescript-eslint': tseslint
|
||||
},
|
||||
rules: {
|
||||
"eqeqeq": ["error", "always"], // Enforces the use of === and !== instead of == and !=
|
||||
"indent": ["error", 2], // Enforces a 2-space indentation
|
||||
"eqeqeq": ["error", "always"], // Enforces the use of `===` and `!==` instead of `==` and `!=`
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }], // Enforces a 2-space indentation, enforces indentation of `case ...:` statements
|
||||
"quotes": ["error", "double"], // Enforces the use of double quotes for strings
|
||||
"no-var": "error", // Disallows the use of var, enforcing let or const instead
|
||||
"prefer-const": "error", // Prefers the use of const for variables that are never reassigned
|
||||
"no-var": "error", // Disallows the use of `var`, enforcing `let` or `const` instead
|
||||
"prefer-const": "error", // Enforces the use of `const` for variables that are never reassigned
|
||||
"no-undef": "off", // Disables the rule that disallows the use of undeclared variables (TypeScript handles this)
|
||||
"@typescript-eslint/no-unused-vars": [ "error", {
|
||||
"args": "none", // Allows unused function parameters. Useful for functions with specific signatures where not all parameters are always used.
|
||||
"ignoreRestSiblings": true // Allows unused variables that are part of a rest property in object destructuring. Useful for excluding certain properties from an object while using the rest.
|
||||
"ignoreRestSiblings": true // Allows unused variables that are part of a rest property in object destructuring. Useful for excluding certain properties from an object while using the others.
|
||||
}],
|
||||
"eol-last": ["error", "always"], // Enforces at least one newline at the end of files
|
||||
"@stylistic/ts/semi": ["error", "always"], // Requires semicolons for TypeScript-specific syntax
|
||||
|
@ -32,14 +32,14 @@ export default [
|
|||
"no-extra-semi": ["error"], // Disallows unnecessary semicolons for TypeScript-specific syntax
|
||||
"brace-style": "off", // Note: you must disable the base rule as it can report incorrect errors
|
||||
"curly": ["error", "all"], // Enforces the use of curly braces for all control statements
|
||||
"@stylistic/ts/brace-style": ["error", "1tbs"],
|
||||
"@stylistic/ts/brace-style": ["error", "1tbs"], // Enforces the following brace style: https://eslint.style/rules/js/brace-style#_1tbs
|
||||
"no-trailing-spaces": ["error", { // Disallows trailing whitespace at the end of lines
|
||||
"skipBlankLines": false, // Enforces the rule even on blank lines
|
||||
"ignoreComments": false // Enforces the rule on lines containing comments
|
||||
}],
|
||||
"space-before-blocks": ["error", "always"], // Enforces a space before blocks
|
||||
"keyword-spacing": ["error", { "before": true, "after": true }], // Enforces spacing before and after keywords
|
||||
"comma-spacing": ["error", { "before": false, "after": true }], // Enforces spacing after comma
|
||||
"comma-spacing": ["error", { "before": false, "after": true }], // Enforces spacing after commas
|
||||
"import-x/extensions": ["error", "never", { "json": "always" }], // Enforces no extension for imports unless json
|
||||
"array-bracket-spacing": ["error", "always", { "objectsInArrays": false, "arraysInArrays": false }], // Enforces consistent spacing inside array brackets
|
||||
"object-curly-spacing": ["error", "always", { "arraysInObjects": false, "objectsInObjects": false }], // Enforces consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pokemon-rogue-battle",
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@material/material-color-utilities": "^0.2.7",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"private": true,
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
|
@ -20,7 +20,7 @@
|
|||
"depcruise": "depcruise src",
|
||||
"depcruise:graph": "depcruise src --output-type dot | node dependency-graph.js > dependency-graph.svg",
|
||||
"create-test": "node ./create-test-boilerplate.js",
|
||||
"postinstall": "npx lefthook install && npx lefthook run post-merge"
|
||||
"postinstall": "npx lefthook install && npx lefthook run post-merge"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.3.0",
|
||||
|
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -4,7 +4,7 @@ import Pokemon, { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
|||
import PokemonSpecies, { allSpecies, getPokemonSpecies, PokemonSpeciesFilter } from "#app/data/pokemon-species";
|
||||
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import * as Utils from "#app/utils";
|
||||
import { ConsumableModifier, ConsumablePokemonModifier, DoubleBattleChanceBoosterModifier, ExpBalanceModifier, ExpShareModifier, FusePokemonModifier, HealingBoosterModifier, Modifier, ModifierBar, ModifierPredicate, MultipleParticipantExpBonusModifier, overrideHeldItems, overrideModifiers, PersistentModifier, PokemonExpBoosterModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, PokemonHpRestoreModifier, PokemonIncrementingStatModifier, TerastallizeModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
||||
import { ConsumableModifier, ConsumablePokemonModifier, DoubleBattleChanceBoosterModifier, ExpBalanceModifier, ExpShareModifier, FusePokemonModifier, HealingBoosterModifier, Modifier, ModifierBar, ModifierPredicate, MultipleParticipantExpBonusModifier, overrideHeldItems, overrideModifiers, PersistentModifier, PokemonExpBoosterModifier, PokemonFormChangeItemModifier, PokemonHeldItemModifier, PokemonHpRestoreModifier, PokemonIncrementingStatModifier, RememberMoveModifier, TerastallizeModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "#app/data/pokeball";
|
||||
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from "#app/data/battle-anims";
|
||||
import { Phase } from "#app/phase";
|
||||
|
@ -95,6 +95,7 @@ import { ExpPhase } from "#app/phases/exp-phase";
|
|||
import { ShowPartyExpBarPhase } from "#app/phases/show-party-exp-bar-phase";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
|
||||
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
|
||||
|
||||
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
|
||||
|
||||
|
@ -789,7 +790,7 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
|
||||
getEnemyParty(): EnemyPokemon[] {
|
||||
return this.currentBattle?.enemyParty || [];
|
||||
return this.currentBattle?.enemyParty ?? [];
|
||||
}
|
||||
|
||||
getEnemyPokemon(): EnemyPokemon | undefined {
|
||||
|
@ -1358,69 +1359,69 @@ export default class BattleScene extends SceneBase {
|
|||
}
|
||||
|
||||
switch (species.speciesId) {
|
||||
case Species.UNOWN:
|
||||
case Species.SHELLOS:
|
||||
case Species.GASTRODON:
|
||||
case Species.BASCULIN:
|
||||
case Species.DEERLING:
|
||||
case Species.SAWSBUCK:
|
||||
case Species.FROAKIE:
|
||||
case Species.FROGADIER:
|
||||
case Species.SCATTERBUG:
|
||||
case Species.SPEWPA:
|
||||
case Species.VIVILLON:
|
||||
case Species.FLABEBE:
|
||||
case Species.FLOETTE:
|
||||
case Species.FLORGES:
|
||||
case Species.FURFROU:
|
||||
case Species.PUMPKABOO:
|
||||
case Species.GOURGEIST:
|
||||
case Species.ORICORIO:
|
||||
case Species.MAGEARNA:
|
||||
case Species.ZARUDE:
|
||||
case Species.SQUAWKABILLY:
|
||||
case Species.TATSUGIRI:
|
||||
case Species.PALDEA_TAUROS:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
case Species.PIKACHU:
|
||||
return Utils.randSeedInt(8);
|
||||
case Species.EEVEE:
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.GRENINJA:
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.ZYGARDE:
|
||||
return Utils.randSeedInt(3);
|
||||
case Species.MINIOR:
|
||||
return Utils.randSeedInt(6);
|
||||
case Species.ALCREMIE:
|
||||
return Utils.randSeedInt(9);
|
||||
case Species.MEOWSTIC:
|
||||
case Species.INDEEDEE:
|
||||
case Species.BASCULEGION:
|
||||
case Species.OINKOLOGNE:
|
||||
return gender === Gender.FEMALE ? 1 : 0;
|
||||
case Species.TOXTRICITY:
|
||||
const lowkeyNatures = [ Nature.LONELY, Nature.BOLD, Nature.RELAXED, Nature.TIMID, Nature.SERIOUS, Nature.MODEST, Nature.MILD, Nature.QUIET, Nature.BASHFUL, Nature.CALM, Nature.GENTLE, Nature.CAREFUL ];
|
||||
if (nature !== undefined && lowkeyNatures.indexOf(nature) > -1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case Species.GIMMIGHOUL:
|
||||
// Chest form can only be found in Mysterious Chest Encounter, if this is a game mode with MEs
|
||||
if (this.gameMode.hasMysteryEncounters) {
|
||||
return 1; // Wandering form
|
||||
} else {
|
||||
case Species.UNOWN:
|
||||
case Species.SHELLOS:
|
||||
case Species.GASTRODON:
|
||||
case Species.BASCULIN:
|
||||
case Species.DEERLING:
|
||||
case Species.SAWSBUCK:
|
||||
case Species.FROAKIE:
|
||||
case Species.FROGADIER:
|
||||
case Species.SCATTERBUG:
|
||||
case Species.SPEWPA:
|
||||
case Species.VIVILLON:
|
||||
case Species.FLABEBE:
|
||||
case Species.FLOETTE:
|
||||
case Species.FLORGES:
|
||||
case Species.FURFROU:
|
||||
case Species.PUMPKABOO:
|
||||
case Species.GOURGEIST:
|
||||
case Species.ORICORIO:
|
||||
case Species.MAGEARNA:
|
||||
case Species.ZARUDE:
|
||||
case Species.SQUAWKABILLY:
|
||||
case Species.TATSUGIRI:
|
||||
case Species.PALDEA_TAUROS:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
}
|
||||
case Species.PIKACHU:
|
||||
return Utils.randSeedInt(8);
|
||||
case Species.EEVEE:
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.GRENINJA:
|
||||
return Utils.randSeedInt(2);
|
||||
case Species.ZYGARDE:
|
||||
return Utils.randSeedInt(4);
|
||||
case Species.MINIOR:
|
||||
return Utils.randSeedInt(6);
|
||||
case Species.ALCREMIE:
|
||||
return Utils.randSeedInt(9);
|
||||
case Species.MEOWSTIC:
|
||||
case Species.INDEEDEE:
|
||||
case Species.BASCULEGION:
|
||||
case Species.OINKOLOGNE:
|
||||
return gender === Gender.FEMALE ? 1 : 0;
|
||||
case Species.TOXTRICITY:
|
||||
const lowkeyNatures = [ Nature.LONELY, Nature.BOLD, Nature.RELAXED, Nature.TIMID, Nature.SERIOUS, Nature.MODEST, Nature.MILD, Nature.QUIET, Nature.BASHFUL, Nature.CALM, Nature.GENTLE, Nature.CAREFUL ];
|
||||
if (nature !== undefined && lowkeyNatures.indexOf(nature) > -1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
case Species.GIMMIGHOUL:
|
||||
// Chest form can only be found in Mysterious Chest Encounter, if this is a game mode with MEs
|
||||
if (this.gameMode.hasMysteryEncounters) {
|
||||
return 1; // Wandering form
|
||||
} else {
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (ignoreArena) {
|
||||
switch (species.speciesId) {
|
||||
case Species.BURMY:
|
||||
case Species.WORMADAM:
|
||||
case Species.ROTOM:
|
||||
case Species.LYCANROC:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
case Species.BURMY:
|
||||
case Species.WORMADAM:
|
||||
case Species.ROTOM:
|
||||
case Species.LYCANROC:
|
||||
return Utils.randSeedInt(species.forms.length);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1885,17 +1886,17 @@ export default class BattleScene extends SceneBase {
|
|||
const soundDetails = sound.key.split("/");
|
||||
switch (soundDetails[0]) {
|
||||
|
||||
case "battle_anims":
|
||||
case "cry":
|
||||
if (soundDetails[1].startsWith("PRSFX- ")) {
|
||||
sound.setVolume(this.masterVolume * this.fieldVolume * 0.5);
|
||||
} else {
|
||||
sound.setVolume(this.masterVolume * this.fieldVolume);
|
||||
}
|
||||
break;
|
||||
case "se":
|
||||
case "ui":
|
||||
sound.setVolume(this.masterVolume * this.seVolume);
|
||||
case "battle_anims":
|
||||
case "cry":
|
||||
if (soundDetails[1].startsWith("PRSFX- ")) {
|
||||
sound.setVolume(this.masterVolume * this.fieldVolume * 0.5);
|
||||
} else {
|
||||
sound.setVolume(this.masterVolume * this.fieldVolume);
|
||||
}
|
||||
break;
|
||||
case "se":
|
||||
case "ui":
|
||||
sound.setVolume(this.masterVolume * this.seVolume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1935,31 +1936,31 @@ export default class BattleScene extends SceneBase {
|
|||
const keyDetails = key.split("/");
|
||||
config["volume"] = config["volume"] ?? 1;
|
||||
switch (keyDetails[0]) {
|
||||
case "level_up_fanfare":
|
||||
case "item_fanfare":
|
||||
case "minor_fanfare":
|
||||
case "heal":
|
||||
case "evolution":
|
||||
case "evolution_fanfare":
|
||||
case "level_up_fanfare":
|
||||
case "item_fanfare":
|
||||
case "minor_fanfare":
|
||||
case "heal":
|
||||
case "evolution":
|
||||
case "evolution_fanfare":
|
||||
// These sounds are loaded in as BGM, but played as sound effects
|
||||
// When these sounds are updated in updateVolume(), they are treated as BGM however because they are placed in the BGM Cache through being called by playSoundWithoutBGM()
|
||||
config["volume"] *= (this.masterVolume * this.bgmVolume);
|
||||
break;
|
||||
case "battle_anims":
|
||||
case "cry":
|
||||
config["volume"] *= (this.masterVolume * this.fieldVolume);
|
||||
//PRSFX sound files are unusually loud
|
||||
if (keyDetails[1].startsWith("PRSFX- ")) {
|
||||
config["volume"] *= 0.5;
|
||||
}
|
||||
break;
|
||||
case "ui":
|
||||
config["volume"] *= (this.masterVolume * this.bgmVolume);
|
||||
break;
|
||||
case "battle_anims":
|
||||
case "cry":
|
||||
config["volume"] *= (this.masterVolume * this.fieldVolume);
|
||||
//PRSFX sound files are unusually loud
|
||||
if (keyDetails[1].startsWith("PRSFX- ")) {
|
||||
config["volume"] *= 0.5;
|
||||
}
|
||||
break;
|
||||
case "ui":
|
||||
//As of, right now this applies to the "select", "menu_open", "error" sound effects
|
||||
config["volume"] *= (this.masterVolume * this.uiVolume);
|
||||
break;
|
||||
case "se":
|
||||
config["volume"] *= (this.masterVolume * this.seVolume);
|
||||
break;
|
||||
config["volume"] *= (this.masterVolume * this.uiVolume);
|
||||
break;
|
||||
case "se":
|
||||
config["volume"] *= (this.masterVolume * this.seVolume);
|
||||
break;
|
||||
}
|
||||
this.sound.play(key, config);
|
||||
return this.sound.get(key) as AnySound;
|
||||
|
@ -1988,208 +1989,208 @@ export default class BattleScene extends SceneBase {
|
|||
|
||||
getBgmLoopPoint(bgmName: string): number {
|
||||
switch (bgmName) {
|
||||
case "battle_kanto_champion": //B2W2 Kanto Champion Battle
|
||||
return 13.950;
|
||||
case "battle_johto_champion": //B2W2 Johto Champion Battle
|
||||
return 23.498;
|
||||
case "battle_hoenn_champion_g5": //B2W2 Hoenn Champion Battle
|
||||
return 11.328;
|
||||
case "battle_hoenn_champion_g6": //ORAS Hoenn Champion Battle
|
||||
return 11.762;
|
||||
case "battle_sinnoh_champion": //B2W2 Sinnoh Champion Battle
|
||||
return 12.235;
|
||||
case "battle_champion_alder": //BW Unova Champion Battle
|
||||
return 27.653;
|
||||
case "battle_champion_iris": //B2W2 Unova Champion Battle
|
||||
return 10.145;
|
||||
case "battle_kalos_champion": //XY Kalos Champion Battle
|
||||
return 10.380;
|
||||
case "battle_alola_champion": //USUM Alola Champion Battle
|
||||
return 13.025;
|
||||
case "battle_galar_champion": //SWSH Galar Champion Battle
|
||||
return 61.635;
|
||||
case "battle_champion_geeta": //SV Champion Geeta Battle
|
||||
return 37.447;
|
||||
case "battle_champion_nemona": //SV Champion Nemona Battle
|
||||
return 14.914;
|
||||
case "battle_champion_kieran": //SV Champion Kieran Battle
|
||||
return 7.206;
|
||||
case "battle_hoenn_elite": //ORAS Elite Four Battle
|
||||
return 11.350;
|
||||
case "battle_unova_elite": //BW Elite Four Battle
|
||||
return 17.730;
|
||||
case "battle_kalos_elite": //XY Elite Four Battle
|
||||
return 12.340;
|
||||
case "battle_alola_elite": //SM Elite Four Battle
|
||||
return 19.212;
|
||||
case "battle_galar_elite": //SWSH League Tournament Battle
|
||||
return 164.069;
|
||||
case "battle_paldea_elite": //SV Elite Four Battle
|
||||
return 12.770;
|
||||
case "battle_bb_elite": //SV BB League Elite Four Battle
|
||||
return 19.434;
|
||||
case "battle_final_encounter": //PMD RTDX Rayquaza's Domain
|
||||
return 19.159;
|
||||
case "battle_final": //BW Ghetsis Battle
|
||||
return 16.453;
|
||||
case "battle_kanto_gym": //B2W2 Kanto Gym Battle
|
||||
return 13.857;
|
||||
case "battle_johto_gym": //B2W2 Johto Gym Battle
|
||||
return 12.911;
|
||||
case "battle_hoenn_gym": //B2W2 Hoenn Gym Battle
|
||||
return 12.379;
|
||||
case "battle_sinnoh_gym": //B2W2 Sinnoh Gym Battle
|
||||
return 13.122;
|
||||
case "battle_unova_gym": //BW Unova Gym Battle
|
||||
return 19.145;
|
||||
case "battle_kalos_gym": //XY Kalos Gym Battle
|
||||
return 44.810;
|
||||
case "battle_galar_gym": //SWSH Galar Gym Battle
|
||||
return 171.262;
|
||||
case "battle_paldea_gym": //SV Paldea Gym Battle
|
||||
return 127.489;
|
||||
case "battle_legendary_kanto": //XY Kanto Legendary Battle
|
||||
return 32.966;
|
||||
case "battle_legendary_raikou": //HGSS Raikou Battle
|
||||
return 12.632;
|
||||
case "battle_legendary_entei": //HGSS Entei Battle
|
||||
return 2.905;
|
||||
case "battle_legendary_suicune": //HGSS Suicune Battle
|
||||
return 12.636;
|
||||
case "battle_legendary_lugia": //HGSS Lugia Battle
|
||||
return 19.770;
|
||||
case "battle_legendary_ho_oh": //HGSS Ho-oh Battle
|
||||
return 17.668;
|
||||
case "battle_legendary_regis_g5": //B2W2 Legendary Titan Battle
|
||||
return 49.500;
|
||||
case "battle_legendary_regis_g6": //ORAS Legendary Titan Battle
|
||||
return 21.130;
|
||||
case "battle_legendary_gro_kyo": //ORAS Groudon & Kyogre Battle
|
||||
return 10.547;
|
||||
case "battle_legendary_rayquaza": //ORAS Rayquaza Battle
|
||||
return 10.495;
|
||||
case "battle_legendary_deoxys": //ORAS Deoxys Battle
|
||||
return 13.333;
|
||||
case "battle_legendary_lake_trio": //ORAS Lake Guardians Battle
|
||||
return 16.887;
|
||||
case "battle_legendary_sinnoh": //ORAS Sinnoh Legendary Battle
|
||||
return 22.770;
|
||||
case "battle_legendary_dia_pal": //ORAS Dialga & Palkia Battle
|
||||
return 16.009;
|
||||
case "battle_legendary_origin_forme": //LA Origin Dialga & Palkia Battle
|
||||
return 18.961;
|
||||
case "battle_legendary_giratina": //ORAS Giratina Battle
|
||||
return 10.451;
|
||||
case "battle_legendary_arceus": //HGSS Arceus Battle
|
||||
return 9.595;
|
||||
case "battle_legendary_unova": //BW Unova Legendary Battle
|
||||
return 13.855;
|
||||
case "battle_legendary_kyurem": //BW Kyurem Battle
|
||||
return 18.314;
|
||||
case "battle_legendary_res_zek": //BW Reshiram & Zekrom Battle
|
||||
return 18.329;
|
||||
case "battle_legendary_xern_yvel": //XY Xerneas & Yveltal Battle
|
||||
return 26.468;
|
||||
case "battle_legendary_tapu": //SM Tapu Battle
|
||||
return 0.000;
|
||||
case "battle_legendary_sol_lun": //SM Solgaleo & Lunala Battle
|
||||
return 6.525;
|
||||
case "battle_legendary_ub": //SM Ultra Beast Battle
|
||||
return 9.818;
|
||||
case "battle_legendary_dusk_dawn": //USUM Dusk Mane & Dawn Wings Necrozma Battle
|
||||
return 5.211;
|
||||
case "battle_legendary_ultra_nec": //USUM Ultra Necrozma Battle
|
||||
return 10.344;
|
||||
case "battle_legendary_zac_zam": //SWSH Zacian & Zamazenta Battle
|
||||
return 11.424;
|
||||
case "battle_legendary_glas_spec": //SWSH Glastrier & Spectrier Battle
|
||||
return 12.503;
|
||||
case "battle_legendary_calyrex": //SWSH Calyrex Battle
|
||||
return 50.641;
|
||||
case "battle_legendary_riders": //SWSH Ice & Shadow Rider Calyrex Battle
|
||||
return 18.155;
|
||||
case "battle_legendary_birds_galar": //SWSH Galarian Legendary Birds Battle
|
||||
return 0.175;
|
||||
case "battle_legendary_ruinous": //SV Treasures of Ruin Battle
|
||||
return 6.333;
|
||||
case "battle_legendary_kor_mir": //SV Depths of Area Zero Battle
|
||||
return 6.442;
|
||||
case "battle_legendary_loyal_three": //SV Loyal Three Battle
|
||||
return 6.500;
|
||||
case "battle_legendary_ogerpon": //SV Ogerpon Battle
|
||||
return 14.335;
|
||||
case "battle_legendary_terapagos": //SV Terapagos Battle
|
||||
return 24.377;
|
||||
case "battle_legendary_pecharunt": //SV Pecharunt Battle
|
||||
return 6.508;
|
||||
case "battle_rival": //BW Rival Battle
|
||||
return 14.110;
|
||||
case "battle_rival_2": //BW N Battle
|
||||
return 17.714;
|
||||
case "battle_rival_3": //BW Final N Battle
|
||||
return 17.586;
|
||||
case "battle_trainer": //BW Trainer Battle
|
||||
return 13.686;
|
||||
case "battle_wild": //BW Wild Battle
|
||||
return 12.703;
|
||||
case "battle_wild_strong": //BW Strong Wild Battle
|
||||
return 13.940;
|
||||
case "end_summit": //PMD RTDX Sky Tower Summit
|
||||
return 30.025;
|
||||
case "battle_rocket_grunt": //HGSS Team Rocket Battle
|
||||
return 12.707;
|
||||
case "battle_aqua_magma_grunt": //ORAS Team Aqua & Magma Battle
|
||||
return 12.062;
|
||||
case "battle_galactic_grunt": //BDSP Team Galactic Battle
|
||||
return 13.043;
|
||||
case "battle_plasma_grunt": //BW Team Plasma Battle
|
||||
return 12.974;
|
||||
case "battle_flare_grunt": //XY Team Flare Battle
|
||||
return 4.228;
|
||||
case "battle_aether_grunt": // SM Aether Foundation Battle
|
||||
return 16.00;
|
||||
case "battle_skull_grunt": // SM Team Skull Battle
|
||||
return 20.87;
|
||||
case "battle_macro_grunt": // SWSH Trainer Battle
|
||||
return 11.56;
|
||||
case "battle_star_grunt": //SV Team Star Battle
|
||||
return 133.362;
|
||||
case "battle_galactic_admin": //BDSP Team Galactic Admin Battle
|
||||
return 11.997;
|
||||
case "battle_skull_admin": //SM Team Skull Admin Battle
|
||||
return 15.463;
|
||||
case "battle_oleana": //SWSH Oleana Battle
|
||||
return 14.110;
|
||||
case "battle_star_admin": //SV Team Star Boss Battle
|
||||
return 9.493;
|
||||
case "battle_rocket_boss": //USUM Giovanni Battle
|
||||
return 9.115;
|
||||
case "battle_aqua_magma_boss": //ORAS Archie & Maxie Battle
|
||||
return 14.847;
|
||||
case "battle_galactic_boss": //BDSP Cyrus Battle
|
||||
return 106.962;
|
||||
case "battle_plasma_boss": //B2W2 Ghetsis Battle
|
||||
return 25.624;
|
||||
case "battle_flare_boss": //XY Lysandre Battle
|
||||
return 8.085;
|
||||
case "battle_aether_boss": //SM Lusamine Battle
|
||||
return 11.33;
|
||||
case "battle_skull_boss": //SM Guzma Battle
|
||||
return 13.13;
|
||||
case "battle_macro_boss": //SWSH Rose Battle
|
||||
return 11.42;
|
||||
case "battle_star_boss": //SV Cassiopeia Battle
|
||||
return 25.764;
|
||||
case "mystery_encounter_gen_5_gts": // BW GTS
|
||||
return 8.52;
|
||||
case "mystery_encounter_gen_6_gts": // XY GTS
|
||||
return 9.24;
|
||||
case "mystery_encounter_fun_and_games": // EoS Guildmaster Wigglytuff
|
||||
return 4.78;
|
||||
case "mystery_encounter_weird_dream": // EoS Temporal Spire
|
||||
return 41.42;
|
||||
case "mystery_encounter_delibirdy": // Firel Delibirdy
|
||||
return 82.28;
|
||||
case "battle_kanto_champion": //B2W2 Kanto Champion Battle
|
||||
return 13.950;
|
||||
case "battle_johto_champion": //B2W2 Johto Champion Battle
|
||||
return 23.498;
|
||||
case "battle_hoenn_champion_g5": //B2W2 Hoenn Champion Battle
|
||||
return 11.328;
|
||||
case "battle_hoenn_champion_g6": //ORAS Hoenn Champion Battle
|
||||
return 11.762;
|
||||
case "battle_sinnoh_champion": //B2W2 Sinnoh Champion Battle
|
||||
return 12.235;
|
||||
case "battle_champion_alder": //BW Unova Champion Battle
|
||||
return 27.653;
|
||||
case "battle_champion_iris": //B2W2 Unova Champion Battle
|
||||
return 10.145;
|
||||
case "battle_kalos_champion": //XY Kalos Champion Battle
|
||||
return 10.380;
|
||||
case "battle_alola_champion": //USUM Alola Champion Battle
|
||||
return 13.025;
|
||||
case "battle_galar_champion": //SWSH Galar Champion Battle
|
||||
return 61.635;
|
||||
case "battle_champion_geeta": //SV Champion Geeta Battle
|
||||
return 37.447;
|
||||
case "battle_champion_nemona": //SV Champion Nemona Battle
|
||||
return 14.914;
|
||||
case "battle_champion_kieran": //SV Champion Kieran Battle
|
||||
return 7.206;
|
||||
case "battle_hoenn_elite": //ORAS Elite Four Battle
|
||||
return 11.350;
|
||||
case "battle_unova_elite": //BW Elite Four Battle
|
||||
return 17.730;
|
||||
case "battle_kalos_elite": //XY Elite Four Battle
|
||||
return 12.340;
|
||||
case "battle_alola_elite": //SM Elite Four Battle
|
||||
return 19.212;
|
||||
case "battle_galar_elite": //SWSH League Tournament Battle
|
||||
return 164.069;
|
||||
case "battle_paldea_elite": //SV Elite Four Battle
|
||||
return 12.770;
|
||||
case "battle_bb_elite": //SV BB League Elite Four Battle
|
||||
return 19.434;
|
||||
case "battle_final_encounter": //PMD RTDX Rayquaza's Domain
|
||||
return 19.159;
|
||||
case "battle_final": //BW Ghetsis Battle
|
||||
return 16.453;
|
||||
case "battle_kanto_gym": //B2W2 Kanto Gym Battle
|
||||
return 13.857;
|
||||
case "battle_johto_gym": //B2W2 Johto Gym Battle
|
||||
return 12.911;
|
||||
case "battle_hoenn_gym": //B2W2 Hoenn Gym Battle
|
||||
return 12.379;
|
||||
case "battle_sinnoh_gym": //B2W2 Sinnoh Gym Battle
|
||||
return 13.122;
|
||||
case "battle_unova_gym": //BW Unova Gym Battle
|
||||
return 19.145;
|
||||
case "battle_kalos_gym": //XY Kalos Gym Battle
|
||||
return 44.810;
|
||||
case "battle_galar_gym": //SWSH Galar Gym Battle
|
||||
return 171.262;
|
||||
case "battle_paldea_gym": //SV Paldea Gym Battle
|
||||
return 127.489;
|
||||
case "battle_legendary_kanto": //XY Kanto Legendary Battle
|
||||
return 32.966;
|
||||
case "battle_legendary_raikou": //HGSS Raikou Battle
|
||||
return 12.632;
|
||||
case "battle_legendary_entei": //HGSS Entei Battle
|
||||
return 2.905;
|
||||
case "battle_legendary_suicune": //HGSS Suicune Battle
|
||||
return 12.636;
|
||||
case "battle_legendary_lugia": //HGSS Lugia Battle
|
||||
return 19.770;
|
||||
case "battle_legendary_ho_oh": //HGSS Ho-oh Battle
|
||||
return 17.668;
|
||||
case "battle_legendary_regis_g5": //B2W2 Legendary Titan Battle
|
||||
return 49.500;
|
||||
case "battle_legendary_regis_g6": //ORAS Legendary Titan Battle
|
||||
return 21.130;
|
||||
case "battle_legendary_gro_kyo": //ORAS Groudon & Kyogre Battle
|
||||
return 10.547;
|
||||
case "battle_legendary_rayquaza": //ORAS Rayquaza Battle
|
||||
return 10.495;
|
||||
case "battle_legendary_deoxys": //ORAS Deoxys Battle
|
||||
return 13.333;
|
||||
case "battle_legendary_lake_trio": //ORAS Lake Guardians Battle
|
||||
return 16.887;
|
||||
case "battle_legendary_sinnoh": //ORAS Sinnoh Legendary Battle
|
||||
return 22.770;
|
||||
case "battle_legendary_dia_pal": //ORAS Dialga & Palkia Battle
|
||||
return 16.009;
|
||||
case "battle_legendary_origin_forme": //LA Origin Dialga & Palkia Battle
|
||||
return 18.961;
|
||||
case "battle_legendary_giratina": //ORAS Giratina Battle
|
||||
return 10.451;
|
||||
case "battle_legendary_arceus": //HGSS Arceus Battle
|
||||
return 9.595;
|
||||
case "battle_legendary_unova": //BW Unova Legendary Battle
|
||||
return 13.855;
|
||||
case "battle_legendary_kyurem": //BW Kyurem Battle
|
||||
return 18.314;
|
||||
case "battle_legendary_res_zek": //BW Reshiram & Zekrom Battle
|
||||
return 18.329;
|
||||
case "battle_legendary_xern_yvel": //XY Xerneas & Yveltal Battle
|
||||
return 26.468;
|
||||
case "battle_legendary_tapu": //SM Tapu Battle
|
||||
return 0.000;
|
||||
case "battle_legendary_sol_lun": //SM Solgaleo & Lunala Battle
|
||||
return 6.525;
|
||||
case "battle_legendary_ub": //SM Ultra Beast Battle
|
||||
return 9.818;
|
||||
case "battle_legendary_dusk_dawn": //USUM Dusk Mane & Dawn Wings Necrozma Battle
|
||||
return 5.211;
|
||||
case "battle_legendary_ultra_nec": //USUM Ultra Necrozma Battle
|
||||
return 10.344;
|
||||
case "battle_legendary_zac_zam": //SWSH Zacian & Zamazenta Battle
|
||||
return 11.424;
|
||||
case "battle_legendary_glas_spec": //SWSH Glastrier & Spectrier Battle
|
||||
return 12.503;
|
||||
case "battle_legendary_calyrex": //SWSH Calyrex Battle
|
||||
return 50.641;
|
||||
case "battle_legendary_riders": //SWSH Ice & Shadow Rider Calyrex Battle
|
||||
return 18.155;
|
||||
case "battle_legendary_birds_galar": //SWSH Galarian Legendary Birds Battle
|
||||
return 0.175;
|
||||
case "battle_legendary_ruinous": //SV Treasures of Ruin Battle
|
||||
return 6.333;
|
||||
case "battle_legendary_kor_mir": //SV Depths of Area Zero Battle
|
||||
return 6.442;
|
||||
case "battle_legendary_loyal_three": //SV Loyal Three Battle
|
||||
return 6.500;
|
||||
case "battle_legendary_ogerpon": //SV Ogerpon Battle
|
||||
return 14.335;
|
||||
case "battle_legendary_terapagos": //SV Terapagos Battle
|
||||
return 24.377;
|
||||
case "battle_legendary_pecharunt": //SV Pecharunt Battle
|
||||
return 6.508;
|
||||
case "battle_rival": //BW Rival Battle
|
||||
return 14.110;
|
||||
case "battle_rival_2": //BW N Battle
|
||||
return 17.714;
|
||||
case "battle_rival_3": //BW Final N Battle
|
||||
return 17.586;
|
||||
case "battle_trainer": //BW Trainer Battle
|
||||
return 13.686;
|
||||
case "battle_wild": //BW Wild Battle
|
||||
return 12.703;
|
||||
case "battle_wild_strong": //BW Strong Wild Battle
|
||||
return 13.940;
|
||||
case "end_summit": //PMD RTDX Sky Tower Summit
|
||||
return 30.025;
|
||||
case "battle_rocket_grunt": //HGSS Team Rocket Battle
|
||||
return 12.707;
|
||||
case "battle_aqua_magma_grunt": //ORAS Team Aqua & Magma Battle
|
||||
return 12.062;
|
||||
case "battle_galactic_grunt": //BDSP Team Galactic Battle
|
||||
return 13.043;
|
||||
case "battle_plasma_grunt": //BW Team Plasma Battle
|
||||
return 12.974;
|
||||
case "battle_flare_grunt": //XY Team Flare Battle
|
||||
return 4.228;
|
||||
case "battle_aether_grunt": // SM Aether Foundation Battle
|
||||
return 16.00;
|
||||
case "battle_skull_grunt": // SM Team Skull Battle
|
||||
return 20.87;
|
||||
case "battle_macro_grunt": // SWSH Trainer Battle
|
||||
return 11.56;
|
||||
case "battle_star_grunt": //SV Team Star Battle
|
||||
return 133.362;
|
||||
case "battle_galactic_admin": //BDSP Team Galactic Admin Battle
|
||||
return 11.997;
|
||||
case "battle_skull_admin": //SM Team Skull Admin Battle
|
||||
return 15.463;
|
||||
case "battle_oleana": //SWSH Oleana Battle
|
||||
return 14.110;
|
||||
case "battle_star_admin": //SV Team Star Boss Battle
|
||||
return 9.493;
|
||||
case "battle_rocket_boss": //USUM Giovanni Battle
|
||||
return 9.115;
|
||||
case "battle_aqua_magma_boss": //ORAS Archie & Maxie Battle
|
||||
return 14.847;
|
||||
case "battle_galactic_boss": //BDSP Cyrus Battle
|
||||
return 106.962;
|
||||
case "battle_plasma_boss": //B2W2 Ghetsis Battle
|
||||
return 25.624;
|
||||
case "battle_flare_boss": //XY Lysandre Battle
|
||||
return 8.085;
|
||||
case "battle_aether_boss": //SM Lusamine Battle
|
||||
return 11.33;
|
||||
case "battle_skull_boss": //SM Guzma Battle
|
||||
return 13.13;
|
||||
case "battle_macro_boss": //SWSH Rose Battle
|
||||
return 11.42;
|
||||
case "battle_star_boss": //SV Cassiopeia Battle
|
||||
return 25.764;
|
||||
case "mystery_encounter_gen_5_gts": // BW GTS
|
||||
return 8.52;
|
||||
case "mystery_encounter_gen_6_gts": // XY GTS
|
||||
return 9.24;
|
||||
case "mystery_encounter_fun_and_games": // EoS Guildmaster Wigglytuff
|
||||
return 4.78;
|
||||
case "mystery_encounter_weird_dream": // EoS Temporal Spire
|
||||
return 41.42;
|
||||
case "mystery_encounter_delibirdy": // Firel Delibirdy
|
||||
return 82.28;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2425,7 +2426,7 @@ export default class BattleScene extends SceneBase {
|
|||
return Math.floor(moneyValue / 10) * 10;
|
||||
}
|
||||
|
||||
addModifier(modifier: Modifier | null, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean): Promise<boolean> {
|
||||
addModifier(modifier: Modifier | null, ignoreUpdate?: boolean, playSound?: boolean, virtual?: boolean, instant?: boolean, cost?: number): Promise<boolean> {
|
||||
if (!modifier) {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
@ -2482,6 +2483,8 @@ 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)) {
|
||||
args.push(cost);
|
||||
}
|
||||
|
||||
if (modifier.shouldApply(pokemon, ...args)) {
|
||||
|
@ -3052,7 +3055,7 @@ export default class BattleScene extends SceneBase {
|
|||
const pId = partyMember.id;
|
||||
const participated = participantIds.has(pId);
|
||||
if (participated && pokemonDefeated) {
|
||||
partyMember.addFriendship(2);
|
||||
partyMember.addFriendship(FRIENDSHIP_GAIN_FROM_BATTLE);
|
||||
const machoBraceModifier = partyMember.getHeldItems().find(m => m instanceof PokemonIncrementingStatModifier);
|
||||
if (machoBraceModifier && machoBraceModifier.stackCount < machoBraceModifier.getMaxStackCount(this)) {
|
||||
machoBraceModifier.stackCount++;
|
||||
|
@ -3174,6 +3177,9 @@ export default class BattleScene extends SceneBase {
|
|||
let encounter: MysteryEncounter | null;
|
||||
if (!isNullOrUndefined(Overrides.MYSTERY_ENCOUNTER_OVERRIDE) && allMysteryEncounters.hasOwnProperty(Overrides.MYSTERY_ENCOUNTER_OVERRIDE)) {
|
||||
encounter = allMysteryEncounters[Overrides.MYSTERY_ENCOUNTER_OVERRIDE];
|
||||
if (canBypass) {
|
||||
return encounter;
|
||||
}
|
||||
} else if (canBypass) {
|
||||
encounter = allMysteryEncounters[encounterType ?? -1];
|
||||
return encounter;
|
||||
|
|
|
@ -2579,24 +2579,24 @@ export class PreSwitchOutClearWeatherAbAttr extends PreSwitchOutAbAttr {
|
|||
|
||||
// Clear weather only if user's ability matches the weather and no other pokemon has the ability.
|
||||
switch (weatherType) {
|
||||
case (WeatherType.HARSH_SUN):
|
||||
if (pokemon.hasAbility(Abilities.DESOLATE_LAND)
|
||||
case (WeatherType.HARSH_SUN):
|
||||
if (pokemon.hasAbility(Abilities.DESOLATE_LAND)
|
||||
&& pokemon.scene.getField(true).filter(p => p !== pokemon).filter(p => p.hasAbility(Abilities.DESOLATE_LAND)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.HEAVY_RAIN):
|
||||
if (pokemon.hasAbility(Abilities.PRIMORDIAL_SEA)
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.HEAVY_RAIN):
|
||||
if (pokemon.hasAbility(Abilities.PRIMORDIAL_SEA)
|
||||
&& pokemon.scene.getField(true).filter(p => p !== pokemon).filter(p => p.hasAbility(Abilities.PRIMORDIAL_SEA)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.STRONG_WINDS):
|
||||
if (pokemon.hasAbility(Abilities.DELTA_STREAM)
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.STRONG_WINDS):
|
||||
if (pokemon.hasAbility(Abilities.DELTA_STREAM)
|
||||
&& pokemon.scene.getField(true).filter(p => p !== pokemon).filter(p => p.hasAbility(Abilities.DELTA_STREAM)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (simulated) {
|
||||
|
@ -4079,24 +4079,24 @@ export class PostFaintClearWeatherAbAttr extends PostFaintAbAttr {
|
|||
|
||||
// Clear weather only if user's ability matches the weather and no other pokemon has the ability.
|
||||
switch (weatherType) {
|
||||
case (WeatherType.HARSH_SUN):
|
||||
if (pokemon.hasAbility(Abilities.DESOLATE_LAND)
|
||||
case (WeatherType.HARSH_SUN):
|
||||
if (pokemon.hasAbility(Abilities.DESOLATE_LAND)
|
||||
&& pokemon.scene.getField(true).filter(p => p.hasAbility(Abilities.DESOLATE_LAND)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.HEAVY_RAIN):
|
||||
if (pokemon.hasAbility(Abilities.PRIMORDIAL_SEA)
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.HEAVY_RAIN):
|
||||
if (pokemon.hasAbility(Abilities.PRIMORDIAL_SEA)
|
||||
&& pokemon.scene.getField(true).filter(p => p.hasAbility(Abilities.PRIMORDIAL_SEA)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.STRONG_WINDS):
|
||||
if (pokemon.hasAbility(Abilities.DELTA_STREAM)
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
case (WeatherType.STRONG_WINDS):
|
||||
if (pokemon.hasAbility(Abilities.DELTA_STREAM)
|
||||
&& pokemon.scene.getField(true).filter(p => p.hasAbility(Abilities.DELTA_STREAM)).length === 0) {
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
turnOffWeather = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (simulated) {
|
||||
|
@ -4913,8 +4913,7 @@ export function initAbilities() {
|
|||
.attr(TypeImmunityAddBattlerTagAbAttr, Type.FIRE, BattlerTagType.FIRE_BOOST, 1)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.SHIELD_DUST, 3)
|
||||
.attr(IgnoreMoveEffectsAbAttr)
|
||||
.edgeCase(), // Does not work with secret power (unimplemented)
|
||||
.attr(IgnoreMoveEffectsAbAttr),
|
||||
new Ability(Abilities.OWN_TEMPO, 3)
|
||||
.attr(BattlerTagImmunityAbAttr, BattlerTagType.CONFUSED)
|
||||
.attr(IntimidateImmunityAbAttr)
|
||||
|
@ -4958,8 +4957,7 @@ export function initAbilities() {
|
|||
.attr(TypeImmunityStatStageChangeAbAttr, Type.ELECTRIC, Stat.SPATK, 1)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.SERENE_GRACE, 3)
|
||||
.attr(MoveEffectChanceMultiplierAbAttr, 2)
|
||||
.edgeCase(), // does not work with secret power (unimplemented)
|
||||
.attr(MoveEffectChanceMultiplierAbAttr, 2),
|
||||
new Ability(Abilities.SWIFT_SWIM, 3)
|
||||
.attr(StatMultiplierAbAttr, Stat.SPD, 2)
|
||||
.condition(getWeatherCondition(WeatherType.RAIN, WeatherType.HEAVY_RAIN)),
|
||||
|
@ -5535,16 +5533,18 @@ export function initAbilities() {
|
|||
.attr(UnsuppressableAbilityAbAttr)
|
||||
.attr(NoFusionAbilityAbAttr)
|
||||
.bypassFaint(),
|
||||
new Ability(Abilities.POWER_CONSTRUCT, 7) // TODO: 10% Power Construct Zygarde isn't accounted for yet. If changed, update Zygarde's getSpeciesFormIndex entry accordingly
|
||||
.attr(PostBattleInitFormChangeAbAttr, () => 2)
|
||||
.attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "complete" ? 4 : 2)
|
||||
.attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "complete" ? 4 : 2)
|
||||
new Ability(Abilities.POWER_CONSTRUCT, 7)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostBattleInitFormChangeAbAttr, () => 2)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 3 || pokemon.formIndex === 5, PostBattleInitFormChangeAbAttr, () => 3)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "complete" ? 4 : 2)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "complete" ? 4 : 2)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 3 || pokemon.formIndex === 5, PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "10-complete" ? 5 : 3)
|
||||
.conditionalAttr(pokemon => pokemon.formIndex === 3 || pokemon.formIndex === 5, PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "10-complete" ? 5 : 3)
|
||||
.attr(UncopiableAbilityAbAttr)
|
||||
.attr(UnswappableAbilityAbAttr)
|
||||
.attr(UnsuppressableAbilityAbAttr)
|
||||
.attr(NoFusionAbilityAbAttr)
|
||||
.bypassFaint()
|
||||
.partial(),
|
||||
.bypassFaint(),
|
||||
new Ability(Abilities.CORROSION, 7)
|
||||
.attr(IgnoreTypeStatusEffectImmunityAbAttr, [ StatusEffect.POISON, StatusEffect.TOXIC ], [ Type.STEEL, Type.POISON ])
|
||||
.edgeCase(), // Should interact correctly with magic coat/bounce (not yet implemented), fling with toxic orb (not implemented yet), and synchronize (not fully implemented yet)
|
||||
|
|
|
@ -88,13 +88,13 @@ export abstract class ArenaTag {
|
|||
*/
|
||||
public getAffectedPokemon(scene: BattleScene): Pokemon[] {
|
||||
switch (this.side) {
|
||||
case ArenaTagSide.PLAYER:
|
||||
return scene.getPlayerField() ?? [];
|
||||
case ArenaTagSide.ENEMY:
|
||||
return scene.getEnemyField() ?? [];
|
||||
case ArenaTagSide.BOTH:
|
||||
default:
|
||||
return scene.getField(true) ?? [];
|
||||
case ArenaTagSide.PLAYER:
|
||||
return scene.getPlayerField() ?? [];
|
||||
case ArenaTagSide.ENEMY:
|
||||
return scene.getEnemyField() ?? [];
|
||||
case ArenaTagSide.BOTH:
|
||||
default:
|
||||
return scene.getField(true) ?? [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,11 +332,11 @@ const WideGuardConditionFunc: ProtectConditionFunc = (arena, moveId) : boolean =
|
|||
const move = allMoves[moveId];
|
||||
|
||||
switch (move.moveTarget) {
|
||||
case MoveTarget.ALL_ENEMIES:
|
||||
case MoveTarget.ALL_NEAR_ENEMIES:
|
||||
case MoveTarget.ALL_OTHERS:
|
||||
case MoveTarget.ALL_NEAR_OTHERS:
|
||||
return true;
|
||||
case MoveTarget.ALL_ENEMIES:
|
||||
case MoveTarget.ALL_NEAR_ENEMIES:
|
||||
case MoveTarget.ALL_OTHERS:
|
||||
case MoveTarget.ALL_NEAR_OTHERS:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
@ -807,24 +807,24 @@ class StealthRockTag extends ArenaTrapTag {
|
|||
let damageHpRatio: number = 0;
|
||||
|
||||
switch (effectiveness) {
|
||||
case 0:
|
||||
damageHpRatio = 0;
|
||||
break;
|
||||
case 0.25:
|
||||
damageHpRatio = 0.03125;
|
||||
break;
|
||||
case 0.5:
|
||||
damageHpRatio = 0.0625;
|
||||
break;
|
||||
case 1:
|
||||
damageHpRatio = 0.125;
|
||||
break;
|
||||
case 2:
|
||||
damageHpRatio = 0.25;
|
||||
break;
|
||||
case 4:
|
||||
damageHpRatio = 0.5;
|
||||
break;
|
||||
case 0:
|
||||
damageHpRatio = 0;
|
||||
break;
|
||||
case 0.25:
|
||||
damageHpRatio = 0.03125;
|
||||
break;
|
||||
case 0.5:
|
||||
damageHpRatio = 0.0625;
|
||||
break;
|
||||
case 1:
|
||||
damageHpRatio = 0.125;
|
||||
break;
|
||||
case 2:
|
||||
damageHpRatio = 0.25;
|
||||
break;
|
||||
case 4:
|
||||
damageHpRatio = 0.5;
|
||||
break;
|
||||
}
|
||||
|
||||
return damageHpRatio;
|
||||
|
@ -1185,63 +1185,63 @@ class GrassWaterPledgeTag extends ArenaTag {
|
|||
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
||||
export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove: Moves | undefined, sourceId: number, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag | null {
|
||||
switch (tagType) {
|
||||
case ArenaTagType.MIST:
|
||||
return new MistTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.QUICK_GUARD:
|
||||
return new QuickGuardTag(sourceId, side);
|
||||
case ArenaTagType.WIDE_GUARD:
|
||||
return new WideGuardTag(sourceId, side);
|
||||
case ArenaTagType.MAT_BLOCK:
|
||||
return new MatBlockTag(sourceId, side);
|
||||
case ArenaTagType.CRAFTY_SHIELD:
|
||||
return new CraftyShieldTag(sourceId, side);
|
||||
case ArenaTagType.NO_CRIT:
|
||||
return new NoCritTag(turnCount, sourceMove!, sourceId, side); // TODO: is this bang correct?
|
||||
case ArenaTagType.MUD_SPORT:
|
||||
return new MudSportTag(turnCount, sourceId);
|
||||
case ArenaTagType.WATER_SPORT:
|
||||
return new WaterSportTag(turnCount, sourceId);
|
||||
case ArenaTagType.ION_DELUGE:
|
||||
return new IonDelugeTag(sourceMove);
|
||||
case ArenaTagType.SPIKES:
|
||||
return new SpikesTag(sourceId, side);
|
||||
case ArenaTagType.TOXIC_SPIKES:
|
||||
return new ToxicSpikesTag(sourceId, side);
|
||||
case ArenaTagType.FUTURE_SIGHT:
|
||||
case ArenaTagType.DOOM_DESIRE:
|
||||
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex!); // TODO:questionable bang
|
||||
case ArenaTagType.WISH:
|
||||
return new WishTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.STEALTH_ROCK:
|
||||
return new StealthRockTag(sourceId, side);
|
||||
case ArenaTagType.STICKY_WEB:
|
||||
return new StickyWebTag(sourceId, side);
|
||||
case ArenaTagType.TRICK_ROOM:
|
||||
return new TrickRoomTag(turnCount, sourceId);
|
||||
case ArenaTagType.GRAVITY:
|
||||
return new GravityTag(turnCount);
|
||||
case ArenaTagType.REFLECT:
|
||||
return new ReflectTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.LIGHT_SCREEN:
|
||||
return new LightScreenTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.AURORA_VEIL:
|
||||
return new AuroraVeilTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.TAILWIND:
|
||||
return new TailwindTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.HAPPY_HOUR:
|
||||
return new HappyHourTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.SAFEGUARD:
|
||||
return new SafeguardTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.IMPRISON:
|
||||
return new ImprisonTag(sourceId, side);
|
||||
case ArenaTagType.FIRE_GRASS_PLEDGE:
|
||||
return new FireGrassPledgeTag(sourceId, side);
|
||||
case ArenaTagType.WATER_FIRE_PLEDGE:
|
||||
return new WaterFirePledgeTag(sourceId, side);
|
||||
case ArenaTagType.GRASS_WATER_PLEDGE:
|
||||
return new GrassWaterPledgeTag(sourceId, side);
|
||||
default:
|
||||
return null;
|
||||
case ArenaTagType.MIST:
|
||||
return new MistTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.QUICK_GUARD:
|
||||
return new QuickGuardTag(sourceId, side);
|
||||
case ArenaTagType.WIDE_GUARD:
|
||||
return new WideGuardTag(sourceId, side);
|
||||
case ArenaTagType.MAT_BLOCK:
|
||||
return new MatBlockTag(sourceId, side);
|
||||
case ArenaTagType.CRAFTY_SHIELD:
|
||||
return new CraftyShieldTag(sourceId, side);
|
||||
case ArenaTagType.NO_CRIT:
|
||||
return new NoCritTag(turnCount, sourceMove!, sourceId, side); // TODO: is this bang correct?
|
||||
case ArenaTagType.MUD_SPORT:
|
||||
return new MudSportTag(turnCount, sourceId);
|
||||
case ArenaTagType.WATER_SPORT:
|
||||
return new WaterSportTag(turnCount, sourceId);
|
||||
case ArenaTagType.ION_DELUGE:
|
||||
return new IonDelugeTag(sourceMove);
|
||||
case ArenaTagType.SPIKES:
|
||||
return new SpikesTag(sourceId, side);
|
||||
case ArenaTagType.TOXIC_SPIKES:
|
||||
return new ToxicSpikesTag(sourceId, side);
|
||||
case ArenaTagType.FUTURE_SIGHT:
|
||||
case ArenaTagType.DOOM_DESIRE:
|
||||
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex!); // TODO:questionable bang
|
||||
case ArenaTagType.WISH:
|
||||
return new WishTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.STEALTH_ROCK:
|
||||
return new StealthRockTag(sourceId, side);
|
||||
case ArenaTagType.STICKY_WEB:
|
||||
return new StickyWebTag(sourceId, side);
|
||||
case ArenaTagType.TRICK_ROOM:
|
||||
return new TrickRoomTag(turnCount, sourceId);
|
||||
case ArenaTagType.GRAVITY:
|
||||
return new GravityTag(turnCount);
|
||||
case ArenaTagType.REFLECT:
|
||||
return new ReflectTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.LIGHT_SCREEN:
|
||||
return new LightScreenTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.AURORA_VEIL:
|
||||
return new AuroraVeilTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.TAILWIND:
|
||||
return new TailwindTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.HAPPY_HOUR:
|
||||
return new HappyHourTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.SAFEGUARD:
|
||||
return new SafeguardTag(turnCount, sourceId, side);
|
||||
case ArenaTagType.IMPRISON:
|
||||
return new ImprisonTag(sourceId, side);
|
||||
case ArenaTagType.FIRE_GRASS_PLEDGE:
|
||||
return new FireGrassPledgeTag(sourceId, side);
|
||||
case ArenaTagType.WATER_FIRE_PLEDGE:
|
||||
return new WaterFirePledgeTag(sourceId, side);
|
||||
case ArenaTagType.GRASS_WATER_PLEDGE:
|
||||
return new GrassWaterPledgeTag(sourceId, side);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@ export function getBiomeName(biome: Biome | -1) {
|
|||
return i18next.t("biome:unknownLocation");
|
||||
}
|
||||
switch (biome) {
|
||||
case Biome.GRASS:
|
||||
return i18next.t("biome:GRASS");
|
||||
case Biome.RUINS:
|
||||
return i18next.t("biome:RUINS");
|
||||
case Biome.END:
|
||||
return i18next.t("biome:END");
|
||||
default:
|
||||
return i18next.t(`biome:${Biome[biome].toUpperCase()}`);
|
||||
case Biome.GRASS:
|
||||
return i18next.t("biome:GRASS");
|
||||
case Biome.RUINS:
|
||||
return i18next.t("biome:RUINS");
|
||||
case Biome.END:
|
||||
return i18next.t("biome:END");
|
||||
default:
|
||||
return i18next.t(`biome:${Biome[biome].toUpperCase()}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,12 @@ import { Species } from "#enums/species";
|
|||
|
||||
export const POKERUS_STARTER_COUNT = 5;
|
||||
|
||||
// #region Friendship constants
|
||||
export const CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER = 2;
|
||||
export const FRIENDSHIP_GAIN_FROM_BATTLE = 2;
|
||||
export const FRIENDSHIP_GAIN_FROM_RARE_CANDY = 5;
|
||||
export const FRIENDSHIP_LOSS_FROM_FAINT = 10;
|
||||
|
||||
/**
|
||||
* Function to get the cumulative friendship threshold at which a candy is earned
|
||||
* @param starterCost The cost of the starter, found in {@linkcode speciesStarterCosts}
|
||||
|
@ -9,25 +15,25 @@ export const POKERUS_STARTER_COUNT = 5;
|
|||
*/
|
||||
export function getStarterValueFriendshipCap(starterCost: number): number {
|
||||
switch (starterCost) {
|
||||
case 1:
|
||||
return 20;
|
||||
case 2:
|
||||
return 40;
|
||||
case 3:
|
||||
return 60;
|
||||
case 4:
|
||||
return 100;
|
||||
case 5:
|
||||
return 140;
|
||||
case 6:
|
||||
return 200;
|
||||
case 7:
|
||||
return 280;
|
||||
case 8:
|
||||
case 9:
|
||||
return 450;
|
||||
default:
|
||||
return 600;
|
||||
case 1:
|
||||
return 20;
|
||||
case 2:
|
||||
return 40;
|
||||
case 3:
|
||||
return 60;
|
||||
case 4:
|
||||
return 100;
|
||||
case 5:
|
||||
return 140;
|
||||
case 6:
|
||||
return 200;
|
||||
case 7:
|
||||
return 280;
|
||||
case 8:
|
||||
case 9:
|
||||
return 450;
|
||||
default:
|
||||
return 600;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,15 +134,15 @@ export class AnimConfig {
|
|||
for (const te of frameTimedEvents[fte]) {
|
||||
let timedEvent: AnimTimedEvent | undefined;
|
||||
switch (te.eventType) {
|
||||
case "AnimTimedSoundEvent":
|
||||
timedEvent = new AnimTimedSoundEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
case "AnimTimedAddBgEvent":
|
||||
timedEvent = new AnimTimedAddBgEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
case "AnimTimedUpdateBgEvent":
|
||||
timedEvent = new AnimTimedUpdateBgEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
case "AnimTimedSoundEvent":
|
||||
timedEvent = new AnimTimedSoundEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
case "AnimTimedAddBgEvent":
|
||||
timedEvent = new AnimTimedAddBgEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
case "AnimTimedUpdateBgEvent":
|
||||
timedEvent = new AnimTimedUpdateBgEvent(te.frameIndex, te.resourceName, te);
|
||||
break;
|
||||
}
|
||||
|
||||
timedEvent && timedEvents.push(timedEvent);
|
||||
|
@ -243,12 +243,12 @@ class AnimFrame {
|
|||
if (!init) {
|
||||
let target = AnimFrameTarget.GRAPHIC;
|
||||
switch (pattern) {
|
||||
case -2:
|
||||
target = AnimFrameTarget.TARGET;
|
||||
break;
|
||||
case -1:
|
||||
target = AnimFrameTarget.USER;
|
||||
break;
|
||||
case -2:
|
||||
target = AnimFrameTarget.TARGET;
|
||||
break;
|
||||
case -1:
|
||||
target = AnimFrameTarget.USER;
|
||||
break;
|
||||
}
|
||||
this.target = target;
|
||||
this.graphicFrame = pattern >= 0 ? pattern : 0;
|
||||
|
@ -803,23 +803,23 @@ export abstract class BattleAnim {
|
|||
let scaleX = (frame.zoomX / 100) * (!frame.mirror ? 1 : -1);
|
||||
const scaleY = (frame.zoomY / 100);
|
||||
switch (frame.focus) {
|
||||
case AnimFocus.TARGET:
|
||||
x += targetInitialX - targetFocusX;
|
||||
y += (targetInitialY - targetHalfHeight) - targetFocusY;
|
||||
break;
|
||||
case AnimFocus.USER:
|
||||
x += userInitialX - userFocusX;
|
||||
y += (userInitialY - userHalfHeight) - userFocusY;
|
||||
break;
|
||||
case AnimFocus.USER_TARGET:
|
||||
const point = transformPoint(this.srcLine[0], this.srcLine[1], this.srcLine[2], this.srcLine[3],
|
||||
this.dstLine[0], this.dstLine[1] - userHalfHeight, this.dstLine[2], this.dstLine[3] - targetHalfHeight, x, y);
|
||||
x = point[0];
|
||||
y = point[1];
|
||||
if (frame.target === AnimFrameTarget.GRAPHIC && isReversed(this.srcLine[0], this.srcLine[2], this.dstLine[0], this.dstLine[2])) {
|
||||
scaleX = scaleX * -1;
|
||||
}
|
||||
break;
|
||||
case AnimFocus.TARGET:
|
||||
x += targetInitialX - targetFocusX;
|
||||
y += (targetInitialY - targetHalfHeight) - targetFocusY;
|
||||
break;
|
||||
case AnimFocus.USER:
|
||||
x += userInitialX - userFocusX;
|
||||
y += (userInitialY - userHalfHeight) - userFocusY;
|
||||
break;
|
||||
case AnimFocus.USER_TARGET:
|
||||
const point = transformPoint(this.srcLine[0], this.srcLine[1], this.srcLine[2], this.srcLine[3],
|
||||
this.dstLine[0], this.dstLine[1] - userHalfHeight, this.dstLine[2], this.dstLine[3] - targetHalfHeight, x, y);
|
||||
x = point[0];
|
||||
y = point[1];
|
||||
if (frame.target === AnimFrameTarget.GRAPHIC && isReversed(this.srcLine[0], this.srcLine[2], this.dstLine[0], this.dstLine[2])) {
|
||||
scaleX = scaleX * -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
const angle = -frame.angle;
|
||||
const key = frame.target === AnimFrameTarget.GRAPHIC ? g++ : frame.target === AnimFrameTarget.USER ? u++ : t++;
|
||||
|
@ -993,44 +993,44 @@ export abstract class BattleAnim {
|
|||
spritePriorities[graphicIndex] = frame.priority;
|
||||
const setSpritePriority = (priority: integer) => {
|
||||
switch (priority) {
|
||||
case 0:
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, scene.getNonSwitchedEnemyPokemon() || scene.getNonSwitchedPlayerPokemon()!); // This bang assumes that if (the EnemyPokemon is undefined, then the PlayerPokemon function must return an object), correct assumption?
|
||||
break;
|
||||
case 1:
|
||||
scene.field.moveTo(moveSprite, scene.field.getAll().length - 1);
|
||||
break;
|
||||
case 2:
|
||||
switch (frame.focus) {
|
||||
case AnimFocus.USER:
|
||||
if (this.bgSprite) {
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.bgSprite);
|
||||
} else {
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, this.user!); // TODO: is this bang correct?
|
||||
case 0:
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, scene.getNonSwitchedEnemyPokemon() || scene.getNonSwitchedPlayerPokemon()!); // This bang assumes that if (the EnemyPokemon is undefined, then the PlayerPokemon function must return an object), correct assumption?
|
||||
break;
|
||||
case 1:
|
||||
scene.field.moveTo(moveSprite, scene.field.getAll().length - 1);
|
||||
break;
|
||||
case 2:
|
||||
switch (frame.focus) {
|
||||
case AnimFocus.USER:
|
||||
if (this.bgSprite) {
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.bgSprite);
|
||||
} else {
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, this.user!); // TODO: is this bang correct?
|
||||
}
|
||||
break;
|
||||
case AnimFocus.TARGET:
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, this.target!); // TODO: is this bang correct?
|
||||
break;
|
||||
default:
|
||||
setSpritePriority(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AnimFocus.TARGET:
|
||||
scene.field.moveBelow(moveSprite as Phaser.GameObjects.GameObject, this.target!); // TODO: is this bang correct?
|
||||
case 3:
|
||||
switch (frame.focus) {
|
||||
case AnimFocus.USER:
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.user!); // TODO: is this bang correct?
|
||||
break;
|
||||
case AnimFocus.TARGET:
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.target!); // TODO: is this bang correct?
|
||||
break;
|
||||
default:
|
||||
setSpritePriority(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
setSpritePriority(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (frame.focus) {
|
||||
case AnimFocus.USER:
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.user!); // TODO: is this bang correct?
|
||||
break;
|
||||
case AnimFocus.TARGET:
|
||||
scene.field.moveAbove(moveSprite as Phaser.GameObjects.GameObject, this.target!); // TODO: is this bang correct?
|
||||
break;
|
||||
default:
|
||||
setSpritePriority(1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
setSpritePriority(1);
|
||||
}
|
||||
};
|
||||
setSpritePriority(frame.priority);
|
||||
|
@ -1396,108 +1396,108 @@ export async function populateAnims() {
|
|||
const fieldName = field.slice(0, field.indexOf(":"));
|
||||
const fieldData = field.slice(fieldName.length + 1, field.lastIndexOf("\n")).trim();
|
||||
switch (fieldName) {
|
||||
case "array":
|
||||
const framesData = fieldData.split(" - - - ").slice(1);
|
||||
for (let fd = 0; fd < framesData.length; fd++) {
|
||||
anim.frames.push([]);
|
||||
const frameData = framesData[fd];
|
||||
const focusFramesData = frameData.split(" - - ");
|
||||
for (let tf = 0; tf < focusFramesData.length; tf++) {
|
||||
const values = focusFramesData[tf].replace(/ \- /g, "").split("\n");
|
||||
const targetFrame = new AnimFrame(parseFloat(values[0]), parseFloat(values[1]), parseFloat(values[2]), parseFloat(values[11]), parseFloat(values[3]),
|
||||
parseInt(values[4]) === 1, parseInt(values[6]) === 1, parseInt(values[5]), parseInt(values[7]), parseInt(values[8]), parseInt(values[12]), parseInt(values[13]),
|
||||
parseInt(values[14]), parseInt(values[15]), parseInt(values[16]), parseInt(values[17]), parseInt(values[18]), parseInt(values[19]),
|
||||
parseInt(values[21]), parseInt(values[22]), parseInt(values[23]), parseInt(values[24]), parseInt(values[20]) === 1, parseInt(values[25]), parseInt(values[26]) as AnimFocus);
|
||||
anim.frames[fd].push(targetFrame);
|
||||
case "array":
|
||||
const framesData = fieldData.split(" - - - ").slice(1);
|
||||
for (let fd = 0; fd < framesData.length; fd++) {
|
||||
anim.frames.push([]);
|
||||
const frameData = framesData[fd];
|
||||
const focusFramesData = frameData.split(" - - ");
|
||||
for (let tf = 0; tf < focusFramesData.length; tf++) {
|
||||
const values = focusFramesData[tf].replace(/ \- /g, "").split("\n");
|
||||
const targetFrame = new AnimFrame(parseFloat(values[0]), parseFloat(values[1]), parseFloat(values[2]), parseFloat(values[11]), parseFloat(values[3]),
|
||||
parseInt(values[4]) === 1, parseInt(values[6]) === 1, parseInt(values[5]), parseInt(values[7]), parseInt(values[8]), parseInt(values[12]), parseInt(values[13]),
|
||||
parseInt(values[14]), parseInt(values[15]), parseInt(values[16]), parseInt(values[17]), parseInt(values[18]), parseInt(values[19]),
|
||||
parseInt(values[21]), parseInt(values[22]), parseInt(values[23]), parseInt(values[24]), parseInt(values[20]) === 1, parseInt(values[25]), parseInt(values[26]) as AnimFocus);
|
||||
anim.frames[fd].push(targetFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "graphic":
|
||||
const graphic = fieldData !== "''" ? fieldData : "";
|
||||
anim.graphic = graphic.indexOf(".") > -1
|
||||
? graphic.slice(0, fieldData.indexOf("."))
|
||||
: graphic;
|
||||
break;
|
||||
case "timing":
|
||||
const timingEntries = fieldData.split("- !ruby/object:PBAnimTiming ").slice(1);
|
||||
for (let t = 0; t < timingEntries.length; t++) {
|
||||
const timingData = timingEntries[t].replace(/\n/g, " ").replace(/[ ]{2,}/g, " ").replace(/[a-z]+: ! '', /ig, "").replace(/name: (.*?),/, "name: \"$1\",")
|
||||
.replace(/flashColor: !ruby\/object:Color { alpha: ([\d\.]+), blue: ([\d\.]+), green: ([\d\.]+), red: ([\d\.]+)}/, "flashRed: $4, flashGreen: $3, flashBlue: $2, flashAlpha: $1");
|
||||
const frameIndex = parseInt(/frame: (\d+)/.exec(timingData)![1]); // TODO: is the bang correct?
|
||||
let resourceName = /name: "(.*?)"/.exec(timingData)![1].replace("''", ""); // TODO: is the bang correct?
|
||||
const timingType = parseInt(/timingType: (\d)/.exec(timingData)![1]); // TODO: is the bang correct?
|
||||
let timedEvent: AnimTimedEvent | undefined;
|
||||
switch (timingType) {
|
||||
case 0:
|
||||
if (resourceName && resourceName.indexOf(".") === -1) {
|
||||
let ext: string | undefined;
|
||||
[ "wav", "mp3", "m4a" ].every(e => {
|
||||
if (seNames.indexOf(`${resourceName}.${e}`) > -1) {
|
||||
ext = e;
|
||||
return false;
|
||||
break;
|
||||
case "graphic":
|
||||
const graphic = fieldData !== "''" ? fieldData : "";
|
||||
anim.graphic = graphic.indexOf(".") > -1
|
||||
? graphic.slice(0, fieldData.indexOf("."))
|
||||
: graphic;
|
||||
break;
|
||||
case "timing":
|
||||
const timingEntries = fieldData.split("- !ruby/object:PBAnimTiming ").slice(1);
|
||||
for (let t = 0; t < timingEntries.length; t++) {
|
||||
const timingData = timingEntries[t].replace(/\n/g, " ").replace(/[ ]{2,}/g, " ").replace(/[a-z]+: ! '', /ig, "").replace(/name: (.*?),/, "name: \"$1\",")
|
||||
.replace(/flashColor: !ruby\/object:Color { alpha: ([\d\.]+), blue: ([\d\.]+), green: ([\d\.]+), red: ([\d\.]+)}/, "flashRed: $4, flashGreen: $3, flashBlue: $2, flashAlpha: $1");
|
||||
const frameIndex = parseInt(/frame: (\d+)/.exec(timingData)![1]); // TODO: is the bang correct?
|
||||
let resourceName = /name: "(.*?)"/.exec(timingData)![1].replace("''", ""); // TODO: is the bang correct?
|
||||
const timingType = parseInt(/timingType: (\d)/.exec(timingData)![1]); // TODO: is the bang correct?
|
||||
let timedEvent: AnimTimedEvent | undefined;
|
||||
switch (timingType) {
|
||||
case 0:
|
||||
if (resourceName && resourceName.indexOf(".") === -1) {
|
||||
let ext: string | undefined;
|
||||
[ "wav", "mp3", "m4a" ].every(e => {
|
||||
if (seNames.indexOf(`${resourceName}.${e}`) > -1) {
|
||||
ext = e;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (!ext) {
|
||||
ext = ".wav";
|
||||
}
|
||||
resourceName += `.${ext}`;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (!ext) {
|
||||
ext = ".wav";
|
||||
timedEvent = new AnimTimedSoundEvent(frameIndex, resourceName);
|
||||
break;
|
||||
case 1:
|
||||
timedEvent = new AnimTimedAddBgEvent(frameIndex, resourceName.slice(0, resourceName.indexOf(".")));
|
||||
break;
|
||||
case 2:
|
||||
timedEvent = new AnimTimedUpdateBgEvent(frameIndex, resourceName.slice(0, resourceName.indexOf(".")));
|
||||
break;
|
||||
}
|
||||
if (!timedEvent) {
|
||||
continue;
|
||||
}
|
||||
const propPattern = /([a-z]+): (.*?)(?:,|\})/ig;
|
||||
let propMatch: RegExpExecArray;
|
||||
while ((propMatch = propPattern.exec(timingData)!)) { // TODO: is this bang correct?
|
||||
const prop = propMatch[1];
|
||||
let value: any = propMatch[2];
|
||||
switch (prop) {
|
||||
case "bgX":
|
||||
case "bgY":
|
||||
value = parseFloat(value);
|
||||
break;
|
||||
case "volume":
|
||||
case "pitch":
|
||||
case "opacity":
|
||||
case "colorRed":
|
||||
case "colorGreen":
|
||||
case "colorBlue":
|
||||
case "colorAlpha":
|
||||
case "duration":
|
||||
case "flashScope":
|
||||
case "flashRed":
|
||||
case "flashGreen":
|
||||
case "flashBlue":
|
||||
case "flashAlpha":
|
||||
case "flashDuration":
|
||||
value = parseInt(value);
|
||||
break;
|
||||
}
|
||||
if (timedEvent.hasOwnProperty(prop)) {
|
||||
timedEvent[prop] = value;
|
||||
}
|
||||
resourceName += `.${ext}`;
|
||||
}
|
||||
timedEvent = new AnimTimedSoundEvent(frameIndex, resourceName);
|
||||
break;
|
||||
case 1:
|
||||
timedEvent = new AnimTimedAddBgEvent(frameIndex, resourceName.slice(0, resourceName.indexOf(".")));
|
||||
break;
|
||||
case 2:
|
||||
timedEvent = new AnimTimedUpdateBgEvent(frameIndex, resourceName.slice(0, resourceName.indexOf(".")));
|
||||
break;
|
||||
}
|
||||
if (!timedEvent) {
|
||||
continue;
|
||||
}
|
||||
const propPattern = /([a-z]+): (.*?)(?:,|\})/ig;
|
||||
let propMatch: RegExpExecArray;
|
||||
while ((propMatch = propPattern.exec(timingData)!)) { // TODO: is this bang correct?
|
||||
const prop = propMatch[1];
|
||||
let value: any = propMatch[2];
|
||||
switch (prop) {
|
||||
case "bgX":
|
||||
case "bgY":
|
||||
value = parseFloat(value);
|
||||
break;
|
||||
case "volume":
|
||||
case "pitch":
|
||||
case "opacity":
|
||||
case "colorRed":
|
||||
case "colorGreen":
|
||||
case "colorBlue":
|
||||
case "colorAlpha":
|
||||
case "duration":
|
||||
case "flashScope":
|
||||
case "flashRed":
|
||||
case "flashGreen":
|
||||
case "flashBlue":
|
||||
case "flashAlpha":
|
||||
case "flashDuration":
|
||||
value = parseInt(value);
|
||||
break;
|
||||
if (!anim.frameTimedEvents.has(frameIndex)) {
|
||||
anim.frameTimedEvents.set(frameIndex, []);
|
||||
}
|
||||
if (timedEvent.hasOwnProperty(prop)) {
|
||||
timedEvent[prop] = value;
|
||||
}
|
||||
}
|
||||
if (!anim.frameTimedEvents.has(frameIndex)) {
|
||||
anim.frameTimedEvents.set(frameIndex, []);
|
||||
}
|
||||
anim.frameTimedEvents.get(frameIndex)!.push(timedEvent); // TODO: is this bang correct?
|
||||
}
|
||||
break;
|
||||
case "position":
|
||||
anim.position = parseInt(fieldData);
|
||||
break;
|
||||
case "hue":
|
||||
anim.hue = parseInt(fieldData);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "position":
|
||||
anim.position = parseInt(fieldData);
|
||||
break;
|
||||
case "hue":
|
||||
anim.hue = parseInt(fieldData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -919,14 +919,14 @@ export class EncoreTag extends BattlerTag {
|
|||
}
|
||||
|
||||
switch (repeatableMove.move) {
|
||||
case Moves.MIMIC:
|
||||
case Moves.MIRROR_MOVE:
|
||||
case Moves.TRANSFORM:
|
||||
case Moves.STRUGGLE:
|
||||
case Moves.SKETCH:
|
||||
case Moves.SLEEP_TALK:
|
||||
case Moves.ENCORE:
|
||||
return false;
|
||||
case Moves.MIMIC:
|
||||
case Moves.MIRROR_MOVE:
|
||||
case Moves.TRANSFORM:
|
||||
case Moves.STRUGGLE:
|
||||
case Moves.SKETCH:
|
||||
case Moves.SLEEP_TALK:
|
||||
case Moves.ENCORE:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (allMoves[repeatableMove.move].hasAttr(ChargeAttr) && repeatableMove.result === MoveResult.OTHER) {
|
||||
|
@ -1641,12 +1641,12 @@ export class HighestStatBoostTag extends AbilityBattlerTag {
|
|||
this.stat = highestStat;
|
||||
|
||||
switch (this.stat) {
|
||||
case Stat.SPD:
|
||||
this.multiplier = 1.5;
|
||||
break;
|
||||
default:
|
||||
this.multiplier = 1.3;
|
||||
break;
|
||||
case Stat.SPD:
|
||||
this.multiplier = 1.5;
|
||||
break;
|
||||
default:
|
||||
this.multiplier = 1.3;
|
||||
break;
|
||||
}
|
||||
|
||||
pokemon.scene.queueMessage(i18next.t("battlerTags:highestStatBoostOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), statName: i18next.t(getStatKey(highestStat)) }), null, false, null, true);
|
||||
|
@ -2436,15 +2436,15 @@ export class SubstituteTag extends BattlerTag {
|
|||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
switch (lapseType) {
|
||||
case BattlerTagLapseType.PRE_MOVE:
|
||||
this.onPreMove(pokemon);
|
||||
break;
|
||||
case BattlerTagLapseType.AFTER_MOVE:
|
||||
this.onAfterMove(pokemon);
|
||||
break;
|
||||
case BattlerTagLapseType.HIT:
|
||||
this.onHit(pokemon);
|
||||
break;
|
||||
case BattlerTagLapseType.PRE_MOVE:
|
||||
this.onPreMove(pokemon);
|
||||
break;
|
||||
case BattlerTagLapseType.AFTER_MOVE:
|
||||
this.onAfterMove(pokemon);
|
||||
break;
|
||||
case BattlerTagLapseType.HIT:
|
||||
this.onHit(pokemon);
|
||||
break;
|
||||
}
|
||||
return lapseType !== BattlerTagLapseType.CUSTOM; // only remove this tag on custom lapse
|
||||
}
|
||||
|
@ -2769,179 +2769,179 @@ export class PowerTrickTag extends BattlerTag {
|
|||
*/
|
||||
export function getBattlerTag(tagType: BattlerTagType, turnCount: number, sourceMove: Moves, sourceId: number): BattlerTag {
|
||||
switch (tagType) {
|
||||
case BattlerTagType.RECHARGING:
|
||||
return new RechargingTag(sourceMove);
|
||||
case BattlerTagType.BEAK_BLAST_CHARGING:
|
||||
return new BeakBlastChargingTag();
|
||||
case BattlerTagType.SHELL_TRAP:
|
||||
return new ShellTrapTag();
|
||||
case BattlerTagType.FLINCHED:
|
||||
return new FlinchedTag(sourceMove);
|
||||
case BattlerTagType.INTERRUPTED:
|
||||
return new InterruptedTag(sourceMove);
|
||||
case BattlerTagType.CONFUSED:
|
||||
return new ConfusedTag(turnCount, sourceMove);
|
||||
case BattlerTagType.INFATUATED:
|
||||
return new InfatuatedTag(sourceMove, sourceId);
|
||||
case BattlerTagType.SEEDED:
|
||||
return new SeedTag(sourceId);
|
||||
case BattlerTagType.NIGHTMARE:
|
||||
return new NightmareTag();
|
||||
case BattlerTagType.FRENZY:
|
||||
return new FrenzyTag(turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.CHARGING:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, 1, sourceMove, sourceId);
|
||||
case BattlerTagType.ENCORE:
|
||||
return new EncoreTag(sourceId);
|
||||
case BattlerTagType.HELPING_HAND:
|
||||
return new HelpingHandTag(sourceId);
|
||||
case BattlerTagType.INGRAIN:
|
||||
return new IngrainTag(sourceId);
|
||||
case BattlerTagType.AQUA_RING:
|
||||
return new AquaRingTag();
|
||||
case BattlerTagType.DROWSY:
|
||||
return new DrowsyTag();
|
||||
case BattlerTagType.TRAPPED:
|
||||
return new TrappedTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.NO_RETREAT:
|
||||
return new NoRetreatTag(sourceId);
|
||||
case BattlerTagType.BIND:
|
||||
return new BindTag(turnCount, sourceId);
|
||||
case BattlerTagType.WRAP:
|
||||
return new WrapTag(turnCount, sourceId);
|
||||
case BattlerTagType.FIRE_SPIN:
|
||||
return new FireSpinTag(turnCount, sourceId);
|
||||
case BattlerTagType.WHIRLPOOL:
|
||||
return new WhirlpoolTag(turnCount, sourceId);
|
||||
case BattlerTagType.CLAMP:
|
||||
return new ClampTag(turnCount, sourceId);
|
||||
case BattlerTagType.SAND_TOMB:
|
||||
return new SandTombTag(turnCount, sourceId);
|
||||
case BattlerTagType.MAGMA_STORM:
|
||||
return new MagmaStormTag(turnCount, sourceId);
|
||||
case BattlerTagType.SNAP_TRAP:
|
||||
return new SnapTrapTag(turnCount, sourceId);
|
||||
case BattlerTagType.THUNDER_CAGE:
|
||||
return new ThunderCageTag(turnCount, sourceId);
|
||||
case BattlerTagType.INFESTATION:
|
||||
return new InfestationTag(turnCount, sourceId);
|
||||
case BattlerTagType.PROTECTED:
|
||||
return new ProtectedTag(sourceMove);
|
||||
case BattlerTagType.SPIKY_SHIELD:
|
||||
return new ContactDamageProtectedTag(sourceMove, 8);
|
||||
case BattlerTagType.KINGS_SHIELD:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.ATK, -1);
|
||||
case BattlerTagType.OBSTRUCT:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.DEF, -2);
|
||||
case BattlerTagType.SILK_TRAP:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.SPD, -1);
|
||||
case BattlerTagType.BANEFUL_BUNKER:
|
||||
return new ContactPoisonProtectedTag(sourceMove);
|
||||
case BattlerTagType.BURNING_BULWARK:
|
||||
return new ContactBurnProtectedTag(sourceMove);
|
||||
case BattlerTagType.ENDURING:
|
||||
return new EnduringTag(sourceMove);
|
||||
case BattlerTagType.STURDY:
|
||||
return new SturdyTag(sourceMove);
|
||||
case BattlerTagType.PERISH_SONG:
|
||||
return new PerishSongTag(turnCount);
|
||||
case BattlerTagType.CENTER_OF_ATTENTION:
|
||||
return new CenterOfAttentionTag(sourceMove);
|
||||
case BattlerTagType.TRUANT:
|
||||
return new TruantTag();
|
||||
case BattlerTagType.SLOW_START:
|
||||
return new SlowStartTag();
|
||||
case BattlerTagType.PROTOSYNTHESIS:
|
||||
return new WeatherHighestStatBoostTag(tagType, Abilities.PROTOSYNTHESIS, WeatherType.SUNNY, WeatherType.HARSH_SUN);
|
||||
case BattlerTagType.QUARK_DRIVE:
|
||||
return new TerrainHighestStatBoostTag(tagType, Abilities.QUARK_DRIVE, TerrainType.ELECTRIC);
|
||||
case BattlerTagType.FLYING:
|
||||
case BattlerTagType.UNDERGROUND:
|
||||
case BattlerTagType.UNDERWATER:
|
||||
case BattlerTagType.HIDDEN:
|
||||
return new SemiInvulnerableTag(tagType, turnCount, sourceMove);
|
||||
case BattlerTagType.FIRE_BOOST:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.FIRE, 1.5, false);
|
||||
case BattlerTagType.CRIT_BOOST:
|
||||
return new CritBoostTag(tagType, sourceMove);
|
||||
case BattlerTagType.DRAGON_CHEER:
|
||||
return new DragonCheerTag();
|
||||
case BattlerTagType.ALWAYS_CRIT:
|
||||
case BattlerTagType.IGNORE_ACCURACY:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove);
|
||||
case BattlerTagType.ALWAYS_GET_HIT:
|
||||
case BattlerTagType.RECEIVE_DOUBLE_DAMAGE:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.PRE_MOVE, 1, sourceMove);
|
||||
case BattlerTagType.BYPASS_SLEEP:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
|
||||
case BattlerTagType.IGNORE_FLYING:
|
||||
return new GroundedTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.ROOSTED:
|
||||
return new RoostedTag();
|
||||
case BattlerTagType.BURNED_UP:
|
||||
return new RemovedTypeTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.DOUBLE_SHOCKED:
|
||||
return new RemovedTypeTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.SALT_CURED:
|
||||
return new SaltCuredTag(sourceId);
|
||||
case BattlerTagType.CURSED:
|
||||
return new CursedTag(sourceId);
|
||||
case BattlerTagType.CHARGED:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.ELECTRIC, 2, true);
|
||||
case BattlerTagType.FLOATING:
|
||||
return new FloatingTag(tagType, sourceMove);
|
||||
case BattlerTagType.MINIMIZED:
|
||||
return new MinimizeTag();
|
||||
case BattlerTagType.DESTINY_BOND:
|
||||
return new DestinyBondTag(sourceMove, sourceId);
|
||||
case BattlerTagType.ICE_FACE:
|
||||
return new IceFaceBlockDamageTag(tagType);
|
||||
case BattlerTagType.DISGUISE:
|
||||
return new FormBlockDamageTag(tagType);
|
||||
case BattlerTagType.STOCKPILING:
|
||||
return new StockpilingTag(sourceMove);
|
||||
case BattlerTagType.OCTOLOCK:
|
||||
return new OctolockTag(sourceId);
|
||||
case BattlerTagType.DISABLED:
|
||||
return new DisabledTag(sourceId);
|
||||
case BattlerTagType.IGNORE_GHOST:
|
||||
return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ]);
|
||||
case BattlerTagType.IGNORE_DARK:
|
||||
return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ]);
|
||||
case BattlerTagType.GULP_MISSILE_ARROKUDA:
|
||||
case BattlerTagType.GULP_MISSILE_PIKACHU:
|
||||
return new GulpMissileTag(tagType, sourceMove);
|
||||
case BattlerTagType.TAR_SHOT:
|
||||
return new TarShotTag();
|
||||
case BattlerTagType.ELECTRIFIED:
|
||||
return new ElectrifiedTag();
|
||||
case BattlerTagType.THROAT_CHOPPED:
|
||||
return new ThroatChoppedTag();
|
||||
case BattlerTagType.GORILLA_TACTICS:
|
||||
return new GorillaTacticsTag();
|
||||
case BattlerTagType.SUBSTITUTE:
|
||||
return new SubstituteTag(sourceMove, sourceId);
|
||||
case BattlerTagType.AUTOTOMIZED:
|
||||
return new AutotomizedTag();
|
||||
case BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON:
|
||||
return new MysteryEncounterPostSummonTag();
|
||||
case BattlerTagType.HEAL_BLOCK:
|
||||
return new HealBlockTag(turnCount, sourceMove);
|
||||
case BattlerTagType.TORMENT:
|
||||
return new TormentTag(sourceId);
|
||||
case BattlerTagType.TAUNT:
|
||||
return new TauntTag();
|
||||
case BattlerTagType.IMPRISON:
|
||||
return new ImprisonTag(sourceId);
|
||||
case BattlerTagType.SYRUP_BOMB:
|
||||
return new SyrupBombTag(sourceId);
|
||||
case BattlerTagType.TELEKINESIS:
|
||||
return new TelekinesisTag(sourceMove);
|
||||
case BattlerTagType.POWER_TRICK:
|
||||
return new PowerTrickTag(sourceMove, sourceId);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.RECHARGING:
|
||||
return new RechargingTag(sourceMove);
|
||||
case BattlerTagType.BEAK_BLAST_CHARGING:
|
||||
return new BeakBlastChargingTag();
|
||||
case BattlerTagType.SHELL_TRAP:
|
||||
return new ShellTrapTag();
|
||||
case BattlerTagType.FLINCHED:
|
||||
return new FlinchedTag(sourceMove);
|
||||
case BattlerTagType.INTERRUPTED:
|
||||
return new InterruptedTag(sourceMove);
|
||||
case BattlerTagType.CONFUSED:
|
||||
return new ConfusedTag(turnCount, sourceMove);
|
||||
case BattlerTagType.INFATUATED:
|
||||
return new InfatuatedTag(sourceMove, sourceId);
|
||||
case BattlerTagType.SEEDED:
|
||||
return new SeedTag(sourceId);
|
||||
case BattlerTagType.NIGHTMARE:
|
||||
return new NightmareTag();
|
||||
case BattlerTagType.FRENZY:
|
||||
return new FrenzyTag(turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.CHARGING:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, 1, sourceMove, sourceId);
|
||||
case BattlerTagType.ENCORE:
|
||||
return new EncoreTag(sourceId);
|
||||
case BattlerTagType.HELPING_HAND:
|
||||
return new HelpingHandTag(sourceId);
|
||||
case BattlerTagType.INGRAIN:
|
||||
return new IngrainTag(sourceId);
|
||||
case BattlerTagType.AQUA_RING:
|
||||
return new AquaRingTag();
|
||||
case BattlerTagType.DROWSY:
|
||||
return new DrowsyTag();
|
||||
case BattlerTagType.TRAPPED:
|
||||
return new TrappedTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.NO_RETREAT:
|
||||
return new NoRetreatTag(sourceId);
|
||||
case BattlerTagType.BIND:
|
||||
return new BindTag(turnCount, sourceId);
|
||||
case BattlerTagType.WRAP:
|
||||
return new WrapTag(turnCount, sourceId);
|
||||
case BattlerTagType.FIRE_SPIN:
|
||||
return new FireSpinTag(turnCount, sourceId);
|
||||
case BattlerTagType.WHIRLPOOL:
|
||||
return new WhirlpoolTag(turnCount, sourceId);
|
||||
case BattlerTagType.CLAMP:
|
||||
return new ClampTag(turnCount, sourceId);
|
||||
case BattlerTagType.SAND_TOMB:
|
||||
return new SandTombTag(turnCount, sourceId);
|
||||
case BattlerTagType.MAGMA_STORM:
|
||||
return new MagmaStormTag(turnCount, sourceId);
|
||||
case BattlerTagType.SNAP_TRAP:
|
||||
return new SnapTrapTag(turnCount, sourceId);
|
||||
case BattlerTagType.THUNDER_CAGE:
|
||||
return new ThunderCageTag(turnCount, sourceId);
|
||||
case BattlerTagType.INFESTATION:
|
||||
return new InfestationTag(turnCount, sourceId);
|
||||
case BattlerTagType.PROTECTED:
|
||||
return new ProtectedTag(sourceMove);
|
||||
case BattlerTagType.SPIKY_SHIELD:
|
||||
return new ContactDamageProtectedTag(sourceMove, 8);
|
||||
case BattlerTagType.KINGS_SHIELD:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.ATK, -1);
|
||||
case BattlerTagType.OBSTRUCT:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.DEF, -2);
|
||||
case BattlerTagType.SILK_TRAP:
|
||||
return new ContactStatStageChangeProtectedTag(sourceMove, tagType, Stat.SPD, -1);
|
||||
case BattlerTagType.BANEFUL_BUNKER:
|
||||
return new ContactPoisonProtectedTag(sourceMove);
|
||||
case BattlerTagType.BURNING_BULWARK:
|
||||
return new ContactBurnProtectedTag(sourceMove);
|
||||
case BattlerTagType.ENDURING:
|
||||
return new EnduringTag(sourceMove);
|
||||
case BattlerTagType.STURDY:
|
||||
return new SturdyTag(sourceMove);
|
||||
case BattlerTagType.PERISH_SONG:
|
||||
return new PerishSongTag(turnCount);
|
||||
case BattlerTagType.CENTER_OF_ATTENTION:
|
||||
return new CenterOfAttentionTag(sourceMove);
|
||||
case BattlerTagType.TRUANT:
|
||||
return new TruantTag();
|
||||
case BattlerTagType.SLOW_START:
|
||||
return new SlowStartTag();
|
||||
case BattlerTagType.PROTOSYNTHESIS:
|
||||
return new WeatherHighestStatBoostTag(tagType, Abilities.PROTOSYNTHESIS, WeatherType.SUNNY, WeatherType.HARSH_SUN);
|
||||
case BattlerTagType.QUARK_DRIVE:
|
||||
return new TerrainHighestStatBoostTag(tagType, Abilities.QUARK_DRIVE, TerrainType.ELECTRIC);
|
||||
case BattlerTagType.FLYING:
|
||||
case BattlerTagType.UNDERGROUND:
|
||||
case BattlerTagType.UNDERWATER:
|
||||
case BattlerTagType.HIDDEN:
|
||||
return new SemiInvulnerableTag(tagType, turnCount, sourceMove);
|
||||
case BattlerTagType.FIRE_BOOST:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.FIRE, 1.5, false);
|
||||
case BattlerTagType.CRIT_BOOST:
|
||||
return new CritBoostTag(tagType, sourceMove);
|
||||
case BattlerTagType.DRAGON_CHEER:
|
||||
return new DragonCheerTag();
|
||||
case BattlerTagType.ALWAYS_CRIT:
|
||||
case BattlerTagType.IGNORE_ACCURACY:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, 2, sourceMove);
|
||||
case BattlerTagType.ALWAYS_GET_HIT:
|
||||
case BattlerTagType.RECEIVE_DOUBLE_DAMAGE:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.PRE_MOVE, 1, sourceMove);
|
||||
case BattlerTagType.BYPASS_SLEEP:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
|
||||
case BattlerTagType.IGNORE_FLYING:
|
||||
return new GroundedTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.ROOSTED:
|
||||
return new RoostedTag();
|
||||
case BattlerTagType.BURNED_UP:
|
||||
return new RemovedTypeTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.DOUBLE_SHOCKED:
|
||||
return new RemovedTypeTag(tagType, BattlerTagLapseType.CUSTOM, sourceMove);
|
||||
case BattlerTagType.SALT_CURED:
|
||||
return new SaltCuredTag(sourceId);
|
||||
case BattlerTagType.CURSED:
|
||||
return new CursedTag(sourceId);
|
||||
case BattlerTagType.CHARGED:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.ELECTRIC, 2, true);
|
||||
case BattlerTagType.FLOATING:
|
||||
return new FloatingTag(tagType, sourceMove);
|
||||
case BattlerTagType.MINIMIZED:
|
||||
return new MinimizeTag();
|
||||
case BattlerTagType.DESTINY_BOND:
|
||||
return new DestinyBondTag(sourceMove, sourceId);
|
||||
case BattlerTagType.ICE_FACE:
|
||||
return new IceFaceBlockDamageTag(tagType);
|
||||
case BattlerTagType.DISGUISE:
|
||||
return new FormBlockDamageTag(tagType);
|
||||
case BattlerTagType.STOCKPILING:
|
||||
return new StockpilingTag(sourceMove);
|
||||
case BattlerTagType.OCTOLOCK:
|
||||
return new OctolockTag(sourceId);
|
||||
case BattlerTagType.DISABLED:
|
||||
return new DisabledTag(sourceId);
|
||||
case BattlerTagType.IGNORE_GHOST:
|
||||
return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ]);
|
||||
case BattlerTagType.IGNORE_DARK:
|
||||
return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ]);
|
||||
case BattlerTagType.GULP_MISSILE_ARROKUDA:
|
||||
case BattlerTagType.GULP_MISSILE_PIKACHU:
|
||||
return new GulpMissileTag(tagType, sourceMove);
|
||||
case BattlerTagType.TAR_SHOT:
|
||||
return new TarShotTag();
|
||||
case BattlerTagType.ELECTRIFIED:
|
||||
return new ElectrifiedTag();
|
||||
case BattlerTagType.THROAT_CHOPPED:
|
||||
return new ThroatChoppedTag();
|
||||
case BattlerTagType.GORILLA_TACTICS:
|
||||
return new GorillaTacticsTag();
|
||||
case BattlerTagType.SUBSTITUTE:
|
||||
return new SubstituteTag(sourceMove, sourceId);
|
||||
case BattlerTagType.AUTOTOMIZED:
|
||||
return new AutotomizedTag();
|
||||
case BattlerTagType.MYSTERY_ENCOUNTER_POST_SUMMON:
|
||||
return new MysteryEncounterPostSummonTag();
|
||||
case BattlerTagType.HEAL_BLOCK:
|
||||
return new HealBlockTag(turnCount, sourceMove);
|
||||
case BattlerTagType.TORMENT:
|
||||
return new TormentTag(sourceId);
|
||||
case BattlerTagType.TAUNT:
|
||||
return new TauntTag();
|
||||
case BattlerTagType.IMPRISON:
|
||||
return new ImprisonTag(sourceId);
|
||||
case BattlerTagType.SYRUP_BOMB:
|
||||
return new SyrupBombTag(sourceId);
|
||||
case BattlerTagType.TELEKINESIS:
|
||||
return new TelekinesisTag(sourceMove);
|
||||
case BattlerTagType.POWER_TRICK:
|
||||
return new PowerTrickTag(sourceMove, sourceId);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,42 +22,42 @@ export type BerryPredicate = (pokemon: Pokemon) => boolean;
|
|||
|
||||
export function getBerryPredicate(berryType: BerryType): BerryPredicate {
|
||||
switch (berryType) {
|
||||
case BerryType.SITRUS:
|
||||
return (pokemon: Pokemon) => pokemon.getHpRatio() < 0.5;
|
||||
case BerryType.LUM:
|
||||
return (pokemon: Pokemon) => !!pokemon.status || !!pokemon.getTag(BattlerTagType.CONFUSED);
|
||||
case BerryType.ENIGMA:
|
||||
return (pokemon: Pokemon) => !!pokemon.turnData.attacksReceived.filter(a => a.result === HitResult.SUPER_EFFECTIVE).length;
|
||||
case BerryType.LIECHI:
|
||||
case BerryType.GANLON:
|
||||
case BerryType.PETAYA:
|
||||
case BerryType.APICOT:
|
||||
case BerryType.SALAC:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.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);
|
||||
return pokemon.getHpRatio() < threshold.value && pokemon.getStatStage(stat) < 6;
|
||||
};
|
||||
case BerryType.LANSAT:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.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);
|
||||
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
|
||||
return pokemon.getHpRatio() < 0.25;
|
||||
};
|
||||
case BerryType.LEPPA:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.NumberHolder(0.25);
|
||||
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
|
||||
return !!pokemon.getMoveset().find(m => !m?.getPpRatio());
|
||||
};
|
||||
case BerryType.SITRUS:
|
||||
return (pokemon: Pokemon) => pokemon.getHpRatio() < 0.5;
|
||||
case BerryType.LUM:
|
||||
return (pokemon: Pokemon) => !!pokemon.status || !!pokemon.getTag(BattlerTagType.CONFUSED);
|
||||
case BerryType.ENIGMA:
|
||||
return (pokemon: Pokemon) => !!pokemon.turnData.attacksReceived.filter(a => a.result === HitResult.SUPER_EFFECTIVE).length;
|
||||
case BerryType.LIECHI:
|
||||
case BerryType.GANLON:
|
||||
case BerryType.PETAYA:
|
||||
case BerryType.APICOT:
|
||||
case BerryType.SALAC:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.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);
|
||||
return pokemon.getHpRatio() < threshold.value && pokemon.getStatStage(stat) < 6;
|
||||
};
|
||||
case BerryType.LANSAT:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.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);
|
||||
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
|
||||
return pokemon.getHpRatio() < 0.25;
|
||||
};
|
||||
case BerryType.LEPPA:
|
||||
return (pokemon: Pokemon) => {
|
||||
const threshold = new Utils.NumberHolder(0.25);
|
||||
applyAbAttrs(ReduceBerryUseThresholdAbAttr, pokemon, null, false, threshold);
|
||||
return !!pokemon.getMoveset().find(m => !m?.getPpRatio());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,70 +65,70 @@ export type BerryEffectFunc = (pokemon: Pokemon) => void;
|
|||
|
||||
export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
|
||||
switch (berryType) {
|
||||
case BerryType.SITRUS:
|
||||
case BerryType.ENIGMA:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const hpHealed = new Utils.NumberHolder(Utils.toDmgValue(pokemon.getMaxHp() / 4));
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, hpHealed);
|
||||
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
|
||||
hpHealed.value, i18next.t("battle:hpHealBerry", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), berryName: getBerryName(berryType) }), true));
|
||||
};
|
||||
case BerryType.LUM:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
if (pokemon.status) {
|
||||
pokemon.scene.queueMessage(getStatusEffectHealText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
||||
}
|
||||
pokemon.resetStatus(true, true);
|
||||
pokemon.updateInfo();
|
||||
};
|
||||
case BerryType.LIECHI:
|
||||
case BerryType.GANLON:
|
||||
case BerryType.PETAYA:
|
||||
case BerryType.APICOT:
|
||||
case BerryType.SALAC:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
// 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);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, statStages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ stat ], statStages.value));
|
||||
};
|
||||
case BerryType.LANSAT:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
pokemon.addTag(BattlerTagType.CRIT_BOOST);
|
||||
};
|
||||
case BerryType.STARF:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const randStat = Utils.randSeedInt(Stat.SPD, Stat.ATK);
|
||||
const stages = new Utils.NumberHolder(2);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, stages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ randStat ], stages.value));
|
||||
};
|
||||
case BerryType.LEPPA:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const ppRestoreMove = pokemon.getMoveset().find(m => !m?.getPpRatio()) ? pokemon.getMoveset().find(m => !m?.getPpRatio()) : pokemon.getMoveset().find(m => m!.getPpRatio() < 1); // TODO: is this bang correct?
|
||||
if (ppRestoreMove !== undefined) {
|
||||
case BerryType.SITRUS:
|
||||
case BerryType.ENIGMA:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const hpHealed = new Utils.NumberHolder(Utils.toDmgValue(pokemon.getMaxHp() / 4));
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, hpHealed);
|
||||
pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(),
|
||||
hpHealed.value, i18next.t("battle:hpHealBerry", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), berryName: getBerryName(berryType) }), true));
|
||||
};
|
||||
case BerryType.LUM:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
if (pokemon.status) {
|
||||
pokemon.scene.queueMessage(getStatusEffectHealText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
||||
}
|
||||
pokemon.resetStatus(true, true);
|
||||
pokemon.updateInfo();
|
||||
};
|
||||
case BerryType.LIECHI:
|
||||
case BerryType.GANLON:
|
||||
case BerryType.PETAYA:
|
||||
case BerryType.APICOT:
|
||||
case BerryType.SALAC:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
// 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);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, statStages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ stat ], statStages.value));
|
||||
};
|
||||
case BerryType.LANSAT:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
pokemon.addTag(BattlerTagType.CRIT_BOOST);
|
||||
};
|
||||
case BerryType.STARF:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const randStat = Utils.randSeedInt(Stat.SPD, Stat.ATK);
|
||||
const stages = new Utils.NumberHolder(2);
|
||||
applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, false, stages);
|
||||
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ randStat ], stages.value));
|
||||
};
|
||||
case BerryType.LEPPA:
|
||||
return (pokemon: Pokemon) => {
|
||||
if (pokemon.battleData) {
|
||||
pokemon.battleData.berriesEaten.push(berryType);
|
||||
}
|
||||
const ppRestoreMove = pokemon.getMoveset().find(m => !m?.getPpRatio()) ? pokemon.getMoveset().find(m => !m?.getPpRatio()) : pokemon.getMoveset().find(m => m!.getPpRatio() < 1); // TODO: is this bang correct?
|
||||
if (ppRestoreMove !== undefined) {
|
||||
ppRestoreMove!.ppUsed = Math.max(ppRestoreMove!.ppUsed - 10, 0);
|
||||
pokemon.scene.queueMessage(i18next.t("battle:ppHealBerry", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), moveName: ppRestoreMove!.getName(), berryName: getBerryName(berryType) }));
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,196 +450,196 @@ export class SingleGenerationChallenge extends Challenge {
|
|||
let trainerTypes: TrainerType[] = [];
|
||||
const rand = Utils.randSeedInt(2, 1);
|
||||
switch (waveIndex) {
|
||||
case 35:
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
case 35:
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 62:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
break;
|
||||
case 62:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 64:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
break;
|
||||
case 64:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, TrainerType.UNKNOWN, TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 66:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.JUPITER, TrainerType.MARS, TrainerType.SATURN ]), Utils.randSeedItem([ TrainerType.ZINZOLIN, TrainerType.ROOD ]), Utils.randSeedItem([ TrainerType.XEROSIC, TrainerType.BRYONY ]), TrainerType.UNKNOWN, TrainerType.OLEANA, Utils.randSeedItem([ TrainerType.GIACOMO, TrainerType.MELA, TrainerType.ATTICUS, TrainerType.ORTEGA, TrainerType.ERI ]) ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.TABITHA, TrainerType.COURTNEY ]) ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.MATT, TrainerType.SHELLY ]) ];
|
||||
break;
|
||||
break;
|
||||
case 66:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.JUPITER, TrainerType.MARS, TrainerType.SATURN ]), Utils.randSeedItem([ TrainerType.ZINZOLIN, TrainerType.ROOD ]), Utils.randSeedItem([ TrainerType.XEROSIC, TrainerType.BRYONY ]), TrainerType.UNKNOWN, TrainerType.OLEANA, Utils.randSeedItem([ TrainerType.GIACOMO, TrainerType.MELA, TrainerType.ATTICUS, TrainerType.ORTEGA, TrainerType.ERI ]) ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.TABITHA, TrainerType.COURTNEY ]) ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.MATT, TrainerType.SHELLY ]) ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.FABA ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.PLUMERIA ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.FABA ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.PLUMERIA ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 112:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, Utils.randSeedItem([ TrainerType.AETHER_GRUNT, TrainerType.SKULL_GRUNT ]), TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
break;
|
||||
case 112:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ TrainerType.ROCKET_GRUNT, TrainerType.ROCKET_GRUNT, TrainerType.UNKNOWN, TrainerType.GALACTIC_GRUNT, TrainerType.PLASMA_GRUNT, TrainerType.FLARE_GRUNT, Utils.randSeedItem([ TrainerType.AETHER_GRUNT, TrainerType.SKULL_GRUNT ]), TrainerType.MACRO_GRUNT, TrainerType.STAR_GRUNT ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAGMA_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AQUA_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.AETHER_GRUNT ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.SKULL_GRUNT ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 114:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.JUPITER, TrainerType.MARS, TrainerType.SATURN ]), Utils.randSeedItem([ TrainerType.ZINZOLIN, TrainerType.ROOD ]), Utils.randSeedItem([ TrainerType.XEROSIC, TrainerType.BRYONY ]), Utils.randSeedItem([ TrainerType.FABA, TrainerType.PLUMERIA ]), TrainerType.OLEANA, Utils.randSeedItem([ TrainerType.GIACOMO, TrainerType.MELA, TrainerType.ATTICUS, TrainerType.ORTEGA, TrainerType.ERI ]) ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.TABITHA, TrainerType.COURTNEY ]) ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.MATT, TrainerType.SHELLY ]) ];
|
||||
break;
|
||||
break;
|
||||
case 114:
|
||||
battleConfig.setSeedOffsetWave(35);
|
||||
trainerTypes = [ Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), Utils.randSeedItem([ TrainerType.ARCHER, TrainerType.ARIANA, TrainerType.PROTON, TrainerType.PETREL ]), TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.JUPITER, TrainerType.MARS, TrainerType.SATURN ]), Utils.randSeedItem([ TrainerType.ZINZOLIN, TrainerType.ROOD ]), Utils.randSeedItem([ TrainerType.XEROSIC, TrainerType.BRYONY ]), Utils.randSeedItem([ TrainerType.FABA, TrainerType.PLUMERIA ]), TrainerType.OLEANA, Utils.randSeedItem([ TrainerType.GIACOMO, TrainerType.MELA, TrainerType.ATTICUS, TrainerType.ORTEGA, TrainerType.ERI ]) ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.TABITHA, TrainerType.COURTNEY ]) ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, Utils.randSeedItem([ TrainerType.MATT, TrainerType.SHELLY ]) ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.FABA ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.PLUMERIA ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.FABA ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.PLUMERIA ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 115:
|
||||
battleConfig.setSeedOffsetWave(35).setCustomModifierRewards({ guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA ], allowLuckUpgrades: false });
|
||||
trainerTypes = [ TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.UNKNOWN, TrainerType.CYRUS, TrainerType.GHETSIS, TrainerType.LYSANDRE, TrainerType.UNKNOWN, TrainerType.ROSE, TrainerType.PENNY ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAXIE ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.ARCHIE ];
|
||||
break;
|
||||
break;
|
||||
case 115:
|
||||
battleConfig.setSeedOffsetWave(35).setCustomModifierRewards({ guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA ], allowLuckUpgrades: false });
|
||||
trainerTypes = [ TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.ROCKET_BOSS_GIOVANNI_1, TrainerType.UNKNOWN, TrainerType.CYRUS, TrainerType.GHETSIS, TrainerType.LYSANDRE, TrainerType.UNKNOWN, TrainerType.ROSE, TrainerType.PENNY ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAXIE ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.ARCHIE ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.LUSAMINE ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.GUZMA ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.LUSAMINE ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.GUZMA ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 165:
|
||||
battleConfig.setSeedOffsetWave(35).setCustomModifierRewards({ guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA ], allowLuckUpgrades: false });
|
||||
trainerTypes = [ TrainerType.ROCKET_BOSS_GIOVANNI_2, TrainerType.ROCKET_BOSS_GIOVANNI_2, TrainerType.UNKNOWN, TrainerType.CYRUS_2, TrainerType.GHETSIS_2, TrainerType.LYSANDRE_2, TrainerType.UNKNOWN, TrainerType.ROSE_2, TrainerType.PENNY_2 ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAXIE_2 ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.ARCHIE_2 ];
|
||||
break;
|
||||
break;
|
||||
case 165:
|
||||
battleConfig.setSeedOffsetWave(35).setCustomModifierRewards({ guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA ], allowLuckUpgrades: false });
|
||||
trainerTypes = [ TrainerType.ROCKET_BOSS_GIOVANNI_2, TrainerType.ROCKET_BOSS_GIOVANNI_2, TrainerType.UNKNOWN, TrainerType.CYRUS_2, TrainerType.GHETSIS_2, TrainerType.LYSANDRE_2, TrainerType.UNKNOWN, TrainerType.ROSE_2, TrainerType.PENNY_2 ];
|
||||
if (this.value === 3) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.MAXIE_2 ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.ARCHIE_2 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.LUSAMINE_2 ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.GUZMA_2 ];
|
||||
break;
|
||||
if (this.value === 7) {
|
||||
if (rand !== 2) {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.LUSAMINE_2 ];
|
||||
break;
|
||||
} else {
|
||||
trainerTypes = [ TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.UNKNOWN, TrainerType.GUZMA_2 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 182:
|
||||
trainerTypes = [ TrainerType.LORELEI, TrainerType.WILL, TrainerType.SIDNEY, TrainerType.AARON, TrainerType.SHAUNTAL, TrainerType.MALVA, Utils.randSeedItem([ TrainerType.HALA, TrainerType.MOLAYNE ]), TrainerType.MARNIE_ELITE, TrainerType.RIKA ];
|
||||
break;
|
||||
case 184:
|
||||
trainerTypes = [ TrainerType.BRUNO, TrainerType.KOGA, TrainerType.PHOEBE, TrainerType.BERTHA, TrainerType.MARSHAL, TrainerType.SIEBOLD, TrainerType.OLIVIA, TrainerType.NESSA_ELITE, TrainerType.POPPY ];
|
||||
break;
|
||||
case 186:
|
||||
trainerTypes = [ TrainerType.AGATHA, TrainerType.BRUNO, TrainerType.GLACIA, TrainerType.FLINT, TrainerType.GRIMSLEY, TrainerType.WIKSTROM, TrainerType.ACEROLA, Utils.randSeedItem([ TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE ]), TrainerType.LARRY_ELITE ];
|
||||
break;
|
||||
case 188:
|
||||
trainerTypes = [ TrainerType.LANCE, TrainerType.KAREN, TrainerType.DRAKE, TrainerType.LUCIAN, TrainerType.CAITLIN, TrainerType.DRASNA, TrainerType.KAHILI, TrainerType.RAIHAN_ELITE, TrainerType.HASSEL ];
|
||||
break;
|
||||
case 190:
|
||||
trainerTypes = [ TrainerType.BLUE, Utils.randSeedItem([ TrainerType.RED, TrainerType.LANCE_CHAMPION ]), Utils.randSeedItem([ TrainerType.STEVEN, TrainerType.WALLACE ]), TrainerType.CYNTHIA, Utils.randSeedItem([ TrainerType.ALDER, TrainerType.IRIS ]), TrainerType.DIANTHA, TrainerType.HAU, TrainerType.LEON, Utils.randSeedItem([ TrainerType.GEETA, TrainerType.NEMONA ]) ];
|
||||
break;
|
||||
break;
|
||||
case 182:
|
||||
trainerTypes = [ TrainerType.LORELEI, TrainerType.WILL, TrainerType.SIDNEY, TrainerType.AARON, TrainerType.SHAUNTAL, TrainerType.MALVA, Utils.randSeedItem([ TrainerType.HALA, TrainerType.MOLAYNE ]), TrainerType.MARNIE_ELITE, TrainerType.RIKA ];
|
||||
break;
|
||||
case 184:
|
||||
trainerTypes = [ TrainerType.BRUNO, TrainerType.KOGA, TrainerType.PHOEBE, TrainerType.BERTHA, TrainerType.MARSHAL, TrainerType.SIEBOLD, TrainerType.OLIVIA, TrainerType.NESSA_ELITE, TrainerType.POPPY ];
|
||||
break;
|
||||
case 186:
|
||||
trainerTypes = [ TrainerType.AGATHA, TrainerType.BRUNO, TrainerType.GLACIA, TrainerType.FLINT, TrainerType.GRIMSLEY, TrainerType.WIKSTROM, TrainerType.ACEROLA, Utils.randSeedItem([ TrainerType.BEA_ELITE, TrainerType.ALLISTER_ELITE ]), TrainerType.LARRY_ELITE ];
|
||||
break;
|
||||
case 188:
|
||||
trainerTypes = [ TrainerType.LANCE, TrainerType.KAREN, TrainerType.DRAKE, TrainerType.LUCIAN, TrainerType.CAITLIN, TrainerType.DRASNA, TrainerType.KAHILI, TrainerType.RAIHAN_ELITE, TrainerType.HASSEL ];
|
||||
break;
|
||||
case 190:
|
||||
trainerTypes = [ TrainerType.BLUE, Utils.randSeedItem([ TrainerType.RED, TrainerType.LANCE_CHAMPION ]), Utils.randSeedItem([ TrainerType.STEVEN, TrainerType.WALLACE ]), TrainerType.CYNTHIA, Utils.randSeedItem([ TrainerType.ALDER, TrainerType.IRIS ]), TrainerType.DIANTHA, TrainerType.HAU, TrainerType.LEON, Utils.randSeedItem([ TrainerType.GEETA, TrainerType.NEMONA ]) ];
|
||||
break;
|
||||
}
|
||||
if (trainerTypes.length === 0) {
|
||||
return false;
|
||||
|
@ -1068,45 +1068,45 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
|
|||
gameMode.challenges.forEach(c => {
|
||||
if (c.value !== 0) {
|
||||
switch (challengeType) {
|
||||
case ChallengeType.STARTER_CHOICE:
|
||||
ret ||= c.applyStarterChoice(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.STARTER_POINTS:
|
||||
ret ||= c.applyStarterPoints(args[0]);
|
||||
break;
|
||||
case ChallengeType.STARTER_COST:
|
||||
ret ||= c.applyStarterCost(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.STARTER_MODIFY:
|
||||
ret ||= c.applyStarterModify(args[0]);
|
||||
break;
|
||||
case ChallengeType.POKEMON_IN_BATTLE:
|
||||
ret ||= c.applyPokemonInBattle(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.FIXED_BATTLES:
|
||||
ret ||= c.applyFixedBattle(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.TYPE_EFFECTIVENESS:
|
||||
ret ||= c.applyTypeEffectiveness(args[0]);
|
||||
break;
|
||||
case ChallengeType.AI_LEVEL:
|
||||
ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.AI_MOVE_SLOTS:
|
||||
ret ||= c.applyMoveSlot(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.PASSIVE_ACCESS:
|
||||
ret ||= c.applyPassiveAccess(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.GAME_MODE_MODIFY:
|
||||
ret ||= c.applyGameModeModify(gameMode);
|
||||
break;
|
||||
case ChallengeType.MOVE_ACCESS:
|
||||
ret ||= c.applyMoveAccessLevel(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.MOVE_WEIGHT:
|
||||
ret ||= c.applyMoveWeight(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.STARTER_CHOICE:
|
||||
ret ||= c.applyStarterChoice(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.STARTER_POINTS:
|
||||
ret ||= c.applyStarterPoints(args[0]);
|
||||
break;
|
||||
case ChallengeType.STARTER_COST:
|
||||
ret ||= c.applyStarterCost(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.STARTER_MODIFY:
|
||||
ret ||= c.applyStarterModify(args[0]);
|
||||
break;
|
||||
case ChallengeType.POKEMON_IN_BATTLE:
|
||||
ret ||= c.applyPokemonInBattle(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.FIXED_BATTLES:
|
||||
ret ||= c.applyFixedBattle(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.TYPE_EFFECTIVENESS:
|
||||
ret ||= c.applyTypeEffectiveness(args[0]);
|
||||
break;
|
||||
case ChallengeType.AI_LEVEL:
|
||||
ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.AI_MOVE_SLOTS:
|
||||
ret ||= c.applyMoveSlot(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.PASSIVE_ACCESS:
|
||||
ret ||= c.applyPassiveAccess(args[0], args[1]);
|
||||
break;
|
||||
case ChallengeType.GAME_MODE_MODIFY:
|
||||
ret ||= c.applyGameModeModify(gameMode);
|
||||
break;
|
||||
case ChallengeType.MOVE_ACCESS:
|
||||
ret ||= c.applyMoveAccessLevel(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
case ChallengeType.MOVE_WEIGHT:
|
||||
ret ||= c.applyMoveWeight(args[0], args[1], args[2], args[3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1120,18 +1120,18 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
|
|||
*/
|
||||
export function copyChallenge(source: Challenge | any): Challenge {
|
||||
switch (source.id) {
|
||||
case Challenges.SINGLE_GENERATION:
|
||||
return SingleGenerationChallenge.loadChallenge(source);
|
||||
case Challenges.SINGLE_TYPE:
|
||||
return SingleTypeChallenge.loadChallenge(source);
|
||||
case Challenges.LOWER_MAX_STARTER_COST:
|
||||
return LowerStarterMaxCostChallenge.loadChallenge(source);
|
||||
case Challenges.LOWER_STARTER_POINTS:
|
||||
return LowerStarterPointsChallenge.loadChallenge(source);
|
||||
case Challenges.FRESH_START:
|
||||
return FreshStartChallenge.loadChallenge(source);
|
||||
case Challenges.INVERSE_BATTLE:
|
||||
return InverseBattleChallenge.loadChallenge(source);
|
||||
case Challenges.SINGLE_GENERATION:
|
||||
return SingleGenerationChallenge.loadChallenge(source);
|
||||
case Challenges.SINGLE_TYPE:
|
||||
return SingleTypeChallenge.loadChallenge(source);
|
||||
case Challenges.LOWER_MAX_STARTER_COST:
|
||||
return LowerStarterMaxCostChallenge.loadChallenge(source);
|
||||
case Challenges.LOWER_STARTER_POINTS:
|
||||
return LowerStarterPointsChallenge.loadChallenge(source);
|
||||
case Challenges.FRESH_START:
|
||||
return FreshStartChallenge.loadChallenge(source);
|
||||
case Challenges.INVERSE_BATTLE:
|
||||
return InverseBattleChallenge.loadChallenge(source);
|
||||
}
|
||||
throw new Error("Unknown challenge copied");
|
||||
}
|
||||
|
|
136
src/data/egg.ts
|
@ -262,14 +262,14 @@ export class Egg {
|
|||
return "Manaphy";
|
||||
}
|
||||
switch (this.tier) {
|
||||
case EggTier.RARE:
|
||||
return i18next.t("egg:greatTier");
|
||||
case EggTier.EPIC:
|
||||
return i18next.t("egg:ultraTier");
|
||||
case EggTier.LEGENDARY:
|
||||
return i18next.t("egg:masterTier");
|
||||
default:
|
||||
return i18next.t("egg:defaultTier");
|
||||
case EggTier.RARE:
|
||||
return i18next.t("egg:greatTier");
|
||||
case EggTier.EPIC:
|
||||
return i18next.t("egg:ultraTier");
|
||||
case EggTier.LEGENDARY:
|
||||
return i18next.t("egg:masterTier");
|
||||
default:
|
||||
return i18next.t("egg:defaultTier");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,19 +288,19 @@ export class Egg {
|
|||
|
||||
public getEggTypeDescriptor(scene: BattleScene): string {
|
||||
switch (this.sourceType) {
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
return this._eggDescriptor ?? i18next.t("egg:sameSpeciesEgg", { species: getPokemonSpecies(this._species).getName() });
|
||||
case EggSourceType.GACHA_LEGENDARY:
|
||||
return this._eggDescriptor ?? `${i18next.t("egg:gachaTypeLegendary")} (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, this.timestamp)).getName()})`;
|
||||
case EggSourceType.GACHA_SHINY:
|
||||
return this._eggDescriptor ?? i18next.t("egg:gachaTypeShiny");
|
||||
case EggSourceType.GACHA_MOVE:
|
||||
return this._eggDescriptor ?? i18next.t("egg:gachaTypeMove");
|
||||
case EggSourceType.EVENT:
|
||||
return this._eggDescriptor ?? i18next.t("egg:eventType");
|
||||
default:
|
||||
console.warn("getEggTypeDescriptor case not defined. Returning default empty string");
|
||||
return "";
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
return this._eggDescriptor ?? i18next.t("egg:sameSpeciesEgg", { species: getPokemonSpecies(this._species).getName() });
|
||||
case EggSourceType.GACHA_LEGENDARY:
|
||||
return this._eggDescriptor ?? `${i18next.t("egg:gachaTypeLegendary")} (${getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(scene, this.timestamp)).getName()})`;
|
||||
case EggSourceType.GACHA_SHINY:
|
||||
return this._eggDescriptor ?? i18next.t("egg:gachaTypeShiny");
|
||||
case EggSourceType.GACHA_MOVE:
|
||||
return this._eggDescriptor ?? i18next.t("egg:gachaTypeMove");
|
||||
case EggSourceType.EVENT:
|
||||
return this._eggDescriptor ?? i18next.t("egg:eventType");
|
||||
default:
|
||||
console.warn("getEggTypeDescriptor case not defined. Returning default empty string");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,14 +315,14 @@ export class Egg {
|
|||
private rollEggMoveIndex() {
|
||||
let baseChance = GACHA_DEFAULT_RARE_EGGMOVE_RATE;
|
||||
switch (this._sourceType) {
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
baseChance = SAME_SPECIES_EGG_RARE_EGGMOVE_RATE;
|
||||
break;
|
||||
case EggSourceType.GACHA_MOVE:
|
||||
baseChance = GACHA_MOVE_UP_RARE_EGGMOVE_RATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
baseChance = SAME_SPECIES_EGG_RARE_EGGMOVE_RATE;
|
||||
break;
|
||||
case EggSourceType.GACHA_MOVE:
|
||||
baseChance = GACHA_MOVE_UP_RARE_EGGMOVE_RATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const tierMultiplier = this.isManaphyEgg() ? 2 : Math.pow(2, 3 - this.tier);
|
||||
|
@ -335,12 +335,12 @@ export class Egg {
|
|||
}
|
||||
|
||||
switch (eggTier ?? this._tier) {
|
||||
case EggTier.COMMON:
|
||||
return HATCH_WAVES_COMMON_EGG;
|
||||
case EggTier.RARE:
|
||||
return HATCH_WAVES_RARE_EGG;
|
||||
case EggTier.EPIC:
|
||||
return HATCH_WAVES_EPIC_EGG;
|
||||
case EggTier.COMMON:
|
||||
return HATCH_WAVES_COMMON_EGG;
|
||||
case EggTier.RARE:
|
||||
return HATCH_WAVES_RARE_EGG;
|
||||
case EggTier.EPIC:
|
||||
return HATCH_WAVES_EPIC_EGG;
|
||||
}
|
||||
return HATCH_WAVES_LEGENDARY_EGG;
|
||||
}
|
||||
|
@ -379,22 +379,22 @@ export class Egg {
|
|||
let maxStarterValue: integer;
|
||||
|
||||
switch (this.tier) {
|
||||
case EggTier.RARE:
|
||||
minStarterValue = 4;
|
||||
maxStarterValue = 5;
|
||||
break;
|
||||
case EggTier.EPIC:
|
||||
minStarterValue = 6;
|
||||
maxStarterValue = 7;
|
||||
break;
|
||||
case EggTier.LEGENDARY:
|
||||
minStarterValue = 8;
|
||||
maxStarterValue = 9;
|
||||
break;
|
||||
default:
|
||||
minStarterValue = 1;
|
||||
maxStarterValue = 3;
|
||||
break;
|
||||
case EggTier.RARE:
|
||||
minStarterValue = 4;
|
||||
maxStarterValue = 5;
|
||||
break;
|
||||
case EggTier.EPIC:
|
||||
minStarterValue = 6;
|
||||
maxStarterValue = 7;
|
||||
break;
|
||||
case EggTier.LEGENDARY:
|
||||
minStarterValue = 8;
|
||||
maxStarterValue = 9;
|
||||
break;
|
||||
default:
|
||||
minStarterValue = 1;
|
||||
maxStarterValue = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
const ignoredSpecies = [ Species.PHIONE, Species.MANAPHY, Species.ETERNATUS ];
|
||||
|
@ -469,14 +469,14 @@ export class Egg {
|
|||
private rollShiny(): boolean {
|
||||
let shinyChance = GACHA_DEFAULT_SHINY_RATE;
|
||||
switch (this._sourceType) {
|
||||
case EggSourceType.GACHA_SHINY:
|
||||
shinyChance = GACHA_SHINY_UP_SHINY_RATE;
|
||||
break;
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
shinyChance = SAME_SPECIES_EGG_SHINY_RATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case EggSourceType.GACHA_SHINY:
|
||||
shinyChance = GACHA_SHINY_UP_SHINY_RATE;
|
||||
break;
|
||||
case EggSourceType.SAME_SPECIES_EGG:
|
||||
shinyChance = SAME_SPECIES_EGG_SHINY_RATE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return !Utils.randSeedInt(shinyChance);
|
||||
|
@ -523,15 +523,15 @@ export class Egg {
|
|||
return;
|
||||
}
|
||||
switch (this.tier) {
|
||||
case EggTier.RARE:
|
||||
scene.gameData.gameStats.rareEggsPulled++;
|
||||
break;
|
||||
case EggTier.EPIC:
|
||||
scene.gameData.gameStats.epicEggsPulled++;
|
||||
break;
|
||||
case EggTier.LEGENDARY:
|
||||
scene.gameData.gameStats.legendaryEggsPulled++;
|
||||
break;
|
||||
case EggTier.RARE:
|
||||
scene.gameData.gameStats.rareEggsPulled++;
|
||||
break;
|
||||
case EggTier.EPIC:
|
||||
scene.gameData.gameStats.epicEggsPulled++;
|
||||
break;
|
||||
case EggTier.LEGENDARY:
|
||||
scene.gameData.gameStats.legendaryEggsPulled++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,24 +28,24 @@ export function getLevelTotalExp(level: integer, growthRate: GrowthRate): intege
|
|||
let ret: integer;
|
||||
|
||||
switch (growthRate) {
|
||||
case GrowthRate.ERRATIC:
|
||||
ret = (Math.pow(level, 4) + (Math.pow(level, 3) * 2000)) / 3500;
|
||||
break;
|
||||
case GrowthRate.FAST:
|
||||
ret = Math.pow(level, 3) * 4 / 5;
|
||||
break;
|
||||
case GrowthRate.MEDIUM_FAST:
|
||||
ret = Math.pow(level, 3);
|
||||
break;
|
||||
case GrowthRate.MEDIUM_SLOW:
|
||||
ret = (Math.pow(level, 3) * 6 / 5) - (15 * Math.pow(level, 2)) + (100 * level) - 140;
|
||||
break;
|
||||
case GrowthRate.SLOW:
|
||||
ret = Math.pow(level, 3) * 5 / 4;
|
||||
break;
|
||||
case GrowthRate.FLUCTUATING:
|
||||
ret = (Math.pow(level, 3) * ((level / 2) + 8)) * 4 / (100 + level);
|
||||
break;
|
||||
case GrowthRate.ERRATIC:
|
||||
ret = (Math.pow(level, 4) + (Math.pow(level, 3) * 2000)) / 3500;
|
||||
break;
|
||||
case GrowthRate.FAST:
|
||||
ret = Math.pow(level, 3) * 4 / 5;
|
||||
break;
|
||||
case GrowthRate.MEDIUM_FAST:
|
||||
ret = Math.pow(level, 3);
|
||||
break;
|
||||
case GrowthRate.MEDIUM_SLOW:
|
||||
ret = (Math.pow(level, 3) * 6 / 5) - (15 * Math.pow(level, 2)) + (100 * level) - 140;
|
||||
break;
|
||||
case GrowthRate.SLOW:
|
||||
ret = Math.pow(level, 3) * 5 / 4;
|
||||
break;
|
||||
case GrowthRate.FLUCTUATING:
|
||||
ret = (Math.pow(level, 3) * ((level / 2) + 8)) * 4 / (100 + level);
|
||||
break;
|
||||
}
|
||||
|
||||
if (growthRate !== GrowthRate.MEDIUM_FAST) {
|
||||
|
@ -61,17 +61,17 @@ export function getLevelRelExp(level: integer, growthRate: GrowthRate): number {
|
|||
|
||||
export function getGrowthRateColor(growthRate: GrowthRate, shadow?: boolean) {
|
||||
switch (growthRate) {
|
||||
case GrowthRate.ERRATIC:
|
||||
return !shadow ? "#f85888" : "#906060";
|
||||
case GrowthRate.FAST:
|
||||
return !shadow ? "#f8d030" : "#b8a038";
|
||||
case GrowthRate.MEDIUM_FAST:
|
||||
return !shadow ? "#78c850" : "#588040";
|
||||
case GrowthRate.MEDIUM_SLOW:
|
||||
return !shadow ? "#6890f0" : "#807870";
|
||||
case GrowthRate.SLOW:
|
||||
return !shadow ? "#f08030" : "#c03028";
|
||||
case GrowthRate.FLUCTUATING:
|
||||
return !shadow ? "#a040a0" : "#483850";
|
||||
case GrowthRate.ERRATIC:
|
||||
return !shadow ? "#f85888" : "#906060";
|
||||
case GrowthRate.FAST:
|
||||
return !shadow ? "#f8d030" : "#b8a038";
|
||||
case GrowthRate.MEDIUM_FAST:
|
||||
return !shadow ? "#78c850" : "#588040";
|
||||
case GrowthRate.MEDIUM_SLOW:
|
||||
return !shadow ? "#6890f0" : "#807870";
|
||||
case GrowthRate.SLOW:
|
||||
return !shadow ? "#f08030" : "#c03028";
|
||||
case GrowthRate.FLUCTUATING:
|
||||
return !shadow ? "#a040a0" : "#483850";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,20 +6,20 @@ export enum Gender {
|
|||
|
||||
export function getGenderSymbol(gender: Gender) {
|
||||
switch (gender) {
|
||||
case Gender.MALE:
|
||||
return "♂";
|
||||
case Gender.FEMALE:
|
||||
return "♀";
|
||||
case Gender.MALE:
|
||||
return "♂";
|
||||
case Gender.FEMALE:
|
||||
return "♀";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
export function getGenderColor(gender: Gender, shadow?: boolean) {
|
||||
switch (gender) {
|
||||
case Gender.MALE:
|
||||
return shadow ? "#006090" : "#40c8f8";
|
||||
case Gender.FEMALE:
|
||||
return shadow ? "#984038" : "#f89890";
|
||||
case Gender.MALE:
|
||||
return shadow ? "#006090" : "#40c8f8";
|
||||
case Gender.FEMALE:
|
||||
return shadow ? "#984038" : "#f89890";
|
||||
}
|
||||
return "#ffffff";
|
||||
}
|
||||
|
|
1148
src/data/move.ts
|
@ -44,32 +44,32 @@ export const ATrainersTestEncounter: MysteryEncounter =
|
|||
let spriteKeys;
|
||||
let trainerNameKey: string;
|
||||
switch (randSeedInt(5)) {
|
||||
default:
|
||||
case 0:
|
||||
trainerType = TrainerType.BUCK;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.CLAYDOL);
|
||||
trainerNameKey = "buck";
|
||||
break;
|
||||
case 1:
|
||||
trainerType = TrainerType.CHERYL;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.BLISSEY);
|
||||
trainerNameKey = "cheryl";
|
||||
break;
|
||||
case 2:
|
||||
trainerType = TrainerType.MARLEY;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.ARCANINE);
|
||||
trainerNameKey = "marley";
|
||||
break;
|
||||
case 3:
|
||||
trainerType = TrainerType.MIRA;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.ALAKAZAM, false, 1);
|
||||
trainerNameKey = "mira";
|
||||
break;
|
||||
case 4:
|
||||
trainerType = TrainerType.RILEY;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.LUCARIO, false, 1);
|
||||
trainerNameKey = "riley";
|
||||
break;
|
||||
default:
|
||||
case 0:
|
||||
trainerType = TrainerType.BUCK;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.CLAYDOL);
|
||||
trainerNameKey = "buck";
|
||||
break;
|
||||
case 1:
|
||||
trainerType = TrainerType.CHERYL;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.BLISSEY);
|
||||
trainerNameKey = "cheryl";
|
||||
break;
|
||||
case 2:
|
||||
trainerType = TrainerType.MARLEY;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.ARCANINE);
|
||||
trainerNameKey = "marley";
|
||||
break;
|
||||
case 3:
|
||||
trainerType = TrainerType.MIRA;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.ALAKAZAM, false, 1);
|
||||
trainerNameKey = "mira";
|
||||
break;
|
||||
case 4:
|
||||
trainerType = TrainerType.RILEY;
|
||||
spriteKeys = getSpriteKeysFromSpecies(Species.LUCARIO, false, 1);
|
||||
trainerNameKey = "riley";
|
||||
break;
|
||||
}
|
||||
|
||||
// Dialogue and tokens for trainer
|
||||
|
@ -154,7 +154,7 @@ export const ATrainersTestEncounter: MysteryEncounter =
|
|||
};
|
||||
encounter.setDialogueToken("eggType", i18next.t(`${namespace}:eggTypes.epic`));
|
||||
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [ modifierTypes.SACRED_ASH ], guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ULTRA ], fillRemaining: true }, [ eggOptions ]);
|
||||
return initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
}
|
||||
)
|
||||
.withSimpleOption(
|
||||
|
|
|
@ -286,7 +286,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
ignorePp: true
|
||||
});
|
||||
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await initBattleWithEnemyConfig(scene, encounter.enemyPartyConfigs[0]);
|
||||
})
|
||||
.build()
|
||||
|
@ -328,7 +328,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
});
|
||||
await scene.updateModifiers(true);
|
||||
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
.build()
|
||||
|
@ -359,7 +359,7 @@ export const AbsoluteAvariceEncounter: MysteryEncounter =
|
|||
greedent.moveset = [ new PokemonMove(Moves.THRASH), new PokemonMove(Moves.BODY_PRESS), new PokemonMove(Moves.STUFF_CHEEKS), new PokemonMove(Moves.SLACK_OFF) ];
|
||||
greedent.passive = true;
|
||||
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await catchPokemon(scene, greedent, null, PokeballType.POKEBALL, false);
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
|
|
|
@ -228,7 +228,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
|||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Learn its Dance
|
||||
hideOricorioPokemon(scene);
|
||||
await hideOricorioPokemon(scene);
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
.build()
|
||||
|
@ -303,7 +303,7 @@ export const DancingLessonsEncounter: MysteryEncounter =
|
|||
}
|
||||
}
|
||||
|
||||
hideOricorioPokemon(scene);
|
||||
await hideOricorioPokemon(scene);
|
||||
await catchPokemon(scene, oricorio, null, PokeballType.POKEBALL, false);
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
})
|
||||
|
|
|
@ -182,7 +182,7 @@ export const DarkDealEncounter: MysteryEncounter =
|
|||
const config: EnemyPartyConfig = {
|
||||
pokemonConfigs: [ pokemonConfig ],
|
||||
};
|
||||
return initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
|
|
@ -222,12 +222,13 @@ export const FieryFalloutEncounter: MysteryEncounter =
|
|||
],
|
||||
})
|
||||
.withPreOptionPhase(async (scene: BattleScene) => {
|
||||
// Do NOT await this, to prevent player from repeatedly pressing options
|
||||
transitionMysteryEncounterIntroVisuals(scene, false, false, 2000);
|
||||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Fire types help calm the Volcarona
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
transitionMysteryEncounterIntroVisuals(scene);
|
||||
await transitionMysteryEncounterIntroVisuals(scene);
|
||||
setEncounterRewards(scene,
|
||||
{ fillRemaining: true },
|
||||
undefined,
|
||||
|
|
|
@ -152,7 +152,7 @@ export const FunAndGamesEncounter: MysteryEncounter =
|
|||
},
|
||||
async (scene: BattleScene) => {
|
||||
// Leave encounter with no rewards or exp
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true);
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ export const GlobalTradeSystemEncounter: MysteryEncounter =
|
|||
if (modifier.stackCount === 0) {
|
||||
scene.removeModifier(modifier);
|
||||
}
|
||||
scene.updateModifiers(true, true);
|
||||
await scene.updateModifiers(true, true);
|
||||
|
||||
// Generate a trainer name
|
||||
const traderName = generateRandomTraderName();
|
||||
|
|
|
@ -129,7 +129,7 @@ export const LostAtSeaEncounter: MysteryEncounter = MysteryEncounterBuilder.with
|
|||
*
|
||||
* @param scene Battle scene
|
||||
*/
|
||||
async function handlePokemonGuidingYouPhase(scene: BattleScene) {
|
||||
function handlePokemonGuidingYouPhase(scene: BattleScene) {
|
||||
const laprasSpecies = getPokemonSpecies(Species.LAPRAS);
|
||||
const { mysteryEncounter } = scene.currentBattle;
|
||||
|
||||
|
|
|
@ -147,11 +147,11 @@ export const MysteriousChallengersEncounter: MysteryEncounter =
|
|||
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [ modifierTypes.TM_COMMON, modifierTypes.TM_GREAT, modifierTypes.MEMORY_MUSHROOM ], fillRemaining: true });
|
||||
|
||||
// Seed offsets to remove possibility of different trainers having exact same teams
|
||||
let ret;
|
||||
let initBattlePromise: Promise<void>;
|
||||
scene.executeWithSeedOffset(() => {
|
||||
ret = initBattleWithEnemyConfig(scene, config);
|
||||
initBattlePromise = initBattleWithEnemyConfig(scene, config);
|
||||
}, scene.currentBattle.waveIndex * 10);
|
||||
return ret;
|
||||
await initBattlePromise!;
|
||||
}
|
||||
)
|
||||
.withSimpleOption(
|
||||
|
@ -172,11 +172,11 @@ export const MysteriousChallengersEncounter: MysteryEncounter =
|
|||
setEncounterRewards(scene, { guaranteedModifierTiers: [ ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.GREAT, ModifierTier.GREAT ], fillRemaining: true });
|
||||
|
||||
// Seed offsets to remove possibility of different trainers having exact same teams
|
||||
let ret;
|
||||
let initBattlePromise: Promise<void>;
|
||||
scene.executeWithSeedOffset(() => {
|
||||
ret = initBattleWithEnemyConfig(scene, config);
|
||||
initBattlePromise = initBattleWithEnemyConfig(scene, config);
|
||||
}, scene.currentBattle.waveIndex * 100);
|
||||
return ret;
|
||||
await initBattlePromise!;
|
||||
}
|
||||
)
|
||||
.withSimpleOption(
|
||||
|
@ -200,11 +200,11 @@ export const MysteriousChallengersEncounter: MysteryEncounter =
|
|||
setEncounterRewards(scene, { guaranteedModifierTiers: [ ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT ], fillRemaining: true });
|
||||
|
||||
// Seed offsets to remove possibility of different trainers having exact same teams
|
||||
let ret;
|
||||
let initBattlePromise: Promise<void>;
|
||||
scene.executeWithSeedOffset(() => {
|
||||
ret = initBattleWithEnemyConfig(scene, config);
|
||||
initBattlePromise = initBattleWithEnemyConfig(scene, config);
|
||||
}, scene.currentBattle.waveIndex * 1000);
|
||||
return ret;
|
||||
await initBattlePromise!;
|
||||
}
|
||||
)
|
||||
.withOutroDialogue([
|
||||
|
|
|
@ -184,7 +184,7 @@ export const MysteriousChestEncounter: MysteryEncounter =
|
|||
scene.unshiftPhase(new GameOverPhase(scene));
|
||||
} else {
|
||||
// Show which Pokemon was KOed, then start battle against Gimmighoul
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
setEncounterRewards(scene, { fillRemaining: true });
|
||||
await initBattleWithEnemyConfig(scene, encounter.enemyPartyConfigs[0]);
|
||||
}
|
||||
|
|
|
@ -303,13 +303,16 @@ async function summonSafariPokemon(scene: BattleScene) {
|
|||
scene.unshiftPhase(new SummonPhase(scene, 0, false));
|
||||
|
||||
encounter.setDialogueToken("pokemonName", getPokemonNameWithAffix(pokemon));
|
||||
showEncounterText(scene, getEncounterText(scene, "battle:singleWildAppeared") ?? "", null, 1500, false)
|
||||
.then(() => {
|
||||
const ivScannerModifier = scene.findModifier(m => m instanceof IvScannerModifier);
|
||||
if (ivScannerModifier) {
|
||||
scene.pushPhase(new ScanIvsPhase(scene, pokemon.getBattlerIndex(), Math.min(ivScannerModifier.getStackCount() * 2, 6)));
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: If we await showEncounterText here, then the text will display without
|
||||
// the wild Pokemon on screen, but if we don't await it, then the text never
|
||||
// shows up and the IV scanner breaks. For now, we place the IV scanner code
|
||||
// separately so that at least the IV scanner works.
|
||||
|
||||
const ivScannerModifier = scene.findModifier(m => m instanceof IvScannerModifier);
|
||||
if (ivScannerModifier) {
|
||||
scene.pushPhase(new ScanIvsPhase(scene, pokemon.getBattlerIndex(), Math.min(ivScannerModifier.getStackCount() * 2, 6)));
|
||||
}
|
||||
}
|
||||
|
||||
function throwPokeball(scene: BattleScene, pokemon: EnemyPokemon): Promise<boolean> {
|
||||
|
|
|
@ -142,7 +142,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
|||
encounter.setDialogueToken("newNature", getNatureName(newNature));
|
||||
queueEncounterMessage(scene, `${namespace}:cheap_side_effects`);
|
||||
setEncounterExp(scene, [ chosenPokemon.id ], 100);
|
||||
chosenPokemon.updateInfo();
|
||||
await chosenPokemon.updateInfo();
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
@ -204,7 +204,7 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter =
|
|||
queueEncounterMessage(scene, `${namespace}:no_bad_effects`);
|
||||
setEncounterExp(scene, [ chosenPokemon.id ], 100);
|
||||
|
||||
chosenPokemon.updateInfo();
|
||||
await chosenPokemon.updateInfo();
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
|
|
@ -149,7 +149,7 @@ export const TeleportingHijinksEncounter: MysteryEncounter =
|
|||
const magnet = generateModifierTypeOption(scene, modifierTypes.ATTACK_TYPE_BOOSTER, [ Type.STEEL ])!;
|
||||
const metalCoat = generateModifierTypeOption(scene, modifierTypes.ATTACK_TYPE_BOOSTER, [ Type.ELECTRIC ])!;
|
||||
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [ magnet, metalCoat ], fillRemaining: true });
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
}
|
||||
)
|
||||
|
|
|
@ -61,7 +61,7 @@ const POOL_1_POKEMON: (Species | BreederSpeciesEvolution)[][] = [
|
|||
const POOL_2_POKEMON: (Species | BreederSpeciesEvolution)[][] = [
|
||||
[ Species.PICHU, new BreederSpeciesEvolution(Species.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(Species.RAICHU, FINAL_STAGE_EVOLUTION_WAVE) ],
|
||||
[ Species.PICHU, new BreederSpeciesEvolution(Species.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(Species.ALOLA_RAICHU, FINAL_STAGE_EVOLUTION_WAVE) ],
|
||||
[ Species.JYNX ],
|
||||
[ Species.SMOOCHUM, new BreederSpeciesEvolution(Species.JYNX, SECOND_STAGE_EVOLUTION_WAVE) ],
|
||||
[ Species.TYROGUE, new BreederSpeciesEvolution(Species.HITMONLEE, SECOND_STAGE_EVOLUTION_WAVE) ],
|
||||
[ Species.TYROGUE, new BreederSpeciesEvolution(Species.HITMONCHAN, SECOND_STAGE_EVOLUTION_WAVE) ],
|
||||
[ Species.TYROGUE, new BreederSpeciesEvolution(Species.HITMONTOP, SECOND_STAGE_EVOLUTION_WAVE) ],
|
||||
|
@ -245,7 +245,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||
}
|
||||
|
||||
encounter.onGameOver = onGameOver;
|
||||
initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.withPostOptionPhase(async (scene: BattleScene) => {
|
||||
await doPostEncounterCleanup(scene);
|
||||
|
@ -297,7 +297,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||
}
|
||||
|
||||
encounter.onGameOver = onGameOver;
|
||||
initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.withPostOptionPhase(async (scene: BattleScene) => {
|
||||
await doPostEncounterCleanup(scene);
|
||||
|
@ -349,7 +349,7 @@ export const TheExpertPokemonBreederEncounter: MysteryEncounter =
|
|||
}
|
||||
|
||||
encounter.onGameOver = onGameOver;
|
||||
initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.withPostOptionPhase(async (scene: BattleScene) => {
|
||||
await doPostEncounterCleanup(scene);
|
||||
|
|
|
@ -201,7 +201,7 @@ export const TheStrongStuffEncounter: MysteryEncounter =
|
|||
});
|
||||
|
||||
encounter.dialogue.outro = [];
|
||||
transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, true, 500);
|
||||
await initBattleWithEnemyConfig(scene, encounter.enemyPartyConfigs[0]);
|
||||
}
|
||||
)
|
||||
|
|
|
@ -111,8 +111,8 @@ export const TheWinstrateChallengeEncounter: MysteryEncounter =
|
|||
},
|
||||
async (scene: BattleScene) => {
|
||||
// Spawn 5 trainer battles back to back with Macho Brace in rewards
|
||||
scene.currentBattle.mysteryEncounter!.doContinueEncounter = (scene: BattleScene) => {
|
||||
return endTrainerBattleAndShowDialogue(scene);
|
||||
scene.currentBattle.mysteryEncounter!.doContinueEncounter = async (scene: BattleScene) => {
|
||||
await endTrainerBattleAndShowDialogue(scene);
|
||||
};
|
||||
await transitionMysteryEncounterIntroVisuals(scene, true, false);
|
||||
await spawnNextTrainerOrEndEncounter(scene);
|
||||
|
|
|
@ -162,7 +162,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
|
||||
setEncounterRewards(scene, { fillRemaining: true }, undefined, onBeforeRewardsPhase);
|
||||
|
||||
return initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
@ -238,7 +238,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
|
||||
setEncounterRewards(scene, { fillRemaining: true }, undefined, onBeforeRewardsPhase);
|
||||
|
||||
return initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
@ -351,7 +351,7 @@ export const TrainingSessionEncounter: MysteryEncounter =
|
|||
|
||||
setEncounterRewards(scene, { fillRemaining: true }, undefined, onBeforeRewardsPhase);
|
||||
|
||||
return initBattleWithEnemyConfig(scene, config);
|
||||
await initBattleWithEnemyConfig(scene, config);
|
||||
})
|
||||
.build()
|
||||
)
|
||||
|
|
|
@ -105,7 +105,7 @@ export const TrashToTreasureEncounter: MysteryEncounter =
|
|||
})
|
||||
.withOptionPhase(async (scene: BattleScene) => {
|
||||
// Gain 2 Leftovers and 2 Shell Bell
|
||||
transitionMysteryEncounterIntroVisuals(scene);
|
||||
await transitionMysteryEncounterIntroVisuals(scene);
|
||||
await tryApplyDigRewardItems(scene);
|
||||
|
||||
const blackSludge = generateModifierType(scene, modifierTypes.MYSTERY_ENCOUNTER_BLACK_SLUDGE, [ SHOP_ITEM_COST_MULTIPLIER ]);
|
||||
|
@ -136,7 +136,7 @@ export const TrashToTreasureEncounter: MysteryEncounter =
|
|||
// Investigate garbage, battle Gmax Garbodor
|
||||
scene.setFieldScale(0.75);
|
||||
await showEncounterText(scene, `${namespace}:option.2.selected_2`);
|
||||
transitionMysteryEncounterIntroVisuals(scene);
|
||||
await transitionMysteryEncounterIntroVisuals(scene);
|
||||
|
||||
const encounter = scene.currentBattle.mysteryEncounter!;
|
||||
|
||||
|
@ -222,7 +222,7 @@ async function tryApplyDigRewardItems(scene: BattleScene) {
|
|||
await showEncounterText(scene, i18next.t("battle:rewardGainCount", { modifierName: shellBell.name, count: 2 }), null, undefined, true);
|
||||
}
|
||||
|
||||
async function doGarbageDig(scene: BattleScene) {
|
||||
function doGarbageDig(scene: BattleScene) {
|
||||
scene.playSound("battle_anims/PRSFX- Dig2");
|
||||
scene.time.delayedCall(SOUND_EFFECT_WAIT_TIME, () => {
|
||||
scene.playSound("battle_anims/PRSFX- Dig2");
|
||||
|
|
|
@ -1069,19 +1069,19 @@ export function calculateRareSpawnAggregateStats(scene: BattleScene, luckValue:
|
|||
const tier = tierValue >= 20 ? BiomePoolTier.BOSS : tierValue >= 6 ? BiomePoolTier.BOSS_RARE : tierValue >= 1 ? BiomePoolTier.BOSS_SUPER_RARE : BiomePoolTier.BOSS_ULTRA_RARE;
|
||||
|
||||
switch (tier) {
|
||||
default:
|
||||
case BiomePoolTier.BOSS:
|
||||
++bossEncountersByRarity[0];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_RARE:
|
||||
++bossEncountersByRarity[1];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_SUPER_RARE:
|
||||
++bossEncountersByRarity[2];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_ULTRA_RARE:
|
||||
++bossEncountersByRarity[3];
|
||||
break;
|
||||
default:
|
||||
case BiomePoolTier.BOSS:
|
||||
++bossEncountersByRarity[0];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_RARE:
|
||||
++bossEncountersByRarity[1];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_SUPER_RARE:
|
||||
++bossEncountersByRarity[2];
|
||||
break;
|
||||
case BiomePoolTier.BOSS_ULTRA_RARE:
|
||||
++bossEncountersByRarity[3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,76 +37,76 @@ export function getNatureName(nature: Nature, includeStatEffects: boolean = fals
|
|||
|
||||
export function getNatureStatMultiplier(nature: Nature, stat: Stat): number {
|
||||
switch (stat) {
|
||||
case Stat.ATK:
|
||||
switch (nature) {
|
||||
case Nature.LONELY:
|
||||
case Nature.BRAVE:
|
||||
case Nature.ADAMANT:
|
||||
case Nature.NAUGHTY:
|
||||
return 1.1;
|
||||
case Nature.BOLD:
|
||||
case Nature.TIMID:
|
||||
case Nature.MODEST:
|
||||
case Nature.CALM:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.DEF:
|
||||
switch (nature) {
|
||||
case Nature.BOLD:
|
||||
case Nature.RELAXED:
|
||||
case Nature.IMPISH:
|
||||
case Nature.LAX:
|
||||
return 1.1;
|
||||
case Nature.LONELY:
|
||||
case Nature.HASTY:
|
||||
case Nature.MILD:
|
||||
case Nature.GENTLE:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPATK:
|
||||
switch (nature) {
|
||||
case Nature.MODEST:
|
||||
case Nature.MILD:
|
||||
case Nature.QUIET:
|
||||
case Nature.RASH:
|
||||
return 1.1;
|
||||
case Nature.ADAMANT:
|
||||
case Nature.IMPISH:
|
||||
case Nature.JOLLY:
|
||||
case Nature.CAREFUL:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPDEF:
|
||||
switch (nature) {
|
||||
case Nature.CALM:
|
||||
case Nature.GENTLE:
|
||||
case Nature.SASSY:
|
||||
case Nature.CAREFUL:
|
||||
return 1.1;
|
||||
case Nature.NAUGHTY:
|
||||
case Nature.LAX:
|
||||
case Nature.NAIVE:
|
||||
case Nature.RASH:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPD:
|
||||
switch (nature) {
|
||||
case Nature.TIMID:
|
||||
case Nature.HASTY:
|
||||
case Nature.JOLLY:
|
||||
case Nature.NAIVE:
|
||||
return 1.1;
|
||||
case Nature.BRAVE:
|
||||
case Nature.RELAXED:
|
||||
case Nature.QUIET:
|
||||
case Nature.SASSY:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.ATK:
|
||||
switch (nature) {
|
||||
case Nature.LONELY:
|
||||
case Nature.BRAVE:
|
||||
case Nature.ADAMANT:
|
||||
case Nature.NAUGHTY:
|
||||
return 1.1;
|
||||
case Nature.BOLD:
|
||||
case Nature.TIMID:
|
||||
case Nature.MODEST:
|
||||
case Nature.CALM:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.DEF:
|
||||
switch (nature) {
|
||||
case Nature.BOLD:
|
||||
case Nature.RELAXED:
|
||||
case Nature.IMPISH:
|
||||
case Nature.LAX:
|
||||
return 1.1;
|
||||
case Nature.LONELY:
|
||||
case Nature.HASTY:
|
||||
case Nature.MILD:
|
||||
case Nature.GENTLE:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPATK:
|
||||
switch (nature) {
|
||||
case Nature.MODEST:
|
||||
case Nature.MILD:
|
||||
case Nature.QUIET:
|
||||
case Nature.RASH:
|
||||
return 1.1;
|
||||
case Nature.ADAMANT:
|
||||
case Nature.IMPISH:
|
||||
case Nature.JOLLY:
|
||||
case Nature.CAREFUL:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPDEF:
|
||||
switch (nature) {
|
||||
case Nature.CALM:
|
||||
case Nature.GENTLE:
|
||||
case Nature.SASSY:
|
||||
case Nature.CAREFUL:
|
||||
return 1.1;
|
||||
case Nature.NAUGHTY:
|
||||
case Nature.LAX:
|
||||
case Nature.NAIVE:
|
||||
case Nature.RASH:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
case Stat.SPD:
|
||||
switch (nature) {
|
||||
case Nature.TIMID:
|
||||
case Nature.HASTY:
|
||||
case Nature.JOLLY:
|
||||
case Nature.NAIVE:
|
||||
return 1.1;
|
||||
case Nature.BRAVE:
|
||||
case Nature.RELAXED:
|
||||
case Nature.QUIET:
|
||||
case Nature.SASSY:
|
||||
return 0.9;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -8,77 +8,77 @@ export const MAX_PER_TYPE_POKEBALLS: integer = 99;
|
|||
|
||||
export function getPokeballAtlasKey(type: PokeballType): string {
|
||||
switch (type) {
|
||||
case PokeballType.POKEBALL:
|
||||
return "pb";
|
||||
case PokeballType.GREAT_BALL:
|
||||
return "gb";
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return "ub";
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return "rb";
|
||||
case PokeballType.MASTER_BALL:
|
||||
return "mb";
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return "lb";
|
||||
case PokeballType.POKEBALL:
|
||||
return "pb";
|
||||
case PokeballType.GREAT_BALL:
|
||||
return "gb";
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return "ub";
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return "rb";
|
||||
case PokeballType.MASTER_BALL:
|
||||
return "mb";
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return "lb";
|
||||
}
|
||||
}
|
||||
|
||||
export function getPokeballName(type: PokeballType): string {
|
||||
let ret: string;
|
||||
switch (type) {
|
||||
case PokeballType.POKEBALL:
|
||||
ret = i18next.t("pokeball:pokeBall");
|
||||
break;
|
||||
case PokeballType.GREAT_BALL:
|
||||
ret = i18next.t("pokeball:greatBall");
|
||||
break;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
ret = i18next.t("pokeball:ultraBall");
|
||||
break;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
ret = i18next.t("pokeball:rogueBall");
|
||||
break;
|
||||
case PokeballType.MASTER_BALL:
|
||||
ret = i18next.t("pokeball:masterBall");
|
||||
break;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
ret = i18next.t("pokeball:luxuryBall");
|
||||
break;
|
||||
case PokeballType.POKEBALL:
|
||||
ret = i18next.t("pokeball:pokeBall");
|
||||
break;
|
||||
case PokeballType.GREAT_BALL:
|
||||
ret = i18next.t("pokeball:greatBall");
|
||||
break;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
ret = i18next.t("pokeball:ultraBall");
|
||||
break;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
ret = i18next.t("pokeball:rogueBall");
|
||||
break;
|
||||
case PokeballType.MASTER_BALL:
|
||||
ret = i18next.t("pokeball:masterBall");
|
||||
break;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
ret = i18next.t("pokeball:luxuryBall");
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getPokeballCatchMultiplier(type: PokeballType): number {
|
||||
switch (type) {
|
||||
case PokeballType.POKEBALL:
|
||||
return 1;
|
||||
case PokeballType.GREAT_BALL:
|
||||
return 1.5;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return 2;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return 3;
|
||||
case PokeballType.MASTER_BALL:
|
||||
return -1;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return 1;
|
||||
case PokeballType.POKEBALL:
|
||||
return 1;
|
||||
case PokeballType.GREAT_BALL:
|
||||
return 1.5;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return 2;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return 3;
|
||||
case PokeballType.MASTER_BALL:
|
||||
return -1;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
export function getPokeballTintColor(type: PokeballType): number {
|
||||
switch (type) {
|
||||
case PokeballType.POKEBALL:
|
||||
return 0xd52929;
|
||||
case PokeballType.GREAT_BALL:
|
||||
return 0x94b4de;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return 0xe6cd31;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return 0xd52929;
|
||||
case PokeballType.MASTER_BALL:
|
||||
return 0xa441bd;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return 0xffde6a;
|
||||
case PokeballType.POKEBALL:
|
||||
return 0xd52929;
|
||||
case PokeballType.GREAT_BALL:
|
||||
return 0x94b4de;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
return 0xe6cd31;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
return 0xd52929;
|
||||
case PokeballType.MASTER_BALL:
|
||||
return 0xa441bd;
|
||||
case PokeballType.LUXURY_BALL:
|
||||
return 0xffde6a;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -799,8 +799,8 @@ export const pokemonFormChanges: PokemonFormChanges = {
|
|||
[Species.ZYGARDE]: [
|
||||
new SpeciesFormChange(Species.ZYGARDE, "50-pc", "complete", new SpeciesFormChangeManualTrigger(), true),
|
||||
new SpeciesFormChange(Species.ZYGARDE, "complete", "50-pc", new SpeciesFormChangeManualTrigger(), true),
|
||||
new SpeciesFormChange(Species.ZYGARDE, "10-pc", "complete", new SpeciesFormChangeManualTrigger(), true),
|
||||
new SpeciesFormChange(Species.ZYGARDE, "complete", "10-pc", new SpeciesFormChangeManualTrigger(), true)
|
||||
new SpeciesFormChange(Species.ZYGARDE, "10-pc", "10-complete", new SpeciesFormChangeManualTrigger(), true),
|
||||
new SpeciesFormChange(Species.ZYGARDE, "10-complete", "10-pc", new SpeciesFormChangeManualTrigger(), true)
|
||||
],
|
||||
[Species.DIANCIE]: [
|
||||
new SpeciesFormChange(Species.DIANCIE, "", SpeciesFormKey.MEGA, new SpeciesFormChangeItemTrigger(FormChangeItem.DIANCITE))
|
||||
|
|
|
@ -238,8 +238,8 @@ export abstract class PokemonSpeciesForm {
|
|||
|
||||
isRareRegional(): boolean {
|
||||
switch (this.getRegion()) {
|
||||
case Region.HISUI:
|
||||
return true;
|
||||
case Region.HISUI:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -265,14 +265,14 @@ export abstract class PokemonSpeciesForm {
|
|||
getBaseExp(): number {
|
||||
let ret = this.baseExp;
|
||||
switch (this.getFormSpriteKey()) {
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
case SpeciesFormKey.PRIMAL:
|
||||
case SpeciesFormKey.GIGANTAMAX:
|
||||
case SpeciesFormKey.ETERNAMAX:
|
||||
ret *= 1.5;
|
||||
break;
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
case SpeciesFormKey.PRIMAL:
|
||||
case SpeciesFormKey.GIGANTAMAX:
|
||||
case SpeciesFormKey.ETERNAMAX:
|
||||
ret *= 1.5;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -346,29 +346,29 @@ export abstract class PokemonSpeciesForm {
|
|||
}
|
||||
|
||||
switch (this.speciesId) {
|
||||
case Species.HIPPOPOTAS:
|
||||
case Species.HIPPOWDON:
|
||||
case Species.UNFEZANT:
|
||||
case Species.FRILLISH:
|
||||
case Species.JELLICENT:
|
||||
case Species.PYROAR:
|
||||
ret += female ? "-f" : "";
|
||||
break;
|
||||
case Species.HIPPOPOTAS:
|
||||
case Species.HIPPOWDON:
|
||||
case Species.UNFEZANT:
|
||||
case Species.FRILLISH:
|
||||
case Species.JELLICENT:
|
||||
case Species.PYROAR:
|
||||
ret += female ? "-f" : "";
|
||||
break;
|
||||
}
|
||||
|
||||
let formSpriteKey = this.getFormSpriteKey(formIndex);
|
||||
if (formSpriteKey) {
|
||||
switch (this.speciesId) {
|
||||
case Species.DUDUNSPARCE:
|
||||
break;
|
||||
case Species.ZACIAN:
|
||||
case Species.ZAMAZENTA:
|
||||
if (formSpriteKey.startsWith("behemoth")) {
|
||||
formSpriteKey = "crowned";
|
||||
}
|
||||
default:
|
||||
ret += `-${formSpriteKey}`;
|
||||
break;
|
||||
case Species.DUDUNSPARCE:
|
||||
break;
|
||||
case Species.ZACIAN:
|
||||
case Species.ZAMAZENTA:
|
||||
if (formSpriteKey.startsWith("behemoth")) {
|
||||
formSpriteKey = "crowned";
|
||||
}
|
||||
default:
|
||||
ret += `-${formSpriteKey}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,15 +383,15 @@ export abstract class PokemonSpeciesForm {
|
|||
let speciesId = this.speciesId;
|
||||
if (this.speciesId > 2000) {
|
||||
switch (this.speciesId) {
|
||||
case Species.GALAR_SLOWPOKE:
|
||||
break;
|
||||
case Species.ETERNAL_FLOETTE:
|
||||
break;
|
||||
case Species.BLOODMOON_URSALUNA:
|
||||
break;
|
||||
default:
|
||||
speciesId = speciesId % 2000;
|
||||
break;
|
||||
case Species.GALAR_SLOWPOKE:
|
||||
break;
|
||||
case Species.ETERNAL_FLOETTE:
|
||||
break;
|
||||
case Species.BLOODMOON_URSALUNA:
|
||||
break;
|
||||
default:
|
||||
speciesId = speciesId % 2000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let ret = speciesId.toString();
|
||||
|
@ -403,43 +403,44 @@ export abstract class PokemonSpeciesForm {
|
|||
}
|
||||
const formKey = forms[formIndex || 0].formKey;
|
||||
switch (formKey) {
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
case SpeciesFormKey.GIGANTAMAX:
|
||||
case SpeciesFormKey.GIGANTAMAX_SINGLE:
|
||||
case SpeciesFormKey.GIGANTAMAX_RAPID:
|
||||
case "white":
|
||||
case "black":
|
||||
case "therian":
|
||||
case "sky":
|
||||
case "gorging":
|
||||
case "gulping":
|
||||
case "no-ice":
|
||||
case "hangry":
|
||||
case "crowned":
|
||||
case "eternamax":
|
||||
case "four":
|
||||
case "droopy":
|
||||
case "stretchy":
|
||||
case "hero":
|
||||
case "roaming":
|
||||
case "complete":
|
||||
case "10":
|
||||
case "10-pc":
|
||||
case "super":
|
||||
case "unbound":
|
||||
case "pau":
|
||||
case "pompom":
|
||||
case "sensu":
|
||||
case "dusk":
|
||||
case "midnight":
|
||||
case "school":
|
||||
case "dawn-wings":
|
||||
case "dusk-mane":
|
||||
case "ultra":
|
||||
ret += `-${formKey}`;
|
||||
break;
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
case SpeciesFormKey.GIGANTAMAX:
|
||||
case SpeciesFormKey.GIGANTAMAX_SINGLE:
|
||||
case SpeciesFormKey.GIGANTAMAX_RAPID:
|
||||
case "white":
|
||||
case "black":
|
||||
case "therian":
|
||||
case "sky":
|
||||
case "gorging":
|
||||
case "gulping":
|
||||
case "no-ice":
|
||||
case "hangry":
|
||||
case "crowned":
|
||||
case "eternamax":
|
||||
case "four":
|
||||
case "droopy":
|
||||
case "stretchy":
|
||||
case "hero":
|
||||
case "roaming":
|
||||
case "complete":
|
||||
case "10-complete":
|
||||
case "10":
|
||||
case "10-pc":
|
||||
case "super":
|
||||
case "unbound":
|
||||
case "pau":
|
||||
case "pompom":
|
||||
case "sensu":
|
||||
case "dusk":
|
||||
case "midnight":
|
||||
case "school":
|
||||
case "dawn-wings":
|
||||
case "dusk-mane":
|
||||
case "ultra":
|
||||
ret += `-${formKey}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -635,19 +636,19 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
const form = this.forms[formIndex];
|
||||
let key: string | null;
|
||||
switch (form.formKey) {
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.PRIMAL:
|
||||
case SpeciesFormKey.ETERNAMAX:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
key = form.formKey;
|
||||
break;
|
||||
default:
|
||||
if (form.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) > -1) {
|
||||
key = "gigantamax";
|
||||
} else {
|
||||
key = null;
|
||||
}
|
||||
case SpeciesFormKey.MEGA:
|
||||
case SpeciesFormKey.PRIMAL:
|
||||
case SpeciesFormKey.ETERNAMAX:
|
||||
case SpeciesFormKey.MEGA_X:
|
||||
case SpeciesFormKey.MEGA_Y:
|
||||
key = form.formKey;
|
||||
break;
|
||||
default:
|
||||
if (form.formKey.indexOf(SpeciesFormKey.GIGANTAMAX) > -1) {
|
||||
key = "gigantamax";
|
||||
} else {
|
||||
key = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (key) {
|
||||
|
@ -689,18 +690,18 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
|||
*/
|
||||
private getStrengthLevelDiff(strength: PartyMemberStrength): integer {
|
||||
switch (Math.min(strength, PartyMemberStrength.STRONGER)) {
|
||||
case PartyMemberStrength.WEAKEST:
|
||||
return 60;
|
||||
case PartyMemberStrength.WEAKER:
|
||||
return 40;
|
||||
case PartyMemberStrength.WEAK:
|
||||
return 20;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
return 8;
|
||||
case PartyMemberStrength.STRONG:
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
case PartyMemberStrength.WEAKEST:
|
||||
return 60;
|
||||
case PartyMemberStrength.WEAKER:
|
||||
return 40;
|
||||
case PartyMemberStrength.WEAK:
|
||||
return 20;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
return 8;
|
||||
case PartyMemberStrength.STRONG:
|
||||
return 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2135,7 +2136,8 @@ export function initSpecies() {
|
|||
new PokemonForm("10% Forme", "10", Type.DRAGON, Type.GROUND, 1.2, 33.5, Abilities.AURA_BREAK, Abilities.NONE, Abilities.NONE, 486, 54, 100, 71, 61, 85, 115, 3, 0, 300, false, null, true),
|
||||
new PokemonForm("50% Forme Power Construct", "50-pc", Type.DRAGON, Type.GROUND, 5, 305, Abilities.POWER_CONSTRUCT, Abilities.NONE, Abilities.NONE, 600, 108, 100, 121, 81, 95, 95, 3, 0, 300, false, "", true),
|
||||
new PokemonForm("10% Forme Power Construct", "10-pc", Type.DRAGON, Type.GROUND, 1.2, 33.5, Abilities.POWER_CONSTRUCT, Abilities.NONE, Abilities.NONE, 486, 54, 100, 71, 61, 85, 115, 3, 0, 300, false, "10", true),
|
||||
new PokemonForm("Complete Forme", "complete", Type.DRAGON, Type.GROUND, 4.5, 610, Abilities.POWER_CONSTRUCT, Abilities.NONE, Abilities.NONE, 708, 216, 100, 121, 91, 95, 85, 3, 0, 300),
|
||||
new PokemonForm("Complete Forme (50% PC)", "complete", Type.DRAGON, Type.GROUND, 4.5, 610, Abilities.POWER_CONSTRUCT, Abilities.NONE, Abilities.NONE, 708, 216, 100, 121, 91, 95, 85, 3, 0, 300),
|
||||
new PokemonForm("Complete Forme (10% PC)", "10-complete", Type.DRAGON, Type.GROUND, 4.5, 610, Abilities.POWER_CONSTRUCT, Abilities.NONE, Abilities.NONE, 708, 216, 100, 121, 91, 95, 85, 3, 0, 300, false, "complete"),
|
||||
),
|
||||
new PokemonSpecies(Species.DIANCIE, 6, false, false, true, "Jewel Pokémon", Type.ROCK, Type.FAIRY, 0.7, 8.8, Abilities.CLEAR_BODY, Abilities.NONE, Abilities.NONE, 600, 50, 100, 150, 100, 150, 50, 3, 50, 300, GrowthRate.SLOW, null, false, true,
|
||||
new PokemonForm("Normal", "", Type.ROCK, Type.FAIRY, 0.7, 8.8, Abilities.CLEAR_BODY, Abilities.NONE, Abilities.NONE, 600, 50, 100, 150, 100, 150, 50, 3, 50, 300, false, null, true),
|
||||
|
|
|
@ -26,20 +26,20 @@ export class Status {
|
|||
|
||||
function getStatusEffectMessageKey(statusEffect: StatusEffect | undefined): string {
|
||||
switch (statusEffect) {
|
||||
case StatusEffect.POISON:
|
||||
return "statusEffect:poison";
|
||||
case StatusEffect.TOXIC:
|
||||
return "statusEffect:toxic";
|
||||
case StatusEffect.PARALYSIS:
|
||||
return "statusEffect:paralysis";
|
||||
case StatusEffect.SLEEP:
|
||||
return "statusEffect:sleep";
|
||||
case StatusEffect.FREEZE:
|
||||
return "statusEffect:freeze";
|
||||
case StatusEffect.BURN:
|
||||
return "statusEffect:burn";
|
||||
default:
|
||||
return "statusEffect:none";
|
||||
case StatusEffect.POISON:
|
||||
return "statusEffect:poison";
|
||||
case StatusEffect.TOXIC:
|
||||
return "statusEffect:toxic";
|
||||
case StatusEffect.PARALYSIS:
|
||||
return "statusEffect:paralysis";
|
||||
case StatusEffect.SLEEP:
|
||||
return "statusEffect:sleep";
|
||||
case StatusEffect.FREEZE:
|
||||
return "statusEffect:freeze";
|
||||
case StatusEffect.BURN:
|
||||
return "statusEffect:burn";
|
||||
default:
|
||||
return "statusEffect:none";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,14 +90,14 @@ export function getStatusEffectDescriptor(statusEffect: StatusEffect): string {
|
|||
|
||||
export function getStatusEffectCatchRateMultiplier(statusEffect: StatusEffect): number {
|
||||
switch (statusEffect) {
|
||||
case StatusEffect.POISON:
|
||||
case StatusEffect.TOXIC:
|
||||
case StatusEffect.PARALYSIS:
|
||||
case StatusEffect.BURN:
|
||||
return 1.5;
|
||||
case StatusEffect.SLEEP:
|
||||
case StatusEffect.FREEZE:
|
||||
return 2.5;
|
||||
case StatusEffect.POISON:
|
||||
case StatusEffect.TOXIC:
|
||||
case StatusEffect.PARALYSIS:
|
||||
case StatusEffect.BURN:
|
||||
return 1.5;
|
||||
case StatusEffect.SLEEP:
|
||||
case StatusEffect.FREEZE:
|
||||
return 2.5;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -34,21 +34,21 @@ export class Terrain {
|
|||
|
||||
getAttackTypeMultiplier(attackType: Type): number {
|
||||
switch (this.terrainType) {
|
||||
case TerrainType.ELECTRIC:
|
||||
if (attackType === Type.ELECTRIC) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
case TerrainType.GRASSY:
|
||||
if (attackType === Type.GRASS) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
case TerrainType.PSYCHIC:
|
||||
if (attackType === Type.PSYCHIC) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
case TerrainType.ELECTRIC:
|
||||
if (attackType === Type.ELECTRIC) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
case TerrainType.GRASSY:
|
||||
if (attackType === Type.GRASS) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
case TerrainType.PSYCHIC:
|
||||
if (attackType === Type.PSYCHIC) {
|
||||
return 1.3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -56,13 +56,13 @@ export class Terrain {
|
|||
|
||||
isMoveTerrainCancelled(user: Pokemon, targets: BattlerIndex[], move: Move): boolean {
|
||||
switch (this.terrainType) {
|
||||
case TerrainType.PSYCHIC:
|
||||
if (!move.hasAttr(ProtectAttr)) {
|
||||
const priority = new Utils.IntegerHolder(move.priority);
|
||||
applyAbAttrs(ChangeMovePriorityAbAttr, user, null, false, move, priority);
|
||||
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
||||
return priority.value > 0 && user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded());
|
||||
}
|
||||
case TerrainType.PSYCHIC:
|
||||
if (!move.hasAttr(ProtectAttr)) {
|
||||
const priority = new Utils.IntegerHolder(move.priority);
|
||||
applyAbAttrs(ChangeMovePriorityAbAttr, user, null, false, move, priority);
|
||||
// Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain
|
||||
return priority.value > 0 && user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -71,14 +71,14 @@ export class Terrain {
|
|||
|
||||
export function getTerrainName(terrainType: TerrainType): string {
|
||||
switch (terrainType) {
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:misty");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electric");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassy");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychic");
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:misty");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electric");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassy");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychic");
|
||||
}
|
||||
|
||||
return "";
|
||||
|
@ -87,14 +87,14 @@ export function getTerrainName(terrainType: TerrainType): string {
|
|||
|
||||
export function getTerrainColor(terrainType: TerrainType): [ integer, integer, integer ] {
|
||||
switch (terrainType) {
|
||||
case TerrainType.MISTY:
|
||||
return [ 232, 136, 200 ];
|
||||
case TerrainType.ELECTRIC:
|
||||
return [ 248, 248, 120 ];
|
||||
case TerrainType.GRASSY:
|
||||
return [ 120, 200, 80 ];
|
||||
case TerrainType.PSYCHIC:
|
||||
return [ 160, 64, 160 ];
|
||||
case TerrainType.MISTY:
|
||||
return [ 232, 136, 200 ];
|
||||
case TerrainType.ELECTRIC:
|
||||
return [ 248, 248, 120 ];
|
||||
case TerrainType.GRASSY:
|
||||
return [ 120, 200, 80 ];
|
||||
case TerrainType.PSYCHIC:
|
||||
return [ 160, 64, 160 ];
|
||||
}
|
||||
|
||||
return [ 0, 0, 0 ];
|
||||
|
|
|
@ -299,65 +299,65 @@ export class TrainerConfig {
|
|||
getDerivedType(trainerTypeToDeriveFrom: TrainerType | null = null): TrainerType {
|
||||
let trainerType = trainerTypeToDeriveFrom ? trainerTypeToDeriveFrom : this.trainerType;
|
||||
switch (trainerType) {
|
||||
case TrainerType.RIVAL_2:
|
||||
case TrainerType.RIVAL_3:
|
||||
case TrainerType.RIVAL_4:
|
||||
case TrainerType.RIVAL_5:
|
||||
case TrainerType.RIVAL_6:
|
||||
trainerType = TrainerType.RIVAL;
|
||||
break;
|
||||
case TrainerType.LANCE_CHAMPION:
|
||||
trainerType = TrainerType.LANCE;
|
||||
break;
|
||||
case TrainerType.LARRY_ELITE:
|
||||
trainerType = TrainerType.LARRY;
|
||||
break;
|
||||
case TrainerType.ROCKET_BOSS_GIOVANNI_1:
|
||||
case TrainerType.ROCKET_BOSS_GIOVANNI_2:
|
||||
trainerType = TrainerType.GIOVANNI;
|
||||
break;
|
||||
case TrainerType.MAXIE_2:
|
||||
trainerType = TrainerType.MAXIE;
|
||||
break;
|
||||
case TrainerType.ARCHIE_2:
|
||||
trainerType = TrainerType.ARCHIE;
|
||||
break;
|
||||
case TrainerType.CYRUS_2:
|
||||
trainerType = TrainerType.CYRUS;
|
||||
break;
|
||||
case TrainerType.GHETSIS_2:
|
||||
trainerType = TrainerType.GHETSIS;
|
||||
break;
|
||||
case TrainerType.LYSANDRE_2:
|
||||
trainerType = TrainerType.LYSANDRE;
|
||||
break;
|
||||
case TrainerType.LUSAMINE_2:
|
||||
trainerType = TrainerType.LUSAMINE;
|
||||
break;
|
||||
case TrainerType.GUZMA_2:
|
||||
trainerType = TrainerType.GUZMA;
|
||||
break;
|
||||
case TrainerType.ROSE_2:
|
||||
trainerType = TrainerType.ROSE;
|
||||
break;
|
||||
case TrainerType.PENNY_2:
|
||||
trainerType = TrainerType.PENNY;
|
||||
break;
|
||||
case TrainerType.MARNIE_ELITE:
|
||||
trainerType = TrainerType.MARNIE;
|
||||
break;
|
||||
case TrainerType.NESSA_ELITE:
|
||||
trainerType = TrainerType.NESSA;
|
||||
break;
|
||||
case TrainerType.BEA_ELITE:
|
||||
trainerType = TrainerType.BEA;
|
||||
break;
|
||||
case TrainerType.ALLISTER_ELITE:
|
||||
trainerType = TrainerType.ALLISTER;
|
||||
break;
|
||||
case TrainerType.RAIHAN_ELITE:
|
||||
trainerType = TrainerType.RAIHAN;
|
||||
break;
|
||||
case TrainerType.RIVAL_2:
|
||||
case TrainerType.RIVAL_3:
|
||||
case TrainerType.RIVAL_4:
|
||||
case TrainerType.RIVAL_5:
|
||||
case TrainerType.RIVAL_6:
|
||||
trainerType = TrainerType.RIVAL;
|
||||
break;
|
||||
case TrainerType.LANCE_CHAMPION:
|
||||
trainerType = TrainerType.LANCE;
|
||||
break;
|
||||
case TrainerType.LARRY_ELITE:
|
||||
trainerType = TrainerType.LARRY;
|
||||
break;
|
||||
case TrainerType.ROCKET_BOSS_GIOVANNI_1:
|
||||
case TrainerType.ROCKET_BOSS_GIOVANNI_2:
|
||||
trainerType = TrainerType.GIOVANNI;
|
||||
break;
|
||||
case TrainerType.MAXIE_2:
|
||||
trainerType = TrainerType.MAXIE;
|
||||
break;
|
||||
case TrainerType.ARCHIE_2:
|
||||
trainerType = TrainerType.ARCHIE;
|
||||
break;
|
||||
case TrainerType.CYRUS_2:
|
||||
trainerType = TrainerType.CYRUS;
|
||||
break;
|
||||
case TrainerType.GHETSIS_2:
|
||||
trainerType = TrainerType.GHETSIS;
|
||||
break;
|
||||
case TrainerType.LYSANDRE_2:
|
||||
trainerType = TrainerType.LYSANDRE;
|
||||
break;
|
||||
case TrainerType.LUSAMINE_2:
|
||||
trainerType = TrainerType.LUSAMINE;
|
||||
break;
|
||||
case TrainerType.GUZMA_2:
|
||||
trainerType = TrainerType.GUZMA;
|
||||
break;
|
||||
case TrainerType.ROSE_2:
|
||||
trainerType = TrainerType.ROSE;
|
||||
break;
|
||||
case TrainerType.PENNY_2:
|
||||
trainerType = TrainerType.PENNY;
|
||||
break;
|
||||
case TrainerType.MARNIE_ELITE:
|
||||
trainerType = TrainerType.MARNIE;
|
||||
break;
|
||||
case TrainerType.NESSA_ELITE:
|
||||
trainerType = TrainerType.NESSA;
|
||||
break;
|
||||
case TrainerType.BEA_ELITE:
|
||||
trainerType = TrainerType.BEA;
|
||||
break;
|
||||
case TrainerType.ALLISTER_ELITE:
|
||||
trainerType = TrainerType.ALLISTER;
|
||||
break;
|
||||
case TrainerType.RAIHAN_ELITE:
|
||||
trainerType = TrainerType.RAIHAN;
|
||||
break;
|
||||
}
|
||||
|
||||
return trainerType;
|
||||
|
@ -564,104 +564,104 @@ export class TrainerConfig {
|
|||
speciesPoolPerEvilTeamAdmin(team): TrainerTierPools {
|
||||
team = team.toLowerCase();
|
||||
switch (team) {
|
||||
case "rocket": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.RATTATA, Species.KOFFING, Species.EKANS, Species.ZUBAT, Species.MAGIKARP, Species.HOUNDOUR, Species.ONIX, Species.CUBONE, Species.GROWLITHE, Species.MURKROW, Species.GASTLY, Species.EXEGGCUTE, Species.VOLTORB, Species.DROWZEE, Species.VILEPLUME ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PORYGON, Species.MANKEY, Species.MAGNEMITE, Species.ALOLA_SANDSHREW, Species.ALOLA_MEOWTH, Species.ALOLA_GRIMER, Species.ALOLA_GEODUDE, Species.PALDEA_TAUROS, Species.OMANYTE, Species.KABUTO, Species.MAGBY, Species.ELEKID ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DRATINI, Species.LARVITAR ]
|
||||
};
|
||||
}
|
||||
case "magma": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.GROWLITHE, Species.SLUGMA, Species.SOLROCK, Species.HIPPOPOTAS, Species.BALTOY, Species.ROLYCOLY, Species.GLIGAR, Species.TORKOAL, Species.HOUNDOUR, Species.MAGBY ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.TRAPINCH, Species.SILICOBRA, Species.RHYHORN, Species.ANORITH, Species.LILEEP, Species.HISUI_GROWLITHE, Species.TURTONATOR, Species.ARON, Species.TOEDSCOOL ],
|
||||
[TrainerPoolTier.RARE]: [ Species.CAPSAKID, Species.CHARCADET ]
|
||||
};
|
||||
}
|
||||
case "aqua": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.CORPHISH, Species.SPHEAL, Species.CLAMPERL, Species.CHINCHOU, Species.WOOPER, Species.WINGULL, Species.TENTACOOL, Species.AZURILL, Species.LOTAD, Species.WAILMER, Species.REMORAID, Species.BARBOACH ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.MANTYKE, Species.HISUI_QWILFISH, Species.ARROKUDA, Species.DHELMISE, Species.CLOBBOPUS, Species.FEEBAS, Species.PALDEA_WOOPER, Species.HORSEA, Species.SKRELP ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DONDOZO, Species.BASCULEGION ]
|
||||
};
|
||||
}
|
||||
case "galactic": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.BRONZOR, Species.SWINUB, Species.YANMA, Species.LICKITUNG, Species.TANGELA, Species.MAGBY, Species.ELEKID, Species.SKORUPI, Species.ZUBAT, Species.MURKROW, Species.MAGIKARP, Species.VOLTORB ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.HISUI_GROWLITHE, Species.HISUI_QWILFISH, Species.SNEASEL, Species.DUSKULL, Species.ROTOM, Species.HISUI_VOLTORB, Species.GLIGAR, Species.ABRA ],
|
||||
[TrainerPoolTier.RARE]: [ Species.URSALUNA, Species.HISUI_LILLIGANT, Species.SPIRITOMB, Species.HISUI_SNEASEL ]
|
||||
};
|
||||
}
|
||||
case "plasma": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.YAMASK, Species.ROGGENROLA, Species.JOLTIK, Species.TYMPOLE, Species.FRILLISH, Species.FERROSEED, Species.SANDILE, Species.TIMBURR, Species.DARUMAKA, Species.FOONGUS, Species.CUBCHOO, Species.VANILLITE ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PAWNIARD, Species.VULLABY, Species.ZORUA, Species.DRILBUR, Species.KLINK, Species.TYNAMO, Species.GALAR_DARUMAKA, Species.GOLETT, Species.MIENFOO, Species.DURANT, Species.SIGILYPH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.HISUI_ZORUA, Species.AXEW, Species.DEINO, Species.HISUI_BRAVIARY ]
|
||||
};
|
||||
}
|
||||
case "flare": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.FLETCHLING, Species.LITLEO, Species.INKAY, Species.FOONGUS, Species.HELIOPTILE, Species.ELECTRIKE, Species.SKORUPI, Species.PURRLOIN, Species.CLAWITZER, Species.PANCHAM, Species.ESPURR, Species.BUNNELBY ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.LITWICK, Species.SNEASEL, Species.PUMPKABOO, Species.PHANTUMP, Species.HONEDGE, Species.BINACLE, Species.HOUNDOUR, Species.SKRELP, Species.SLIGGOO ],
|
||||
[TrainerPoolTier.RARE]: [ Species.NOIBAT, Species.HISUI_AVALUGG, Species.HISUI_SLIGGOO ]
|
||||
};
|
||||
}
|
||||
case "aether": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.BRUXISH, Species.SLOWPOKE, Species.BALTOY, Species.EXEGGCUTE, Species.ABRA, Species.ALOLA_RAICHU, Species.ELGYEM, Species.NATU, Species.BLIPBUG, Species.GIRAFARIG, Species.ORANGURU ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GALAR_SLOWPOKE, Species.MEDITITE, Species.BELDUM, Species.HATENNA, Species.INKAY, Species.RALTS, Species.GALAR_MR_MIME ],
|
||||
[TrainerPoolTier.RARE]: [ Species.ARMAROUGE, Species.HISUI_BRAVIARY, Species.PORYGON ]
|
||||
};
|
||||
}
|
||||
case "skull": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.MAREANIE, Species.ALOLA_GRIMER, Species.GASTLY, Species.ZUBAT, Species.FOMANTIS, Species.VENIPEDE, Species.BUDEW, Species.KOFFING, Species.STUNKY, Species.CROAGUNK, Species.NIDORAN_F ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GALAR_SLOWPOKE, Species.SKORUPI, Species.PALDEA_WOOPER, Species.VULLABY, Species.HISUI_QWILFISH, Species.GLIMMET ],
|
||||
[TrainerPoolTier.RARE]: [ Species.SKRELP, Species.HISUI_SNEASEL ]
|
||||
};
|
||||
}
|
||||
case "macro": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.HATENNA, Species.FEEBAS, Species.BOUNSWEET, Species.SALANDIT, Species.GALAR_PONYTA, Species.GOTHITA, Species.FROSLASS, Species.VULPIX, Species.FRILLISH, Species.ODDISH, Species.SINISTEA ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.VULLABY, Species.MAREANIE, Species.ALOLA_VULPIX, Species.TOGEPI, Species.GALAR_CORSOLA, Species.APPLIN ],
|
||||
[TrainerPoolTier.RARE]: [ Species.TINKATINK, Species.HISUI_LILLIGANT ]
|
||||
};
|
||||
}
|
||||
case "star_1": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.MURKROW, Species.SEEDOT, Species.CACNEA, Species.STUNKY, Species.SANDILE, Species.NYMBLE, Species.MASCHIFF, Species.GALAR_ZIGZAGOON ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.UMBREON, Species.SNEASEL, Species.CORPHISH, Species.ZORUA, Species.INKAY, Species.BOMBIRDIER ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DEINO, Species.SPRIGATITO ]
|
||||
};
|
||||
}
|
||||
case "star_2": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.GROWLITHE, Species.HOUNDOUR, Species.NUMEL, Species.LITWICK, Species.FLETCHLING, Species.LITLEO, Species.ROLYCOLY, Species.CAPSAKID ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PONYTA, Species.FLAREON, Species.MAGBY, Species.TORKOAL, Species.SALANDIT, Species.TURTONATOR ],
|
||||
[TrainerPoolTier.RARE]: [ Species.LARVESTA, Species.FUECOCO ]
|
||||
};
|
||||
}
|
||||
case "star_3": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.ZUBAT, Species.GRIMER, Species.STUNKY, Species.FOONGUS, Species.MAREANIE, Species.TOXEL, Species.SHROODLE, Species.PALDEA_WOOPER ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GASTLY, Species.SEVIPER, Species.SKRELP, Species.ALOLA_GRIMER, Species.GALAR_SLOWPOKE, Species.HISUI_QWILFISH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.GLIMMET, Species.BULBASAUR ]
|
||||
};
|
||||
}
|
||||
case "star_4": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.CLEFFA, Species.IGGLYBUFF, Species.AZURILL, Species.COTTONEE, Species.FLABEBE, Species.HATENNA, Species.IMPIDIMP, Species.TINKATINK ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.TOGEPI, Species.GARDEVOIR, Species.SYLVEON, Species.KLEFKI, Species.MIMIKYU, Species.ALOLA_VULPIX ],
|
||||
[TrainerPoolTier.RARE]: [ Species.GALAR_PONYTA, Species.POPPLIO ]
|
||||
};
|
||||
}
|
||||
case "star_5": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.SHROOMISH, Species.MAKUHITA, Species.MEDITITE, Species.CROAGUNK, Species.SCRAGGY, Species.MIENFOO, Species.PAWMI, Species.PALDEA_TAUROS ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.RIOLU, Species.TIMBURR, Species.HAWLUCHA, Species.PASSIMIAN, Species.FALINKS, Species.FLAMIGO ],
|
||||
[TrainerPoolTier.RARE]: [ Species.JANGMO_O, Species.QUAXLY ]
|
||||
};
|
||||
}
|
||||
case "rocket": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.RATTATA, Species.KOFFING, Species.EKANS, Species.ZUBAT, Species.MAGIKARP, Species.HOUNDOUR, Species.ONIX, Species.CUBONE, Species.GROWLITHE, Species.MURKROW, Species.GASTLY, Species.EXEGGCUTE, Species.VOLTORB, Species.DROWZEE, Species.VILEPLUME ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PORYGON, Species.MANKEY, Species.MAGNEMITE, Species.ALOLA_SANDSHREW, Species.ALOLA_MEOWTH, Species.ALOLA_GRIMER, Species.ALOLA_GEODUDE, Species.PALDEA_TAUROS, Species.OMANYTE, Species.KABUTO, Species.MAGBY, Species.ELEKID ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DRATINI, Species.LARVITAR ]
|
||||
};
|
||||
}
|
||||
case "magma": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.GROWLITHE, Species.SLUGMA, Species.SOLROCK, Species.HIPPOPOTAS, Species.BALTOY, Species.ROLYCOLY, Species.GLIGAR, Species.TORKOAL, Species.HOUNDOUR, Species.MAGBY ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.TRAPINCH, Species.SILICOBRA, Species.RHYHORN, Species.ANORITH, Species.LILEEP, Species.HISUI_GROWLITHE, Species.TURTONATOR, Species.ARON, Species.TOEDSCOOL ],
|
||||
[TrainerPoolTier.RARE]: [ Species.CAPSAKID, Species.CHARCADET ]
|
||||
};
|
||||
}
|
||||
case "aqua": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.CORPHISH, Species.SPHEAL, Species.CLAMPERL, Species.CHINCHOU, Species.WOOPER, Species.WINGULL, Species.TENTACOOL, Species.AZURILL, Species.LOTAD, Species.WAILMER, Species.REMORAID, Species.BARBOACH ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.MANTYKE, Species.HISUI_QWILFISH, Species.ARROKUDA, Species.DHELMISE, Species.CLOBBOPUS, Species.FEEBAS, Species.PALDEA_WOOPER, Species.HORSEA, Species.SKRELP ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DONDOZO, Species.BASCULEGION ]
|
||||
};
|
||||
}
|
||||
case "galactic": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.BRONZOR, Species.SWINUB, Species.YANMA, Species.LICKITUNG, Species.TANGELA, Species.MAGBY, Species.ELEKID, Species.SKORUPI, Species.ZUBAT, Species.MURKROW, Species.MAGIKARP, Species.VOLTORB ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.HISUI_GROWLITHE, Species.HISUI_QWILFISH, Species.SNEASEL, Species.DUSKULL, Species.ROTOM, Species.HISUI_VOLTORB, Species.GLIGAR, Species.ABRA ],
|
||||
[TrainerPoolTier.RARE]: [ Species.URSALUNA, Species.HISUI_LILLIGANT, Species.SPIRITOMB, Species.HISUI_SNEASEL ]
|
||||
};
|
||||
}
|
||||
case "plasma": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.YAMASK, Species.ROGGENROLA, Species.JOLTIK, Species.TYMPOLE, Species.FRILLISH, Species.FERROSEED, Species.SANDILE, Species.TIMBURR, Species.DARUMAKA, Species.FOONGUS, Species.CUBCHOO, Species.VANILLITE ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PAWNIARD, Species.VULLABY, Species.ZORUA, Species.DRILBUR, Species.KLINK, Species.TYNAMO, Species.GALAR_DARUMAKA, Species.GOLETT, Species.MIENFOO, Species.DURANT, Species.SIGILYPH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.HISUI_ZORUA, Species.AXEW, Species.DEINO, Species.HISUI_BRAVIARY ]
|
||||
};
|
||||
}
|
||||
case "flare": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.FLETCHLING, Species.LITLEO, Species.INKAY, Species.FOONGUS, Species.HELIOPTILE, Species.ELECTRIKE, Species.SKORUPI, Species.PURRLOIN, Species.CLAWITZER, Species.PANCHAM, Species.ESPURR, Species.BUNNELBY ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.LITWICK, Species.SNEASEL, Species.PUMPKABOO, Species.PHANTUMP, Species.HONEDGE, Species.BINACLE, Species.HOUNDOUR, Species.SKRELP, Species.SLIGGOO ],
|
||||
[TrainerPoolTier.RARE]: [ Species.NOIBAT, Species.HISUI_AVALUGG, Species.HISUI_SLIGGOO ]
|
||||
};
|
||||
}
|
||||
case "aether": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.BRUXISH, Species.SLOWPOKE, Species.BALTOY, Species.EXEGGCUTE, Species.ABRA, Species.ALOLA_RAICHU, Species.ELGYEM, Species.NATU, Species.BLIPBUG, Species.GIRAFARIG, Species.ORANGURU ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GALAR_SLOWPOKE, Species.MEDITITE, Species.BELDUM, Species.HATENNA, Species.INKAY, Species.RALTS, Species.GALAR_MR_MIME ],
|
||||
[TrainerPoolTier.RARE]: [ Species.ARMAROUGE, Species.HISUI_BRAVIARY, Species.PORYGON ]
|
||||
};
|
||||
}
|
||||
case "skull": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.MAREANIE, Species.ALOLA_GRIMER, Species.GASTLY, Species.ZUBAT, Species.FOMANTIS, Species.VENIPEDE, Species.BUDEW, Species.KOFFING, Species.STUNKY, Species.CROAGUNK, Species.NIDORAN_F ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GALAR_SLOWPOKE, Species.SKORUPI, Species.PALDEA_WOOPER, Species.VULLABY, Species.HISUI_QWILFISH, Species.GLIMMET ],
|
||||
[TrainerPoolTier.RARE]: [ Species.SKRELP, Species.HISUI_SNEASEL ]
|
||||
};
|
||||
}
|
||||
case "macro": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.HATENNA, Species.FEEBAS, Species.BOUNSWEET, Species.SALANDIT, Species.GALAR_PONYTA, Species.GOTHITA, Species.FROSLASS, Species.VULPIX, Species.FRILLISH, Species.ODDISH, Species.SINISTEA ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.VULLABY, Species.MAREANIE, Species.ALOLA_VULPIX, Species.TOGEPI, Species.GALAR_CORSOLA, Species.APPLIN ],
|
||||
[TrainerPoolTier.RARE]: [ Species.TINKATINK, Species.HISUI_LILLIGANT ]
|
||||
};
|
||||
}
|
||||
case "star_1": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.MURKROW, Species.SEEDOT, Species.CACNEA, Species.STUNKY, Species.SANDILE, Species.NYMBLE, Species.MASCHIFF, Species.GALAR_ZIGZAGOON ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.UMBREON, Species.SNEASEL, Species.CORPHISH, Species.ZORUA, Species.INKAY, Species.BOMBIRDIER ],
|
||||
[TrainerPoolTier.RARE]: [ Species.DEINO, Species.SPRIGATITO ]
|
||||
};
|
||||
}
|
||||
case "star_2": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.GROWLITHE, Species.HOUNDOUR, Species.NUMEL, Species.LITWICK, Species.FLETCHLING, Species.LITLEO, Species.ROLYCOLY, Species.CAPSAKID ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.PONYTA, Species.FLAREON, Species.MAGBY, Species.TORKOAL, Species.SALANDIT, Species.TURTONATOR ],
|
||||
[TrainerPoolTier.RARE]: [ Species.LARVESTA, Species.FUECOCO ]
|
||||
};
|
||||
}
|
||||
case "star_3": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.ZUBAT, Species.GRIMER, Species.STUNKY, Species.FOONGUS, Species.MAREANIE, Species.TOXEL, Species.SHROODLE, Species.PALDEA_WOOPER ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.GASTLY, Species.SEVIPER, Species.SKRELP, Species.ALOLA_GRIMER, Species.GALAR_SLOWPOKE, Species.HISUI_QWILFISH ],
|
||||
[TrainerPoolTier.RARE]: [ Species.GLIMMET, Species.BULBASAUR ]
|
||||
};
|
||||
}
|
||||
case "star_4": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.CLEFFA, Species.IGGLYBUFF, Species.AZURILL, Species.COTTONEE, Species.FLABEBE, Species.HATENNA, Species.IMPIDIMP, Species.TINKATINK ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.TOGEPI, Species.GARDEVOIR, Species.SYLVEON, Species.KLEFKI, Species.MIMIKYU, Species.ALOLA_VULPIX ],
|
||||
[TrainerPoolTier.RARE]: [ Species.GALAR_PONYTA, Species.POPPLIO ]
|
||||
};
|
||||
}
|
||||
case "star_5": {
|
||||
return {
|
||||
[TrainerPoolTier.COMMON]: [ Species.SHROOMISH, Species.MAKUHITA, Species.MEDITITE, Species.CROAGUNK, Species.SCRAGGY, Species.MIENFOO, Species.PAWMI, Species.PALDEA_TAUROS ],
|
||||
[TrainerPoolTier.UNCOMMON]: [ Species.RIOLU, Species.TIMBURR, Species.HAWLUCHA, Species.PASSIMIAN, Species.FALINKS, Species.FLAMIGO ],
|
||||
[TrainerPoolTier.RARE]: [ Species.JANGMO_O, Species.QUAXLY ]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
console.warn(`Evil team admin for ${team} not found. Returning empty species pools.`);
|
||||
|
|
628
src/data/type.ts
|
@ -29,260 +29,260 @@ export function getTypeDamageMultiplier(attackType: Type, defType: Type): TypeDa
|
|||
}
|
||||
|
||||
switch (defType) {
|
||||
case Type.NORMAL:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
return 2;
|
||||
case Type.GHOST:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FIGHTING:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.PSYCHIC:
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.ROCK:
|
||||
case Type.BUG:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FLYING:
|
||||
switch (attackType) {
|
||||
case Type.ROCK:
|
||||
case Type.ELECTRIC:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.GRASS:
|
||||
return 0.5;
|
||||
case Type.GROUND:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.POISON:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
case Type.PSYCHIC:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
case Type.GRASS:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GROUND:
|
||||
switch (attackType) {
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.POISON:
|
||||
case Type.ROCK:
|
||||
return 0.5;
|
||||
case Type.ELECTRIC:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ROCK:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.GROUND:
|
||||
case Type.STEEL:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
return 2;
|
||||
case Type.NORMAL:
|
||||
case Type.FLYING:
|
||||
case Type.POISON:
|
||||
case Type.FIRE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.BUG:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.ROCK:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
return 2;
|
||||
case Type.GHOST:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FIGHTING:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.PSYCHIC:
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.ROCK:
|
||||
case Type.BUG:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FLYING:
|
||||
switch (attackType) {
|
||||
case Type.ROCK:
|
||||
case Type.ELECTRIC:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.GRASS:
|
||||
return 0.5;
|
||||
case Type.GROUND:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.POISON:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
case Type.PSYCHIC:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
case Type.GRASS:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GROUND:
|
||||
case Type.GRASS:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GHOST:
|
||||
switch (attackType) {
|
||||
switch (attackType) {
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.POISON:
|
||||
case Type.ROCK:
|
||||
return 0.5;
|
||||
case Type.ELECTRIC:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ROCK:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.GROUND:
|
||||
case Type.STEEL:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
return 2;
|
||||
case Type.NORMAL:
|
||||
case Type.FLYING:
|
||||
case Type.POISON:
|
||||
case Type.FIRE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.BUG:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.ROCK:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.GROUND:
|
||||
case Type.GRASS:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GHOST:
|
||||
case Type.DARK:
|
||||
return 2;
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
return 0.5;
|
||||
case Type.NORMAL:
|
||||
case Type.FIGHTING:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.STEEL:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.GROUND:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
case Type.NORMAL:
|
||||
case Type.FLYING:
|
||||
case Type.ROCK:
|
||||
case Type.BUG:
|
||||
switch (attackType) {
|
||||
case Type.GHOST:
|
||||
case Type.DARK:
|
||||
return 2;
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
return 0.5;
|
||||
case Type.NORMAL:
|
||||
case Type.FIGHTING:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.STEEL:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.GROUND:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
case Type.NORMAL:
|
||||
case Type.FLYING:
|
||||
case Type.ROCK:
|
||||
case Type.BUG:
|
||||
case Type.STEEL:
|
||||
case Type.GRASS:
|
||||
case Type.PSYCHIC:
|
||||
case Type.ICE:
|
||||
case Type.DRAGON:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
case Type.POISON:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FIRE:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
case Type.ROCK:
|
||||
case Type.WATER:
|
||||
return 2;
|
||||
case Type.BUG:
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
case Type.GRASS:
|
||||
case Type.ICE:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.WATER:
|
||||
switch (attackType) {
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 2;
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
case Type.WATER:
|
||||
case Type.ICE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GRASS:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
case Type.FIRE:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.GROUND:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ELECTRIC:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
return 2;
|
||||
case Type.FLYING:
|
||||
case Type.STEEL:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.PSYCHIC:
|
||||
switch (attackType) {
|
||||
case Type.BUG:
|
||||
case Type.GHOST:
|
||||
case Type.DARK:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.PSYCHIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ICE:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.ROCK:
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
case Type.ICE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.DRAGON:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
case Type.POISON:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FIRE:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
case Type.ROCK:
|
||||
case Type.WATER:
|
||||
return 2;
|
||||
case Type.BUG:
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
case Type.GRASS:
|
||||
case Type.ICE:
|
||||
case Type.FAIRY:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.WATER:
|
||||
switch (attackType) {
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 2;
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
case Type.WATER:
|
||||
case Type.ICE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.GRASS:
|
||||
switch (attackType) {
|
||||
case Type.FLYING:
|
||||
case Type.POISON:
|
||||
case Type.BUG:
|
||||
case Type.FIRE:
|
||||
case Type.ICE:
|
||||
return 2;
|
||||
case Type.GROUND:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ELECTRIC:
|
||||
switch (attackType) {
|
||||
case Type.GROUND:
|
||||
return 2;
|
||||
case Type.FLYING:
|
||||
case Type.STEEL:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.PSYCHIC:
|
||||
switch (attackType) {
|
||||
case Type.BUG:
|
||||
case Type.GHOST:
|
||||
switch (attackType) {
|
||||
case Type.ICE:
|
||||
case Type.DRAGON:
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.FIRE:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.DARK:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.PSYCHIC:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.ICE:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.ROCK:
|
||||
case Type.STEEL:
|
||||
case Type.FIRE:
|
||||
return 2;
|
||||
case Type.ICE:
|
||||
return 0.5;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.DRAGON:
|
||||
switch (attackType) {
|
||||
case Type.ICE:
|
||||
case Type.DRAGON:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.GHOST:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
case Type.PSYCHIC:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.FIRE:
|
||||
case Type.WATER:
|
||||
case Type.GRASS:
|
||||
case Type.ELECTRIC:
|
||||
return 0.5;
|
||||
default:
|
||||
switch (attackType) {
|
||||
case Type.POISON:
|
||||
case Type.STEEL:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
case Type.DRAGON:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.STELLAR:
|
||||
return 1;
|
||||
}
|
||||
case Type.DARK:
|
||||
switch (attackType) {
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.FAIRY:
|
||||
return 2;
|
||||
case Type.GHOST:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
case Type.PSYCHIC:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.FAIRY:
|
||||
switch (attackType) {
|
||||
case Type.POISON:
|
||||
case Type.STEEL:
|
||||
return 2;
|
||||
case Type.FIGHTING:
|
||||
case Type.BUG:
|
||||
case Type.DARK:
|
||||
return 0.5;
|
||||
case Type.DRAGON:
|
||||
return 0;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
case Type.STELLAR:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -295,86 +295,86 @@ export function getTypeDamageMultiplier(attackType: Type, defType: Type): TypeDa
|
|||
export function getTypeDamageMultiplierColor(multiplier: TypeDamageMultiplier, side: "defense" | "offense"): string | undefined {
|
||||
if (side === "offense") {
|
||||
switch (multiplier) {
|
||||
case 0:
|
||||
return "#929292";
|
||||
case 0.125:
|
||||
return "#FF5500";
|
||||
case 0.25:
|
||||
return "#FF7400";
|
||||
case 0.5:
|
||||
return "#FE8E00";
|
||||
case 1:
|
||||
return undefined;
|
||||
case 2:
|
||||
return "#4AA500";
|
||||
case 4:
|
||||
return "#4BB400";
|
||||
case 8:
|
||||
return "#52C200";
|
||||
case 0:
|
||||
return "#929292";
|
||||
case 0.125:
|
||||
return "#FF5500";
|
||||
case 0.25:
|
||||
return "#FF7400";
|
||||
case 0.5:
|
||||
return "#FE8E00";
|
||||
case 1:
|
||||
return undefined;
|
||||
case 2:
|
||||
return "#4AA500";
|
||||
case 4:
|
||||
return "#4BB400";
|
||||
case 8:
|
||||
return "#52C200";
|
||||
}
|
||||
} else if (side === "defense") {
|
||||
switch (multiplier) {
|
||||
case 0:
|
||||
return "#B1B100";
|
||||
case 0.125:
|
||||
return "#2DB4FF";
|
||||
case 0.25:
|
||||
return "#00A4FF";
|
||||
case 0.5:
|
||||
return "#0093FF";
|
||||
case 1:
|
||||
return undefined;
|
||||
case 2:
|
||||
return "#FE8E00";
|
||||
case 4:
|
||||
return "#FF7400";
|
||||
case 8:
|
||||
return "#FF5500";
|
||||
case 0:
|
||||
return "#B1B100";
|
||||
case 0.125:
|
||||
return "#2DB4FF";
|
||||
case 0.25:
|
||||
return "#00A4FF";
|
||||
case 0.5:
|
||||
return "#0093FF";
|
||||
case 1:
|
||||
return undefined;
|
||||
case 2:
|
||||
return "#FE8E00";
|
||||
case 4:
|
||||
return "#FF7400";
|
||||
case 8:
|
||||
return "#FF5500";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getTypeRgb(type: Type): [ integer, integer, integer ] {
|
||||
switch (type) {
|
||||
case Type.NORMAL:
|
||||
return [ 168, 168, 120 ];
|
||||
case Type.FIGHTING:
|
||||
return [ 192, 48, 40 ];
|
||||
case Type.FLYING:
|
||||
return [ 168, 144, 240 ];
|
||||
case Type.POISON:
|
||||
return [ 160, 64, 160 ];
|
||||
case Type.GROUND:
|
||||
return [ 224, 192, 104 ];
|
||||
case Type.ROCK:
|
||||
return [ 184, 160, 56 ];
|
||||
case Type.BUG:
|
||||
return [ 168, 184, 32 ];
|
||||
case Type.GHOST:
|
||||
return [ 112, 88, 152 ];
|
||||
case Type.STEEL:
|
||||
return [ 184, 184, 208 ];
|
||||
case Type.FIRE:
|
||||
return [ 240, 128, 48 ];
|
||||
case Type.WATER:
|
||||
return [ 104, 144, 240 ];
|
||||
case Type.GRASS:
|
||||
return [ 120, 200, 80 ];
|
||||
case Type.ELECTRIC:
|
||||
return [ 248, 208, 48 ];
|
||||
case Type.PSYCHIC:
|
||||
return [ 248, 88, 136 ];
|
||||
case Type.ICE:
|
||||
return [ 152, 216, 216 ];
|
||||
case Type.DRAGON:
|
||||
return [ 112, 56, 248 ];
|
||||
case Type.DARK:
|
||||
return [ 112, 88, 72 ];
|
||||
case Type.FAIRY:
|
||||
return [ 232, 136, 200 ];
|
||||
case Type.STELLAR:
|
||||
return [ 255, 255, 255 ];
|
||||
default:
|
||||
return [ 0, 0, 0 ];
|
||||
case Type.NORMAL:
|
||||
return [ 168, 168, 120 ];
|
||||
case Type.FIGHTING:
|
||||
return [ 192, 48, 40 ];
|
||||
case Type.FLYING:
|
||||
return [ 168, 144, 240 ];
|
||||
case Type.POISON:
|
||||
return [ 160, 64, 160 ];
|
||||
case Type.GROUND:
|
||||
return [ 224, 192, 104 ];
|
||||
case Type.ROCK:
|
||||
return [ 184, 160, 56 ];
|
||||
case Type.BUG:
|
||||
return [ 168, 184, 32 ];
|
||||
case Type.GHOST:
|
||||
return [ 112, 88, 152 ];
|
||||
case Type.STEEL:
|
||||
return [ 184, 184, 208 ];
|
||||
case Type.FIRE:
|
||||
return [ 240, 128, 48 ];
|
||||
case Type.WATER:
|
||||
return [ 104, 144, 240 ];
|
||||
case Type.GRASS:
|
||||
return [ 120, 200, 80 ];
|
||||
case Type.ELECTRIC:
|
||||
return [ 248, 208, 48 ];
|
||||
case Type.PSYCHIC:
|
||||
return [ 248, 88, 136 ];
|
||||
case Type.ICE:
|
||||
return [ 152, 216, 216 ];
|
||||
case Type.DRAGON:
|
||||
return [ 112, 56, 248 ];
|
||||
case Type.DARK:
|
||||
return [ 112, 88, 72 ];
|
||||
case Type.FAIRY:
|
||||
return [ 232, 136, 200 ];
|
||||
case Type.STELLAR:
|
||||
return [ 255, 255, 255 ];
|
||||
default:
|
||||
return [ 0, 0, 0 ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,22 +10,22 @@ export const variantColorCache = {};
|
|||
|
||||
export function getVariantTint(variant: Variant): integer {
|
||||
switch (variant) {
|
||||
case 0:
|
||||
return 0xf8c020;
|
||||
case 1:
|
||||
return 0x20f8f0;
|
||||
case 2:
|
||||
return 0xe81048;
|
||||
case 0:
|
||||
return 0xf8c020;
|
||||
case 1:
|
||||
return 0x20f8f0;
|
||||
case 2:
|
||||
return 0xe81048;
|
||||
}
|
||||
}
|
||||
|
||||
export function getVariantIcon(variant: Variant): integer {
|
||||
switch (variant) {
|
||||
case 0:
|
||||
return VariantTier.STANDARD;
|
||||
case 1:
|
||||
return VariantTier.RARE;
|
||||
case 2:
|
||||
return VariantTier.EPIC;
|
||||
case 0:
|
||||
return VariantTier.STANDARD;
|
||||
case 1:
|
||||
return VariantTier.RARE;
|
||||
case 2:
|
||||
return VariantTier.EPIC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,10 @@ export class Weather {
|
|||
|
||||
isImmutable(): boolean {
|
||||
switch (this.weatherType) {
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
case WeatherType.HARSH_SUN:
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return true;
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
case WeatherType.HARSH_SUN:
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -44,9 +44,9 @@ export class Weather {
|
|||
|
||||
isDamaging(): boolean {
|
||||
switch (this.weatherType) {
|
||||
case WeatherType.SANDSTORM:
|
||||
case WeatherType.HAIL:
|
||||
return true;
|
||||
case WeatherType.SANDSTORM:
|
||||
case WeatherType.HAIL:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -54,10 +54,10 @@ export class Weather {
|
|||
|
||||
isTypeDamageImmune(type: Type): boolean {
|
||||
switch (this.weatherType) {
|
||||
case WeatherType.SANDSTORM:
|
||||
return type === Type.GROUND || type === Type.ROCK || type === Type.STEEL;
|
||||
case WeatherType.HAIL:
|
||||
return type === Type.ICE;
|
||||
case WeatherType.SANDSTORM:
|
||||
return type === Type.GROUND || type === Type.ROCK || type === Type.STEEL;
|
||||
case WeatherType.HAIL:
|
||||
return type === Type.ICE;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -65,24 +65,24 @@ export class Weather {
|
|||
|
||||
getAttackTypeMultiplier(attackType: Type): number {
|
||||
switch (this.weatherType) {
|
||||
case WeatherType.SUNNY:
|
||||
case WeatherType.HARSH_SUN:
|
||||
if (attackType === Type.FIRE) {
|
||||
return 1.5;
|
||||
}
|
||||
if (attackType === Type.WATER) {
|
||||
return 0.5;
|
||||
}
|
||||
break;
|
||||
case WeatherType.RAIN:
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
if (attackType === Type.FIRE) {
|
||||
return 0.5;
|
||||
}
|
||||
if (attackType === Type.WATER) {
|
||||
return 1.5;
|
||||
}
|
||||
break;
|
||||
case WeatherType.SUNNY:
|
||||
case WeatherType.HARSH_SUN:
|
||||
if (attackType === Type.FIRE) {
|
||||
return 1.5;
|
||||
}
|
||||
if (attackType === Type.WATER) {
|
||||
return 0.5;
|
||||
}
|
||||
break;
|
||||
case WeatherType.RAIN:
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
if (attackType === Type.FIRE) {
|
||||
return 0.5;
|
||||
}
|
||||
if (attackType === Type.WATER) {
|
||||
return 1.5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -92,10 +92,10 @@ export class Weather {
|
|||
const moveType = user.getMoveType(move);
|
||||
|
||||
switch (this.weatherType) {
|
||||
case WeatherType.HARSH_SUN:
|
||||
return move instanceof AttackMove && moveType === Type.WATER;
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return move instanceof AttackMove && moveType === Type.FIRE;
|
||||
case WeatherType.HARSH_SUN:
|
||||
return move instanceof AttackMove && moveType === Type.WATER;
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return move instanceof AttackMove && moveType === Type.FIRE;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -120,24 +120,24 @@ export class Weather {
|
|||
|
||||
export function getWeatherStartMessage(weatherType: WeatherType): string | null {
|
||||
switch (weatherType) {
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyStartMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainStartMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormStartMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailStartMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowStartMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogStartMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainStartMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunStartMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsStartMessage");
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyStartMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainStartMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormStartMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailStartMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowStartMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogStartMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainStartMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunStartMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsStartMessage");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -145,24 +145,24 @@ export function getWeatherStartMessage(weatherType: WeatherType): string | null
|
|||
|
||||
export function getWeatherLapseMessage(weatherType: WeatherType): string | null {
|
||||
switch (weatherType) {
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyLapseMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainLapseMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormLapseMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailLapseMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowLapseMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogLapseMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainLapseMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunLapseMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsLapseMessage");
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyLapseMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainLapseMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormLapseMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailLapseMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowLapseMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogLapseMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainLapseMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunLapseMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsLapseMessage");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -170,10 +170,10 @@ export function getWeatherLapseMessage(weatherType: WeatherType): string | null
|
|||
|
||||
export function getWeatherDamageMessage(weatherType: WeatherType, pokemon: Pokemon): string | null {
|
||||
switch (weatherType) {
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) });
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) });
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) });
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailDamageMessage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) });
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -181,24 +181,24 @@ export function getWeatherDamageMessage(weatherType: WeatherType, pokemon: Pokem
|
|||
|
||||
export function getWeatherClearMessage(weatherType: WeatherType): string | null {
|
||||
switch (weatherType) {
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyClearMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainClearMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormClearMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailClearMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowClearMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogClearMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainClearMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunClearMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsClearMessage");
|
||||
case WeatherType.SUNNY:
|
||||
return i18next.t("weather:sunnyClearMessage");
|
||||
case WeatherType.RAIN:
|
||||
return i18next.t("weather:rainClearMessage");
|
||||
case WeatherType.SANDSTORM:
|
||||
return i18next.t("weather:sandstormClearMessage");
|
||||
case WeatherType.HAIL:
|
||||
return i18next.t("weather:hailClearMessage");
|
||||
case WeatherType.SNOW:
|
||||
return i18next.t("weather:snowClearMessage");
|
||||
case WeatherType.FOG:
|
||||
return i18next.t("weather:fogClearMessage");
|
||||
case WeatherType.HEAVY_RAIN:
|
||||
return i18next.t("weather:heavyRainClearMessage");
|
||||
case WeatherType.HARSH_SUN:
|
||||
return i18next.t("weather:harshSunClearMessage");
|
||||
case WeatherType.STRONG_WINDS:
|
||||
return i18next.t("weather:strongWindsClearMessage");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -206,33 +206,33 @@ export function getWeatherClearMessage(weatherType: WeatherType): string | null
|
|||
|
||||
export function getTerrainStartMessage(terrainType: TerrainType): string | null {
|
||||
switch (terrainType) {
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:mistyStartMessage");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electricStartMessage");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassyStartMessage");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychicStartMessage");
|
||||
default:
|
||||
console.warn("getTerrainStartMessage not defined. Using default null");
|
||||
return null;
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:mistyStartMessage");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electricStartMessage");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassyStartMessage");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychicStartMessage");
|
||||
default:
|
||||
console.warn("getTerrainStartMessage not defined. Using default null");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getTerrainClearMessage(terrainType: TerrainType): string | null {
|
||||
switch (terrainType) {
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:mistyClearMessage");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electricClearMessage");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassyClearMessage");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychicClearMessage");
|
||||
default:
|
||||
console.warn("getTerrainClearMessage not defined. Using default null");
|
||||
return null;
|
||||
case TerrainType.MISTY:
|
||||
return i18next.t("terrain:mistyClearMessage");
|
||||
case TerrainType.ELECTRIC:
|
||||
return i18next.t("terrain:electricClearMessage");
|
||||
case TerrainType.GRASSY:
|
||||
return i18next.t("terrain:grassyClearMessage");
|
||||
case TerrainType.PSYCHIC:
|
||||
return i18next.t("terrain:psychicClearMessage");
|
||||
default:
|
||||
console.warn("getTerrainClearMessage not defined. Using default null");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,126 +252,126 @@ export function getRandomWeatherType(arena: any /* Importing from arena causes a
|
|||
let weatherPool: WeatherPoolEntry[] = [];
|
||||
const hasSun = arena.getTimeOfDay() < 2;
|
||||
switch (arena.biomeType) {
|
||||
case Biome.GRASS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 7 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 3 });
|
||||
}
|
||||
break;
|
||||
case Biome.TALL_GRASS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 },
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 8 });
|
||||
}
|
||||
break;
|
||||
case Biome.FOREST:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 }
|
||||
];
|
||||
break;
|
||||
case Biome.SEA:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 12 }
|
||||
];
|
||||
break;
|
||||
case Biome.SWAMP:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 4 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.BEACH:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 3 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||
}
|
||||
break;
|
||||
case Biome.LAKE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 10 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.SEABED:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.RAIN, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.BADLANDS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||
}
|
||||
break;
|
||||
case Biome.DESERT:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
break;
|
||||
case Biome.ICE_CAVE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.SNOW, weight: 4 },
|
||||
{ weatherType: WeatherType.HAIL, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.MEADOW:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
case Biome.VOLCANO:
|
||||
weatherPool = [
|
||||
{ weatherType: hasSun ? WeatherType.SUNNY : WeatherType.NONE, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.GRAVEYARD:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.JUNGLE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 2 }
|
||||
];
|
||||
break;
|
||||
case Biome.SNOWY_FOREST:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.SNOW, weight: 7 },
|
||||
{ weatherType: WeatherType.HAIL, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.ISLAND:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 5 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 1 },
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
break;
|
||||
case Biome.GRASS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 7 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 3 });
|
||||
}
|
||||
break;
|
||||
case Biome.TALL_GRASS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 },
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 8 });
|
||||
}
|
||||
break;
|
||||
case Biome.FOREST:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 }
|
||||
];
|
||||
break;
|
||||
case Biome.SEA:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 12 }
|
||||
];
|
||||
break;
|
||||
case Biome.SWAMP:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 4 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.BEACH:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 3 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||
}
|
||||
break;
|
||||
case Biome.LAKE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 10 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 5 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.SEABED:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.RAIN, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.BADLANDS:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||
}
|
||||
break;
|
||||
case Biome.DESERT:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
break;
|
||||
case Biome.ICE_CAVE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.SNOW, weight: 4 },
|
||||
{ weatherType: WeatherType.HAIL, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.MEADOW:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 2 }
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
case Biome.VOLCANO:
|
||||
weatherPool = [
|
||||
{ weatherType: hasSun ? WeatherType.SUNNY : WeatherType.NONE, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.GRAVEYARD:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 3 },
|
||||
{ weatherType: WeatherType.FOG, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.JUNGLE:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 2 }
|
||||
];
|
||||
break;
|
||||
case Biome.SNOWY_FOREST:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.SNOW, weight: 7 },
|
||||
{ weatherType: WeatherType.HAIL, weight: 1 }
|
||||
];
|
||||
break;
|
||||
case Biome.ISLAND:
|
||||
weatherPool = [
|
||||
{ weatherType: WeatherType.NONE, weight: 5 },
|
||||
{ weatherType: WeatherType.RAIN, weight: 1 },
|
||||
];
|
||||
if (hasSun) {
|
||||
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (weatherPool.length > 1) {
|
||||
|
|
|
@ -4,21 +4,21 @@ import * as Utils from "../utils";
|
|||
|
||||
export function addPokeballOpenParticles(scene: BattleScene, x: number, y: number, pokeballType: PokeballType): void {
|
||||
switch (pokeballType) {
|
||||
case PokeballType.POKEBALL:
|
||||
doDefaultPbOpenParticles(scene, x, y, 48);
|
||||
break;
|
||||
case PokeballType.GREAT_BALL:
|
||||
doDefaultPbOpenParticles(scene, x, y, 96);
|
||||
break;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
doUbOpenParticles(scene, x, y, 8);
|
||||
break;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
doUbOpenParticles(scene, x, y, 10);
|
||||
break;
|
||||
case PokeballType.MASTER_BALL:
|
||||
doMbOpenParticles(scene, x, y);
|
||||
break;
|
||||
case PokeballType.POKEBALL:
|
||||
doDefaultPbOpenParticles(scene, x, y, 48);
|
||||
break;
|
||||
case PokeballType.GREAT_BALL:
|
||||
doDefaultPbOpenParticles(scene, x, y, 96);
|
||||
break;
|
||||
case PokeballType.ULTRA_BALL:
|
||||
doUbOpenParticles(scene, x, y, 8);
|
||||
break;
|
||||
case PokeballType.ROGUE_BALL:
|
||||
doUbOpenParticles(scene, x, y, 10);
|
||||
break;
|
||||
case PokeballType.MASTER_BALL:
|
||||
doMbOpenParticles(scene, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,18 +129,18 @@ export class Arena {
|
|||
|
||||
if (ret.subLegendary || ret.legendary || ret.mythical) {
|
||||
switch (true) {
|
||||
case (ret.baseTotal >= 720):
|
||||
regen = level < 90;
|
||||
break;
|
||||
case (ret.baseTotal >= 670):
|
||||
regen = level < 70;
|
||||
break;
|
||||
case (ret.baseTotal >= 580):
|
||||
regen = level < 50;
|
||||
break;
|
||||
default:
|
||||
regen = level < 30;
|
||||
break;
|
||||
case (ret.baseTotal >= 720):
|
||||
regen = level < 90;
|
||||
break;
|
||||
case (ret.baseTotal >= 670):
|
||||
regen = level < 70;
|
||||
break;
|
||||
case (ret.baseTotal >= 580):
|
||||
regen = level < 50;
|
||||
break;
|
||||
default:
|
||||
regen = level < 30;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -177,41 +177,41 @@ export class Arena {
|
|||
|
||||
getSpeciesFormIndex(species: PokemonSpecies): integer {
|
||||
switch (species.speciesId) {
|
||||
case Species.BURMY:
|
||||
case Species.WORMADAM:
|
||||
switch (this.biomeType) {
|
||||
case Biome.BEACH:
|
||||
return 1;
|
||||
case Biome.SLUM:
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
case Species.ROTOM:
|
||||
switch (this.biomeType) {
|
||||
case Biome.VOLCANO:
|
||||
return 1;
|
||||
case Biome.SEA:
|
||||
return 2;
|
||||
case Biome.ICE_CAVE:
|
||||
return 3;
|
||||
case Biome.MOUNTAIN:
|
||||
return 4;
|
||||
case Biome.TALL_GRASS:
|
||||
return 5;
|
||||
}
|
||||
break;
|
||||
case Species.LYCANROC:
|
||||
const timeOfDay = this.getTimeOfDay();
|
||||
switch (timeOfDay) {
|
||||
case TimeOfDay.DAY:
|
||||
case TimeOfDay.DAWN:
|
||||
return 0;
|
||||
case TimeOfDay.DUSK:
|
||||
return 2;
|
||||
case TimeOfDay.NIGHT:
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case Species.BURMY:
|
||||
case Species.WORMADAM:
|
||||
switch (this.biomeType) {
|
||||
case Biome.BEACH:
|
||||
return 1;
|
||||
case Biome.SLUM:
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
case Species.ROTOM:
|
||||
switch (this.biomeType) {
|
||||
case Biome.VOLCANO:
|
||||
return 1;
|
||||
case Biome.SEA:
|
||||
return 2;
|
||||
case Biome.ICE_CAVE:
|
||||
return 3;
|
||||
case Biome.MOUNTAIN:
|
||||
return 4;
|
||||
case Biome.TALL_GRASS:
|
||||
return 5;
|
||||
}
|
||||
break;
|
||||
case Species.LYCANROC:
|
||||
const timeOfDay = this.getTimeOfDay();
|
||||
switch (timeOfDay) {
|
||||
case TimeOfDay.DAY:
|
||||
case TimeOfDay.DAWN:
|
||||
return 0;
|
||||
case TimeOfDay.DUSK:
|
||||
return 2;
|
||||
case TimeOfDay.NIGHT:
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -219,70 +219,70 @@ export class Arena {
|
|||
|
||||
getTypeForBiome() {
|
||||
switch (this.biomeType) {
|
||||
case Biome.TOWN:
|
||||
case Biome.PLAINS:
|
||||
case Biome.METROPOLIS:
|
||||
return Type.NORMAL;
|
||||
case Biome.GRASS:
|
||||
case Biome.TALL_GRASS:
|
||||
return Type.GRASS;
|
||||
case Biome.FOREST:
|
||||
case Biome.JUNGLE:
|
||||
return Type.BUG;
|
||||
case Biome.SLUM:
|
||||
case Biome.SWAMP:
|
||||
return Type.POISON;
|
||||
case Biome.SEA:
|
||||
case Biome.BEACH:
|
||||
case Biome.LAKE:
|
||||
case Biome.SEABED:
|
||||
return Type.WATER;
|
||||
case Biome.MOUNTAIN:
|
||||
return Type.FLYING;
|
||||
case Biome.BADLANDS:
|
||||
return Type.GROUND;
|
||||
case Biome.CAVE:
|
||||
case Biome.DESERT:
|
||||
return Type.ROCK;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.SNOWY_FOREST:
|
||||
return Type.ICE;
|
||||
case Biome.MEADOW:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.ISLAND:
|
||||
return Type.FAIRY;
|
||||
case Biome.POWER_PLANT:
|
||||
return Type.ELECTRIC;
|
||||
case Biome.VOLCANO:
|
||||
return Type.FIRE;
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.TEMPLE:
|
||||
return Type.GHOST;
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return Type.FIGHTING;
|
||||
case Biome.FACTORY:
|
||||
case Biome.LABORATORY:
|
||||
return Type.STEEL;
|
||||
case Biome.RUINS:
|
||||
case Biome.SPACE:
|
||||
return Type.PSYCHIC;
|
||||
case Biome.WASTELAND:
|
||||
case Biome.END:
|
||||
return Type.DRAGON;
|
||||
case Biome.ABYSS:
|
||||
return Type.DARK;
|
||||
default:
|
||||
return Type.UNKNOWN;
|
||||
case Biome.TOWN:
|
||||
case Biome.PLAINS:
|
||||
case Biome.METROPOLIS:
|
||||
return Type.NORMAL;
|
||||
case Biome.GRASS:
|
||||
case Biome.TALL_GRASS:
|
||||
return Type.GRASS;
|
||||
case Biome.FOREST:
|
||||
case Biome.JUNGLE:
|
||||
return Type.BUG;
|
||||
case Biome.SLUM:
|
||||
case Biome.SWAMP:
|
||||
return Type.POISON;
|
||||
case Biome.SEA:
|
||||
case Biome.BEACH:
|
||||
case Biome.LAKE:
|
||||
case Biome.SEABED:
|
||||
return Type.WATER;
|
||||
case Biome.MOUNTAIN:
|
||||
return Type.FLYING;
|
||||
case Biome.BADLANDS:
|
||||
return Type.GROUND;
|
||||
case Biome.CAVE:
|
||||
case Biome.DESERT:
|
||||
return Type.ROCK;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.SNOWY_FOREST:
|
||||
return Type.ICE;
|
||||
case Biome.MEADOW:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.ISLAND:
|
||||
return Type.FAIRY;
|
||||
case Biome.POWER_PLANT:
|
||||
return Type.ELECTRIC;
|
||||
case Biome.VOLCANO:
|
||||
return Type.FIRE;
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.TEMPLE:
|
||||
return Type.GHOST;
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return Type.FIGHTING;
|
||||
case Biome.FACTORY:
|
||||
case Biome.LABORATORY:
|
||||
return Type.STEEL;
|
||||
case Biome.RUINS:
|
||||
case Biome.SPACE:
|
||||
return Type.PSYCHIC;
|
||||
case Biome.WASTELAND:
|
||||
case Biome.END:
|
||||
return Type.DRAGON;
|
||||
case Biome.ABYSS:
|
||||
return Type.DARK;
|
||||
default:
|
||||
return Type.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
getBgTerrainColorRatioForBiome(): number {
|
||||
switch (this.biomeType) {
|
||||
case Biome.SPACE:
|
||||
return 1;
|
||||
case Biome.END:
|
||||
return 0;
|
||||
case Biome.SPACE:
|
||||
return 1;
|
||||
case Biome.END:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 131 / 180;
|
||||
|
@ -424,52 +424,52 @@ export class Arena {
|
|||
*/
|
||||
getTrainerChance(): integer {
|
||||
switch (this.biomeType) {
|
||||
case Biome.METROPOLIS:
|
||||
return 2;
|
||||
case Biome.SLUM:
|
||||
case Biome.BEACH:
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return 4;
|
||||
case Biome.PLAINS:
|
||||
case Biome.GRASS:
|
||||
case Biome.LAKE:
|
||||
case Biome.CAVE:
|
||||
return 6;
|
||||
case Biome.TALL_GRASS:
|
||||
case Biome.FOREST:
|
||||
case Biome.SEA:
|
||||
case Biome.SWAMP:
|
||||
case Biome.MOUNTAIN:
|
||||
case Biome.BADLANDS:
|
||||
case Biome.DESERT:
|
||||
case Biome.MEADOW:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.FACTORY:
|
||||
case Biome.SNOWY_FOREST:
|
||||
return 8;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.VOLCANO:
|
||||
case Biome.RUINS:
|
||||
case Biome.WASTELAND:
|
||||
case Biome.JUNGLE:
|
||||
case Biome.FAIRY_CAVE:
|
||||
return 12;
|
||||
case Biome.SEABED:
|
||||
case Biome.ABYSS:
|
||||
case Biome.SPACE:
|
||||
case Biome.TEMPLE:
|
||||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
case Biome.METROPOLIS:
|
||||
return 2;
|
||||
case Biome.SLUM:
|
||||
case Biome.BEACH:
|
||||
case Biome.DOJO:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return 4;
|
||||
case Biome.PLAINS:
|
||||
case Biome.GRASS:
|
||||
case Biome.LAKE:
|
||||
case Biome.CAVE:
|
||||
return 6;
|
||||
case Biome.TALL_GRASS:
|
||||
case Biome.FOREST:
|
||||
case Biome.SEA:
|
||||
case Biome.SWAMP:
|
||||
case Biome.MOUNTAIN:
|
||||
case Biome.BADLANDS:
|
||||
case Biome.DESERT:
|
||||
case Biome.MEADOW:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.FACTORY:
|
||||
case Biome.SNOWY_FOREST:
|
||||
return 8;
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.VOLCANO:
|
||||
case Biome.RUINS:
|
||||
case Biome.WASTELAND:
|
||||
case Biome.JUNGLE:
|
||||
case Biome.FAIRY_CAVE:
|
||||
return 12;
|
||||
case Biome.SEABED:
|
||||
case Biome.ABYSS:
|
||||
case Biome.SPACE:
|
||||
case Biome.TEMPLE:
|
||||
return 16;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
getTimeOfDay(): TimeOfDay {
|
||||
switch (this.biomeType) {
|
||||
case Biome.ABYSS:
|
||||
return TimeOfDay.NIGHT;
|
||||
case Biome.ABYSS:
|
||||
return TimeOfDay.NIGHT;
|
||||
}
|
||||
|
||||
const waveCycle = ((this.scene.currentBattle?.waveIndex || 0) + this.scene.waveCycleOffset) % 40;
|
||||
|
@ -491,35 +491,35 @@ export class Arena {
|
|||
|
||||
isOutside(): boolean {
|
||||
switch (this.biomeType) {
|
||||
case Biome.SEABED:
|
||||
case Biome.CAVE:
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.DOJO:
|
||||
case Biome.FACTORY:
|
||||
case Biome.ABYSS:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.TEMPLE:
|
||||
case Biome.LABORATORY:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
case Biome.SEABED:
|
||||
case Biome.CAVE:
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.DOJO:
|
||||
case Biome.FACTORY:
|
||||
case Biome.ABYSS:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.TEMPLE:
|
||||
case Biome.LABORATORY:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
overrideTint(): [integer, integer, integer] {
|
||||
switch (Overrides.ARENA_TINT_OVERRIDE) {
|
||||
case TimeOfDay.DUSK:
|
||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
||||
break;
|
||||
case (TimeOfDay.NIGHT):
|
||||
return [ 64, 64, 64 ];
|
||||
break;
|
||||
case TimeOfDay.DAWN:
|
||||
case TimeOfDay.DAY:
|
||||
default:
|
||||
return [ 128, 128, 128 ];
|
||||
break;
|
||||
case TimeOfDay.DUSK:
|
||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
||||
break;
|
||||
case (TimeOfDay.NIGHT):
|
||||
return [ 64, 64, 64 ];
|
||||
break;
|
||||
case TimeOfDay.DAWN:
|
||||
case TimeOfDay.DAY:
|
||||
default:
|
||||
return [ 128, 128, 128 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -528,10 +528,10 @@ export class Arena {
|
|||
return this.overrideTint();
|
||||
}
|
||||
switch (this.biomeType) {
|
||||
case Biome.ABYSS:
|
||||
return [ 64, 64, 64 ];
|
||||
default:
|
||||
return [ 128, 128, 128 ];
|
||||
case Biome.ABYSS:
|
||||
return [ 64, 64, 64 ];
|
||||
default:
|
||||
return [ 128, 128, 128 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,8 +544,8 @@ export class Arena {
|
|||
}
|
||||
|
||||
switch (this.biomeType) {
|
||||
default:
|
||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
||||
default:
|
||||
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -554,10 +554,10 @@ export class Arena {
|
|||
return this.overrideTint();
|
||||
}
|
||||
switch (this.biomeType) {
|
||||
case Biome.ABYSS:
|
||||
case Biome.SPACE:
|
||||
case Biome.END:
|
||||
return this.getDayTint();
|
||||
case Biome.ABYSS:
|
||||
case Biome.SPACE:
|
||||
case Biome.END:
|
||||
return this.getDayTint();
|
||||
}
|
||||
|
||||
if (!this.isOutside()) {
|
||||
|
@ -565,8 +565,8 @@ export class Arena {
|
|||
}
|
||||
|
||||
switch (this.biomeType) {
|
||||
default:
|
||||
return [ 48, 48, 98 ];
|
||||
default:
|
||||
return [ 48, 48, 98 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,77 +747,77 @@ export class Arena {
|
|||
|
||||
getBgmLoopPoint(): number {
|
||||
switch (this.biomeType) {
|
||||
case Biome.TOWN:
|
||||
return 7.288;
|
||||
case Biome.PLAINS:
|
||||
return 17.485;
|
||||
case Biome.GRASS:
|
||||
return 1.995;
|
||||
case Biome.TALL_GRASS:
|
||||
return 9.608;
|
||||
case Biome.METROPOLIS:
|
||||
return 141.470;
|
||||
case Biome.FOREST:
|
||||
return 4.294;
|
||||
case Biome.SEA:
|
||||
return 0.024;
|
||||
case Biome.SWAMP:
|
||||
return 4.461;
|
||||
case Biome.BEACH:
|
||||
return 3.462;
|
||||
case Biome.LAKE:
|
||||
return 7.215;
|
||||
case Biome.SEABED:
|
||||
return 2.600;
|
||||
case Biome.MOUNTAIN:
|
||||
return 4.018;
|
||||
case Biome.BADLANDS:
|
||||
return 17.790;
|
||||
case Biome.CAVE:
|
||||
return 14.240;
|
||||
case Biome.DESERT:
|
||||
return 1.143;
|
||||
case Biome.ICE_CAVE:
|
||||
return 0.000;
|
||||
case Biome.MEADOW:
|
||||
return 3.891;
|
||||
case Biome.POWER_PLANT:
|
||||
return 9.447;
|
||||
case Biome.VOLCANO:
|
||||
return 17.637;
|
||||
case Biome.GRAVEYARD:
|
||||
return 3.232;
|
||||
case Biome.DOJO:
|
||||
return 6.205;
|
||||
case Biome.FACTORY:
|
||||
return 4.985;
|
||||
case Biome.RUINS:
|
||||
return 0.000;
|
||||
case Biome.WASTELAND:
|
||||
return 6.336;
|
||||
case Biome.ABYSS:
|
||||
return 5.130;
|
||||
case Biome.SPACE:
|
||||
return 20.036;
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return 1.222;
|
||||
case Biome.JUNGLE:
|
||||
return 0.000;
|
||||
case Biome.FAIRY_CAVE:
|
||||
return 4.542;
|
||||
case Biome.TEMPLE:
|
||||
return 2.547;
|
||||
case Biome.ISLAND:
|
||||
return 2.751;
|
||||
case Biome.LABORATORY:
|
||||
return 114.862;
|
||||
case Biome.SLUM:
|
||||
return 0.000;
|
||||
case Biome.SNOWY_FOREST:
|
||||
return 3.047;
|
||||
default:
|
||||
console.warn(`missing bgm loop-point for biome "${Biome[this.biomeType]}" (=${this.biomeType})`);
|
||||
return 0;
|
||||
case Biome.TOWN:
|
||||
return 7.288;
|
||||
case Biome.PLAINS:
|
||||
return 17.485;
|
||||
case Biome.GRASS:
|
||||
return 1.995;
|
||||
case Biome.TALL_GRASS:
|
||||
return 9.608;
|
||||
case Biome.METROPOLIS:
|
||||
return 141.470;
|
||||
case Biome.FOREST:
|
||||
return 4.294;
|
||||
case Biome.SEA:
|
||||
return 0.024;
|
||||
case Biome.SWAMP:
|
||||
return 4.461;
|
||||
case Biome.BEACH:
|
||||
return 3.462;
|
||||
case Biome.LAKE:
|
||||
return 7.215;
|
||||
case Biome.SEABED:
|
||||
return 2.600;
|
||||
case Biome.MOUNTAIN:
|
||||
return 4.018;
|
||||
case Biome.BADLANDS:
|
||||
return 17.790;
|
||||
case Biome.CAVE:
|
||||
return 14.240;
|
||||
case Biome.DESERT:
|
||||
return 1.143;
|
||||
case Biome.ICE_CAVE:
|
||||
return 0.000;
|
||||
case Biome.MEADOW:
|
||||
return 3.891;
|
||||
case Biome.POWER_PLANT:
|
||||
return 9.447;
|
||||
case Biome.VOLCANO:
|
||||
return 17.637;
|
||||
case Biome.GRAVEYARD:
|
||||
return 3.232;
|
||||
case Biome.DOJO:
|
||||
return 6.205;
|
||||
case Biome.FACTORY:
|
||||
return 4.985;
|
||||
case Biome.RUINS:
|
||||
return 0.000;
|
||||
case Biome.WASTELAND:
|
||||
return 6.336;
|
||||
case Biome.ABYSS:
|
||||
return 5.130;
|
||||
case Biome.SPACE:
|
||||
return 20.036;
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
return 1.222;
|
||||
case Biome.JUNGLE:
|
||||
return 0.000;
|
||||
case Biome.FAIRY_CAVE:
|
||||
return 4.542;
|
||||
case Biome.TEMPLE:
|
||||
return 2.547;
|
||||
case Biome.ISLAND:
|
||||
return 2.751;
|
||||
case Biome.LABORATORY:
|
||||
return 114.862;
|
||||
case Biome.SLUM:
|
||||
return 0.000;
|
||||
case Biome.SNOWY_FOREST:
|
||||
return 3.047;
|
||||
default:
|
||||
console.warn(`missing bgm loop-point for biome "${Biome[this.biomeType]}" (=${this.biomeType})`);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -828,32 +828,32 @@ export function getBiomeKey(biome: Biome): string {
|
|||
|
||||
export function getBiomeHasProps(biomeType: Biome): boolean {
|
||||
switch (biomeType) {
|
||||
case Biome.METROPOLIS:
|
||||
case Biome.BEACH:
|
||||
case Biome.LAKE:
|
||||
case Biome.SEABED:
|
||||
case Biome.MOUNTAIN:
|
||||
case Biome.BADLANDS:
|
||||
case Biome.CAVE:
|
||||
case Biome.DESERT:
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.MEADOW:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.VOLCANO:
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.FACTORY:
|
||||
case Biome.RUINS:
|
||||
case Biome.WASTELAND:
|
||||
case Biome.ABYSS:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
case Biome.JUNGLE:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.TEMPLE:
|
||||
case Biome.SNOWY_FOREST:
|
||||
case Biome.ISLAND:
|
||||
case Biome.LABORATORY:
|
||||
case Biome.END:
|
||||
return true;
|
||||
case Biome.METROPOLIS:
|
||||
case Biome.BEACH:
|
||||
case Biome.LAKE:
|
||||
case Biome.SEABED:
|
||||
case Biome.MOUNTAIN:
|
||||
case Biome.BADLANDS:
|
||||
case Biome.CAVE:
|
||||
case Biome.DESERT:
|
||||
case Biome.ICE_CAVE:
|
||||
case Biome.MEADOW:
|
||||
case Biome.POWER_PLANT:
|
||||
case Biome.VOLCANO:
|
||||
case Biome.GRAVEYARD:
|
||||
case Biome.FACTORY:
|
||||
case Biome.RUINS:
|
||||
case Biome.WASTELAND:
|
||||
case Biome.ABYSS:
|
||||
case Biome.CONSTRUCTION_SITE:
|
||||
case Biome.JUNGLE:
|
||||
case Biome.FAIRY_CAVE:
|
||||
case Biome.TEMPLE:
|
||||
case Biome.SNOWY_FOREST:
|
||||
case Biome.ISLAND:
|
||||
case Biome.LABORATORY:
|
||||
case Biome.END:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -29,21 +29,21 @@ export default class DamageNumberHandler {
|
|||
let [ textColor, shadowColor ] : TextAndShadowArr = [ null, null ];
|
||||
|
||||
switch (result) {
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
[ textColor, shadowColor ] = [ "#f8d030", "#b8a038" ];
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
[ textColor, shadowColor ] = [ "#f08030", "#c03028" ];
|
||||
break;
|
||||
case HitResult.ONE_HIT_KO:
|
||||
[ textColor, shadowColor ] = [ "#a040a0", "#483850" ];
|
||||
break;
|
||||
case HitResult.HEAL:
|
||||
[ textColor, shadowColor ] = [ "#78c850", "#588040" ];
|
||||
break;
|
||||
default:
|
||||
[ textColor, shadowColor ] = [ "#ffffff", "#636363" ];
|
||||
break;
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
[ textColor, shadowColor ] = [ "#f8d030", "#b8a038" ];
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
[ textColor, shadowColor ] = [ "#f08030", "#c03028" ];
|
||||
break;
|
||||
case HitResult.ONE_HIT_KO:
|
||||
[ textColor, shadowColor ] = [ "#a040a0", "#483850" ];
|
||||
break;
|
||||
case HitResult.HEAL:
|
||||
[ textColor, shadowColor ] = [ "#78c850", "#588040" ];
|
||||
break;
|
||||
default:
|
||||
[ textColor, shadowColor ] = [ "#ffffff", "#636363" ];
|
||||
break;
|
||||
}
|
||||
|
||||
if (textColor) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { variantData } from "#app/data/variant";
|
|||
import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from "#app/ui/battle-info";
|
||||
import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, VariableMoveTypeAttr, VariableDefAttr, AttackMove, ModifiedDamageAttr, VariableMoveTypeMultiplierAttr, IgnoreOpponentStatStagesAttr, SacrificialAttr, VariableMoveCategoryAttr, CounterDamageAttr, StatStageChangeAttr, RechargeAttr, ChargeAttr, IgnoreWeatherTypeDebuffAttr, BypassBurnDamageReductionAttr, SacrificialAttrOnHit, OneHitKOAccuracyAttr, RespectAttackTypeImmunityAttr, MoveTarget, CombinedPledgeStabBoostAttr } from "#app/data/move";
|
||||
import { default as PokemonSpecies, PokemonSpeciesForm, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||
import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER, getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/balance/starters";
|
||||
import { starterPassiveAbilities } from "#app/data/balance/passives";
|
||||
import { Constructor, isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import * as Utils from "#app/utils";
|
||||
|
@ -680,12 +680,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
|
||||
getFieldPositionOffset(): [ number, number ] {
|
||||
switch (this.fieldPosition) {
|
||||
case FieldPosition.CENTER:
|
||||
return [ 0, 0 ];
|
||||
case FieldPosition.LEFT:
|
||||
return [ -32, -8 ];
|
||||
case FieldPosition.RIGHT:
|
||||
return [ 32, 0 ];
|
||||
case FieldPosition.CENTER:
|
||||
return [ 0, 0 ];
|
||||
case FieldPosition.LEFT:
|
||||
return [ -32, -8 ];
|
||||
case FieldPosition.RIGHT:
|
||||
return [ 32, 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -917,39 +917,39 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
let ret = statValue.value * this.getStatStageMultiplier(stat, opponent, move, ignoreOppAbility, isCritical, simulated);
|
||||
|
||||
switch (stat) {
|
||||
case Stat.ATK:
|
||||
if (this.getTag(BattlerTagType.SLOW_START)) {
|
||||
ret >>= 1;
|
||||
}
|
||||
break;
|
||||
case Stat.DEF:
|
||||
if (this.isOfType(Type.ICE) && this.scene.arena.weather?.weatherType === WeatherType.SNOW) {
|
||||
ret *= 1.5;
|
||||
}
|
||||
break;
|
||||
case Stat.SPATK:
|
||||
break;
|
||||
case Stat.SPDEF:
|
||||
if (this.isOfType(Type.ROCK) && this.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
||||
ret *= 1.5;
|
||||
}
|
||||
break;
|
||||
case Stat.SPD:
|
||||
const side = this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;
|
||||
if (this.scene.arena.getTagOnSide(ArenaTagType.TAILWIND, side)) {
|
||||
ret *= 2;
|
||||
}
|
||||
if (this.scene.arena.getTagOnSide(ArenaTagType.GRASS_WATER_PLEDGE, side)) {
|
||||
ret >>= 2;
|
||||
}
|
||||
case Stat.ATK:
|
||||
if (this.getTag(BattlerTagType.SLOW_START)) {
|
||||
ret >>= 1;
|
||||
}
|
||||
break;
|
||||
case Stat.DEF:
|
||||
if (this.isOfType(Type.ICE) && this.scene.arena.weather?.weatherType === WeatherType.SNOW) {
|
||||
ret *= 1.5;
|
||||
}
|
||||
break;
|
||||
case Stat.SPATK:
|
||||
break;
|
||||
case Stat.SPDEF:
|
||||
if (this.isOfType(Type.ROCK) && this.scene.arena.weather?.weatherType === WeatherType.SANDSTORM) {
|
||||
ret *= 1.5;
|
||||
}
|
||||
break;
|
||||
case Stat.SPD:
|
||||
const side = this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;
|
||||
if (this.scene.arena.getTagOnSide(ArenaTagType.TAILWIND, side)) {
|
||||
ret *= 2;
|
||||
}
|
||||
if (this.scene.arena.getTagOnSide(ArenaTagType.GRASS_WATER_PLEDGE, side)) {
|
||||
ret >>= 2;
|
||||
}
|
||||
|
||||
if (this.getTag(BattlerTagType.SLOW_START)) {
|
||||
ret >>= 1;
|
||||
}
|
||||
if (this.status && this.status.effect === StatusEffect.PARALYSIS) {
|
||||
ret >>= 1;
|
||||
}
|
||||
break;
|
||||
if (this.getTag(BattlerTagType.SLOW_START)) {
|
||||
ret >>= 1;
|
||||
}
|
||||
if (this.status && this.status.effect === StatusEffect.PARALYSIS) {
|
||||
ret >>= 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const highestStatBoost = this.findTag(t => t instanceof HighestStatBoostTag && (t as HighestStatBoostTag).stat === stat) as HighestStatBoostTag;
|
||||
|
@ -2338,14 +2338,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
if (opponent) {
|
||||
if (isCritical) {
|
||||
switch (stat) {
|
||||
case Stat.ATK:
|
||||
case Stat.SPATK:
|
||||
statStage.value = Math.max(statStage.value, 0);
|
||||
break;
|
||||
case Stat.DEF:
|
||||
case Stat.SPDEF:
|
||||
statStage.value = Math.min(statStage.value, 0);
|
||||
break;
|
||||
case Stat.ATK:
|
||||
case Stat.SPATK:
|
||||
statStage.value = Math.max(statStage.value, 0);
|
||||
break;
|
||||
case Stat.DEF:
|
||||
case Stat.SPDEF:
|
||||
statStage.value = Math.min(statStage.value, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ignoreOppAbility) {
|
||||
|
@ -2795,30 +2795,31 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
// want to include is.Fainted() in case multi hit move ends early, still want to render message
|
||||
if (source.turnData.hitsLeft === 1 || this.isFainted()) {
|
||||
switch (result) {
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultSuperEffective"));
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultNotVeryEffective"));
|
||||
break;
|
||||
case HitResult.ONE_HIT_KO:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultOneHitKO"));
|
||||
break;
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultSuperEffective"));
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultNotVeryEffective"));
|
||||
break;
|
||||
case HitResult.ONE_HIT_KO:
|
||||
this.scene.queueMessage(i18next.t("battle:hitResultOneHitKO"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isFainted()) {
|
||||
// set splice index here, so future scene queues happen before FaintedPhase
|
||||
this.scene.setPhaseQueueSplice();
|
||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo));
|
||||
if (!isNullOrUndefined(destinyTag) && dmg) {
|
||||
// Destiny Bond will activate during FaintPhase
|
||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo, destinyTag, source));
|
||||
} else {
|
||||
this.scene.unshiftPhase(new FaintPhase(this.scene, this.getBattlerIndex(), isOneHitKo));
|
||||
}
|
||||
this.destroySubstitute();
|
||||
this.resetSummonData();
|
||||
}
|
||||
|
||||
if (dmg) {
|
||||
destinyTag?.lapse(source, BattlerTagLapseType.CUSTOM);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -3354,53 +3355,53 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
switch (effect) {
|
||||
case StatusEffect.POISON:
|
||||
case StatusEffect.TOXIC:
|
||||
case StatusEffect.POISON:
|
||||
case StatusEffect.TOXIC:
|
||||
// Check if the Pokemon is immune to Poison/Toxic or if the source pokemon is canceling the immunity
|
||||
const poisonImmunity = types.map(defType => {
|
||||
const poisonImmunity = types.map(defType => {
|
||||
// Check if the Pokemon is not immune to Poison/Toxic
|
||||
if (defType !== Type.POISON && defType !== Type.STEEL) {
|
||||
return false;
|
||||
}
|
||||
if (defType !== Type.POISON && defType !== Type.STEEL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity
|
||||
const cancelImmunity = new Utils.BooleanHolder(false);
|
||||
if (sourcePokemon) {
|
||||
applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, sourcePokemon, cancelImmunity, false, effect, defType);
|
||||
if (cancelImmunity.value) {
|
||||
// Check if the source Pokemon has an ability that cancels the Poison/Toxic immunity
|
||||
const cancelImmunity = new Utils.BooleanHolder(false);
|
||||
if (sourcePokemon) {
|
||||
applyAbAttrs(IgnoreTypeStatusEffectImmunityAbAttr, sourcePokemon, cancelImmunity, false, effect, defType);
|
||||
if (cancelImmunity.value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)) {
|
||||
if (poisonImmunity.includes(true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (this.isOfType(Type.POISON) || this.isOfType(Type.STEEL)) {
|
||||
if (poisonImmunity.includes(true)) {
|
||||
break;
|
||||
case StatusEffect.PARALYSIS:
|
||||
if (this.isOfType(Type.ELECTRIC)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StatusEffect.PARALYSIS:
|
||||
if (this.isOfType(Type.ELECTRIC)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.SLEEP:
|
||||
if (this.isGrounded() && this.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.FREEZE:
|
||||
if (this.isOfType(Type.ICE) || (this.scene?.arena?.weather?.weatherType && [ WeatherType.SUNNY, WeatherType.HARSH_SUN ].includes(this.scene.arena.weather.weatherType))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
if (this.isOfType(Type.FIRE)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case StatusEffect.SLEEP:
|
||||
if (this.isGrounded() && this.scene.arena.terrain?.terrainType === TerrainType.ELECTRIC) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.FREEZE:
|
||||
if (this.isOfType(Type.ICE) || (this.scene?.arena?.weather?.weatherType && [ WeatherType.SUNNY, WeatherType.HARSH_SUN ].includes(this.scene.arena.weather.weatherType))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
if (this.isOfType(Type.FIRE)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const cancelled = new Utils.BooleanHolder(false);
|
||||
|
@ -4081,7 +4082,7 @@ export class PlayerPokemon extends Pokemon {
|
|||
fusionStarterSpeciesId ? this.scene.gameData.starterData[fusionStarterSpeciesId] : null
|
||||
].filter(d => !!d);
|
||||
const amount = new Utils.IntegerHolder(friendship);
|
||||
const starterAmount = new Utils.IntegerHolder(Math.floor(friendship * (this.scene.gameMode.isClassic && friendship > 0 ? 2 : 1) / (fusionStarterSpeciesId ? 2 : 1)));
|
||||
const starterAmount = new Utils.IntegerHolder(Math.floor(friendship * (this.scene.gameMode.isClassic && friendship > 0 ? CLASSIC_CANDY_FRIENDSHIP_MULTIPLIER : 1) / (fusionStarterSpeciesId ? 2 : 1)));
|
||||
if (amount.value > 0) {
|
||||
this.scene.applyModifier(PokemonFriendshipBoosterModifier, true, this, amount);
|
||||
this.scene.applyModifier(PokemonFriendshipBoosterModifier, true, this, starterAmount);
|
||||
|
@ -4500,35 +4501,35 @@ export class EnemyPokemon extends Pokemon {
|
|||
|
||||
generateAndPopulateMoveset(formIndex?: integer): void {
|
||||
switch (true) {
|
||||
case (this.species.speciesId === Species.SMEARGLE):
|
||||
this.moveset = [
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH)
|
||||
];
|
||||
break;
|
||||
case (this.species.speciesId === Species.ETERNATUS):
|
||||
this.moveset = (formIndex !== undefined ? formIndex : this.formIndex)
|
||||
? [
|
||||
new PokemonMove(Moves.DYNAMAX_CANNON),
|
||||
new PokemonMove(Moves.CROSS_POISON),
|
||||
new PokemonMove(Moves.FLAMETHROWER),
|
||||
new PokemonMove(Moves.RECOVER, 0, -4)
|
||||
]
|
||||
: [
|
||||
new PokemonMove(Moves.ETERNABEAM),
|
||||
new PokemonMove(Moves.SLUDGE_BOMB),
|
||||
new PokemonMove(Moves.FLAMETHROWER),
|
||||
new PokemonMove(Moves.COSMIC_POWER)
|
||||
case (this.species.speciesId === Species.SMEARGLE):
|
||||
this.moveset = [
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH),
|
||||
new PokemonMove(Moves.SKETCH)
|
||||
];
|
||||
if (this.scene.gameMode.hasChallenge(Challenges.INVERSE_BATTLE)) {
|
||||
this.moveset[2] = new PokemonMove(Moves.THUNDERBOLT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.generateAndPopulateMoveset();
|
||||
break;
|
||||
break;
|
||||
case (this.species.speciesId === Species.ETERNATUS):
|
||||
this.moveset = (formIndex !== undefined ? formIndex : this.formIndex)
|
||||
? [
|
||||
new PokemonMove(Moves.DYNAMAX_CANNON),
|
||||
new PokemonMove(Moves.CROSS_POISON),
|
||||
new PokemonMove(Moves.FLAMETHROWER),
|
||||
new PokemonMove(Moves.RECOVER, 0, -4)
|
||||
]
|
||||
: [
|
||||
new PokemonMove(Moves.ETERNABEAM),
|
||||
new PokemonMove(Moves.SLUDGE_BOMB),
|
||||
new PokemonMove(Moves.FLAMETHROWER),
|
||||
new PokemonMove(Moves.COSMIC_POWER)
|
||||
];
|
||||
if (this.scene.gameMode.hasChallenge(Challenges.INVERSE_BATTLE)) {
|
||||
this.moveset[2] = new PokemonMove(Moves.THUNDERBOLT);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.generateAndPopulateMoveset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4568,135 +4569,135 @@ export class EnemyPokemon extends Pokemon {
|
|||
}
|
||||
}
|
||||
switch (this.aiType) {
|
||||
case AiType.RANDOM: // No enemy should spawn with this AI type in-game
|
||||
const moveId = movePool[this.scene.randBattleSeedInt(movePool.length)]!.moveId; // TODO: is the bang correct?
|
||||
return { move: moveId, targets: this.getNextTargets(moveId) };
|
||||
case AiType.SMART_RANDOM:
|
||||
case AiType.SMART:
|
||||
case AiType.RANDOM: // No enemy should spawn with this AI type in-game
|
||||
const moveId = movePool[this.scene.randBattleSeedInt(movePool.length)]!.moveId; // TODO: is the bang correct?
|
||||
return { move: moveId, targets: this.getNextTargets(moveId) };
|
||||
case AiType.SMART_RANDOM:
|
||||
case AiType.SMART:
|
||||
/**
|
||||
* Search this Pokemon's move pool for moves that will KO an opposing target.
|
||||
* If there are any moves that can KO an opponent (i.e. a player Pokemon),
|
||||
* those moves are the only ones considered for selection on this turn.
|
||||
*/
|
||||
const koMoves = movePool.filter(pkmnMove => {
|
||||
if (!pkmnMove) {
|
||||
return false;
|
||||
}
|
||||
const koMoves = movePool.filter(pkmnMove => {
|
||||
if (!pkmnMove) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const move = pkmnMove.getMove()!;
|
||||
if (move.moveTarget === MoveTarget.ATTACKER) {
|
||||
return false;
|
||||
}
|
||||
const move = pkmnMove.getMove()!;
|
||||
if (move.moveTarget === MoveTarget.ATTACKER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const fieldPokemon = this.scene.getField();
|
||||
const moveTargets = getMoveTargets(this, move.id).targets
|
||||
.map(ind => fieldPokemon[ind])
|
||||
.filter(p => this.isPlayer() !== p.isPlayer());
|
||||
// Only considers critical hits for crit-only moves or when this Pokemon is under the effect of Laser Focus
|
||||
const isCritical = move.hasAttr(CritOnlyAttr) || !!this.getTag(BattlerTagType.ALWAYS_CRIT);
|
||||
const fieldPokemon = this.scene.getField();
|
||||
const moveTargets = getMoveTargets(this, move.id).targets
|
||||
.map(ind => fieldPokemon[ind])
|
||||
.filter(p => this.isPlayer() !== p.isPlayer());
|
||||
// Only considers critical hits for crit-only moves or when this Pokemon is under the effect of Laser Focus
|
||||
const isCritical = move.hasAttr(CritOnlyAttr) || !!this.getTag(BattlerTagType.ALWAYS_CRIT);
|
||||
|
||||
return move.category !== MoveCategory.STATUS
|
||||
return move.category !== MoveCategory.STATUS
|
||||
&& moveTargets.some(p => {
|
||||
const doesNotFail = move.applyConditions(this, p, move) || [ Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP ].includes(move.id);
|
||||
return doesNotFail && p.getAttackDamage(this, move, !p.battleData.abilityRevealed, false, isCritical).damage >= p.hp;
|
||||
});
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
if (koMoves.length > 0) {
|
||||
movePool = koMoves;
|
||||
}
|
||||
if (koMoves.length > 0) {
|
||||
movePool = koMoves;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Move selection is based on the move's calculated "benefit score" against the
|
||||
* best possible target(s) (as determined by {@linkcode getNextTargets}).
|
||||
* For more information on how benefit scores are calculated, see `docs/enemy-ai.md`.
|
||||
*/
|
||||
const moveScores = movePool.map(() => 0);
|
||||
const moveTargets = Object.fromEntries(movePool.map(m => [ m!.moveId, this.getNextTargets(m!.moveId) ])); // TODO: are those bangs correct?
|
||||
for (const m in movePool) {
|
||||
const pokemonMove = movePool[m]!; // TODO: is the bang correct?
|
||||
const move = pokemonMove.getMove();
|
||||
const moveScores = movePool.map(() => 0);
|
||||
const moveTargets = Object.fromEntries(movePool.map(m => [ m!.moveId, this.getNextTargets(m!.moveId) ])); // TODO: are those bangs correct?
|
||||
for (const m in movePool) {
|
||||
const pokemonMove = movePool[m]!; // TODO: is the bang correct?
|
||||
const move = pokemonMove.getMove();
|
||||
|
||||
let moveScore = moveScores[m];
|
||||
const targetScores: integer[] = [];
|
||||
let moveScore = moveScores[m];
|
||||
const targetScores: integer[] = [];
|
||||
|
||||
for (const mt of moveTargets[move.id]) {
|
||||
for (const mt of moveTargets[move.id]) {
|
||||
// Prevent a target score from being calculated when the target is whoever attacks the user
|
||||
if (mt === BattlerIndex.ATTACKER) {
|
||||
break;
|
||||
}
|
||||
if (mt === BattlerIndex.ATTACKER) {
|
||||
break;
|
||||
}
|
||||
|
||||
const target = this.scene.getField()[mt];
|
||||
/**
|
||||
const target = this.scene.getField()[mt];
|
||||
/**
|
||||
* The "target score" of a move is given by the move's user benefit score + the move's target benefit score.
|
||||
* If the target is an ally, the target benefit score is multiplied by -1.
|
||||
*/
|
||||
let targetScore = move.getUserBenefitScore(this, target, move) + move.getTargetBenefitScore(this, target, move) * (mt < BattlerIndex.ENEMY === this.isPlayer() ? 1 : -1);
|
||||
if (Number.isNaN(targetScore)) {
|
||||
console.error(`Move ${move.name} returned score of NaN`);
|
||||
targetScore = 0;
|
||||
}
|
||||
/**
|
||||
let targetScore = move.getUserBenefitScore(this, target, move) + move.getTargetBenefitScore(this, target, move) * (mt < BattlerIndex.ENEMY === this.isPlayer() ? 1 : -1);
|
||||
if (Number.isNaN(targetScore)) {
|
||||
console.error(`Move ${move.name} returned score of NaN`);
|
||||
targetScore = 0;
|
||||
}
|
||||
/**
|
||||
* If this move is unimplemented, or the move is known to fail when used, set its
|
||||
* target score to -20
|
||||
*/
|
||||
if ((move.name.endsWith(" (N)") || !move.applyConditions(this, target, move)) && ![ Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP ].includes(move.id)) {
|
||||
targetScore = -20;
|
||||
} else if (move instanceof AttackMove) {
|
||||
if ((move.name.endsWith(" (N)") || !move.applyConditions(this, target, move)) && ![ Moves.SUCKER_PUNCH, Moves.UPPER_HAND, Moves.THUNDERCLAP ].includes(move.id)) {
|
||||
targetScore = -20;
|
||||
} else if (move instanceof AttackMove) {
|
||||
/**
|
||||
* Attack moves are given extra multipliers to their base benefit score based on
|
||||
* the move's type effectiveness against the target and whether the move is a STAB move.
|
||||
*/
|
||||
const effectiveness = target.getMoveEffectiveness(this, move, !target.battleData?.abilityRevealed);
|
||||
if (target.isPlayer() !== this.isPlayer()) {
|
||||
targetScore *= effectiveness;
|
||||
if (this.isOfType(move.type)) {
|
||||
targetScore *= 1.5;
|
||||
const effectiveness = target.getMoveEffectiveness(this, move, !target.battleData?.abilityRevealed);
|
||||
if (target.isPlayer() !== this.isPlayer()) {
|
||||
targetScore *= effectiveness;
|
||||
if (this.isOfType(move.type)) {
|
||||
targetScore *= 1.5;
|
||||
}
|
||||
} else if (effectiveness) {
|
||||
targetScore /= effectiveness;
|
||||
if (this.isOfType(move.type)) {
|
||||
targetScore /= 1.5;
|
||||
}
|
||||
}
|
||||
} else if (effectiveness) {
|
||||
targetScore /= effectiveness;
|
||||
if (this.isOfType(move.type)) {
|
||||
targetScore /= 1.5;
|
||||
/** If a move has a base benefit score of 0, its benefit score is assumed to be unimplemented at this point */
|
||||
if (!targetScore) {
|
||||
targetScore = -20;
|
||||
}
|
||||
}
|
||||
/** If a move has a base benefit score of 0, its benefit score is assumed to be unimplemented at this point */
|
||||
if (!targetScore) {
|
||||
targetScore = -20;
|
||||
}
|
||||
targetScores.push(targetScore);
|
||||
}
|
||||
targetScores.push(targetScore);
|
||||
// When a move has multiple targets, its score is equal to the maximum target score across all targets
|
||||
moveScore += Math.max(...targetScores);
|
||||
|
||||
// could make smarter by checking opponent def/spdef
|
||||
moveScores[m] = moveScore;
|
||||
}
|
||||
// When a move has multiple targets, its score is equal to the maximum target score across all targets
|
||||
moveScore += Math.max(...targetScores);
|
||||
|
||||
// could make smarter by checking opponent def/spdef
|
||||
moveScores[m] = moveScore;
|
||||
}
|
||||
console.log(moveScores);
|
||||
|
||||
console.log(moveScores);
|
||||
|
||||
// Sort the move pool in decreasing order of move score
|
||||
const sortedMovePool = movePool.slice(0);
|
||||
sortedMovePool.sort((a, b) => {
|
||||
const scoreA = moveScores[movePool.indexOf(a)];
|
||||
const scoreB = moveScores[movePool.indexOf(b)];
|
||||
return scoreA < scoreB ? 1 : scoreA > scoreB ? -1 : 0;
|
||||
});
|
||||
let r = 0;
|
||||
if (this.aiType === AiType.SMART_RANDOM) {
|
||||
// Sort the move pool in decreasing order of move score
|
||||
const sortedMovePool = movePool.slice(0);
|
||||
sortedMovePool.sort((a, b) => {
|
||||
const scoreA = moveScores[movePool.indexOf(a)];
|
||||
const scoreB = moveScores[movePool.indexOf(b)];
|
||||
return scoreA < scoreB ? 1 : scoreA > scoreB ? -1 : 0;
|
||||
});
|
||||
let r = 0;
|
||||
if (this.aiType === AiType.SMART_RANDOM) {
|
||||
// Has a 5/8 chance to select the best move, and a 3/8 chance to advance to the next best move (and repeat this roll)
|
||||
while (r < sortedMovePool.length - 1 && this.scene.randBattleSeedInt(8) >= 5) {
|
||||
r++;
|
||||
}
|
||||
} else if (this.aiType === AiType.SMART) {
|
||||
while (r < sortedMovePool.length - 1 && this.scene.randBattleSeedInt(8) >= 5) {
|
||||
r++;
|
||||
}
|
||||
} else if (this.aiType === AiType.SMART) {
|
||||
// The chance to advance to the next best move increases when the compared moves' scores are closer to each other.
|
||||
while (r < sortedMovePool.length - 1 && (moveScores[movePool.indexOf(sortedMovePool[r + 1])] / moveScores[movePool.indexOf(sortedMovePool[r])]) >= 0
|
||||
while (r < sortedMovePool.length - 1 && (moveScores[movePool.indexOf(sortedMovePool[r + 1])] / moveScores[movePool.indexOf(sortedMovePool[r])]) >= 0
|
||||
&& this.scene.randBattleSeedInt(100) < Math.round((moveScores[movePool.indexOf(sortedMovePool[r + 1])] / moveScores[movePool.indexOf(sortedMovePool[r])]) * 50)) {
|
||||
r++;
|
||||
r++;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(movePool.map(m => m!.getName()), moveScores, r, sortedMovePool.map(m => m!.getName())); // TODO: are those bangs correct?
|
||||
return { move: sortedMovePool[r]!.moveId, targets: moveTargets[sortedMovePool[r]!.moveId] };
|
||||
console.log(movePool.map(m => m!.getName()), moveScores, r, sortedMovePool.map(m => m!.getName())); // TODO: are those bangs correct?
|
||||
return { move: sortedMovePool[r]!.moveId, targets: moveTargets[sortedMovePool[r]!.moveId] };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4844,10 +4845,10 @@ export class EnemyPokemon extends Pokemon {
|
|||
}
|
||||
|
||||
switch (this.scene.currentBattle.battleSpec) {
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
if (!this.formIndex && this.bossSegmentIndex < 1) {
|
||||
damage = Math.min(damage, this.hp - 1);
|
||||
}
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
if (!this.formIndex && this.bossSegmentIndex < 1) {
|
||||
damage = Math.min(damage, this.hp - 1);
|
||||
}
|
||||
}
|
||||
|
||||
const ret = super.damage(damage, ignoreSegments, preventEndure, ignoreFaintPhase);
|
||||
|
|
|
@ -65,16 +65,16 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
}
|
||||
|
||||
switch (this.variant) {
|
||||
case TrainerVariant.FEMALE:
|
||||
if (!this.config.hasGenders) {
|
||||
variant = TrainerVariant.DEFAULT;
|
||||
}
|
||||
break;
|
||||
case TrainerVariant.DOUBLE:
|
||||
if (!this.config.hasDouble) {
|
||||
variant = TrainerVariant.DEFAULT;
|
||||
}
|
||||
break;
|
||||
case TrainerVariant.FEMALE:
|
||||
if (!this.config.hasGenders) {
|
||||
variant = TrainerVariant.DEFAULT;
|
||||
}
|
||||
break;
|
||||
case TrainerVariant.DOUBLE:
|
||||
if (!this.config.hasDouble) {
|
||||
variant = TrainerVariant.DEFAULT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
console.log(Object.keys(trainerPartyTemplates)[Object.values(trainerPartyTemplates).indexOf(this.getPartyTemplate())]);
|
||||
|
@ -229,21 +229,21 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
const strength = partyTemplate.getStrength(i);
|
||||
|
||||
switch (strength) {
|
||||
case PartyMemberStrength.WEAKER:
|
||||
multiplier = 0.95;
|
||||
break;
|
||||
case PartyMemberStrength.WEAK:
|
||||
multiplier = 1.0;
|
||||
break;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
multiplier = 1.1;
|
||||
break;
|
||||
case PartyMemberStrength.STRONG:
|
||||
multiplier = 1.2;
|
||||
break;
|
||||
case PartyMemberStrength.STRONGER:
|
||||
multiplier = 1.25;
|
||||
break;
|
||||
case PartyMemberStrength.WEAKER:
|
||||
multiplier = 0.95;
|
||||
break;
|
||||
case PartyMemberStrength.WEAK:
|
||||
multiplier = 1.0;
|
||||
break;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
multiplier = 1.1;
|
||||
break;
|
||||
case PartyMemberStrength.STRONG:
|
||||
multiplier = 1.2;
|
||||
break;
|
||||
case PartyMemberStrength.STRONGER:
|
||||
multiplier = 1.25;
|
||||
break;
|
||||
}
|
||||
|
||||
let levelOffset = 0;
|
||||
|
@ -515,19 +515,19 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
|||
|
||||
getPartyMemberModifierChanceMultiplier(index: integer): number {
|
||||
switch (this.getPartyTemplate().getStrength(index)) {
|
||||
case PartyMemberStrength.WEAKER:
|
||||
return 0.75;
|
||||
case PartyMemberStrength.WEAK:
|
||||
return 0.675;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
return 0.5625;
|
||||
case PartyMemberStrength.STRONG:
|
||||
return 0.45;
|
||||
case PartyMemberStrength.STRONGER:
|
||||
return 0.375;
|
||||
default:
|
||||
console.warn("getPartyMemberModifierChanceMultiplier not defined. Using default 0");
|
||||
return 0;
|
||||
case PartyMemberStrength.WEAKER:
|
||||
return 0.75;
|
||||
case PartyMemberStrength.WEAK:
|
||||
return 0.675;
|
||||
case PartyMemberStrength.AVERAGE:
|
||||
return 0.5625;
|
||||
case PartyMemberStrength.STRONG:
|
||||
return 0.45;
|
||||
case PartyMemberStrength.STRONGER:
|
||||
return 0.375;
|
||||
default:
|
||||
console.warn("getPartyMemberModifierChanceMultiplier not defined. Using default 0");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
148
src/game-mode.ts
|
@ -92,10 +92,10 @@ export class GameMode implements GameModeConfig {
|
|||
return Overrides.STARTING_LEVEL_OVERRIDE;
|
||||
}
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return 20;
|
||||
default:
|
||||
return 5;
|
||||
case GameModes.DAILY:
|
||||
return 20;
|
||||
default:
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,19 +117,19 @@ export class GameMode implements GameModeConfig {
|
|||
*/
|
||||
getStartingBiome(scene: BattleScene): Biome {
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
|
||||
default:
|
||||
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||
case GameModes.DAILY:
|
||||
return scene.generateRandomBiome(this.getWaveForDifficulty(1));
|
||||
default:
|
||||
return Overrides.STARTING_BIOME_OVERRIDE || Biome.TOWN;
|
||||
}
|
||||
}
|
||||
|
||||
getWaveForDifficulty(waveIndex: integer, ignoreCurveChanges: boolean = false): integer {
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return waveIndex + 30 + (!ignoreCurveChanges ? Math.floor(waveIndex / 5) : 0);
|
||||
default:
|
||||
return waveIndex;
|
||||
case GameModes.DAILY:
|
||||
return waveIndex + 30 + (!ignoreCurveChanges ? Math.floor(waveIndex / 5) : 0);
|
||||
default:
|
||||
return waveIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,10 +186,10 @@ export class GameMode implements GameModeConfig {
|
|||
|
||||
isTrainerBoss(waveIndex: integer, biomeType: Biome, offsetGym: boolean): boolean {
|
||||
switch (this.modeId) {
|
||||
case GameModes.DAILY:
|
||||
return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10);
|
||||
default:
|
||||
return (waveIndex % 30) === (offsetGym ? 0 : 20) && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex));
|
||||
case GameModes.DAILY:
|
||||
return waveIndex > 10 && waveIndex < 50 && !(waveIndex % 10);
|
||||
default:
|
||||
return (waveIndex % 30) === (offsetGym ? 0 : 20) && (biomeType !== Biome.END || this.isClassic || this.isWaveFinal(waveIndex));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,14 +211,14 @@ export class GameMode implements GameModeConfig {
|
|||
*/
|
||||
isWaveFinal(waveIndex: integer, modeId: GameModes = this.modeId): boolean {
|
||||
switch (modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
return waveIndex === 200;
|
||||
case GameModes.ENDLESS:
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return !(waveIndex % 250);
|
||||
case GameModes.DAILY:
|
||||
return waveIndex === 50;
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
return waveIndex === 200;
|
||||
case GameModes.ENDLESS:
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return !(waveIndex % 250);
|
||||
case GameModes.DAILY:
|
||||
return waveIndex === 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,40 +287,40 @@ export class GameMode implements GameModeConfig {
|
|||
|
||||
getClearScoreBonus(): integer {
|
||||
switch (this.modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
return 5000;
|
||||
case GameModes.DAILY:
|
||||
return 2500;
|
||||
default:
|
||||
return 0;
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
return 5000;
|
||||
case GameModes.DAILY:
|
||||
return 2500;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
getEnemyModifierChance(isBoss: boolean): integer {
|
||||
switch (this.modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
case GameModes.DAILY:
|
||||
return !isBoss ? 18 : 6;
|
||||
case GameModes.ENDLESS:
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return !isBoss ? 12 : 4;
|
||||
case GameModes.CLASSIC:
|
||||
case GameModes.CHALLENGE:
|
||||
case GameModes.DAILY:
|
||||
return !isBoss ? 18 : 6;
|
||||
case GameModes.ENDLESS:
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return !isBoss ? 12 : 4;
|
||||
}
|
||||
}
|
||||
|
||||
getName(): string {
|
||||
switch (this.modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
return i18next.t("gameMode:classic");
|
||||
case GameModes.ENDLESS:
|
||||
return i18next.t("gameMode:endless");
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return i18next.t("gameMode:endlessSpliced");
|
||||
case GameModes.DAILY:
|
||||
return i18next.t("gameMode:dailyRun");
|
||||
case GameModes.CHALLENGE:
|
||||
return i18next.t("gameMode:challenge");
|
||||
case GameModes.CLASSIC:
|
||||
return i18next.t("gameMode:classic");
|
||||
case GameModes.ENDLESS:
|
||||
return i18next.t("gameMode:endless");
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return i18next.t("gameMode:endlessSpliced");
|
||||
case GameModes.DAILY:
|
||||
return i18next.t("gameMode:dailyRun");
|
||||
case GameModes.CHALLENGE:
|
||||
return i18next.t("gameMode:challenge");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -329,42 +329,42 @@ export class GameMode implements GameModeConfig {
|
|||
*/
|
||||
getMysteryEncounterLegalWaves(): [number, number] {
|
||||
switch (this.modeId) {
|
||||
default:
|
||||
return [ 0, 0 ];
|
||||
case GameModes.CLASSIC:
|
||||
return CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES;
|
||||
case GameModes.CHALLENGE:
|
||||
return CHALLENGE_MODE_MYSTERY_ENCOUNTER_WAVES;
|
||||
default:
|
||||
return [ 0, 0 ];
|
||||
case GameModes.CLASSIC:
|
||||
return CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES;
|
||||
case GameModes.CHALLENGE:
|
||||
return CHALLENGE_MODE_MYSTERY_ENCOUNTER_WAVES;
|
||||
}
|
||||
}
|
||||
|
||||
static getModeName(modeId: GameModes): string {
|
||||
switch (modeId) {
|
||||
case GameModes.CLASSIC:
|
||||
return i18next.t("gameMode:classic");
|
||||
case GameModes.ENDLESS:
|
||||
return i18next.t("gameMode:endless");
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return i18next.t("gameMode:endlessSpliced");
|
||||
case GameModes.DAILY:
|
||||
return i18next.t("gameMode:dailyRun");
|
||||
case GameModes.CHALLENGE:
|
||||
return i18next.t("gameMode:challenge");
|
||||
case GameModes.CLASSIC:
|
||||
return i18next.t("gameMode:classic");
|
||||
case GameModes.ENDLESS:
|
||||
return i18next.t("gameMode:endless");
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return i18next.t("gameMode:endlessSpliced");
|
||||
case GameModes.DAILY:
|
||||
return i18next.t("gameMode:dailyRun");
|
||||
case GameModes.CHALLENGE:
|
||||
return i18next.t("gameMode:challenge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getGameMode(gameMode: GameModes): GameMode {
|
||||
switch (gameMode) {
|
||||
case GameModes.CLASSIC:
|
||||
return new GameMode(GameModes.CLASSIC, { isClassic: true, hasTrainers: true, hasMysteryEncounters: true }, classicFixedBattles);
|
||||
case GameModes.ENDLESS:
|
||||
return new GameMode(GameModes.ENDLESS, { isEndless: true, hasShortBiomes: true, hasRandomBosses: true });
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return new GameMode(GameModes.SPLICED_ENDLESS, { isEndless: true, hasShortBiomes: true, hasRandomBosses: true, isSplicedOnly: true });
|
||||
case GameModes.DAILY:
|
||||
return new GameMode(GameModes.DAILY, { isDaily: true, hasTrainers: true, hasNoShop: true });
|
||||
case GameModes.CHALLENGE:
|
||||
return new GameMode(GameModes.CHALLENGE, { isClassic: true, hasTrainers: true, isChallenge: true, hasMysteryEncounters: true }, classicFixedBattles);
|
||||
case GameModes.CLASSIC:
|
||||
return new GameMode(GameModes.CLASSIC, { isClassic: true, hasTrainers: true, hasMysteryEncounters: true }, classicFixedBattles);
|
||||
case GameModes.ENDLESS:
|
||||
return new GameMode(GameModes.ENDLESS, { isEndless: true, hasShortBiomes: true, hasRandomBosses: true });
|
||||
case GameModes.SPLICED_ENDLESS:
|
||||
return new GameMode(GameModes.SPLICED_ENDLESS, { isEndless: true, hasShortBiomes: true, hasRandomBosses: true, isSplicedOnly: true });
|
||||
case GameModes.DAILY:
|
||||
return new GameMode(GameModes.DAILY, { isDaily: true, hasTrainers: true, hasNoShop: true });
|
||||
case GameModes.CHALLENGE:
|
||||
return new GameMode(GameModes.CHALLENGE, { isClassic: true, hasTrainers: true, isChallenge: true, hasMysteryEncounters: true }, classicFixedBattles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -477,18 +477,18 @@ export class LoadingScene extends SceneBase {
|
|||
this.load.on(this.LOAD_EVENTS.FILE_COMPLETE, (key: string) => {
|
||||
assetText.setText(i18next.t("menu:loadingAsset", { assetName: key }));
|
||||
switch (key) {
|
||||
case "loading_bg":
|
||||
bg.setTexture("loading_bg");
|
||||
if (mobile) {
|
||||
bg.setVisible(true);
|
||||
}
|
||||
break;
|
||||
case "logo":
|
||||
logo.setTexture("logo");
|
||||
if (mobile) {
|
||||
logo.setVisible(true);
|
||||
}
|
||||
break;
|
||||
case "loading_bg":
|
||||
bg.setTexture("loading_bg");
|
||||
if (mobile) {
|
||||
bg.setVisible(true);
|
||||
}
|
||||
break;
|
||||
case "logo":
|
||||
logo.setTexture("logo");
|
||||
if (mobile) {
|
||||
logo.setVisible(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -13,21 +13,21 @@ export function getPokemonNameWithAffix(pokemon: Pokemon | undefined): string {
|
|||
}
|
||||
|
||||
switch (pokemon.scene.currentBattle.battleSpec) {
|
||||
case BattleSpec.DEFAULT:
|
||||
return !pokemon.isPlayer()
|
||||
? pokemon.hasTrainer()
|
||||
? i18next.t("battle:foePokemonWithAffix", {
|
||||
pokemonName: pokemon.getNameToRender(),
|
||||
})
|
||||
: i18next.t("battle:wildPokemonWithAffix", {
|
||||
pokemonName: pokemon.getNameToRender(),
|
||||
})
|
||||
: pokemon.getNameToRender();
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
return !pokemon.isPlayer()
|
||||
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.getNameToRender() })
|
||||
: pokemon.getNameToRender();
|
||||
default:
|
||||
return pokemon.getNameToRender();
|
||||
case BattleSpec.DEFAULT:
|
||||
return !pokemon.isPlayer()
|
||||
? pokemon.hasTrainer()
|
||||
? i18next.t("battle:foePokemonWithAffix", {
|
||||
pokemonName: pokemon.getNameToRender(),
|
||||
})
|
||||
: i18next.t("battle:wildPokemonWithAffix", {
|
||||
pokemonName: pokemon.getNameToRender(),
|
||||
})
|
||||
: pokemon.getNameToRender();
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
return !pokemon.isPlayer()
|
||||
? i18next.t("battle:foePokemonWithAffix", { pokemonName: pokemon.getNameToRender() })
|
||||
: pokemon.getNameToRender();
|
||||
default:
|
||||
return pokemon.getNameToRender();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,18 +78,18 @@ export class ModifierType {
|
|||
}
|
||||
let poolTypes: ModifierPoolType[];
|
||||
switch (poolType) {
|
||||
case ModifierPoolType.PLAYER:
|
||||
poolTypes = [ poolType, ModifierPoolType.TRAINER, ModifierPoolType.WILD ];
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.TRAINER ];
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.WILD ];
|
||||
break;
|
||||
default:
|
||||
poolTypes = [ poolType ];
|
||||
break;
|
||||
case ModifierPoolType.PLAYER:
|
||||
poolTypes = [ poolType, ModifierPoolType.TRAINER, ModifierPoolType.WILD ];
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.TRAINER ];
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
poolTypes = [ poolType, ModifierPoolType.PLAYER, ModifierPoolType.WILD ];
|
||||
break;
|
||||
default:
|
||||
poolTypes = [ poolType ];
|
||||
break;
|
||||
}
|
||||
// Try multiple pool types in case of stolen items
|
||||
for (const type of poolTypes) {
|
||||
|
@ -502,42 +502,42 @@ export class BerryModifierType extends PokemonHeldItemModifierType implements Ge
|
|||
|
||||
function getAttackTypeBoosterItemName(type: Type) {
|
||||
switch (type) {
|
||||
case Type.NORMAL:
|
||||
return "Silk Scarf";
|
||||
case Type.FIGHTING:
|
||||
return "Black Belt";
|
||||
case Type.FLYING:
|
||||
return "Sharp Beak";
|
||||
case Type.POISON:
|
||||
return "Poison Barb";
|
||||
case Type.GROUND:
|
||||
return "Soft Sand";
|
||||
case Type.ROCK:
|
||||
return "Hard Stone";
|
||||
case Type.BUG:
|
||||
return "Silver Powder";
|
||||
case Type.GHOST:
|
||||
return "Spell Tag";
|
||||
case Type.STEEL:
|
||||
return "Metal Coat";
|
||||
case Type.FIRE:
|
||||
return "Charcoal";
|
||||
case Type.WATER:
|
||||
return "Mystic Water";
|
||||
case Type.GRASS:
|
||||
return "Miracle Seed";
|
||||
case Type.ELECTRIC:
|
||||
return "Magnet";
|
||||
case Type.PSYCHIC:
|
||||
return "Twisted Spoon";
|
||||
case Type.ICE:
|
||||
return "Never-Melt Ice";
|
||||
case Type.DRAGON:
|
||||
return "Dragon Fang";
|
||||
case Type.DARK:
|
||||
return "Black Glasses";
|
||||
case Type.FAIRY:
|
||||
return "Fairy Feather";
|
||||
case Type.NORMAL:
|
||||
return "Silk Scarf";
|
||||
case Type.FIGHTING:
|
||||
return "Black Belt";
|
||||
case Type.FLYING:
|
||||
return "Sharp Beak";
|
||||
case Type.POISON:
|
||||
return "Poison Barb";
|
||||
case Type.GROUND:
|
||||
return "Soft Sand";
|
||||
case Type.ROCK:
|
||||
return "Hard Stone";
|
||||
case Type.BUG:
|
||||
return "Silver Powder";
|
||||
case Type.GHOST:
|
||||
return "Spell Tag";
|
||||
case Type.STEEL:
|
||||
return "Metal Coat";
|
||||
case Type.FIRE:
|
||||
return "Charcoal";
|
||||
case Type.WATER:
|
||||
return "Mystic Water";
|
||||
case Type.GRASS:
|
||||
return "Miracle Seed";
|
||||
case Type.ELECTRIC:
|
||||
return "Magnet";
|
||||
case Type.PSYCHIC:
|
||||
return "Twisted Spoon";
|
||||
case Type.ICE:
|
||||
return "Never-Melt Ice";
|
||||
case Type.DRAGON:
|
||||
return "Dragon Fang";
|
||||
case Type.DARK:
|
||||
return "Black Glasses";
|
||||
case Type.FAIRY:
|
||||
return "Fairy Feather";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1149,15 +1149,15 @@ class FormChangeItemModifierTypeGenerator extends ModifierTypeGenerator {
|
|||
foundN_SOLAR = false;
|
||||
formChangeItemTriggers.forEach((fc, i) => {
|
||||
switch (fc.item) {
|
||||
case FormChangeItem.ULTRANECROZIUM_Z:
|
||||
foundULTRA_Z = true;
|
||||
break;
|
||||
case FormChangeItem.N_LUNARIZER:
|
||||
foundN_LUNA = true;
|
||||
break;
|
||||
case FormChangeItem.N_SOLARIZER:
|
||||
foundN_SOLAR = true;
|
||||
break;
|
||||
case FormChangeItem.ULTRANECROZIUM_Z:
|
||||
foundULTRA_Z = true;
|
||||
break;
|
||||
case FormChangeItem.N_LUNARIZER:
|
||||
foundN_LUNA = true;
|
||||
break;
|
||||
case FormChangeItem.N_SOLARIZER:
|
||||
foundN_SOLAR = true;
|
||||
break;
|
||||
}
|
||||
});
|
||||
if (foundULTRA_Z && foundN_LUNA && foundN_SOLAR) {
|
||||
|
@ -1975,21 +1975,21 @@ let enemyBuffIgnoredPoolIndexes = {}; // eslint-disable-line @typescript-eslint/
|
|||
export function getModifierPoolForType(poolType: ModifierPoolType): ModifierPool {
|
||||
let pool: ModifierPool;
|
||||
switch (poolType) {
|
||||
case ModifierPoolType.PLAYER:
|
||||
pool = modifierPool;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
pool = wildModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
pool = trainerModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
pool = enemyBuffModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
pool = dailyStarterModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.PLAYER:
|
||||
pool = modifierPool;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
pool = wildModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
pool = trainerModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
pool = enemyBuffModifierPool;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
pool = dailyStarterModifierPool;
|
||||
break;
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
@ -2060,23 +2060,23 @@ export function regenerateModifierPoolThresholds(party: Pokemon[], poolType: Mod
|
|||
console.table(modifierTableData);
|
||||
}
|
||||
switch (poolType) {
|
||||
case ModifierPoolType.PLAYER:
|
||||
modifierPoolThresholds = thresholds;
|
||||
ignoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
case ModifierPoolType.TRAINER:
|
||||
enemyModifierPoolThresholds = thresholds;
|
||||
enemyIgnoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
enemyBuffModifierPoolThresholds = thresholds;
|
||||
enemyBuffIgnoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
dailyStarterModifierPoolThresholds = thresholds;
|
||||
ignoredDailyStarterPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.PLAYER:
|
||||
modifierPoolThresholds = thresholds;
|
||||
ignoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
case ModifierPoolType.TRAINER:
|
||||
enemyModifierPoolThresholds = thresholds;
|
||||
enemyIgnoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
enemyBuffModifierPoolThresholds = thresholds;
|
||||
enemyBuffIgnoredPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
dailyStarterModifierPoolThresholds = thresholds;
|
||||
ignoredDailyStarterPoolIndexes = ignoredIndexes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2227,7 +2227,8 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, base
|
|||
],
|
||||
[
|
||||
new ModifierTypeOption(modifierTypes.HYPER_POTION(), 0, baseCost * 0.8),
|
||||
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), 0, baseCost * 2.75)
|
||||
new ModifierTypeOption(modifierTypes.MAX_REVIVE(), 0, baseCost * 2.75),
|
||||
new ModifierTypeOption(modifierTypes.MEMORY_MUSHROOM(), 0, baseCost * 4)
|
||||
],
|
||||
[
|
||||
new ModifierTypeOption(modifierTypes.MAX_POTION(), 0, baseCost * 1.5),
|
||||
|
@ -2246,15 +2247,15 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: integer, base
|
|||
export function getEnemyBuffModifierForWave(tier: ModifierTier, enemyModifiers: PersistentModifier[], scene: BattleScene): EnemyPersistentModifier {
|
||||
let tierStackCount: number;
|
||||
switch (tier) {
|
||||
case ModifierTier.ULTRA:
|
||||
tierStackCount = 5;
|
||||
break;
|
||||
case ModifierTier.GREAT:
|
||||
tierStackCount = 3;
|
||||
break;
|
||||
default:
|
||||
tierStackCount = 1;
|
||||
break;
|
||||
case ModifierTier.ULTRA:
|
||||
tierStackCount = 5;
|
||||
break;
|
||||
case ModifierTier.GREAT:
|
||||
tierStackCount = 3;
|
||||
break;
|
||||
default:
|
||||
tierStackCount = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
const retryCount = 50;
|
||||
|
@ -2320,21 +2321,21 @@ function getNewModifierTypeOption(party: Pokemon[], poolType: ModifierPoolType,
|
|||
const pool = getModifierPoolForType(poolType);
|
||||
let thresholds: object;
|
||||
switch (poolType) {
|
||||
case ModifierPoolType.PLAYER:
|
||||
thresholds = modifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
thresholds = enemyModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
thresholds = enemyModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
thresholds = enemyBuffModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
thresholds = dailyStarterModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.PLAYER:
|
||||
thresholds = modifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.WILD:
|
||||
thresholds = enemyModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.TRAINER:
|
||||
thresholds = enemyModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.ENEMY_BUFF:
|
||||
thresholds = enemyBuffModifierPoolThresholds;
|
||||
break;
|
||||
case ModifierPoolType.DAILY_STARTER:
|
||||
thresholds = dailyStarterModifierPoolThresholds;
|
||||
break;
|
||||
}
|
||||
if (tier === undefined) {
|
||||
const tierValue = randSeedInt(1024);
|
||||
|
|
|
@ -11,7 +11,7 @@ import Pokemon, { type PlayerPokemon } from "#app/field/pokemon";
|
|||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import Overrides from "#app/overrides";
|
||||
import { EvolutionPhase } from "#app/phases/evolution-phase";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { LearnMovePhase, LearnMoveType } from "#app/phases/learn-move-phase";
|
||||
import { LevelUpPhase } from "#app/phases/level-up-phase";
|
||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||
import { achvs } from "#app/system/achv";
|
||||
|
@ -30,6 +30,7 @@ import { StatusEffect } from "#enums/status-effect";
|
|||
import i18next from "i18next";
|
||||
import { type DoubleBattleChanceBoosterModifierType, type EvolutionItemModifierType, type FormChangeItemModifierType, type ModifierOverride, type ModifierType, type PokemonBaseStatTotalModifierType, type PokemonExpBoosterModifierType, type PokemonFriendshipBoosterModifierType, type PokemonMoveAccuracyBoosterModifierType, type PokemonMultiHitModifierType, type TerastallizeModifierType, type TmModifierType, getModifierType, ModifierPoolType, ModifierTypeGenerator, modifierTypes, PokemonHeldItemModifierType } from "./modifier-type";
|
||||
import { Color, ShadowColor } from "#enums/color";
|
||||
import { FRIENDSHIP_GAIN_FROM_RARE_CANDY } from "#app/data/balance/starters";
|
||||
|
||||
export type ModifierPredicate = (modifier: Modifier) => boolean;
|
||||
|
||||
|
@ -1694,12 +1695,12 @@ export class TurnStatusEffectModifier extends PokemonHeldItemModifier {
|
|||
super(type, pokemonId, stackCount);
|
||||
|
||||
switch (type.id) {
|
||||
case "TOXIC_ORB":
|
||||
this.effect = StatusEffect.TOXIC;
|
||||
break;
|
||||
case "FLAME_ORB":
|
||||
this.effect = StatusEffect.BURN;
|
||||
break;
|
||||
case "TOXIC_ORB":
|
||||
this.effect = StatusEffect.TOXIC;
|
||||
break;
|
||||
case "FLAME_ORB":
|
||||
this.effect = StatusEffect.BURN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2213,7 +2214,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
|
|||
playerPokemon.levelExp = 0;
|
||||
}
|
||||
|
||||
playerPokemon.addFriendship(5);
|
||||
playerPokemon.addFriendship(FRIENDSHIP_GAIN_FROM_RARE_CANDY);
|
||||
|
||||
playerPokemon.scene.unshiftPhase(new LevelUpPhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), playerPokemon.level - levelCount.value, playerPokemon.level));
|
||||
|
||||
|
@ -2235,7 +2236,7 @@ export class TmModifier extends ConsumablePokemonModifier {
|
|||
*/
|
||||
override apply(playerPokemon: PlayerPokemon): boolean {
|
||||
|
||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), this.type.moveId, true));
|
||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), this.type.moveId, LearnMoveType.TM));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2255,8 +2256,9 @@ export class RememberMoveModifier extends ConsumablePokemonModifier {
|
|||
* @param playerPokemon The {@linkcode PlayerPokemon} that should remember the move
|
||||
* @returns always `true`
|
||||
*/
|
||||
override apply(playerPokemon: PlayerPokemon): boolean {
|
||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex]));
|
||||
override apply(playerPokemon: PlayerPokemon, cost?: number): boolean {
|
||||
|
||||
playerPokemon.scene.unshiftPhase(new LearnMovePhase(playerPokemon.scene, playerPokemon.scene.getParty().indexOf(playerPokemon), playerPokemon.getLearnableLevelMoves()[this.levelMoveIndex], LearnMoveType.MEMORY, cost));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2682,15 +2684,15 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier {
|
|||
count.value *= (this.getStackCount() + 1);
|
||||
|
||||
switch (this.getStackCount()) {
|
||||
case 1:
|
||||
power.value *= 0.4;
|
||||
break;
|
||||
case 2:
|
||||
power.value *= 0.25;
|
||||
break;
|
||||
case 3:
|
||||
power.value *= 0.175;
|
||||
break;
|
||||
case 1:
|
||||
power.value *= 0.4;
|
||||
break;
|
||||
case 2:
|
||||
power.value *= 0.25;
|
||||
break;
|
||||
case 3:
|
||||
power.value *= 0.175;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -84,170 +84,170 @@ export class CommandPhase extends FieldPhase {
|
|||
let success: boolean;
|
||||
|
||||
switch (command) {
|
||||
case Command.FIGHT:
|
||||
let useStruggle = false;
|
||||
if (cursor === -1 ||
|
||||
case Command.FIGHT:
|
||||
let useStruggle = false;
|
||||
if (cursor === -1 ||
|
||||
playerPokemon.trySelectMove(cursor, args[0] as boolean) ||
|
||||
(useStruggle = cursor > -1 && !playerPokemon.getMoveset().filter(m => m?.isUsable(playerPokemon)).length)) {
|
||||
const moveId = !useStruggle ? cursor > -1 ? playerPokemon.getMoveset()[cursor]!.moveId : Moves.NONE : Moves.STRUGGLE; // TODO: is the bang correct?
|
||||
const turnCommand: TurnCommand = { command: Command.FIGHT, cursor: cursor, move: { move: moveId, targets: [], ignorePP: args[0] }, args: args };
|
||||
const moveTargets: MoveTargetSet = args.length < 3 ? getMoveTargets(playerPokemon, moveId) : args[2];
|
||||
if (!moveId) {
|
||||
turnCommand.targets = [ this.fieldIndex ];
|
||||
}
|
||||
console.log(moveTargets, getPokemonNameWithAffix(playerPokemon));
|
||||
if (moveTargets.targets.length > 1 && moveTargets.multiple) {
|
||||
this.scene.unshiftPhase(new SelectTargetPhase(this.scene, this.fieldIndex));
|
||||
}
|
||||
if (moveTargets.targets.length <= 1 || moveTargets.multiple) {
|
||||
const moveId = !useStruggle ? cursor > -1 ? playerPokemon.getMoveset()[cursor]!.moveId : Moves.NONE : Moves.STRUGGLE; // TODO: is the bang correct?
|
||||
const turnCommand: TurnCommand = { command: Command.FIGHT, cursor: cursor, move: { move: moveId, targets: [], ignorePP: args[0] }, args: args };
|
||||
const moveTargets: MoveTargetSet = args.length < 3 ? getMoveTargets(playerPokemon, moveId) : args[2];
|
||||
if (!moveId) {
|
||||
turnCommand.targets = [ this.fieldIndex ];
|
||||
}
|
||||
console.log(moveTargets, getPokemonNameWithAffix(playerPokemon));
|
||||
if (moveTargets.targets.length > 1 && moveTargets.multiple) {
|
||||
this.scene.unshiftPhase(new SelectTargetPhase(this.scene, this.fieldIndex));
|
||||
}
|
||||
if (moveTargets.targets.length <= 1 || moveTargets.multiple) {
|
||||
turnCommand.move!.targets = moveTargets.targets; //TODO: is the bang correct here?
|
||||
} else if (playerPokemon.getTag(BattlerTagType.CHARGING) && playerPokemon.getMoveQueue().length >= 1) {
|
||||
} else if (playerPokemon.getTag(BattlerTagType.CHARGING) && playerPokemon.getMoveQueue().length >= 1) {
|
||||
turnCommand.move!.targets = playerPokemon.getMoveQueue()[0].targets; //TODO: is the bang correct here?
|
||||
} else {
|
||||
this.scene.unshiftPhase(new SelectTargetPhase(this.scene, this.fieldIndex));
|
||||
}
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = turnCommand;
|
||||
success = true;
|
||||
} else if (cursor < playerPokemon.getMoveset().length) {
|
||||
const move = playerPokemon.getMoveset()[cursor]!; //TODO: is this bang correct?
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
} else {
|
||||
this.scene.unshiftPhase(new SelectTargetPhase(this.scene, this.fieldIndex));
|
||||
}
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = turnCommand;
|
||||
success = true;
|
||||
} else if (cursor < playerPokemon.getMoveset().length) {
|
||||
const move = playerPokemon.getMoveset()[cursor]!; //TODO: is this bang correct?
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
|
||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||
const errorMessage =
|
||||
// Decides between a Disabled, Not Implemented, or No PP translation message
|
||||
const errorMessage =
|
||||
playerPokemon.isMoveRestricted(move.moveId, playerPokemon)
|
||||
? playerPokemon.getRestrictingTag(move.moveId, playerPokemon)!.selectionDeniedText(playerPokemon, move.moveId)
|
||||
: move.getName().endsWith(" (N)") ? "battle:moveNotImplemented" : "battle:moveNoPP";
|
||||
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
|
||||
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
|
||||
|
||||
this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
}, null, true);
|
||||
}
|
||||
break;
|
||||
case Command.BALL:
|
||||
const notInDex = (this.scene.getEnemyField().filter(p => p.isActive(true)).some(p => !p.scene.gameData.dexData[p.species.speciesId].caughtAttr) && this.scene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarterCosts).length - 1);
|
||||
if (this.scene.arena.biomeType === Biome.END && (!this.scene.gameMode.isClassic || this.scene.gameMode.isFreshStartChallenge() || notInDex )) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballForce"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballTrainer"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (this.scene.currentBattle.isBattleMysteryEncounter() && !this.scene.currentBattle.mysteryEncounter!.catchAllowed) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballMysteryEncounter"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
const targets = this.scene.getEnemyField().filter(p => p.isActive(true)).map(p => p.getBattlerIndex());
|
||||
if (targets.length > 1) {
|
||||
this.scene.ui.showText(i18next.t(errorMessage, { moveName: moveName }), null, () => {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.FIGHT, this.fieldIndex);
|
||||
}, null, true);
|
||||
}
|
||||
break;
|
||||
case Command.BALL:
|
||||
const notInDex = (this.scene.getEnemyField().filter(p => p.isActive(true)).some(p => !p.scene.gameData.dexData[p.species.speciesId].caughtAttr) && this.scene.gameData.getStarterCount(d => !!d.caughtAttr) < Object.keys(speciesStarterCosts).length - 1);
|
||||
if (this.scene.arena.biomeType === Biome.END && (!this.scene.gameMode.isClassic || this.scene.gameMode.isFreshStartChallenge() || notInDex )) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballMulti"), null, () => {
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballForce"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (cursor < 5) {
|
||||
const targetPokemon = this.scene.getEnemyField().find(p => p.isActive(true));
|
||||
if (targetPokemon?.isBoss() && targetPokemon?.bossSegmentIndex >= 1 && !targetPokemon?.hasAbility(Abilities.WONDER_GUARD, false, true) && cursor < PokeballType.MASTER_BALL) {
|
||||
} else if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballTrainer"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (this.scene.currentBattle.isBattleMysteryEncounter() && !this.scene.currentBattle.mysteryEncounter!.catchAllowed) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballMysteryEncounter"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
const targets = this.scene.getEnemyField().filter(p => p.isActive(true)).map(p => p.getBattlerIndex());
|
||||
if (targets.length > 1) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballStrong"), null, () => {
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballMulti"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = { command: Command.BALL, cursor: cursor };
|
||||
} else if (cursor < 5) {
|
||||
const targetPokemon = this.scene.getEnemyField().find(p => p.isActive(true));
|
||||
if (targetPokemon?.isBoss() && targetPokemon?.bossSegmentIndex >= 1 && !targetPokemon?.hasAbility(Abilities.WONDER_GUARD, false, true) && cursor < PokeballType.MASTER_BALL) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noPokeballStrong"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = { command: Command.BALL, cursor: cursor };
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex]!.targets = targets;
|
||||
if (this.fieldIndex) {
|
||||
this.scene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Command.POKEMON:
|
||||
case Command.RUN:
|
||||
const isSwitch = command === Command.POKEMON;
|
||||
const { currentBattle, arena } = this.scene;
|
||||
const mysteryEncounterFleeAllowed = currentBattle.mysteryEncounter?.fleeAllowed;
|
||||
if (!isSwitch && (arena.biomeType === Biome.END || (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noEscapeForce"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
break;
|
||||
case Command.POKEMON:
|
||||
case Command.RUN:
|
||||
const isSwitch = command === Command.POKEMON;
|
||||
const { currentBattle, arena } = this.scene;
|
||||
const mysteryEncounterFleeAllowed = currentBattle.mysteryEncounter?.fleeAllowed;
|
||||
if (!isSwitch && (arena.biomeType === Biome.END || (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (!isSwitch && (currentBattle.battleType === BattleType.TRAINER || currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noEscapeTrainer"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
const batonPass = isSwitch && args[0] as boolean;
|
||||
const trappedAbMessages: string[] = [];
|
||||
if (batonPass || !playerPokemon.isTrapped(trappedAbMessages)) {
|
||||
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
: { command: Command.RUN };
|
||||
success = true;
|
||||
if (!isSwitch && this.fieldIndex) {
|
||||
currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
||||
}
|
||||
} else if (trappedAbMessages.length > 0) {
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
}
|
||||
this.scene.ui.showText(trappedAbMessages[0], null, () => {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noEscapeForce"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else if (!isSwitch && (currentBattle.battleType === BattleType.TRAINER || currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
this.scene.ui.showText(i18next.t("battle:noEscapeTrainer"), null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}, null, true);
|
||||
} else {
|
||||
const trapTag = playerPokemon.getTag(TrappedTag);
|
||||
|
||||
// trapTag should be defined at this point, but just in case...
|
||||
if (!trapTag) {
|
||||
const batonPass = isSwitch && args[0] as boolean;
|
||||
const trappedAbMessages: string[] = [];
|
||||
if (batonPass || !playerPokemon.isTrapped(trappedAbMessages)) {
|
||||
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
: { command: Command.RUN };
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
}
|
||||
this.scene.ui.showText(
|
||||
i18next.t("battle:noEscapePokemon", {
|
||||
pokemonName: trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) : "",
|
||||
moveName: trapTag.getMoveName(),
|
||||
escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee")
|
||||
}),
|
||||
null,
|
||||
() => {
|
||||
success = true;
|
||||
if (!isSwitch && this.fieldIndex) {
|
||||
currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
||||
}
|
||||
} else if (trappedAbMessages.length > 0) {
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
}
|
||||
this.scene.ui.showText(trappedAbMessages[0], null, () => {
|
||||
this.scene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}, null, true);
|
||||
} else {
|
||||
const trapTag = playerPokemon.getTag(TrappedTag);
|
||||
|
||||
// trapTag should be defined at this point, but just in case...
|
||||
if (!trapTag) {
|
||||
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||
: { command: Command.RUN };
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
}
|
||||
this.scene.ui.showText(
|
||||
i18next.t("battle:noEscapePokemon", {
|
||||
pokemonName: trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) : "",
|
||||
moveName: trapTag.getMoveName(),
|
||||
escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee")
|
||||
}),
|
||||
null,
|
||||
() => {
|
||||
this.scene.ui.showText("", 0);
|
||||
if (!isSwitch) {
|
||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||
}
|
||||
}, null, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (success!) { // TODO: is the bang correct?
|
||||
|
|
|
@ -41,16 +41,16 @@ export class DamagePhase extends PokemonPhase {
|
|||
|
||||
applyDamage() {
|
||||
switch (this.damageResult) {
|
||||
case HitResult.EFFECTIVE:
|
||||
this.scene.playSound("se/hit");
|
||||
break;
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
case HitResult.ONE_HIT_KO:
|
||||
this.scene.playSound("se/hit_strong");
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
this.scene.playSound("se/hit_weak");
|
||||
break;
|
||||
case HitResult.EFFECTIVE:
|
||||
this.scene.playSound("se/hit");
|
||||
break;
|
||||
case HitResult.SUPER_EFFECTIVE:
|
||||
case HitResult.ONE_HIT_KO:
|
||||
this.scene.playSound("se/hit_strong");
|
||||
break;
|
||||
case HitResult.NOT_VERY_EFFECTIVE:
|
||||
this.scene.playSound("se/hit_weak");
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.amount) {
|
||||
|
|
|
@ -494,31 +494,31 @@ export class EncounterPhase extends BattlePhase {
|
|||
|
||||
tryOverrideForBattleSpec(): boolean {
|
||||
switch (this.scene.currentBattle.battleSpec) {
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
const enemy = this.scene.getEnemyPokemon();
|
||||
this.scene.ui.showText(this.getEncounterMessage(), null, () => {
|
||||
const localizationKey = "battleSpecDialogue:encounter";
|
||||
if (this.scene.ui.shouldSkipDialogue(localizationKey)) {
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
const enemy = this.scene.getEnemyPokemon();
|
||||
this.scene.ui.showText(this.getEncounterMessage(), null, () => {
|
||||
const localizationKey = "battleSpecDialogue:encounter";
|
||||
if (this.scene.ui.shouldSkipDialogue(localizationKey)) {
|
||||
// Logging mirrors logging found in dialogue-ui-handler
|
||||
console.log(`Dialogue ${localizationKey} skipped`);
|
||||
this.doEncounterCommon(false);
|
||||
} else {
|
||||
const count = 5643853 + this.scene.gameData.gameStats.classicSessionsPlayed;
|
||||
// The line below checks if an English ordinal is necessary or not based on whether an entry for encounterLocalizationKey exists in the language or not.
|
||||
const ordinalUsed = !i18next.exists(localizationKey, { fallbackLng: []}) || i18next.resolvedLanguage === "en" ? i18next.t("battleSpecDialogue:key", { count: count, ordinal: true }) : "";
|
||||
const cycleCount = count.toLocaleString() + ordinalUsed;
|
||||
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
const encounterDialogue = i18next.t(localizationKey, { context: genderStr, cycleCount: cycleCount });
|
||||
if (!this.scene.gameData.getSeenDialogues()[localizationKey]) {
|
||||
this.scene.gameData.saveSeenDialogue(localizationKey);
|
||||
}
|
||||
this.scene.ui.showDialogue(encounterDialogue, enemy?.species.name, null, () => {
|
||||
console.log(`Dialogue ${localizationKey} skipped`);
|
||||
this.doEncounterCommon(false);
|
||||
});
|
||||
}
|
||||
}, 1500, true);
|
||||
return true;
|
||||
} else {
|
||||
const count = 5643853 + this.scene.gameData.gameStats.classicSessionsPlayed;
|
||||
// The line below checks if an English ordinal is necessary or not based on whether an entry for encounterLocalizationKey exists in the language or not.
|
||||
const ordinalUsed = !i18next.exists(localizationKey, { fallbackLng: []}) || i18next.resolvedLanguage === "en" ? i18next.t("battleSpecDialogue:key", { count: count, ordinal: true }) : "";
|
||||
const cycleCount = count.toLocaleString() + ordinalUsed;
|
||||
const genderIndex = this.scene.gameData.gender ?? PlayerGender.UNSET;
|
||||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
const encounterDialogue = i18next.t(localizationKey, { context: genderStr, cycleCount: cycleCount });
|
||||
if (!this.scene.gameData.getSeenDialogues()[localizationKey]) {
|
||||
this.scene.gameData.saveSeenDialogue(localizationKey);
|
||||
}
|
||||
this.scene.ui.showDialogue(encounterDialogue, enemy?.species.name, null, () => {
|
||||
this.doEncounterCommon(false);
|
||||
});
|
||||
}
|
||||
}, 1500, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import { BattlerIndex, BattleType } from "#app/battle";
|
||||
import { applyPostFaintAbAttrs, PostFaintAbAttr, applyPostKnockOutAbAttrs, PostKnockOutAbAttr, applyPostVictoryAbAttrs, PostVictoryAbAttr } from "#app/data/ability";
|
||||
import { BattlerTagLapseType } from "#app/data/battler-tags";
|
||||
import { BattlerTagLapseType, DestinyBondTag } from "#app/data/battler-tags";
|
||||
import { battleSpecDialogue } from "#app/data/dialogue";
|
||||
import { allMoves, PostVictoryStatStageChangeAttr } from "#app/data/move";
|
||||
import { BattleSpec } from "#app/enums/battle-spec";
|
||||
import { StatusEffect } from "#app/enums/status-effect";
|
||||
import { PokemonMove, EnemyPokemon, PlayerPokemon, HitResult } from "#app/field/pokemon";
|
||||
import Pokemon, { PokemonMove, EnemyPokemon, PlayerPokemon, HitResult } from "#app/field/pokemon";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { PokemonInstantReviveModifier } from "#app/modifier/modifier";
|
||||
import i18next from "i18next";
|
||||
|
@ -19,19 +19,40 @@ import { SwitchPhase } from "./switch-phase";
|
|||
import { VictoryPhase } from "./victory-phase";
|
||||
import { SpeciesFormChangeActiveTrigger } from "#app/data/pokemon-forms";
|
||||
import { SwitchType } from "#enums/switch-type";
|
||||
import { isNullOrUndefined } from "#app/utils";
|
||||
import { FRIENDSHIP_LOSS_FROM_FAINT } from "#app/data/balance/starters";
|
||||
|
||||
export class FaintPhase extends PokemonPhase {
|
||||
/**
|
||||
* Whether or not enduring (for this phase's purposes, Reviver Seed) should be prevented
|
||||
*/
|
||||
private preventEndure: boolean;
|
||||
|
||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, preventEndure?: boolean) {
|
||||
/**
|
||||
* Destiny Bond tag belonging to the currently fainting Pokemon, if applicable
|
||||
*/
|
||||
private destinyTag?: DestinyBondTag;
|
||||
|
||||
/**
|
||||
* The source Pokemon that dealt fatal damage and should get KO'd by Destiny Bond, if applicable
|
||||
*/
|
||||
private source?: Pokemon;
|
||||
|
||||
constructor(scene: BattleScene, battlerIndex: BattlerIndex, preventEndure: boolean = false, destinyTag?: DestinyBondTag, source?: Pokemon) {
|
||||
super(scene, battlerIndex);
|
||||
|
||||
this.preventEndure = preventEndure!; // TODO: is this bang correct?
|
||||
this.preventEndure = preventEndure;
|
||||
this.destinyTag = destinyTag;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!isNullOrUndefined(this.destinyTag) && !isNullOrUndefined(this.source)) {
|
||||
this.destinyTag.lapse(this.source, BattlerTagLapseType.CUSTOM);
|
||||
}
|
||||
|
||||
if (!this.preventEndure) {
|
||||
const instantReviveModifier = this.scene.applyModifier(PokemonInstantReviveModifier, this.player, this.getPokemon()) as PokemonInstantReviveModifier;
|
||||
|
||||
|
@ -127,7 +148,7 @@ export class FaintPhase extends PokemonPhase {
|
|||
|
||||
pokemon.faintCry(() => {
|
||||
if (pokemon instanceof PlayerPokemon) {
|
||||
pokemon.addFriendship(-10);
|
||||
pokemon.addFriendship(-FRIENDSHIP_LOSS_FROM_FAINT);
|
||||
}
|
||||
pokemon.hideInfo();
|
||||
this.scene.playSound("se/faint");
|
||||
|
@ -158,19 +179,19 @@ export class FaintPhase extends PokemonPhase {
|
|||
|
||||
tryOverrideForBattleSpec(): boolean {
|
||||
switch (this.scene.currentBattle.battleSpec) {
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
if (!this.player) {
|
||||
const enemy = this.getPokemon();
|
||||
if (enemy.formIndex) {
|
||||
this.scene.ui.showDialogue(battleSpecDialogue[BattleSpec.FINAL_BOSS].secondStageWin, enemy.species.name, null, () => this.doFaint());
|
||||
} else {
|
||||
case BattleSpec.FINAL_BOSS:
|
||||
if (!this.player) {
|
||||
const enemy = this.getPokemon();
|
||||
if (enemy.formIndex) {
|
||||
this.scene.ui.showDialogue(battleSpecDialogue[BattleSpec.FINAL_BOSS].secondStageWin, enemy.species.name, null, () => this.doFaint());
|
||||
} else {
|
||||
// Final boss' HP threshold has been bypassed; cancel faint and force check for 2nd phase
|
||||
enemy.hp++;
|
||||
this.scene.unshiftPhase(new DamagePhase(this.scene, enemy.getBattlerIndex(), 0, HitResult.OTHER));
|
||||
this.end();
|
||||
enemy.hp++;
|
||||
this.scene.unshiftPhase(new DamagePhase(this.scene, enemy.getBattlerIndex(), 0, HitResult.OTHER));
|
||||
this.end();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -2,24 +2,37 @@ import BattleScene from "#app/battle-scene";
|
|||
import { initMoveAnim, loadMoveAnimAssets } from "#app/data/battle-anims";
|
||||
import Move, { allMoves } from "#app/data/move";
|
||||
import { SpeciesFormChangeMoveLearnedTrigger } from "#app/data/pokemon-forms";
|
||||
import { Moves } from "#app/enums/moves";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import Overrides from "#app/overrides";
|
||||
import EvolutionSceneHandler from "#app/ui/evolution-scene-handler";
|
||||
import { SummaryUiMode } from "#app/ui/summary-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import i18next from "i18next";
|
||||
import { PlayerPartyMemberPokemonPhase } from "./player-party-member-pokemon-phase";
|
||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
|
||||
export enum LearnMoveType {
|
||||
/** For learning a move via level-up, evolution, or other non-item-based event */
|
||||
LEARN_MOVE,
|
||||
/** For learning a move via Memory Mushroom */
|
||||
MEMORY,
|
||||
/** For learning a move via TM */
|
||||
TM
|
||||
}
|
||||
|
||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||
private moveId: Moves;
|
||||
private messageMode: Mode;
|
||||
private fromTM: boolean;
|
||||
private learnMoveType;
|
||||
private cost: number;
|
||||
|
||||
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves, fromTM?: boolean) {
|
||||
constructor(scene: BattleScene, partyMemberIndex: integer, moveId: Moves, learnMoveType: LearnMoveType = LearnMoveType.LEARN_MOVE, cost: number = -1) {
|
||||
super(scene, partyMemberIndex);
|
||||
this.moveId = moveId;
|
||||
this.fromTM = fromTM ?? false;
|
||||
this.learnMoveType = learnMoveType;
|
||||
this.cost = cost;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -136,11 +149,23 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||
* @param Pokemon The Pokemon learning the move
|
||||
*/
|
||||
async learnMove(index: number, move: Move, pokemon: Pokemon, textMessage?: string) {
|
||||
if (this.fromTM) {
|
||||
if (this.learnMoveType === LearnMoveType.TM) {
|
||||
if (!pokemon.usedTMs) {
|
||||
pokemon.usedTMs = [];
|
||||
}
|
||||
pokemon.usedTMs.push(this.moveId);
|
||||
this.scene.tryRemovePhase((phase) => phase instanceof SelectModifierPhase);
|
||||
} else if (this.learnMoveType === LearnMoveType.MEMORY) {
|
||||
if (this.cost !== -1) {
|
||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
this.scene.money -= this.cost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
}
|
||||
this.scene.playSound("se/buy");
|
||||
} else {
|
||||
this.scene.tryRemovePhase((phase) => phase instanceof SelectModifierPhase);
|
||||
}
|
||||
}
|
||||
pokemon.setMove(index, this.moveId);
|
||||
initMoveAnim(this.scene, this.moveId).then(() => {
|
||||
|
|
|
@ -167,23 +167,23 @@ export class MovePhase extends BattlePhase {
|
|||
let healed = false;
|
||||
|
||||
switch (this.pokemon.status.effect) {
|
||||
case StatusEffect.PARALYSIS:
|
||||
if (!this.pokemon.randSeedInt(4)) {
|
||||
activated = true;
|
||||
this.cancelled = true;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.SLEEP:
|
||||
applyMoveAttrs(BypassSleepAttr, this.pokemon, null, this.move.getMove());
|
||||
healed = this.pokemon.status.turnCount === this.pokemon.status.cureTurn;
|
||||
activated = !healed && !this.pokemon.getTag(BattlerTagType.BYPASS_SLEEP);
|
||||
this.cancelled = activated;
|
||||
break;
|
||||
case StatusEffect.FREEZE:
|
||||
healed = !!this.move.getMove().findAttr(attr => attr instanceof HealStatusEffectAttr && attr.selfTarget && attr.isOfEffect(StatusEffect.FREEZE)) || !this.pokemon.randSeedInt(5);
|
||||
activated = !healed;
|
||||
this.cancelled = activated;
|
||||
break;
|
||||
case StatusEffect.PARALYSIS:
|
||||
if (!this.pokemon.randSeedInt(4)) {
|
||||
activated = true;
|
||||
this.cancelled = true;
|
||||
}
|
||||
break;
|
||||
case StatusEffect.SLEEP:
|
||||
applyMoveAttrs(BypassSleepAttr, this.pokemon, null, this.move.getMove());
|
||||
healed = this.pokemon.status.turnCount === this.pokemon.status.cureTurn;
|
||||
activated = !healed && !this.pokemon.getTag(BattlerTagType.BYPASS_SLEEP);
|
||||
this.cancelled = activated;
|
||||
break;
|
||||
case StatusEffect.FREEZE:
|
||||
healed = !!this.move.getMove().findAttr(attr => attr instanceof HealStatusEffectAttr && attr.selfTarget && attr.isOfEffect(StatusEffect.FREEZE)) || !this.pokemon.randSeedInt(5);
|
||||
activated = !healed;
|
||||
this.cancelled = activated;
|
||||
break;
|
||||
}
|
||||
|
||||
if (activated) {
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import BattleScene from "#app/battle-scene";
|
||||
import { Phase } from "#app/phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
|
||||
export class OutdatedPhase extends Phase {
|
||||
constructor(scene: BattleScene) {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
start(): void {
|
||||
this.scene.ui.setMode(Mode.OUTDATED);
|
||||
}
|
||||
}
|
|
@ -25,20 +25,20 @@ export class PokemonAnimPhase extends BattlePhase {
|
|||
super.start();
|
||||
|
||||
switch (this.key) {
|
||||
case PokemonAnimType.SUBSTITUTE_ADD:
|
||||
this.doSubstituteAddAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_PRE_MOVE:
|
||||
this.doSubstitutePreMoveAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_POST_MOVE:
|
||||
this.doSubstitutePostMoveAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_REMOVE:
|
||||
this.doSubstituteRemoveAnim();
|
||||
break;
|
||||
default:
|
||||
this.end();
|
||||
case PokemonAnimType.SUBSTITUTE_ADD:
|
||||
this.doSubstituteAddAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_PRE_MOVE:
|
||||
this.doSubstitutePreMoveAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_POST_MOVE:
|
||||
this.doSubstitutePostMoveAnim();
|
||||
break;
|
||||
case PokemonAnimType.SUBSTITUTE_REMOVE:
|
||||
this.doSubstituteRemoveAnim();
|
||||
break;
|
||||
default:
|
||||
this.end();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,16 +26,16 @@ export class PostTurnStatusEffectPhase extends PokemonPhase {
|
|||
this.scene.queueMessage(getStatusEffectActivationText(pokemon.status.effect, getPokemonNameWithAffix(pokemon)));
|
||||
const damage = new Utils.NumberHolder(0);
|
||||
switch (pokemon.status.effect) {
|
||||
case StatusEffect.POISON:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||
break;
|
||||
case StatusEffect.TOXIC:
|
||||
damage.value = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1);
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 4, 1);
|
||||
applyAbAttrs(ReduceBurnDamageAbAttr, pokemon, null, false, damage);
|
||||
break;
|
||||
case StatusEffect.POISON:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 3, 1);
|
||||
break;
|
||||
case StatusEffect.TOXIC:
|
||||
damage.value = Math.max(Math.floor((pokemon.getMaxHp() / 16) * pokemon.status.turnCount), 1);
|
||||
break;
|
||||
case StatusEffect.BURN:
|
||||
damage.value = Math.max(pokemon.getMaxHp() >> 4, 1);
|
||||
applyAbAttrs(ReduceBurnDamageAbAttr, pokemon, null, false, damage);
|
||||
break;
|
||||
}
|
||||
if (damage.value) {
|
||||
// Set preventEndure flag to avoid pokemon surviving thanks to focus band, sturdy, endure ...
|
||||
|
|
|
@ -16,26 +16,32 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
private rerollCount: integer;
|
||||
private modifierTiers?: ModifierTier[];
|
||||
private customModifierSettings?: CustomModifierSettings;
|
||||
private isCopy: boolean;
|
||||
|
||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings) {
|
||||
private typeOptions: ModifierTypeOption[];
|
||||
|
||||
constructor(scene: BattleScene, rerollCount: integer = 0, modifierTiers?: ModifierTier[], customModifierSettings?: CustomModifierSettings, isCopy: boolean = false) {
|
||||
super(scene);
|
||||
|
||||
this.rerollCount = rerollCount;
|
||||
this.modifierTiers = modifierTiers;
|
||||
this.customModifierSettings = customModifierSettings;
|
||||
this.isCopy = isCopy;
|
||||
}
|
||||
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
if (!this.rerollCount) {
|
||||
if (!this.rerollCount && !this.isCopy) {
|
||||
this.updateSeed();
|
||||
} else {
|
||||
} else if (this.rerollCount) {
|
||||
this.scene.reroll = false;
|
||||
}
|
||||
|
||||
const party = this.scene.getParty();
|
||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||
if (!this.isCopy) {
|
||||
regenerateModifierPoolThresholds(party, this.getPoolType(), this.rerollCount);
|
||||
}
|
||||
const modifierCount = new Utils.IntegerHolder(3);
|
||||
if (this.isPlayer()) {
|
||||
this.scene.applyModifiers(ExtraModifierModifier, true, modifierCount);
|
||||
|
@ -54,7 +60,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
}
|
||||
}
|
||||
|
||||
const typeOptions: ModifierTypeOption[] = this.getModifierTypeOptions(modifierCount.value);
|
||||
this.typeOptions = this.getModifierTypeOptions(modifierCount.value);
|
||||
|
||||
const modifierSelectCallback = (rowCursor: integer, cursor: integer) => {
|
||||
if (rowCursor < 0 || cursor < 0) {
|
||||
|
@ -63,86 +69,86 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
this.scene.ui.revertMode();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)));
|
||||
}, () => this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers)));
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let modifierType: ModifierType;
|
||||
let cost: integer;
|
||||
const rerollCost = this.getRerollCost(typeOptions, this.scene.lockModifierTiers);
|
||||
const rerollCost = this.getRerollCost(this.scene.lockModifierTiers);
|
||||
switch (rowCursor) {
|
||||
case 0:
|
||||
switch (cursor) {
|
||||
case 0:
|
||||
if (rerollCost < 0 || this.scene.money < rerollCost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
} else {
|
||||
this.scene.reroll = true;
|
||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as ModifierTier[]));
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
this.scene.money -= rerollCost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
}
|
||||
this.scene.playSound("se/buy");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
switch (cursor) {
|
||||
case 0:
|
||||
if (rerollCost < 0 || this.scene.money < rerollCost) {
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
} else {
|
||||
this.scene.reroll = true;
|
||||
this.scene.unshiftPhase(new SelectModifierPhase(this.scene, this.rerollCount + 1, this.typeOptions.map(o => o.type?.tier).filter(t => t !== undefined) as ModifierTier[]));
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => super.end());
|
||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
this.scene.money -= rerollCost;
|
||||
this.scene.updateMoneyText();
|
||||
this.scene.animateMoneyChanged(false);
|
||||
}
|
||||
this.scene.playSound("se/buy");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, -1, (fromSlotIndex: integer, itemIndex: integer, itemQuantity: integer, toSlotIndex: integer) => {
|
||||
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
|
||||
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
&& m.isTransferable && m.pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
|
||||
const itemModifier = itemModifiers[itemIndex];
|
||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
}
|
||||
}, PartyUiHandler.FilterItemMaxStacks);
|
||||
break;
|
||||
case 2:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
if (rerollCost < 0) {
|
||||
// Reroll lock button is also disabled when reroll is disabled
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
const itemModifier = itemModifiers[itemIndex];
|
||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true, itemQuantity);
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||
}
|
||||
}, PartyUiHandler.FilterItemMaxStacks);
|
||||
break;
|
||||
case 2:
|
||||
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.CHECK, -1, () => {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
if (rerollCost < 0) {
|
||||
// Reroll lock button is also disabled when reroll is disabled
|
||||
this.scene.ui.playError();
|
||||
return false;
|
||||
}
|
||||
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||
uiHandler.setRerollCost(this.getRerollCost(this.scene.lockModifierTiers));
|
||||
uiHandler.updateLockRaritiesText();
|
||||
uiHandler.updateRerollCostText();
|
||||
return false;
|
||||
}
|
||||
this.scene.lockModifierTiers = !this.scene.lockModifierTiers;
|
||||
const uiHandler = this.scene.ui.getHandler() as ModifierSelectUiHandler;
|
||||
uiHandler.setRerollCost(this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
uiHandler.updateLockRaritiesText();
|
||||
uiHandler.updateRerollCostText();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case 1:
|
||||
if (typeOptions.length === 0) {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
return true;
|
||||
}
|
||||
if (typeOptions[cursor].type) {
|
||||
modifierType = typeOptions[cursor].type;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
const shopOptions = getPlayerShopModifierTypeOptionsForWave(this.scene.currentBattle.waveIndex, this.scene.getWaveMoneyAmount(1));
|
||||
const shopOption = shopOptions[rowCursor > 2 || shopOptions.length <= SHOP_OPTIONS_ROW_LIMIT ? cursor : cursor + SHOP_OPTIONS_ROW_LIMIT];
|
||||
if (shopOption.type) {
|
||||
modifierType = shopOption.type;
|
||||
}
|
||||
// Apply Black Sludge to healing item cost
|
||||
const healingItemCost = new NumberHolder(shopOption.cost);
|
||||
this.scene.applyModifier(HealShopCostModifier, true, healingItemCost);
|
||||
cost = healingItemCost.value;
|
||||
break;
|
||||
case 1:
|
||||
if (this.typeOptions.length === 0) {
|
||||
this.scene.ui.clearText();
|
||||
this.scene.ui.setMode(Mode.MESSAGE);
|
||||
super.end();
|
||||
return true;
|
||||
}
|
||||
if (this.typeOptions[cursor].type) {
|
||||
modifierType = this.typeOptions[cursor].type;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
const shopOptions = getPlayerShopModifierTypeOptionsForWave(this.scene.currentBattle.waveIndex, this.scene.getWaveMoneyAmount(1));
|
||||
const shopOption = shopOptions[rowCursor > 2 || shopOptions.length <= SHOP_OPTIONS_ROW_LIMIT ? cursor : cursor + SHOP_OPTIONS_ROW_LIMIT];
|
||||
if (shopOption.type) {
|
||||
modifierType = shopOption.type;
|
||||
}
|
||||
// Apply Black Sludge to healing item cost
|
||||
const healingItemCost = new NumberHolder(shopOption.cost);
|
||||
this.scene.applyModifier(HealShopCostModifier, true, healingItemCost);
|
||||
cost = healingItemCost.value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cost! && (this.scene.money < cost) && !Overrides.WAIVE_ROLL_FEE_OVERRIDE) { // TODO: is the bang on cost correct?
|
||||
|
@ -151,8 +157,16 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
}
|
||||
|
||||
const applyModifier = (modifier: Modifier, playSound: boolean = false) => {
|
||||
const result = this.scene.addModifier(modifier, false, playSound);
|
||||
if (cost) {
|
||||
const result = this.scene.addModifier(modifier, false, playSound, undefined, undefined, cost);
|
||||
// Queue a copy of this phase when applying a TM or Memory Mushroom.
|
||||
// If the player selects either of these, then escapes out of consuming them,
|
||||
// they are returned to a shop in the same state.
|
||||
if (modifier.type instanceof RememberMoveModifierType ||
|
||||
modifier.type instanceof TmModifierType) {
|
||||
this.scene.unshiftPhase(this.copy());
|
||||
}
|
||||
|
||||
if (cost && !(modifier.type instanceof RememberMoveModifierType)) {
|
||||
result.then(success => {
|
||||
if (success) {
|
||||
if (!Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
|
@ -189,7 +203,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
applyModifier(modifier, true);
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||
}
|
||||
}, modifierType.selectFilter);
|
||||
} else {
|
||||
|
@ -216,7 +230,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
applyModifier(modifier!, true); // TODO: is the bang correct?
|
||||
});
|
||||
} else {
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||
}
|
||||
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier);
|
||||
}
|
||||
|
@ -226,7 +240,7 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
|
||||
return !cost!;// TODO: is the bang correct?
|
||||
};
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers));
|
||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), this.typeOptions, modifierSelectCallback, this.getRerollCost(this.scene.lockModifierTiers));
|
||||
}
|
||||
|
||||
updateSeed(): void {
|
||||
|
@ -237,13 +251,13 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
return true;
|
||||
}
|
||||
|
||||
getRerollCost(typeOptions: ModifierTypeOption[], lockRarities: boolean): number {
|
||||
getRerollCost(lockRarities: boolean): number {
|
||||
let baseValue = 0;
|
||||
if (Overrides.WAIVE_ROLL_FEE_OVERRIDE) {
|
||||
return baseValue;
|
||||
} else if (lockRarities) {
|
||||
const tierValues = [ 50, 125, 300, 750, 2000 ];
|
||||
for (const opt of typeOptions) {
|
||||
for (const opt of this.typeOptions) {
|
||||
baseValue += tierValues[opt.type.tier ?? 0];
|
||||
}
|
||||
} else {
|
||||
|
@ -271,6 +285,16 @@ export class SelectModifierPhase extends BattlePhase {
|
|||
return getPlayerModifierTypeOptions(modifierCount, this.scene.getParty(), this.scene.lockModifierTiers ? this.modifierTiers : undefined, this.customModifierSettings);
|
||||
}
|
||||
|
||||
copy(): SelectModifierPhase {
|
||||
return new SelectModifierPhase(
|
||||
this.scene,
|
||||
this.rerollCount,
|
||||
this.modifierTiers,
|
||||
{ guaranteedModifierTypeOptions: this.typeOptions, rerollMultiplier: this.customModifierSettings?.rerollMultiplier, allowLuckUpgrades: false },
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
addModifier(modifier: Modifier): Promise<boolean> {
|
||||
return this.scene.addModifier(modifier, false, true);
|
||||
}
|
||||
|
|
|
@ -152,55 +152,55 @@ export class TurnStartPhase extends FieldPhase {
|
|||
}
|
||||
|
||||
switch (turnCommand?.command) {
|
||||
case Command.FIGHT:
|
||||
const queuedMove = turnCommand.move;
|
||||
pokemon.turnData.order = orderIndex++;
|
||||
if (!queuedMove) {
|
||||
continue;
|
||||
}
|
||||
const move = pokemon.getMoveset().find(m => m?.moveId === queuedMove.move && m?.ppUsed < m?.getMovePp()) || new PokemonMove(queuedMove.move);
|
||||
if (move.getMove().hasAttr(MoveHeaderAttr)) {
|
||||
this.scene.unshiftPhase(new MoveHeaderPhase(this.scene, pokemon, move));
|
||||
}
|
||||
if (pokemon.isPlayer()) {
|
||||
if (turnCommand.cursor === -1) {
|
||||
this.scene.pushPhase(new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move));//TODO: is the bang correct here?
|
||||
} else {
|
||||
const playerPhase = new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move, false, queuedMove.ignorePP);//TODO: is the bang correct here?
|
||||
this.scene.pushPhase(playerPhase);
|
||||
case Command.FIGHT:
|
||||
const queuedMove = turnCommand.move;
|
||||
pokemon.turnData.order = orderIndex++;
|
||||
if (!queuedMove) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
this.scene.pushPhase(new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move, false, queuedMove.ignorePP));//TODO: is the bang correct here?
|
||||
}
|
||||
break;
|
||||
case Command.BALL:
|
||||
this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets![0] % 2, turnCommand.cursor!));//TODO: is the bang correct here?
|
||||
break;
|
||||
case Command.POKEMON:
|
||||
const switchType = turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH;
|
||||
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, switchType, pokemon.getFieldIndex(), turnCommand.cursor!, true, pokemon.isPlayer()));
|
||||
break;
|
||||
case Command.RUN:
|
||||
let runningPokemon = pokemon;
|
||||
if (this.scene.currentBattle.double) {
|
||||
const playerActivePokemon = field.filter(pokemon => {
|
||||
if (!!pokemon) {
|
||||
return pokemon.isPlayer() && pokemon.isActive();
|
||||
const move = pokemon.getMoveset().find(m => m?.moveId === queuedMove.move && m?.ppUsed < m?.getMovePp()) || new PokemonMove(queuedMove.move);
|
||||
if (move.getMove().hasAttr(MoveHeaderAttr)) {
|
||||
this.scene.unshiftPhase(new MoveHeaderPhase(this.scene, pokemon, move));
|
||||
}
|
||||
if (pokemon.isPlayer()) {
|
||||
if (turnCommand.cursor === -1) {
|
||||
this.scene.pushPhase(new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move));//TODO: is the bang correct here?
|
||||
} else {
|
||||
return;
|
||||
const playerPhase = new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move, false, queuedMove.ignorePP);//TODO: is the bang correct here?
|
||||
this.scene.pushPhase(playerPhase);
|
||||
}
|
||||
});
|
||||
// if only one pokemon is alive, use that one
|
||||
if (playerActivePokemon.length > 1) {
|
||||
// find which active pokemon has faster speed
|
||||
const fasterPokemon = playerActivePokemon[0].getStat(Stat.SPD) > playerActivePokemon[1].getStat(Stat.SPD) ? playerActivePokemon[0] : playerActivePokemon[1];
|
||||
// check if either active pokemon has the ability "Run Away"
|
||||
const hasRunAway = playerActivePokemon.find(p => p.hasAbility(Abilities.RUN_AWAY));
|
||||
runningPokemon = hasRunAway !== undefined ? hasRunAway : fasterPokemon;
|
||||
} else {
|
||||
this.scene.pushPhase(new MovePhase(this.scene, pokemon, turnCommand.targets || turnCommand.move!.targets, move, false, queuedMove.ignorePP));//TODO: is the bang correct here?
|
||||
}
|
||||
}
|
||||
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, runningPokemon.getFieldIndex()));
|
||||
break;
|
||||
break;
|
||||
case Command.BALL:
|
||||
this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets![0] % 2, turnCommand.cursor!));//TODO: is the bang correct here?
|
||||
break;
|
||||
case Command.POKEMON:
|
||||
const switchType = turnCommand.args?.[0] ? SwitchType.BATON_PASS : SwitchType.SWITCH;
|
||||
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, switchType, pokemon.getFieldIndex(), turnCommand.cursor!, true, pokemon.isPlayer()));
|
||||
break;
|
||||
case Command.RUN:
|
||||
let runningPokemon = pokemon;
|
||||
if (this.scene.currentBattle.double) {
|
||||
const playerActivePokemon = field.filter(pokemon => {
|
||||
if (!!pokemon) {
|
||||
return pokemon.isPlayer() && pokemon.isActive();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
// if only one pokemon is alive, use that one
|
||||
if (playerActivePokemon.length > 1) {
|
||||
// find which active pokemon has faster speed
|
||||
const fasterPokemon = playerActivePokemon[0].getStat(Stat.SPD) > playerActivePokemon[1].getStat(Stat.SPD) ? playerActivePokemon[0] : playerActivePokemon[1];
|
||||
// check if either active pokemon has the ability "Run Away"
|
||||
const hasRunAway = playerActivePokemon.find(p => p.hasAbility(Abilities.RUN_AWAY));
|
||||
runningPokemon = hasRunAway !== undefined ? hasRunAway : fasterPokemon;
|
||||
}
|
||||
}
|
||||
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, runningPokemon.getFieldIndex()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,133 +156,133 @@ export function getAchievementDescription(localizationKey: string): string {
|
|||
const genderStr = PlayerGender[genderIndex].toLowerCase();
|
||||
|
||||
switch (localizationKey) {
|
||||
case "10K_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._10K_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "100K_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._100K_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "1M_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._1M_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "10M_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._10M_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "250_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._250_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "1000_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._1000_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "2500_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._2500_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "10000_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._10000_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "250_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._250_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "1000_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._1000_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "2500_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._2500_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "10000_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._10000_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "LV_100":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_100.level });
|
||||
case "LV_250":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_250.level });
|
||||
case "LV_1000":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_1000.level });
|
||||
case "10_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._10_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "25_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._25_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "50_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._50_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "75_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._75_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "100_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._100_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "TRANSFER_MAX_STAT_STAGE":
|
||||
return i18next.t("achv:TRANSFER_MAX_STAT_STAGE.description", { context: genderStr });
|
||||
case "MAX_FRIENDSHIP":
|
||||
return i18next.t("achv:MAX_FRIENDSHIP.description", { context: genderStr });
|
||||
case "MEGA_EVOLVE":
|
||||
return i18next.t("achv:MEGA_EVOLVE.description", { context: genderStr });
|
||||
case "GIGANTAMAX":
|
||||
return i18next.t("achv:GIGANTAMAX.description", { context: genderStr });
|
||||
case "TERASTALLIZE":
|
||||
return i18next.t("achv:TERASTALLIZE.description", { context: genderStr });
|
||||
case "STELLAR_TERASTALLIZE":
|
||||
return i18next.t("achv:STELLAR_TERASTALLIZE.description", { context: genderStr });
|
||||
case "SPLICE":
|
||||
return i18next.t("achv:SPLICE.description", { context: genderStr });
|
||||
case "MINI_BLACK_HOLE":
|
||||
return i18next.t("achv:MINI_BLACK_HOLE.description", { context: genderStr });
|
||||
case "CATCH_MYTHICAL":
|
||||
return i18next.t("achv:CATCH_MYTHICAL.description", { context: genderStr });
|
||||
case "CATCH_SUB_LEGENDARY":
|
||||
return i18next.t("achv:CATCH_SUB_LEGENDARY.description", { context: genderStr });
|
||||
case "CATCH_LEGENDARY":
|
||||
return i18next.t("achv:CATCH_LEGENDARY.description", { context: genderStr });
|
||||
case "SEE_SHINY":
|
||||
return i18next.t("achv:SEE_SHINY.description", { context: genderStr });
|
||||
case "SHINY_PARTY":
|
||||
return i18next.t("achv:SHINY_PARTY.description", { context: genderStr });
|
||||
case "HATCH_MYTHICAL":
|
||||
return i18next.t("achv:HATCH_MYTHICAL.description", { context: genderStr });
|
||||
case "HATCH_SUB_LEGENDARY":
|
||||
return i18next.t("achv:HATCH_SUB_LEGENDARY.description", { context: genderStr });
|
||||
case "HATCH_LEGENDARY":
|
||||
return i18next.t("achv:HATCH_LEGENDARY.description", { context: genderStr });
|
||||
case "HATCH_SHINY":
|
||||
return i18next.t("achv:HATCH_SHINY.description", { context: genderStr });
|
||||
case "HIDDEN_ABILITY":
|
||||
return i18next.t("achv:HIDDEN_ABILITY.description", { context: genderStr });
|
||||
case "PERFECT_IVS":
|
||||
return i18next.t("achv:PERFECT_IVS.description", { context: genderStr });
|
||||
case "CLASSIC_VICTORY":
|
||||
return i18next.t("achv:CLASSIC_VICTORY.description", { context: genderStr });
|
||||
case "UNEVOLVED_CLASSIC_VICTORY":
|
||||
return i18next.t("achv:UNEVOLVED_CLASSIC_VICTORY.description", { context: genderStr });
|
||||
case "MONO_GEN_ONE":
|
||||
return i18next.t("achv:MONO_GEN_ONE.description", { context: genderStr });
|
||||
case "MONO_GEN_TWO":
|
||||
return i18next.t("achv:MONO_GEN_TWO.description", { context: genderStr });
|
||||
case "MONO_GEN_THREE":
|
||||
return i18next.t("achv:MONO_GEN_THREE.description", { context: genderStr });
|
||||
case "MONO_GEN_FOUR":
|
||||
return i18next.t("achv:MONO_GEN_FOUR.description", { context: genderStr });
|
||||
case "MONO_GEN_FIVE":
|
||||
return i18next.t("achv:MONO_GEN_FIVE.description", { context: genderStr });
|
||||
case "MONO_GEN_SIX":
|
||||
return i18next.t("achv:MONO_GEN_SIX.description", { context: genderStr });
|
||||
case "MONO_GEN_SEVEN":
|
||||
return i18next.t("achv:MONO_GEN_SEVEN.description", { context: genderStr });
|
||||
case "MONO_GEN_EIGHT":
|
||||
return i18next.t("achv:MONO_GEN_EIGHT.description", { context: genderStr });
|
||||
case "MONO_GEN_NINE":
|
||||
return i18next.t("achv:MONO_GEN_NINE.description", { context: genderStr });
|
||||
case "MONO_NORMAL":
|
||||
case "MONO_FIGHTING":
|
||||
case "MONO_FLYING":
|
||||
case "MONO_POISON":
|
||||
case "MONO_GROUND":
|
||||
case "MONO_ROCK":
|
||||
case "MONO_BUG":
|
||||
case "MONO_GHOST":
|
||||
case "MONO_STEEL":
|
||||
case "MONO_FIRE":
|
||||
case "MONO_WATER":
|
||||
case "MONO_GRASS":
|
||||
case "MONO_ELECTRIC":
|
||||
case "MONO_PSYCHIC":
|
||||
case "MONO_ICE":
|
||||
case "MONO_DRAGON":
|
||||
case "MONO_DARK":
|
||||
case "MONO_FAIRY":
|
||||
return i18next.t("achv:MonoType.description", { context: genderStr, "type": i18next.t(`pokemonInfo:Type.${localizationKey.slice(5)}`) });
|
||||
case "FRESH_START":
|
||||
return i18next.t("achv:FRESH_START.description", { context: genderStr });
|
||||
case "INVERSE_BATTLE":
|
||||
return i18next.t("achv:INVERSE_BATTLE.description", { context: genderStr });
|
||||
case "BREEDERS_IN_SPACE":
|
||||
return i18next.t("achv:BREEDERS_IN_SPACE.description", { context: genderStr });
|
||||
default:
|
||||
return "";
|
||||
case "10K_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._10K_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "100K_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._100K_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "1M_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._1M_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "10M_MONEY":
|
||||
return i18next.t("achv:MoneyAchv.description", { context: genderStr, "moneyAmount": achvs._10M_MONEY.moneyAmount.toLocaleString("en-US") });
|
||||
case "250_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._250_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "1000_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._1000_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "2500_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._2500_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "10000_DMG":
|
||||
return i18next.t("achv:DamageAchv.description", { context: genderStr, "damageAmount": achvs._10000_DMG.damageAmount.toLocaleString("en-US") });
|
||||
case "250_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._250_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "1000_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._1000_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "2500_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._2500_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "10000_HEAL":
|
||||
return i18next.t("achv:HealAchv.description", { context: genderStr, "healAmount": achvs._10000_HEAL.healAmount.toLocaleString("en-US"), "HP": i18next.t(getShortenedStatKey(Stat.HP)) });
|
||||
case "LV_100":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_100.level });
|
||||
case "LV_250":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_250.level });
|
||||
case "LV_1000":
|
||||
return i18next.t("achv:LevelAchv.description", { context: genderStr, "level": achvs.LV_1000.level });
|
||||
case "10_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._10_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "25_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._25_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "50_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._50_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "75_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._75_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "100_RIBBONS":
|
||||
return i18next.t("achv:RibbonAchv.description", { context: genderStr, "ribbonAmount": achvs._100_RIBBONS.ribbonAmount.toLocaleString("en-US") });
|
||||
case "TRANSFER_MAX_STAT_STAGE":
|
||||
return i18next.t("achv:TRANSFER_MAX_STAT_STAGE.description", { context: genderStr });
|
||||
case "MAX_FRIENDSHIP":
|
||||
return i18next.t("achv:MAX_FRIENDSHIP.description", { context: genderStr });
|
||||
case "MEGA_EVOLVE":
|
||||
return i18next.t("achv:MEGA_EVOLVE.description", { context: genderStr });
|
||||
case "GIGANTAMAX":
|
||||
return i18next.t("achv:GIGANTAMAX.description", { context: genderStr });
|
||||
case "TERASTALLIZE":
|
||||
return i18next.t("achv:TERASTALLIZE.description", { context: genderStr });
|
||||
case "STELLAR_TERASTALLIZE":
|
||||
return i18next.t("achv:STELLAR_TERASTALLIZE.description", { context: genderStr });
|
||||
case "SPLICE":
|
||||
return i18next.t("achv:SPLICE.description", { context: genderStr });
|
||||
case "MINI_BLACK_HOLE":
|
||||
return i18next.t("achv:MINI_BLACK_HOLE.description", { context: genderStr });
|
||||
case "CATCH_MYTHICAL":
|
||||
return i18next.t("achv:CATCH_MYTHICAL.description", { context: genderStr });
|
||||
case "CATCH_SUB_LEGENDARY":
|
||||
return i18next.t("achv:CATCH_SUB_LEGENDARY.description", { context: genderStr });
|
||||
case "CATCH_LEGENDARY":
|
||||
return i18next.t("achv:CATCH_LEGENDARY.description", { context: genderStr });
|
||||
case "SEE_SHINY":
|
||||
return i18next.t("achv:SEE_SHINY.description", { context: genderStr });
|
||||
case "SHINY_PARTY":
|
||||
return i18next.t("achv:SHINY_PARTY.description", { context: genderStr });
|
||||
case "HATCH_MYTHICAL":
|
||||
return i18next.t("achv:HATCH_MYTHICAL.description", { context: genderStr });
|
||||
case "HATCH_SUB_LEGENDARY":
|
||||
return i18next.t("achv:HATCH_SUB_LEGENDARY.description", { context: genderStr });
|
||||
case "HATCH_LEGENDARY":
|
||||
return i18next.t("achv:HATCH_LEGENDARY.description", { context: genderStr });
|
||||
case "HATCH_SHINY":
|
||||
return i18next.t("achv:HATCH_SHINY.description", { context: genderStr });
|
||||
case "HIDDEN_ABILITY":
|
||||
return i18next.t("achv:HIDDEN_ABILITY.description", { context: genderStr });
|
||||
case "PERFECT_IVS":
|
||||
return i18next.t("achv:PERFECT_IVS.description", { context: genderStr });
|
||||
case "CLASSIC_VICTORY":
|
||||
return i18next.t("achv:CLASSIC_VICTORY.description", { context: genderStr });
|
||||
case "UNEVOLVED_CLASSIC_VICTORY":
|
||||
return i18next.t("achv:UNEVOLVED_CLASSIC_VICTORY.description", { context: genderStr });
|
||||
case "MONO_GEN_ONE":
|
||||
return i18next.t("achv:MONO_GEN_ONE.description", { context: genderStr });
|
||||
case "MONO_GEN_TWO":
|
||||
return i18next.t("achv:MONO_GEN_TWO.description", { context: genderStr });
|
||||
case "MONO_GEN_THREE":
|
||||
return i18next.t("achv:MONO_GEN_THREE.description", { context: genderStr });
|
||||
case "MONO_GEN_FOUR":
|
||||
return i18next.t("achv:MONO_GEN_FOUR.description", { context: genderStr });
|
||||
case "MONO_GEN_FIVE":
|
||||
return i18next.t("achv:MONO_GEN_FIVE.description", { context: genderStr });
|
||||
case "MONO_GEN_SIX":
|
||||
return i18next.t("achv:MONO_GEN_SIX.description", { context: genderStr });
|
||||
case "MONO_GEN_SEVEN":
|
||||
return i18next.t("achv:MONO_GEN_SEVEN.description", { context: genderStr });
|
||||
case "MONO_GEN_EIGHT":
|
||||
return i18next.t("achv:MONO_GEN_EIGHT.description", { context: genderStr });
|
||||
case "MONO_GEN_NINE":
|
||||
return i18next.t("achv:MONO_GEN_NINE.description", { context: genderStr });
|
||||
case "MONO_NORMAL":
|
||||
case "MONO_FIGHTING":
|
||||
case "MONO_FLYING":
|
||||
case "MONO_POISON":
|
||||
case "MONO_GROUND":
|
||||
case "MONO_ROCK":
|
||||
case "MONO_BUG":
|
||||
case "MONO_GHOST":
|
||||
case "MONO_STEEL":
|
||||
case "MONO_FIRE":
|
||||
case "MONO_WATER":
|
||||
case "MONO_GRASS":
|
||||
case "MONO_ELECTRIC":
|
||||
case "MONO_PSYCHIC":
|
||||
case "MONO_ICE":
|
||||
case "MONO_DRAGON":
|
||||
case "MONO_DARK":
|
||||
case "MONO_FAIRY":
|
||||
return i18next.t("achv:MonoType.description", { context: genderStr, "type": i18next.t(`pokemonInfo:Type.${localizationKey.slice(5)}`) });
|
||||
case "FRESH_START":
|
||||
return i18next.t("achv:FRESH_START.description", { context: genderStr });
|
||||
case "INVERSE_BATTLE":
|
||||
return i18next.t("achv:INVERSE_BATTLE.description", { context: genderStr });
|
||||
case "BREEDERS_IN_SPACE":
|
||||
return i18next.t("achv:BREEDERS_IN_SPACE.description", { context: genderStr });
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,10 +43,9 @@ import { Species } from "#enums/species";
|
|||
import { applyChallenges, ChallengeType } from "#app/data/challenge";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import { TerrainType } from "#app/data/terrain";
|
||||
import { OutdatedPhase } from "#app/phases/outdated-phase";
|
||||
import { ReloadSessionPhase } from "#app/phases/reload-session-phase";
|
||||
import { RUN_HISTORY_LIMIT } from "#app/ui/run-history-ui-handler";
|
||||
import { applySessionDataPatches, applySettingsDataPatches, applySystemDataPatches } from "#app/system/version-converter";
|
||||
import { applySessionVersionMigration, applySystemVersionMigration, applySettingsVersionMigration } from "./version_migration/version_converter";
|
||||
import { MysteryEncounterSaveData } from "#app/data/mystery-encounters/mystery-encounter-save-data";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { PokerogueApiClearSessionData } from "#app/@types/pokerogue-api";
|
||||
|
@ -68,22 +67,22 @@ const saveKey = "x0i2O7WRiANTqPmZ"; // Temporary; secure encryption is not yet n
|
|||
|
||||
export function getDataTypeKey(dataType: GameDataType, slotId: integer = 0): string {
|
||||
switch (dataType) {
|
||||
case GameDataType.SYSTEM:
|
||||
return "data";
|
||||
case GameDataType.SESSION:
|
||||
let ret = "sessionData";
|
||||
if (slotId) {
|
||||
ret += slotId;
|
||||
}
|
||||
return ret;
|
||||
case GameDataType.SETTINGS:
|
||||
return "settings";
|
||||
case GameDataType.TUTORIALS:
|
||||
return "tutorials";
|
||||
case GameDataType.SEEN_DIALOGUES:
|
||||
return "seenDialogues";
|
||||
case GameDataType.RUN_HISTORY:
|
||||
return "runHistoryData";
|
||||
case GameDataType.SYSTEM:
|
||||
return "data";
|
||||
case GameDataType.SESSION:
|
||||
let ret = "sessionData";
|
||||
if (slotId) {
|
||||
ret += slotId;
|
||||
}
|
||||
return ret;
|
||||
case GameDataType.SETTINGS:
|
||||
return "settings";
|
||||
case GameDataType.TUTORIALS:
|
||||
return "tutorials";
|
||||
case GameDataType.SEEN_DIALOGUES:
|
||||
return "seenDialogues";
|
||||
case GameDataType.RUN_HISTORY:
|
||||
return "runHistoryData";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,10 +402,7 @@ export class GameData {
|
|||
.then(error => {
|
||||
this.scene.ui.savingIcon.hide();
|
||||
if (error) {
|
||||
if (error.startsWith("client version out of date")) {
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
|
||||
} else if (error.startsWith("session out of date")) {
|
||||
if (error.startsWith("session out of date")) {
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
||||
}
|
||||
|
@ -482,7 +478,7 @@ export class GameData {
|
|||
localStorage.setItem(lsItemKey, "");
|
||||
}
|
||||
|
||||
applySystemDataPatches(systemData);
|
||||
applySystemVersionMigration(systemData);
|
||||
|
||||
this.trainerId = systemData.trainerId;
|
||||
this.secretId = systemData.secretId;
|
||||
|
@ -857,7 +853,7 @@ export class GameData {
|
|||
|
||||
const settings = JSON.parse(localStorage.getItem("settings")!); // TODO: is this bang correct?
|
||||
|
||||
applySettingsDataPatches(settings);
|
||||
applySettingsVersionMigration(settings);
|
||||
|
||||
for (const setting of Object.keys(settings)) {
|
||||
setSetting(this.scene, setting, settings[setting]);
|
||||
|
@ -1313,7 +1309,7 @@ export class GameData {
|
|||
return v;
|
||||
}) as SessionSaveData;
|
||||
|
||||
applySessionDataPatches(sessionData);
|
||||
applySessionVersionMigration(sessionData);
|
||||
|
||||
return sessionData;
|
||||
}
|
||||
|
@ -1354,10 +1350,7 @@ export class GameData {
|
|||
this.scene.ui.savingIcon.hide();
|
||||
}
|
||||
if (error) {
|
||||
if (error.startsWith("client version out of date")) {
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.unshiftPhase(new OutdatedPhase(this.scene));
|
||||
} else if (error.startsWith("session out of date")) {
|
||||
if (error.startsWith("session out of date")) {
|
||||
this.scene.clearPhaseQueue();
|
||||
this.scene.unshiftPhase(new ReloadSessionPhase(this.scene));
|
||||
}
|
||||
|
@ -1381,9 +1374,9 @@ export class GameData {
|
|||
const dataKey: string = `${getDataTypeKey(dataType, slotId)}_${loggedInUser?.username}`;
|
||||
const handleData = (dataStr: string) => {
|
||||
switch (dataType) {
|
||||
case GameDataType.SYSTEM:
|
||||
dataStr = this.convertSystemDataStr(dataStr, true);
|
||||
break;
|
||||
case GameDataType.SYSTEM:
|
||||
dataStr = this.convertSystemDataStr(dataStr, true);
|
||||
break;
|
||||
}
|
||||
const encryptedData = AES.encrypt(dataStr, saveKey);
|
||||
const blob = new Blob([ encryptedData.toString() ], { type: "text/json" });
|
||||
|
@ -1441,28 +1434,28 @@ export class GameData {
|
|||
try {
|
||||
dataName = GameDataType[dataType].toLowerCase();
|
||||
switch (dataType) {
|
||||
case GameDataType.SYSTEM:
|
||||
dataStr = this.convertSystemDataStr(dataStr);
|
||||
const systemData = this.parseSystemData(dataStr);
|
||||
valid = !!systemData.dexData && !!systemData.timestamp;
|
||||
break;
|
||||
case GameDataType.SESSION:
|
||||
const sessionData = this.parseSessionData(dataStr);
|
||||
valid = !!sessionData.party && !!sessionData.enemyParty && !!sessionData.timestamp;
|
||||
break;
|
||||
case GameDataType.RUN_HISTORY:
|
||||
const data = JSON.parse(dataStr);
|
||||
const keys = Object.keys(data);
|
||||
dataName = i18next.t("menuUiHandler:RUN_HISTORY").toLowerCase();
|
||||
keys.forEach((key) => {
|
||||
const entryKeys = Object.keys(data[key]);
|
||||
valid = [ "isFavorite", "isVictory", "entry" ].every(v => entryKeys.includes(v)) && entryKeys.length === 3;
|
||||
});
|
||||
break;
|
||||
case GameDataType.SETTINGS:
|
||||
case GameDataType.TUTORIALS:
|
||||
valid = true;
|
||||
break;
|
||||
case GameDataType.SYSTEM:
|
||||
dataStr = this.convertSystemDataStr(dataStr);
|
||||
const systemData = this.parseSystemData(dataStr);
|
||||
valid = !!systemData.dexData && !!systemData.timestamp;
|
||||
break;
|
||||
case GameDataType.SESSION:
|
||||
const sessionData = this.parseSessionData(dataStr);
|
||||
valid = !!sessionData.party && !!sessionData.enemyParty && !!sessionData.timestamp;
|
||||
break;
|
||||
case GameDataType.RUN_HISTORY:
|
||||
const data = JSON.parse(dataStr);
|
||||
const keys = Object.keys(data);
|
||||
dataName = i18next.t("menuUiHandler:RUN_HISTORY").toLowerCase();
|
||||
keys.forEach((key) => {
|
||||
const entryKeys = Object.keys(data[key]);
|
||||
valid = [ "isFavorite", "isVictory", "entry" ].every(v => entryKeys.includes(v)) && entryKeys.length === 3;
|
||||
});
|
||||
break;
|
||||
case GameDataType.SETTINGS:
|
||||
case GameDataType.TUTORIALS:
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
|
|
|
@ -82,66 +82,66 @@ export const settingGamepadBlackList = [
|
|||
|
||||
export function setSettingGamepad(scene: BattleScene, setting: SettingGamepad, value: integer): boolean {
|
||||
switch (setting) {
|
||||
case SettingGamepad.Gamepad_Support:
|
||||
case SettingGamepad.Gamepad_Support:
|
||||
// if we change the value of the gamepad support, we call a method in the inputController to
|
||||
// activate or deactivate the controller listener
|
||||
scene.inputController.setGamepadSupport(settingGamepadOptions[setting][value] !== "Disabled");
|
||||
break;
|
||||
case SettingGamepad.Button_Action:
|
||||
case SettingGamepad.Button_Cancel:
|
||||
case SettingGamepad.Button_Menu:
|
||||
case SettingGamepad.Button_Stats:
|
||||
case SettingGamepad.Button_Cycle_Shiny:
|
||||
case SettingGamepad.Button_Cycle_Form:
|
||||
case SettingGamepad.Button_Cycle_Gender:
|
||||
case SettingGamepad.Button_Cycle_Ability:
|
||||
case SettingGamepad.Button_Cycle_Nature:
|
||||
case SettingGamepad.Button_Cycle_Variant:
|
||||
case SettingGamepad.Button_Speed_Up:
|
||||
case SettingGamepad.Button_Slow_Down:
|
||||
case SettingGamepad.Button_Submit:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = (success: boolean = false) : boolean => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.GAMEPAD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
scene.inputController.setGamepadSupport(settingGamepadOptions[setting][value] !== "Disabled");
|
||||
break;
|
||||
case SettingGamepad.Button_Action:
|
||||
case SettingGamepad.Button_Cancel:
|
||||
case SettingGamepad.Button_Menu:
|
||||
case SettingGamepad.Button_Stats:
|
||||
case SettingGamepad.Button_Cycle_Shiny:
|
||||
case SettingGamepad.Button_Cycle_Form:
|
||||
case SettingGamepad.Button_Cycle_Gender:
|
||||
case SettingGamepad.Button_Cycle_Ability:
|
||||
case SettingGamepad.Button_Cycle_Nature:
|
||||
case SettingGamepad.Button_Cycle_Variant:
|
||||
case SettingGamepad.Button_Speed_Up:
|
||||
case SettingGamepad.Button_Slow_Down:
|
||||
case SettingGamepad.Button_Submit:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = (success: boolean = false) : boolean => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.GAMEPAD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SettingGamepad.Controller:
|
||||
if (value) {
|
||||
const gp = scene.inputController.getGamepadsName();
|
||||
if (scene.ui && gp) {
|
||||
const cancelHandler = () => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).setOptionCursor(Object.values(SettingGamepad).indexOf(SettingGamepad.Controller), 0, true);
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings();
|
||||
break;
|
||||
case SettingGamepad.Controller:
|
||||
if (value) {
|
||||
const gp = scene.inputController.getGamepadsName();
|
||||
if (scene.ui && gp) {
|
||||
const cancelHandler = () => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).setOptionCursor(Object.values(SettingGamepad).indexOf(SettingGamepad.Controller), 0, true);
|
||||
(scene.ui.getHandler() as SettingsGamepadUiHandler).updateBindings();
|
||||
return false;
|
||||
};
|
||||
const changeGamepadHandler = (gamepad: string) => {
|
||||
scene.inputController.setChosenGamepad(gamepad);
|
||||
cancelHandler();
|
||||
return true;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
options: [ ...gp.map((g: string) => ({
|
||||
label: truncateString(g, 30), // Truncate the gamepad name for display
|
||||
handler: () => changeGamepadHandler(g)
|
||||
})), {
|
||||
label: "Cancel",
|
||||
handler: cancelHandler,
|
||||
}]
|
||||
});
|
||||
return false;
|
||||
};
|
||||
const changeGamepadHandler = (gamepad: string) => {
|
||||
scene.inputController.setChosenGamepad(gamepad);
|
||||
cancelHandler();
|
||||
return true;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
options: [ ...gp.map((g: string) => ({
|
||||
label: truncateString(g, 30), // Truncate the gamepad name for display
|
||||
handler: () => changeGamepadHandler(g)
|
||||
})), {
|
||||
label: "Cancel",
|
||||
handler: cancelHandler,
|
||||
}]
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -135,53 +135,53 @@ export const settingKeyboardBlackList = [
|
|||
|
||||
export function setSettingKeyboard(scene: BattleScene, setting: SettingKeyboard, value: integer): boolean {
|
||||
switch (setting) {
|
||||
case SettingKeyboard.Button_Up:
|
||||
case SettingKeyboard.Button_Down:
|
||||
case SettingKeyboard.Button_Left:
|
||||
case SettingKeyboard.Button_Right:
|
||||
case SettingKeyboard.Button_Action:
|
||||
case SettingKeyboard.Button_Cancel:
|
||||
case SettingKeyboard.Button_Menu:
|
||||
case SettingKeyboard.Button_Stats:
|
||||
case SettingKeyboard.Button_Cycle_Shiny:
|
||||
case SettingKeyboard.Button_Cycle_Form:
|
||||
case SettingKeyboard.Button_Cycle_Gender:
|
||||
case SettingKeyboard.Button_Cycle_Ability:
|
||||
case SettingKeyboard.Button_Cycle_Nature:
|
||||
case SettingKeyboard.Button_Cycle_Variant:
|
||||
case SettingKeyboard.Button_Speed_Up:
|
||||
case SettingKeyboard.Button_Slow_Down:
|
||||
case SettingKeyboard.Alt_Button_Up:
|
||||
case SettingKeyboard.Alt_Button_Down:
|
||||
case SettingKeyboard.Alt_Button_Left:
|
||||
case SettingKeyboard.Alt_Button_Right:
|
||||
case SettingKeyboard.Alt_Button_Action:
|
||||
case SettingKeyboard.Alt_Button_Cancel:
|
||||
case SettingKeyboard.Alt_Button_Menu:
|
||||
case SettingKeyboard.Alt_Button_Stats:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Shiny:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Form:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Gender:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Ability:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Nature:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Variant:
|
||||
case SettingKeyboard.Alt_Button_Speed_Up:
|
||||
case SettingKeyboard.Alt_Button_Slow_Down:
|
||||
case SettingKeyboard.Alt_Button_Submit:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = (success: boolean = false) : boolean => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsKeyboardUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.KEYBOARD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
case SettingKeyboard.Button_Up:
|
||||
case SettingKeyboard.Button_Down:
|
||||
case SettingKeyboard.Button_Left:
|
||||
case SettingKeyboard.Button_Right:
|
||||
case SettingKeyboard.Button_Action:
|
||||
case SettingKeyboard.Button_Cancel:
|
||||
case SettingKeyboard.Button_Menu:
|
||||
case SettingKeyboard.Button_Stats:
|
||||
case SettingKeyboard.Button_Cycle_Shiny:
|
||||
case SettingKeyboard.Button_Cycle_Form:
|
||||
case SettingKeyboard.Button_Cycle_Gender:
|
||||
case SettingKeyboard.Button_Cycle_Ability:
|
||||
case SettingKeyboard.Button_Cycle_Nature:
|
||||
case SettingKeyboard.Button_Cycle_Variant:
|
||||
case SettingKeyboard.Button_Speed_Up:
|
||||
case SettingKeyboard.Button_Slow_Down:
|
||||
case SettingKeyboard.Alt_Button_Up:
|
||||
case SettingKeyboard.Alt_Button_Down:
|
||||
case SettingKeyboard.Alt_Button_Left:
|
||||
case SettingKeyboard.Alt_Button_Right:
|
||||
case SettingKeyboard.Alt_Button_Action:
|
||||
case SettingKeyboard.Alt_Button_Cancel:
|
||||
case SettingKeyboard.Alt_Button_Menu:
|
||||
case SettingKeyboard.Alt_Button_Stats:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Shiny:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Form:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Gender:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Ability:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Nature:
|
||||
case SettingKeyboard.Alt_Button_Cycle_Variant:
|
||||
case SettingKeyboard.Alt_Button_Speed_Up:
|
||||
case SettingKeyboard.Alt_Button_Slow_Down:
|
||||
case SettingKeyboard.Alt_Button_Submit:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = (success: boolean = false) : boolean => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsKeyboardUiHandler).updateBindings();
|
||||
return success;
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.KEYBOARD_BINDING, {
|
||||
target: setting,
|
||||
cancelHandler: cancelHandler,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
// case SettingKeyboard.Default_Layout:
|
||||
// if (value && scene.ui) {
|
||||
// const cancelHandler = () => {
|
||||
|
|
|
@ -76,16 +76,16 @@ const SHOP_CURSOR_TARGET_OPTIONS: SettingOption[] = [
|
|||
|
||||
const shopCursorTargetIndexMap = SHOP_CURSOR_TARGET_OPTIONS.map(option => {
|
||||
switch (option.value) {
|
||||
case "Rewards":
|
||||
return ShopCursorTarget.REWARDS;
|
||||
case "Shop":
|
||||
return ShopCursorTarget.SHOP;
|
||||
case "Reroll":
|
||||
return ShopCursorTarget.REROLL;
|
||||
case "Check Team":
|
||||
return ShopCursorTarget.CHECK_TEAM;
|
||||
default:
|
||||
throw new Error(`Unknown value: ${option.value}`);
|
||||
case "Rewards":
|
||||
return ShopCursorTarget.REWARDS;
|
||||
case "Shop":
|
||||
return ShopCursorTarget.SHOP;
|
||||
case "Reroll":
|
||||
return ShopCursorTarget.REROLL;
|
||||
case "Check Team":
|
||||
return ShopCursorTarget.CHECK_TEAM;
|
||||
default:
|
||||
throw new Error(`Unknown value: ${option.value}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -699,226 +699,226 @@ export function setSetting(scene: BattleScene, setting: string, value: integer):
|
|||
return false;
|
||||
}
|
||||
switch (Setting[index].key) {
|
||||
case SettingKeys.Game_Speed:
|
||||
scene.gameSpeed = parseFloat(Setting[index].options[value].value.replace("x", ""));
|
||||
break;
|
||||
case SettingKeys.Master_Volume:
|
||||
scene.masterVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.BGM_Volume:
|
||||
scene.bgmVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.Field_Volume:
|
||||
scene.fieldVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.SE_Volume:
|
||||
scene.seVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.UI_Volume:
|
||||
scene.uiVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
break;
|
||||
case SettingKeys.Music_Preference:
|
||||
scene.musicPreference = value;
|
||||
break;
|
||||
case SettingKeys.Damage_Numbers:
|
||||
scene.damageNumbersMode = value;
|
||||
break;
|
||||
case SettingKeys.UI_Theme:
|
||||
scene.uiTheme = value;
|
||||
break;
|
||||
case SettingKeys.Window_Type:
|
||||
updateWindowType(scene, parseInt(Setting[index].options[value].value));
|
||||
break;
|
||||
case SettingKeys.Tutorials:
|
||||
scene.enableTutorials = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Move_Info:
|
||||
scene.enableMoveInfo = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Enable_Retries:
|
||||
scene.enableRetries = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Hide_IVs:
|
||||
scene.hideIvs = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Skip_Seen_Dialogues:
|
||||
scene.skipSeenDialogues = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Egg_Skip:
|
||||
scene.eggSkipPreference = value;
|
||||
break;
|
||||
case SettingKeys.Battle_Style:
|
||||
scene.battleStyle = value;
|
||||
break;
|
||||
case SettingKeys.Show_BGM_Bar:
|
||||
scene.showBgmBar = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Notification:
|
||||
if (scene.candyUpgradeNotification === value) {
|
||||
case SettingKeys.Game_Speed:
|
||||
scene.gameSpeed = parseFloat(Setting[index].options[value].value.replace("x", ""));
|
||||
break;
|
||||
}
|
||||
scene.candyUpgradeNotification = value;
|
||||
scene.eventTarget.dispatchEvent(new CandyUpgradeNotificationChangedEvent(value));
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Display:
|
||||
scene.candyUpgradeDisplay = value;
|
||||
case SettingKeys.Money_Format:
|
||||
switch (Setting[index].options[value].value) {
|
||||
case "Normal":
|
||||
scene.moneyFormat = MoneyFormat.NORMAL;
|
||||
case SettingKeys.Master_Volume:
|
||||
scene.masterVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case "Abbreviated":
|
||||
scene.moneyFormat = MoneyFormat.ABBREVIATED;
|
||||
case SettingKeys.BGM_Volume:
|
||||
scene.bgmVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
}
|
||||
scene.updateMoneyText(false);
|
||||
break;
|
||||
case SettingKeys.Sprite_Set:
|
||||
scene.experimentalSprites = !!value;
|
||||
if (value) {
|
||||
scene.initExpSprites();
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Move_Animations:
|
||||
scene.moveAnimations = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Moveset_Flyout:
|
||||
scene.showMovesetFlyout = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Arena_Flyout:
|
||||
scene.showArenaFlyout = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Time_Of_Day_Widget:
|
||||
scene.showTimeOfDayWidget = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Time_Of_Day_Animation:
|
||||
scene.timeOfDayAnimation = Setting[index].options[value].value === "Bounce" ? EaseType.BOUNCE : EaseType.BACK;
|
||||
break;
|
||||
case SettingKeys.Show_Stats_on_Level_Up:
|
||||
scene.showLevelUpStats = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Shop_Cursor_Target:
|
||||
const selectedValue = shopCursorTargetIndexMap[value];
|
||||
scene.shopCursorTarget = selectedValue;
|
||||
break;
|
||||
case SettingKeys.EXP_Gains_Speed:
|
||||
scene.expGainsSpeed = value;
|
||||
break;
|
||||
case SettingKeys.EXP_Party_Display:
|
||||
scene.expParty = value;
|
||||
break;
|
||||
case SettingKeys.HP_Bar_Speed:
|
||||
scene.hpBarSpeed = value;
|
||||
break;
|
||||
case SettingKeys.Fusion_Palette_Swaps:
|
||||
scene.fusionPaletteSwaps = !!value;
|
||||
break;
|
||||
case SettingKeys.Player_Gender:
|
||||
if (scene.gameData) {
|
||||
const female = Setting[index].options[value].value === "Girl";
|
||||
scene.gameData.gender = female ? PlayerGender.FEMALE : PlayerGender.MALE;
|
||||
scene.trainer.setTexture(scene.trainer.texture.key.replace(female ? "m" : "f", female ? "f" : "m"));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Touch_Controls:
|
||||
scene.enableTouchControls = Setting[index].options[value].value !== "Disabled" && hasTouchscreen();
|
||||
const touchControls = document.getElementById("touchControls");
|
||||
if (touchControls) {
|
||||
touchControls.classList.toggle("visible", scene.enableTouchControls);
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Vibration:
|
||||
scene.enableVibration = Setting[index].options[value].value !== "Disabled" && hasTouchscreen();
|
||||
break;
|
||||
case SettingKeys.Type_Hints:
|
||||
scene.typeHints = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Language:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = () => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsUiHandler).setOptionCursor(0, 0, true);
|
||||
};
|
||||
const changeLocaleHandler = (locale: string): boolean => {
|
||||
try {
|
||||
i18next.changeLanguage(locale);
|
||||
localStorage.setItem("prLang", locale);
|
||||
cancelHandler();
|
||||
// Reload the whole game to apply the new locale since also some constants are translated
|
||||
window.location.reload();
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("Error changing locale:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
options: [
|
||||
{
|
||||
label: "English",
|
||||
handler: () => changeLocaleHandler("en")
|
||||
},
|
||||
{
|
||||
label: "Español",
|
||||
handler: () => changeLocaleHandler("es")
|
||||
},
|
||||
{
|
||||
label: "Italiano",
|
||||
handler: () => changeLocaleHandler("it")
|
||||
},
|
||||
{
|
||||
label: "Français",
|
||||
handler: () => changeLocaleHandler("fr")
|
||||
},
|
||||
{
|
||||
label: "Deutsch",
|
||||
handler: () => changeLocaleHandler("de")
|
||||
},
|
||||
{
|
||||
label: "Português (BR)",
|
||||
handler: () => changeLocaleHandler("pt-BR")
|
||||
},
|
||||
{
|
||||
label: "简体中文",
|
||||
handler: () => changeLocaleHandler("zh-CN")
|
||||
},
|
||||
{
|
||||
label: "繁體中文",
|
||||
handler: () => changeLocaleHandler("zh-TW")
|
||||
},
|
||||
{
|
||||
label: "한국어",
|
||||
handler: () => changeLocaleHandler("ko")
|
||||
},
|
||||
{
|
||||
label: "日本語",
|
||||
handler: () => changeLocaleHandler("ja")
|
||||
},
|
||||
// {
|
||||
// label: "Català",
|
||||
// handler: () => changeLocaleHandler("ca-ES")
|
||||
// },
|
||||
{
|
||||
label: i18next.t("settings:back"),
|
||||
handler: () => cancelHandler()
|
||||
}
|
||||
],
|
||||
maxOptions: 7
|
||||
});
|
||||
case SettingKeys.Field_Volume:
|
||||
scene.fieldVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.SE_Volume:
|
||||
scene.seVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case SettingKeys.UI_Volume:
|
||||
scene.uiVolume = value ? parseInt(Setting[index].options[value].value) * 0.01 : 0;
|
||||
break;
|
||||
case SettingKeys.Music_Preference:
|
||||
scene.musicPreference = value;
|
||||
break;
|
||||
case SettingKeys.Damage_Numbers:
|
||||
scene.damageNumbersMode = value;
|
||||
break;
|
||||
case SettingKeys.UI_Theme:
|
||||
scene.uiTheme = value;
|
||||
break;
|
||||
case SettingKeys.Window_Type:
|
||||
updateWindowType(scene, parseInt(Setting[index].options[value].value));
|
||||
break;
|
||||
case SettingKeys.Tutorials:
|
||||
scene.enableTutorials = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Move_Info:
|
||||
scene.enableMoveInfo = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Enable_Retries:
|
||||
scene.enableRetries = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Hide_IVs:
|
||||
scene.hideIvs = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Skip_Seen_Dialogues:
|
||||
scene.skipSeenDialogues = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Egg_Skip:
|
||||
scene.eggSkipPreference = value;
|
||||
break;
|
||||
case SettingKeys.Battle_Style:
|
||||
scene.battleStyle = value;
|
||||
break;
|
||||
case SettingKeys.Show_BGM_Bar:
|
||||
scene.showBgmBar = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Notification:
|
||||
if (scene.candyUpgradeNotification === value) {
|
||||
break;
|
||||
}
|
||||
scene.candyUpgradeNotification = value;
|
||||
scene.eventTarget.dispatchEvent(new CandyUpgradeNotificationChangedEvent(value));
|
||||
break;
|
||||
case SettingKeys.Candy_Upgrade_Display:
|
||||
scene.candyUpgradeDisplay = value;
|
||||
case SettingKeys.Money_Format:
|
||||
switch (Setting[index].options[value].value) {
|
||||
case "Normal":
|
||||
scene.moneyFormat = MoneyFormat.NORMAL;
|
||||
break;
|
||||
case "Abbreviated":
|
||||
scene.moneyFormat = MoneyFormat.ABBREVIATED;
|
||||
break;
|
||||
}
|
||||
scene.updateMoneyText(false);
|
||||
break;
|
||||
case SettingKeys.Sprite_Set:
|
||||
scene.experimentalSprites = !!value;
|
||||
if (value) {
|
||||
scene.initExpSprites();
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Move_Animations:
|
||||
scene.moveAnimations = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Moveset_Flyout:
|
||||
scene.showMovesetFlyout = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Arena_Flyout:
|
||||
scene.showArenaFlyout = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Show_Time_Of_Day_Widget:
|
||||
scene.showTimeOfDayWidget = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Time_Of_Day_Animation:
|
||||
scene.timeOfDayAnimation = Setting[index].options[value].value === "Bounce" ? EaseType.BOUNCE : EaseType.BACK;
|
||||
break;
|
||||
case SettingKeys.Show_Stats_on_Level_Up:
|
||||
scene.showLevelUpStats = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Shop_Cursor_Target:
|
||||
const selectedValue = shopCursorTargetIndexMap[value];
|
||||
scene.shopCursorTarget = selectedValue;
|
||||
break;
|
||||
case SettingKeys.EXP_Gains_Speed:
|
||||
scene.expGainsSpeed = value;
|
||||
break;
|
||||
case SettingKeys.EXP_Party_Display:
|
||||
scene.expParty = value;
|
||||
break;
|
||||
case SettingKeys.HP_Bar_Speed:
|
||||
scene.hpBarSpeed = value;
|
||||
break;
|
||||
case SettingKeys.Fusion_Palette_Swaps:
|
||||
scene.fusionPaletteSwaps = !!value;
|
||||
break;
|
||||
case SettingKeys.Player_Gender:
|
||||
if (scene.gameData) {
|
||||
const female = Setting[index].options[value].value === "Girl";
|
||||
scene.gameData.gender = female ? PlayerGender.FEMALE : PlayerGender.MALE;
|
||||
scene.trainer.setTexture(scene.trainer.texture.key.replace(female ? "m" : "f", female ? "f" : "m"));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Shop_Overlay_Opacity:
|
||||
scene.updateShopOverlayOpacity(parseInt(Setting[index].options[value].value) * .01);
|
||||
break;
|
||||
break;
|
||||
case SettingKeys.Touch_Controls:
|
||||
scene.enableTouchControls = Setting[index].options[value].value !== "Disabled" && hasTouchscreen();
|
||||
const touchControls = document.getElementById("touchControls");
|
||||
if (touchControls) {
|
||||
touchControls.classList.toggle("visible", scene.enableTouchControls);
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Vibration:
|
||||
scene.enableVibration = Setting[index].options[value].value !== "Disabled" && hasTouchscreen();
|
||||
break;
|
||||
case SettingKeys.Type_Hints:
|
||||
scene.typeHints = Setting[index].options[value].value === "On";
|
||||
break;
|
||||
case SettingKeys.Language:
|
||||
if (value) {
|
||||
if (scene.ui) {
|
||||
const cancelHandler = () => {
|
||||
scene.ui.revertMode();
|
||||
(scene.ui.getHandler() as SettingsUiHandler).setOptionCursor(0, 0, true);
|
||||
};
|
||||
const changeLocaleHandler = (locale: string): boolean => {
|
||||
try {
|
||||
i18next.changeLanguage(locale);
|
||||
localStorage.setItem("prLang", locale);
|
||||
cancelHandler();
|
||||
// Reload the whole game to apply the new locale since also some constants are translated
|
||||
window.location.reload();
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error("Error changing locale:", error);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
scene.ui.setOverlayMode(Mode.OPTION_SELECT, {
|
||||
options: [
|
||||
{
|
||||
label: "English",
|
||||
handler: () => changeLocaleHandler("en")
|
||||
},
|
||||
{
|
||||
label: "Español",
|
||||
handler: () => changeLocaleHandler("es")
|
||||
},
|
||||
{
|
||||
label: "Italiano",
|
||||
handler: () => changeLocaleHandler("it")
|
||||
},
|
||||
{
|
||||
label: "Français",
|
||||
handler: () => changeLocaleHandler("fr")
|
||||
},
|
||||
{
|
||||
label: "Deutsch",
|
||||
handler: () => changeLocaleHandler("de")
|
||||
},
|
||||
{
|
||||
label: "Português (BR)",
|
||||
handler: () => changeLocaleHandler("pt-BR")
|
||||
},
|
||||
{
|
||||
label: "简体中文",
|
||||
handler: () => changeLocaleHandler("zh-CN")
|
||||
},
|
||||
{
|
||||
label: "繁體中文",
|
||||
handler: () => changeLocaleHandler("zh-TW")
|
||||
},
|
||||
{
|
||||
label: "한국어",
|
||||
handler: () => changeLocaleHandler("ko")
|
||||
},
|
||||
{
|
||||
label: "日本語",
|
||||
handler: () => changeLocaleHandler("ja")
|
||||
},
|
||||
// {
|
||||
// label: "Català",
|
||||
// handler: () => changeLocaleHandler("ca-ES")
|
||||
// },
|
||||
{
|
||||
label: i18next.t("settings:back"),
|
||||
handler: () => cancelHandler()
|
||||
}
|
||||
],
|
||||
maxOptions: 7
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SettingKeys.Shop_Overlay_Opacity:
|
||||
scene.updateShopOverlayOpacity(parseInt(Setting[index].options[value].value) * .01);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -10,13 +10,13 @@ export enum Unlockables {
|
|||
|
||||
export function getUnlockableName(unlockable: Unlockables) {
|
||||
switch (unlockable) {
|
||||
case Unlockables.ENDLESS_MODE:
|
||||
return `${GameMode.getModeName(GameModes.ENDLESS)} Mode`;
|
||||
case Unlockables.MINI_BLACK_HOLE:
|
||||
return i18next.t("modifierType:ModifierType.MINI_BLACK_HOLE.name");
|
||||
case Unlockables.SPLICED_ENDLESS_MODE:
|
||||
return `${GameMode.getModeName(GameModes.SPLICED_ENDLESS)} Mode`;
|
||||
case Unlockables.EVIOLITE:
|
||||
return i18next.t("modifierType:ModifierType.EVIOLITE.name");
|
||||
case Unlockables.ENDLESS_MODE:
|
||||
return `${GameMode.getModeName(GameModes.ENDLESS)} Mode`;
|
||||
case Unlockables.MINI_BLACK_HOLE:
|
||||
return i18next.t("modifierType:ModifierType.MINI_BLACK_HOLE.name");
|
||||
case Unlockables.SPLICED_ENDLESS_MODE:
|
||||
return `${GameMode.getModeName(GameModes.SPLICED_ENDLESS)} Mode`;
|
||||
case Unlockables.EVIOLITE:
|
||||
return i18next.t("modifierType:ModifierType.EVIOLITE.name");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
import { allSpecies } from "#app/data/pokemon-species";
|
||||
import { AbilityAttr, defaultStarterSpecies, DexAttr, SessionSaveData, SystemSaveData } from "./game-data";
|
||||
import { SettingKeys } from "./settings/settings";
|
||||
|
||||
const LATEST_VERSION = "1.0.5";
|
||||
|
||||
export function applySessionDataPatches(data: SessionSaveData) {
|
||||
const curVersion = data.gameVersion;
|
||||
|
||||
// Always sanitize money as a safeguard
|
||||
data.money = Math.floor(data.money);
|
||||
|
||||
if (curVersion !== LATEST_VERSION) {
|
||||
switch (curVersion) {
|
||||
case "1.0.0":
|
||||
case "1.0.1":
|
||||
case "1.0.2":
|
||||
case "1.0.3":
|
||||
case "1.0.4":
|
||||
// --- PATCHES ---
|
||||
|
||||
// Fix Battle Items, Vitamins, and Lures
|
||||
data.modifiers.forEach((m) => {
|
||||
if (m.className === "PokemonBaseStatModifier") {
|
||||
m.className = "BaseStatModifier";
|
||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||
m.className = "ResetNegativeStatStageModifier";
|
||||
} else if (m.className === "TempBattleStatBoosterModifier") {
|
||||
// Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator
|
||||
if (m.typeId !== "DIRE_HIT") {
|
||||
m.className = "TempStatStageBoosterModifier";
|
||||
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
||||
|
||||
// Migration from TempBattleStat to Stat
|
||||
const newStat = m.typePregenArgs[0] + 1;
|
||||
m.typePregenArgs[0] = newStat;
|
||||
|
||||
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
||||
m.args = [ newStat, 5, m.args[1] ];
|
||||
} else {
|
||||
m.className = "TempCritBoosterModifier";
|
||||
m.typePregenArgs = [];
|
||||
|
||||
// From [ stat, battlesLeft ] to [ maxBattles, battleCount ]
|
||||
m.args = [ 5, m.args[1] ];
|
||||
}
|
||||
|
||||
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
||||
let maxBattles: number;
|
||||
switch (m.typeId) {
|
||||
case "MAX_LURE":
|
||||
maxBattles = 30;
|
||||
break;
|
||||
case "SUPER_LURE":
|
||||
maxBattles = 15;
|
||||
break;
|
||||
default:
|
||||
maxBattles = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
// From [ battlesLeft ] to [ maxBattles, battleCount ]
|
||||
m.args = [ maxBattles, m.args[0] ];
|
||||
}
|
||||
});
|
||||
|
||||
data.enemyModifiers.forEach((m) => {
|
||||
if (m.className === "PokemonBaseStatModifier") {
|
||||
m.className = "BaseStatModifier";
|
||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||
m.className = "ResetNegativeStatStageModifier";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
data.gameVersion = LATEST_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
export function applySystemDataPatches(data: SystemSaveData) {
|
||||
const curVersion = data.gameVersion;
|
||||
if (curVersion !== LATEST_VERSION) {
|
||||
switch (curVersion) {
|
||||
case "1.0.0":
|
||||
case "1.0.1":
|
||||
case "1.0.2":
|
||||
case "1.0.3":
|
||||
case "1.0.4":
|
||||
// --- LEGACY PATCHES ---
|
||||
if (data.starterData && data.dexData) {
|
||||
// Migrate ability starter data if empty for caught species
|
||||
Object.keys(data.starterData).forEach(sd => {
|
||||
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
||||
data.starterData[sd].abilityAttr = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Fix Legendary Stats
|
||||
if (data.gameStats && (data.gameStats.legendaryPokemonCaught !== undefined && data.gameStats.subLegendaryPokemonCaught === undefined)) {
|
||||
data.gameStats.subLegendaryPokemonSeen = 0;
|
||||
data.gameStats.subLegendaryPokemonCaught = 0;
|
||||
data.gameStats.subLegendaryPokemonHatched = 0;
|
||||
allSpecies.filter(s => s.subLegendary).forEach(s => {
|
||||
const dexEntry = data.dexData[s.speciesId];
|
||||
data.gameStats.subLegendaryPokemonSeen += dexEntry.seenCount;
|
||||
data.gameStats.legendaryPokemonSeen = Math.max(data.gameStats.legendaryPokemonSeen - dexEntry.seenCount, 0);
|
||||
data.gameStats.subLegendaryPokemonCaught += dexEntry.caughtCount;
|
||||
data.gameStats.legendaryPokemonCaught = Math.max(data.gameStats.legendaryPokemonCaught - dexEntry.caughtCount, 0);
|
||||
data.gameStats.subLegendaryPokemonHatched += dexEntry.hatchedCount;
|
||||
data.gameStats.legendaryPokemonHatched = Math.max(data.gameStats.legendaryPokemonHatched - dexEntry.hatchedCount, 0);
|
||||
});
|
||||
data.gameStats.subLegendaryPokemonSeen = Math.max(data.gameStats.subLegendaryPokemonSeen, data.gameStats.subLegendaryPokemonCaught);
|
||||
data.gameStats.legendaryPokemonSeen = Math.max(data.gameStats.legendaryPokemonSeen, data.gameStats.legendaryPokemonCaught);
|
||||
data.gameStats.mythicalPokemonSeen = Math.max(data.gameStats.mythicalPokemonSeen, data.gameStats.mythicalPokemonCaught);
|
||||
}
|
||||
|
||||
// --- PATCHES ---
|
||||
|
||||
// Fix Starter Data
|
||||
if (data.starterData && data.dexData) {
|
||||
for (const starterId of defaultStarterSpecies) {
|
||||
if (data.starterData[starterId]?.abilityAttr) {
|
||||
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
||||
}
|
||||
if (data.dexData[starterId]?.caughtAttr) {
|
||||
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.gameVersion = LATEST_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
export function applySettingsDataPatches(settings: Object) {
|
||||
const curVersion = settings.hasOwnProperty("gameVersion") ? settings["gameVersion"] : "1.0.0";
|
||||
if (curVersion !== LATEST_VERSION) {
|
||||
switch (curVersion) {
|
||||
case "1.0.0":
|
||||
case "1.0.1":
|
||||
case "1.0.2":
|
||||
case "1.0.3":
|
||||
case "1.0.4":
|
||||
// --- PATCHES ---
|
||||
|
||||
// Fix Reward Cursor Target
|
||||
if (settings.hasOwnProperty("REROLL_TARGET") && !settings.hasOwnProperty(SettingKeys.Shop_Cursor_Target)) {
|
||||
settings[SettingKeys.Shop_Cursor_Target] = settings["REROLL_TARGET"];
|
||||
delete settings["REROLL_TARGET"];
|
||||
localStorage.setItem("settings", JSON.stringify(settings));
|
||||
}
|
||||
}
|
||||
// Note that the current game version will be written at `saveSettings`
|
||||
}
|
||||
}
|
|
@ -0,0 +1,182 @@
|
|||
import { SessionSaveData, SystemSaveData } from "../game-data";
|
||||
import { version } from "../../../package.json";
|
||||
|
||||
// --- v1.0.4 (and below) PATCHES --- //
|
||||
import * as v1_0_4 from "./versions/v1_0_4";
|
||||
|
||||
const LATEST_VERSION = version.split(".").map(value => parseInt(value));
|
||||
|
||||
/**
|
||||
* Converts incoming {@linkcode SystemSaveData} that has a version below the
|
||||
* current version number listed in `package.json`.
|
||||
*
|
||||
* Note that no transforms act on the {@linkcode data} if its version matches
|
||||
* the current version or if there are no migrations made between its version up
|
||||
* to the current version.
|
||||
* @param data {@linkcode SystemSaveData}
|
||||
* @see {@link SystemVersionConverter}
|
||||
*/
|
||||
export function applySystemVersionMigration(data: SystemSaveData) {
|
||||
const curVersion = data.gameVersion.split(".").map(value => parseInt(value));
|
||||
|
||||
if (!curVersion.every((value, index) => value === LATEST_VERSION[index])) {
|
||||
const converter = new SystemVersionConverter();
|
||||
converter.applyStaticPreprocessors(data);
|
||||
converter.applyMigration(data, curVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts incoming {@linkcode SessionSavaData} that has a version below the
|
||||
* current version number listed in `package.json`.
|
||||
*
|
||||
* Note that no transforms act on the {@linkcode data} if its version matches
|
||||
* the current version or if there are no migrations made between its version up
|
||||
* to the current version.
|
||||
* @param data {@linkcode SessionSaveData}
|
||||
* @see {@link SessionVersionConverter}
|
||||
*/
|
||||
export function applySessionVersionMigration(data: SessionSaveData) {
|
||||
const curVersion = data.gameVersion.split(".").map(value => parseInt(value));
|
||||
|
||||
if (!curVersion.every((value, index) => value === LATEST_VERSION[index])) {
|
||||
const converter = new SessionVersionConverter();
|
||||
converter.applyStaticPreprocessors(data);
|
||||
converter.applyMigration(data, curVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts incoming settings data that has a version below the
|
||||
* current version number listed in `package.json`.
|
||||
*
|
||||
* Note that no transforms act on the {@linkcode data} if its version matches
|
||||
* the current version or if there are no migrations made between its version up
|
||||
* to the current version.
|
||||
* @param data Settings data object
|
||||
* @see {@link SettingsVersionConverter}
|
||||
*/
|
||||
export function applySettingsVersionMigration(data: Object) {
|
||||
const gameVersion: string = data.hasOwnProperty("gameVersion") ? data["gameVersion"] : "1.0.0";
|
||||
const curVersion = gameVersion.split(".").map(value => parseInt(value));
|
||||
|
||||
if (!curVersion.every((value, index) => value === LATEST_VERSION[index])) {
|
||||
const converter = new SettingsVersionConverter();
|
||||
converter.applyStaticPreprocessors(data);
|
||||
converter.applyMigration(data, curVersion);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstract class encapsulating the logic for migrating data from a given version up to
|
||||
* the current version listed in `package.json`.
|
||||
*
|
||||
* Note that, for any version converter, the corresponding `applyMigration`
|
||||
* function would only need to be changed once when the first migration for a
|
||||
* given version is introduced. Similarly, a version file (within the `versions`
|
||||
* folder) would only need to be created for a version once with the appropriate
|
||||
* array nomenclature.
|
||||
*/
|
||||
abstract class VersionConverter {
|
||||
/**
|
||||
* Iterates through an array of designated migration functions that are each
|
||||
* called one by one to transform the data.
|
||||
* @param data The data to be operated on
|
||||
* @param migrationArr An array of functions that will transform the incoming data
|
||||
*/
|
||||
callMigrators(data: any, migrationArr: readonly any[]) {
|
||||
for (const migrate of migrationArr) {
|
||||
migrate(data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies any version-agnostic data sanitation as defined within the function
|
||||
* body.
|
||||
* @param data The data to be operated on
|
||||
*/
|
||||
applyStaticPreprocessors(_data: any): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the current version the incoming data to determine the starting point
|
||||
* of the migration which will cascade up to the latest version, calling the
|
||||
* necessary migration functions in the process.
|
||||
* @param data The data to be operated on
|
||||
* @param curVersion [0] Current major version
|
||||
* [1] Current minor version
|
||||
* [2] Current patch version
|
||||
*/
|
||||
abstract applyMigration(data: any, curVersion: number[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class encapsulating the logic for migrating {@linkcode SessionSaveData} from
|
||||
* a given version up to the current version listed in `package.json`.
|
||||
* @extends VersionConverter
|
||||
*/
|
||||
class SessionVersionConverter extends VersionConverter {
|
||||
override applyStaticPreprocessors(data: SessionSaveData): void {
|
||||
// Always sanitize money as a safeguard
|
||||
data.money = Math.floor(data.money);
|
||||
}
|
||||
|
||||
override applyMigration(data: SessionSaveData, curVersion: number[]): void {
|
||||
const [ curMajor, curMinor, curPatch ] = curVersion;
|
||||
|
||||
if (curMajor === 1) {
|
||||
if (curMinor === 0) {
|
||||
if (curPatch <= 4) {
|
||||
console.log("Applying v1.0.4 session data migration!");
|
||||
this.callMigrators(data, v1_0_4.sessionMigrators);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Session data successfully migrated to v${version}!`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class encapsulating the logic for migrating {@linkcode SystemSaveData} from
|
||||
* a given version up to the current version listed in `package.json`.
|
||||
* @extends VersionConverter
|
||||
*/
|
||||
class SystemVersionConverter extends VersionConverter {
|
||||
override applyMigration(data: SystemSaveData, curVersion: number[]): void {
|
||||
const [ curMajor, curMinor, curPatch ] = curVersion;
|
||||
|
||||
if (curMajor === 1) {
|
||||
if (curMinor === 0) {
|
||||
if (curPatch <= 4) {
|
||||
console.log("Applying v1.0.4 system data migraton!");
|
||||
this.callMigrators(data, v1_0_4.systemMigrators);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`System data successfully migrated to v${version}!`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class encapsulating the logic for migrating settings data from
|
||||
* a given version up to the current version listed in `package.json`.
|
||||
* @extends VersionConverter
|
||||
*/
|
||||
class SettingsVersionConverter extends VersionConverter {
|
||||
override applyMigration(data: Object, curVersion: number[]): void {
|
||||
const [ curMajor, curMinor, curPatch ] = curVersion;
|
||||
|
||||
if (curMajor === 1) {
|
||||
if (curMinor === 0) {
|
||||
if (curPatch <= 4) {
|
||||
console.log("Applying v1.0.4 settings data migraton!");
|
||||
this.callMigrators(data, v1_0_4.settingsMigrators);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`System data successfully migrated to v${version}!`);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
import { SettingKeys } from "../../settings/settings";
|
||||
import { AbilityAttr, defaultStarterSpecies, DexAttr, SystemSaveData, SessionSaveData } from "../../game-data";
|
||||
import { allSpecies } from "../../../data/pokemon-species";
|
||||
|
||||
export const systemMigrators = [
|
||||
/**
|
||||
* Migrate ability starter data if empty for caught species.
|
||||
* @param data {@linkcode SystemSaveData}
|
||||
*/
|
||||
function migrateAbilityData(data: SystemSaveData) {
|
||||
if (data.starterData && data.dexData) {
|
||||
Object.keys(data.starterData).forEach(sd => {
|
||||
if (data.dexData[sd]?.caughtAttr && (data.starterData[sd] && !data.starterData[sd].abilityAttr)) {
|
||||
data.starterData[sd].abilityAttr = 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Populate legendary Pokémon statistics if they are missing.
|
||||
* @param data {@linkcode SystemSaveData}
|
||||
*/
|
||||
function fixLegendaryStats(data: SystemSaveData) {
|
||||
if (data.gameStats && (data.gameStats.legendaryPokemonCaught !== undefined && data.gameStats.subLegendaryPokemonCaught === undefined)) {
|
||||
data.gameStats.subLegendaryPokemonSeen = 0;
|
||||
data.gameStats.subLegendaryPokemonCaught = 0;
|
||||
data.gameStats.subLegendaryPokemonHatched = 0;
|
||||
allSpecies.filter(s => s.subLegendary).forEach(s => {
|
||||
const dexEntry = data.dexData[s.speciesId];
|
||||
data.gameStats.subLegendaryPokemonSeen += dexEntry.seenCount;
|
||||
data.gameStats.legendaryPokemonSeen = Math.max(data.gameStats.legendaryPokemonSeen - dexEntry.seenCount, 0);
|
||||
data.gameStats.subLegendaryPokemonCaught += dexEntry.caughtCount;
|
||||
data.gameStats.legendaryPokemonCaught = Math.max(data.gameStats.legendaryPokemonCaught - dexEntry.caughtCount, 0);
|
||||
data.gameStats.subLegendaryPokemonHatched += dexEntry.hatchedCount;
|
||||
data.gameStats.legendaryPokemonHatched = Math.max(data.gameStats.legendaryPokemonHatched - dexEntry.hatchedCount, 0);
|
||||
});
|
||||
data.gameStats.subLegendaryPokemonSeen = Math.max(data.gameStats.subLegendaryPokemonSeen, data.gameStats.subLegendaryPokemonCaught);
|
||||
data.gameStats.legendaryPokemonSeen = Math.max(data.gameStats.legendaryPokemonSeen, data.gameStats.legendaryPokemonCaught);
|
||||
data.gameStats.mythicalPokemonSeen = Math.max(data.gameStats.mythicalPokemonSeen, data.gameStats.mythicalPokemonCaught);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Unlock all starters' first ability and female gender option.
|
||||
* @param data {@linkcode SystemSaveData}
|
||||
*/
|
||||
function fixStarterData(data: SystemSaveData) {
|
||||
for (const starterId of defaultStarterSpecies) {
|
||||
if (data.starterData[starterId]?.abilityAttr) {
|
||||
data.starterData[starterId].abilityAttr |= AbilityAttr.ABILITY_1;
|
||||
}
|
||||
if (data.dexData[starterId]?.caughtAttr) {
|
||||
data.dexData[starterId].caughtAttr |= DexAttr.FEMALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
] as const;
|
||||
|
||||
export const settingsMigrators = [
|
||||
/**
|
||||
* Migrate from "REROLL_TARGET" property to {@linkcode
|
||||
* SettingKeys.Shop_Cursor_Target}.
|
||||
* @param data the `settings` object
|
||||
*/
|
||||
function fixRerollTarget(data: Object) {
|
||||
if (data.hasOwnProperty("REROLL_TARGET") && !data.hasOwnProperty(SettingKeys.Shop_Cursor_Target)) {
|
||||
data[SettingKeys.Shop_Cursor_Target] = data["REROLL_TARGET"];
|
||||
delete data["REROLL_TARGET"];
|
||||
localStorage.setItem("settings", JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
] as const;
|
||||
|
||||
export const sessionMigrators = [
|
||||
/**
|
||||
* Converts old lapsing modifiers (battle items, lures, and Dire Hit) and
|
||||
* other miscellaneous modifiers (vitamins, White Herb) to any new class
|
||||
* names and/or change in reload arguments.
|
||||
* @param data {@linkcode SessionSaveData}
|
||||
*/
|
||||
function migrateModifiers(data: SessionSaveData) {
|
||||
data.modifiers.forEach((m) => {
|
||||
if (m.className === "PokemonBaseStatModifier") {
|
||||
m.className = "BaseStatModifier";
|
||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||
m.className = "ResetNegativeStatStageModifier";
|
||||
} else if (m.className === "TempBattleStatBoosterModifier") {
|
||||
const maxBattles = 5;
|
||||
// Dire Hit no longer a part of the TempBattleStatBoosterModifierTypeGenerator
|
||||
if (m.typeId !== "DIRE_HIT") {
|
||||
m.className = "TempStatStageBoosterModifier";
|
||||
m.typeId = "TEMP_STAT_STAGE_BOOSTER";
|
||||
|
||||
// Migration from TempBattleStat to Stat
|
||||
const newStat = m.typePregenArgs[0] + 1;
|
||||
m.typePregenArgs[0] = newStat;
|
||||
|
||||
// From [ stat, battlesLeft ] to [ stat, maxBattles, battleCount ]
|
||||
m.args = [ newStat, maxBattles, Math.min(m.args[1], maxBattles) ];
|
||||
} else {
|
||||
m.className = "TempCritBoosterModifier";
|
||||
m.typePregenArgs = [];
|
||||
|
||||
// From [ stat, battlesLeft ] to [ maxBattles, battleCount ]
|
||||
m.args = [ maxBattles, Math.min(m.args[1], maxBattles) ];
|
||||
}
|
||||
} else if (m.className === "DoubleBattleChanceBoosterModifier" && m.args.length === 1) {
|
||||
let maxBattles: number;
|
||||
switch (m.typeId) {
|
||||
case "MAX_LURE":
|
||||
maxBattles = 30;
|
||||
break;
|
||||
case "SUPER_LURE":
|
||||
maxBattles = 15;
|
||||
break;
|
||||
default:
|
||||
maxBattles = 10;
|
||||
break;
|
||||
}
|
||||
|
||||
// From [ battlesLeft ] to [ maxBattles, battleCount ]
|
||||
m.args = [ maxBattles, Math.min(m.args[0], maxBattles) ];
|
||||
}
|
||||
});
|
||||
|
||||
data.enemyModifiers.forEach((m) => {
|
||||
if (m.className === "PokemonBaseStatModifier") {
|
||||
m.className = "BaseStatModifier";
|
||||
} else if (m.className === "PokemonResetNegativeStatStageModifier") {
|
||||
m.className = "ResetNegativeStatStageModifier";
|
||||
}
|
||||
});
|
||||
}
|
||||
] as const;
|
|
@ -45,41 +45,41 @@ export class Voucher {
|
|||
|
||||
getTier(): AchvTier {
|
||||
switch (this.voucherType) {
|
||||
case VoucherType.REGULAR:
|
||||
return AchvTier.COMMON;
|
||||
case VoucherType.PLUS:
|
||||
return AchvTier.GREAT;
|
||||
case VoucherType.PREMIUM:
|
||||
return AchvTier.ULTRA;
|
||||
case VoucherType.GOLDEN:
|
||||
return AchvTier.ROGUE;
|
||||
case VoucherType.REGULAR:
|
||||
return AchvTier.COMMON;
|
||||
case VoucherType.PLUS:
|
||||
return AchvTier.GREAT;
|
||||
case VoucherType.PREMIUM:
|
||||
return AchvTier.ULTRA;
|
||||
case VoucherType.GOLDEN:
|
||||
return AchvTier.ROGUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getVoucherTypeName(voucherType: VoucherType): string {
|
||||
switch (voucherType) {
|
||||
case VoucherType.REGULAR:
|
||||
return i18next.t("voucher:eggVoucher");
|
||||
case VoucherType.PLUS:
|
||||
return i18next.t("voucher:eggVoucherPlus");
|
||||
case VoucherType.PREMIUM:
|
||||
return i18next.t("voucher:eggVoucherPremium");
|
||||
case VoucherType.GOLDEN:
|
||||
return i18next.t("voucher:eggVoucherGold");
|
||||
case VoucherType.REGULAR:
|
||||
return i18next.t("voucher:eggVoucher");
|
||||
case VoucherType.PLUS:
|
||||
return i18next.t("voucher:eggVoucherPlus");
|
||||
case VoucherType.PREMIUM:
|
||||
return i18next.t("voucher:eggVoucherPremium");
|
||||
case VoucherType.GOLDEN:
|
||||
return i18next.t("voucher:eggVoucherGold");
|
||||
}
|
||||
}
|
||||
|
||||
export function getVoucherTypeIcon(voucherType: VoucherType): string {
|
||||
switch (voucherType) {
|
||||
case VoucherType.REGULAR:
|
||||
return "coupon";
|
||||
case VoucherType.PLUS:
|
||||
return "pair_of_tickets";
|
||||
case VoucherType.PREMIUM:
|
||||
return "mystic_ticket";
|
||||
case VoucherType.GOLDEN:
|
||||
return "golden_mystic_ticket";
|
||||
case VoucherType.REGULAR:
|
||||
return "coupon";
|
||||
case VoucherType.PLUS:
|
||||
return "pair_of_tickets";
|
||||
case VoucherType.PREMIUM:
|
||||
return "mystic_ticket";
|
||||
case VoucherType.GOLDEN:
|
||||
return "golden_mystic_ticket";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ describe("Abilities - POWER CONSTRUCT", () => {
|
|||
});
|
||||
|
||||
test(
|
||||
"check if fainted pokemon switches to base form on arena reset",
|
||||
"check if fainted 50% Power Construct Pokemon switches to base form on arena reset",
|
||||
async () => {
|
||||
const baseForm = 2,
|
||||
completeForm = 4;
|
||||
|
@ -41,7 +41,37 @@ describe("Abilities - POWER CONSTRUCT", () => {
|
|||
[Species.ZYGARDE]: completeForm,
|
||||
});
|
||||
|
||||
await game.startBattle([ Species.MAGIKARP, Species.ZYGARDE ]);
|
||||
await game.classicMode.startBattle([ Species.MAGIKARP, Species.ZYGARDE ]);
|
||||
|
||||
const zygarde = game.scene.getParty().find((p) => p.species.speciesId === Species.ZYGARDE);
|
||||
expect(zygarde).not.toBe(undefined);
|
||||
expect(zygarde!.formIndex).toBe(completeForm);
|
||||
|
||||
zygarde!.hp = 0;
|
||||
zygarde!.status = new Status(StatusEffect.FAINT);
|
||||
expect(zygarde!.isFainted()).toBe(true);
|
||||
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.doKillOpponents();
|
||||
await game.phaseInterceptor.to(TurnEndPhase);
|
||||
game.doSelectModifier();
|
||||
await game.phaseInterceptor.to(QuietFormChangePhase);
|
||||
|
||||
expect(zygarde!.formIndex).toBe(baseForm);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
"check if fainted 10% Power Construct Pokemon switches to base form on arena reset",
|
||||
async () => {
|
||||
const baseForm = 3,
|
||||
completeForm = 5;
|
||||
game.override.startingWave(4);
|
||||
game.override.starterForms({
|
||||
[Species.ZYGARDE]: completeForm,
|
||||
});
|
||||
|
||||
await game.classicMode.startBattle([ Species.MAGIKARP, Species.ZYGARDE ]);
|
||||
|
||||
const zygarde = game.scene.getParty().find((p) => p.species.speciesId === Species.ZYGARDE);
|
||||
expect(zygarde).not.toBe(undefined);
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { Abilities } from "#app/enums/abilities";
|
||||
import { Moves } from "#app/enums/moves";
|
||||
import { ModifierTypeOption, modifierTypes } from "#app/modifier/modifier-type";
|
||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||
import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phase from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
@ -32,15 +33,16 @@ describe("Items - Lock Capsule", () => {
|
|||
});
|
||||
|
||||
it("doesn't set the cost of common tier items to 0", async () => {
|
||||
await game.startBattle();
|
||||
await game.classicMode.startBattle();
|
||||
game.scene.overridePhase(new SelectModifierPhase(game.scene, 0, undefined, { guaranteedModifierTiers: [ ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.COMMON ], fillRemaining: false }));
|
||||
|
||||
game.move.select(Moves.SURF);
|
||||
await game.phaseInterceptor.to(SelectModifierPhase, false);
|
||||
game.onNextPrompt("SelectModifierPhase", Mode.MODIFIER_SELECT, () => {
|
||||
const selectModifierPhase = game.scene.getCurrentPhase() as SelectModifierPhase;
|
||||
const rerollCost = selectModifierPhase.getRerollCost(true);
|
||||
expect(rerollCost).toBe(150);
|
||||
});
|
||||
|
||||
const rewards = game.scene.getCurrentPhase() as SelectModifierPhase;
|
||||
const potion = new ModifierTypeOption(modifierTypes.POTION(), 0, 40); // Common tier item
|
||||
const rerollCost = rewards.getRerollCost([ potion, potion, potion ], true);
|
||||
|
||||
expect(rerollCost).toBe(150);
|
||||
game.doSelectModifier();
|
||||
await game.phaseInterceptor.to("SelectModifierPhase");
|
||||
}, 20000);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,255 @@
|
|||
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Species } from "#enums/species";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { PokemonInstantReviveModifier } from "#app/modifier/modifier";
|
||||
|
||||
|
||||
describe("Moves - Destiny Bond", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
const defaultParty = [ Species.BULBASAUR, Species.SQUIRTLE ];
|
||||
const enemyFirst = [ BattlerIndex.ENEMY, BattlerIndex.PLAYER ];
|
||||
const playerFirst = [ BattlerIndex.PLAYER, BattlerIndex.ENEMY ];
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override.battleType("single")
|
||||
.ability(Abilities.UNNERVE) // Pre-emptively prevent flakiness from opponent berries
|
||||
.enemySpecies(Species.RATTATA)
|
||||
.enemyAbility(Abilities.RUN_AWAY)
|
||||
.startingLevel(100) // Make sure tested moves KO
|
||||
.enemyLevel(5)
|
||||
.enemyMoveset(Moves.DESTINY_BOND);
|
||||
});
|
||||
|
||||
it("should KO the opponent on the same turn", async () => {
|
||||
const moveToUse = Moves.TACKLE;
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(true);
|
||||
});
|
||||
|
||||
it("should KO the opponent on the next turn", async () => {
|
||||
const moveToUse = Moves.TACKLE;
|
||||
|
||||
game.override.moveset([ Moves.SPLASH, moveToUse ]);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
// Turn 1: Enemy uses Destiny Bond and doesn't faint
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.setTurnOrder(playerFirst);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(false);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
|
||||
// Turn 2: Player KO's the enemy before the enemy's turn
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(playerFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(true);
|
||||
});
|
||||
|
||||
it("should fail if used twice in a row", async () => {
|
||||
const moveToUse = Moves.TACKLE;
|
||||
|
||||
game.override.moveset([ Moves.SPLASH, moveToUse ]);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
// Turn 1: Enemy uses Destiny Bond and doesn't faint
|
||||
game.move.select(Moves.SPLASH);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(false);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
|
||||
// Turn 2: Enemy should fail Destiny Bond then get KO'd
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
});
|
||||
|
||||
it("should not KO the opponent if the user dies to weather", async () => {
|
||||
// Opponent will be reduced to 1 HP by False Swipe, then faint to Sandstorm
|
||||
const moveToUse = Moves.FALSE_SWIPE;
|
||||
|
||||
game.override.moveset(moveToUse)
|
||||
.ability(Abilities.SAND_STREAM);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
});
|
||||
|
||||
it("should not KO the opponent if the user had another turn", async () => {
|
||||
const moveToUse = Moves.TACKLE;
|
||||
|
||||
game.override.moveset([ Moves.SPORE, moveToUse ]);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
// Turn 1: Enemy uses Destiny Bond and doesn't faint
|
||||
game.move.select(Moves.SPORE);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(false);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
expect(enemyPokemon?.status?.effect).toBe(StatusEffect.SLEEP);
|
||||
|
||||
// Turn 2: Enemy should skip a turn due to sleep, then get KO'd
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(false);
|
||||
});
|
||||
|
||||
it("should not KO an ally", async () => {
|
||||
game.override.moveset([ Moves.DESTINY_BOND, Moves.CRUNCH ])
|
||||
.battleType("double");
|
||||
await game.classicMode.startBattle([ Species.SHEDINJA, Species.BULBASAUR, Species.SQUIRTLE ]);
|
||||
|
||||
const enemyPokemon0 = game.scene.getEnemyField()[0];
|
||||
const enemyPokemon1 = game.scene.getEnemyField()[1];
|
||||
const playerPokemon0 = game.scene.getPlayerField()[0];
|
||||
const playerPokemon1 = game.scene.getPlayerField()[1];
|
||||
|
||||
// Shedinja uses Destiny Bond, then ally Bulbasaur KO's Shedinja with Crunch
|
||||
game.move.select(Moves.DESTINY_BOND, 0);
|
||||
game.move.select(Moves.CRUNCH, 1, BattlerIndex.PLAYER);
|
||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon0?.isFainted()).toBe(false);
|
||||
expect(enemyPokemon1?.isFainted()).toBe(false);
|
||||
expect(playerPokemon0?.isFainted()).toBe(true);
|
||||
expect(playerPokemon1?.isFainted()).toBe(false);
|
||||
});
|
||||
|
||||
it("should not cause a crash if the user is KO'd by Ceaseless Edge", async () => {
|
||||
const moveToUse = Moves.CEASELESS_EDGE;
|
||||
vi.spyOn(allMoves[moveToUse], "accuracy", "get").mockReturnValue(100);
|
||||
|
||||
game.override.moveset(moveToUse);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(true);
|
||||
|
||||
// Ceaseless Edge spikes effect should still activate
|
||||
const tagAfter = game.scene.arena.getTagOnSide(ArenaTagType.SPIKES, ArenaTagSide.ENEMY) as ArenaTrapTag;
|
||||
expect(tagAfter.tagType).toBe(ArenaTagType.SPIKES);
|
||||
expect(tagAfter.layers).toBe(1);
|
||||
});
|
||||
|
||||
it("should not cause a crash if the user is KO'd by Pledge moves", async () => {
|
||||
game.override.moveset([ Moves.GRASS_PLEDGE, Moves.WATER_PLEDGE ])
|
||||
.battleType("double");
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon0 = game.scene.getEnemyField()[0];
|
||||
const enemyPokemon1 = game.scene.getEnemyField()[1];
|
||||
const playerPokemon0 = game.scene.getPlayerField()[0];
|
||||
const playerPokemon1 = game.scene.getPlayerField()[1];
|
||||
|
||||
game.move.select(Moves.GRASS_PLEDGE, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.WATER_PLEDGE, 1, BattlerIndex.ENEMY);
|
||||
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER, BattlerIndex.PLAYER_2 ]);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon0?.isFainted()).toBe(true);
|
||||
expect(enemyPokemon1?.isFainted()).toBe(false);
|
||||
expect(playerPokemon0?.isFainted()).toBe(false);
|
||||
expect(playerPokemon1?.isFainted()).toBe(true);
|
||||
|
||||
// Pledge secondary effect should still activate
|
||||
const tagAfter = game.scene.arena.getTagOnSide(ArenaTagType.GRASS_WATER_PLEDGE, ArenaTagSide.ENEMY) as ArenaTrapTag;
|
||||
expect(tagAfter.tagType).toBe(ArenaTagType.GRASS_WATER_PLEDGE);
|
||||
});
|
||||
|
||||
/**
|
||||
* In particular, this should prevent something like
|
||||
* {@link https://github.com/pagefaultgames/pokerogue/issues/4219}
|
||||
* from occurring with fainting by KO'ing a Destiny Bond user with U-Turn.
|
||||
*/
|
||||
it("should not allow the opponent to revive via Reviver Seed", async () => {
|
||||
const moveToUse = Moves.TACKLE;
|
||||
|
||||
game.override.moveset(moveToUse)
|
||||
.startingHeldItems([{ name: "REVIVER_SEED" }]);
|
||||
await game.classicMode.startBattle(defaultParty);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon();
|
||||
const playerPokemon = game.scene.getPlayerPokemon();
|
||||
|
||||
game.move.select(moveToUse);
|
||||
await game.setTurnOrder(enemyFirst);
|
||||
await game.phaseInterceptor.to("BerryPhase");
|
||||
|
||||
expect(enemyPokemon?.isFainted()).toBe(true);
|
||||
expect(playerPokemon?.isFainted()).toBe(true);
|
||||
|
||||
// Check that the Tackle user's Reviver Seed did not activate
|
||||
const revSeeds = game.scene.getModifiers(PokemonInstantReviveModifier).filter(m => m.pokemonId === playerPokemon?.id);
|
||||
expect(revSeeds.length).toBe(1);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,89 @@
|
|||
import { Abilities } from "#enums/abilities";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { allMoves, SecretPowerAttr } from "#app/data/move";
|
||||
import { Species } from "#enums/species";
|
||||
import GameManager from "#test/utils/gameManager";
|
||||
import Phaser from "phaser";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||
|
||||
describe("Moves - Secret Power", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.moveset([ Moves.SECRET_POWER ])
|
||||
.ability(Abilities.BALL_FETCH)
|
||||
.battleType("single")
|
||||
.disableCrits()
|
||||
.enemySpecies(Species.MAGIKARP)
|
||||
.enemyLevel(60)
|
||||
.enemyAbility(Abilities.BALL_FETCH);
|
||||
});
|
||||
|
||||
it("Secret Power checks for an active terrain first then looks at the biome for its secondary effect", async () => {
|
||||
game.override
|
||||
.startingBiome(Biome.VOLCANO)
|
||||
.enemyMoveset([ Moves.SPLASH, Moves.MISTY_TERRAIN ]);
|
||||
vi.spyOn(allMoves[Moves.SECRET_POWER], "chance", "get").mockReturnValue(100);
|
||||
await game.classicMode.startBattle([ Species.FEEBAS ]);
|
||||
|
||||
const enemyPokemon = game.scene.getEnemyPokemon()!;
|
||||
|
||||
// No Terrain + Biome.VOLCANO --> Burn
|
||||
game.move.select(Moves.SECRET_POWER);
|
||||
await game.forceEnemyMove(Moves.SPLASH);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN);
|
||||
|
||||
// Misty Terrain --> SpAtk -1
|
||||
game.move.select(Moves.SECRET_POWER);
|
||||
await game.forceEnemyMove(Moves.MISTY_TERRAIN);
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
expect(enemyPokemon.getStatStage(Stat.SPATK)).toBe(-1);
|
||||
});
|
||||
|
||||
it("the 'rainbow' effect of fire+water pledge does not double the chance of secret power's secondary effect",
|
||||
async () => {
|
||||
game.override
|
||||
.moveset([ Moves.FIRE_PLEDGE, Moves.WATER_PLEDGE, Moves.SECRET_POWER, Moves.SPLASH ])
|
||||
.enemyMoveset([ Moves.SPLASH ])
|
||||
.battleType("double");
|
||||
await game.classicMode.startBattle([ Species.BLASTOISE, Species.CHARIZARD ]);
|
||||
|
||||
const secretPowerAttr = allMoves[Moves.SECRET_POWER].getAttrs(SecretPowerAttr)[0];
|
||||
vi.spyOn(secretPowerAttr, "getMoveChance");
|
||||
|
||||
game.move.select(Moves.WATER_PLEDGE, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.FIRE_PLEDGE, 1, BattlerIndex.ENEMY_2);
|
||||
|
||||
await game.phaseInterceptor.to("TurnEndPhase");
|
||||
|
||||
expect(game.scene.arena.getTagOnSide(ArenaTagType.WATER_FIRE_PLEDGE, ArenaTagSide.PLAYER)).toBeDefined();
|
||||
|
||||
game.move.select(Moves.SECRET_POWER, 0, BattlerIndex.ENEMY);
|
||||
game.move.select(Moves.SPLASH, 1);
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
|
||||
expect(secretPowerAttr.getMoveChance).toHaveLastReturnedWith(30);
|
||||
}
|
||||
);
|
||||
});
|
|
@ -97,20 +97,20 @@ export async function runSelectMysteryEncounterOption(game: GameManager, optionN
|
|||
uiHandler.unblockInput(); // input are blocked by 1s to prevent accidental input. Tests need to handle that
|
||||
|
||||
switch (optionNo) {
|
||||
default:
|
||||
case 1:
|
||||
default:
|
||||
case 1:
|
||||
// no movement needed. Default cursor position
|
||||
break;
|
||||
case 2:
|
||||
uiHandler.processInput(Button.RIGHT);
|
||||
break;
|
||||
case 3:
|
||||
uiHandler.processInput(Button.DOWN);
|
||||
break;
|
||||
case 4:
|
||||
uiHandler.processInput(Button.RIGHT);
|
||||
uiHandler.processInput(Button.DOWN);
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
uiHandler.processInput(Button.RIGHT);
|
||||
break;
|
||||
case 3:
|
||||
uiHandler.processInput(Button.DOWN);
|
||||
break;
|
||||
case 4:
|
||||
uiHandler.processInput(Button.RIGHT);
|
||||
uiHandler.processInput(Button.DOWN);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isNullOrUndefined(secondaryOptionSelect?.pokemonNo)) {
|
||||
|
|
|
@ -124,10 +124,31 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("should start battle against the trainer", async () => {
|
||||
it("should start battle against the trainer with correctly loaded assets", async () => {
|
||||
await game.runToMysteryEncounter(MysteryEncounterType.THE_EXPERT_POKEMON_BREEDER, defaultParty);
|
||||
|
||||
let successfullyLoaded = false;
|
||||
vi.spyOn(scene, "getEnemyParty").mockImplementation(() => {
|
||||
const ace = scene.currentBattle?.enemyParty[0];
|
||||
if (ace) {
|
||||
// Pretend that loading assets takes an extra 500ms
|
||||
vi.spyOn(ace, "loadAssets").mockImplementation(() => new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
successfullyLoaded = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
}));
|
||||
}
|
||||
|
||||
return scene.currentBattle?.enemyParty ?? [];
|
||||
});
|
||||
|
||||
await runMysteryEncounterToEnd(game, 1, undefined, true);
|
||||
|
||||
// Check that assets are successfully loaded
|
||||
expect(successfullyLoaded).toBe(true);
|
||||
|
||||
// Check usual battle stuff
|
||||
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
|
||||
expect(scene.currentBattle.trainer).toBeDefined();
|
||||
expect(scene.currentBattle.mysteryEncounter?.encounterMode).toBe(MysteryEncounterMode.TRAINER_BATTLE);
|
||||
|
@ -182,10 +203,31 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("should start battle against the trainer", async () => {
|
||||
it("should start battle against the trainer with correctly loaded assets", async () => {
|
||||
await game.runToMysteryEncounter(MysteryEncounterType.THE_EXPERT_POKEMON_BREEDER, defaultParty);
|
||||
|
||||
let successfullyLoaded = false;
|
||||
vi.spyOn(scene, "getEnemyParty").mockImplementation(() => {
|
||||
const ace = scene.currentBattle?.enemyParty[0];
|
||||
if (ace) {
|
||||
// Pretend that loading assets takes an extra 500ms
|
||||
vi.spyOn(ace, "loadAssets").mockImplementation(() => new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
successfullyLoaded = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
}));
|
||||
}
|
||||
|
||||
return scene.currentBattle?.enemyParty ?? [];
|
||||
});
|
||||
|
||||
await runMysteryEncounterToEnd(game, 2, undefined, true);
|
||||
|
||||
// Check that assets are successfully loaded
|
||||
expect(successfullyLoaded).toBe(true);
|
||||
|
||||
// Check usual battle stuff
|
||||
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
|
||||
expect(scene.currentBattle.trainer).toBeDefined();
|
||||
expect(scene.currentBattle.mysteryEncounter?.encounterMode).toBe(MysteryEncounterMode.TRAINER_BATTLE);
|
||||
|
@ -240,10 +282,31 @@ describe("The Expert Pokémon Breeder - Mystery Encounter", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("should start battle against the trainer", async () => {
|
||||
it("should start battle against the trainer with correctly loaded assets", async () => {
|
||||
await game.runToMysteryEncounter(MysteryEncounterType.THE_EXPERT_POKEMON_BREEDER, defaultParty);
|
||||
|
||||
let successfullyLoaded = false;
|
||||
vi.spyOn(scene, "getEnemyParty").mockImplementation(() => {
|
||||
const ace = scene.currentBattle?.enemyParty[0];
|
||||
if (ace) {
|
||||
// Pretend that loading assets takes an extra 500ms
|
||||
vi.spyOn(ace, "loadAssets").mockImplementation(() => new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
successfullyLoaded = true;
|
||||
resolve();
|
||||
}, 500);
|
||||
}));
|
||||
}
|
||||
|
||||
return scene.currentBattle?.enemyParty ?? [];
|
||||
});
|
||||
|
||||
await runMysteryEncounterToEnd(game, 3, undefined, true);
|
||||
|
||||
// Check that assets are successfully loaded
|
||||
expect(successfullyLoaded).toBe(true);
|
||||
|
||||
// Check usual battle stuff
|
||||
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
|
||||
expect(scene.currentBattle.trainer).toBeDefined();
|
||||
expect(scene.currentBattle.mysteryEncounter?.encounterMode).toBe(MysteryEncounterMode.TRAINER_BATTLE);
|
||||
|
|
|
@ -63,11 +63,11 @@ describe("SelectModifierPhase", () => {
|
|||
new ModifierTypeOption(modifierTypes.REVIVE(), 0, 1000)
|
||||
];
|
||||
|
||||
const selectModifierPhase1 = new SelectModifierPhase(scene);
|
||||
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, undefined, { rerollMultiplier: 2 });
|
||||
const selectModifierPhase1 = new SelectModifierPhase(scene, 0, undefined, { guaranteedModifierTypeOptions: options });
|
||||
const selectModifierPhase2 = new SelectModifierPhase(scene, 0, undefined, { guaranteedModifierTypeOptions: options, rerollMultiplier: 2 });
|
||||
|
||||
const cost1 = selectModifierPhase1.getRerollCost(options, false);
|
||||
const cost2 = selectModifierPhase2.getRerollCost(options, false);
|
||||
const cost1 = selectModifierPhase1.getRerollCost(false);
|
||||
const cost2 = selectModifierPhase2.getRerollCost(false);
|
||||
expect(cost2).toEqual(cost1 * 2);
|
||||
});
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import KeyboardPlugin = Phaser.Input.Keyboard.KeyboardPlugin;
|
|||
import GamepadPlugin = Phaser.Input.Gamepad.GamepadPlugin;
|
||||
import EventEmitter = Phaser.Events.EventEmitter;
|
||||
import UpdateList = Phaser.GameObjects.UpdateList;
|
||||
import { version } from "../../../package.json";
|
||||
|
||||
Object.defineProperty(window, "localStorage", {
|
||||
value: mockLocalStorage(),
|
||||
|
@ -101,6 +102,7 @@ export default class GameWrapper {
|
|||
injectMandatory() {
|
||||
this.game.config = {
|
||||
seed: ["test"],
|
||||
gameVersion: version
|
||||
};
|
||||
this.scene.game = this.game;
|
||||
this.game.renderer = {
|
||||
|
|
|
@ -122,20 +122,20 @@ export default class TouchControl {
|
|||
const button = Button[key];
|
||||
|
||||
switch (eventType) {
|
||||
case "keydown":
|
||||
this.events.emit("input_down", {
|
||||
controller_type: "keyboard",
|
||||
button: button,
|
||||
isTouch: true
|
||||
});
|
||||
break;
|
||||
case "keyup":
|
||||
this.events.emit("input_up", {
|
||||
controller_type: "keyboard",
|
||||
button: button,
|
||||
isTouch: true
|
||||
});
|
||||
break;
|
||||
case "keydown":
|
||||
this.events.emit("input_down", {
|
||||
controller_type: "keyboard",
|
||||
button: button,
|
||||
isTouch: true
|
||||
});
|
||||
break;
|
||||
case "keyup":
|
||||
this.events.emit("input_up", {
|
||||
controller_type: "keyboard",
|
||||
button: button,
|
||||
isTouch: true
|
||||
});
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -168,26 +168,26 @@ export class UiInputs {
|
|||
return;
|
||||
}
|
||||
switch (this.scene.ui?.getMode()) {
|
||||
case Mode.MESSAGE:
|
||||
const messageHandler = this.scene.ui.getHandler<MessageUiHandler>();
|
||||
if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) {
|
||||
case Mode.MESSAGE:
|
||||
const messageHandler = this.scene.ui.getHandler<MessageUiHandler>();
|
||||
if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) {
|
||||
return;
|
||||
}
|
||||
case Mode.TITLE:
|
||||
case Mode.COMMAND:
|
||||
case Mode.MODIFIER_SELECT:
|
||||
case Mode.MYSTERY_ENCOUNTER:
|
||||
this.scene.ui.setOverlayMode(Mode.MENU);
|
||||
break;
|
||||
case Mode.STARTER_SELECT:
|
||||
this.buttonTouch();
|
||||
break;
|
||||
case Mode.MENU:
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.playSound("ui/select");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
case Mode.TITLE:
|
||||
case Mode.COMMAND:
|
||||
case Mode.MODIFIER_SELECT:
|
||||
case Mode.MYSTERY_ENCOUNTER:
|
||||
this.scene.ui.setOverlayMode(Mode.MENU);
|
||||
break;
|
||||
case Mode.STARTER_SELECT:
|
||||
this.buttonTouch();
|
||||
break;
|
||||
case Mode.MENU:
|
||||
this.scene.ui.revertMode();
|
||||
this.scene.playSound("ui/select");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -222,20 +222,20 @@ export default abstract class AbstractOptionSelectUiHandler extends UiHandler {
|
|||
}
|
||||
} else {
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
if (this.cursor) {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
} else if (this.cursor === 0) {
|
||||
success = this.setCursor(options.length - 1);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (this.cursor < options.length - 1) {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
} else {
|
||||
success = this.setCursor(0);
|
||||
}
|
||||
break;
|
||||
case Button.UP:
|
||||
if (this.cursor) {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
} else if (this.cursor === 0) {
|
||||
success = this.setCursor(options.length - 1);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (this.cursor < options.length - 1) {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
} else {
|
||||
success = this.setCursor(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (this.config?.supportHover) {
|
||||
// handle hover code if the element supports hover-handlers and the option has the optional hover-handler set.
|
||||
|
|
|
@ -245,51 +245,51 @@ export default class AchvsUiHandler extends MessageUiHandler {
|
|||
const rowIndex = Math.floor(this.cursor / this.COLS);
|
||||
const itemOffset = (this.scrollCursor * this.COLS);
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
if (this.cursor < this.COLS) {
|
||||
if (this.scrollCursor) {
|
||||
success = this.setScrollCursor(this.scrollCursor - 1);
|
||||
} else {
|
||||
case Button.UP:
|
||||
if (this.cursor < this.COLS) {
|
||||
if (this.scrollCursor) {
|
||||
success = this.setScrollCursor(this.scrollCursor - 1);
|
||||
} else {
|
||||
// Wrap around to the last row
|
||||
success = this.setScrollCursor(Math.ceil(this.currentTotal / this.COLS) - this.ROWS);
|
||||
let newCursorIndex = this.cursor + (this.ROWS - 1) * this.COLS;
|
||||
if (newCursorIndex > this.currentTotal - this.scrollCursor * this.COLS - 1) {
|
||||
newCursorIndex -= this.COLS;
|
||||
success = this.setScrollCursor(Math.ceil(this.currentTotal / this.COLS) - this.ROWS);
|
||||
let newCursorIndex = this.cursor + (this.ROWS - 1) * this.COLS;
|
||||
if (newCursorIndex > this.currentTotal - this.scrollCursor * this.COLS - 1) {
|
||||
newCursorIndex -= this.COLS;
|
||||
}
|
||||
success = success && this.setCursor(newCursorIndex);
|
||||
}
|
||||
success = success && this.setCursor(newCursorIndex);
|
||||
}
|
||||
} else {
|
||||
success = this.setCursor(this.cursor - this.COLS);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
const canMoveDown = itemOffset + 1 < this.currentTotal;
|
||||
if (rowIndex >= this.ROWS - 1) {
|
||||
if (this.scrollCursor < Math.ceil(this.currentTotal / this.COLS) - this.ROWS && canMoveDown) {
|
||||
// scroll down one row
|
||||
success = this.setScrollCursor(this.scrollCursor + 1);
|
||||
} else {
|
||||
// wrap back to the first row
|
||||
success = this.setScrollCursor(0) && this.setCursor(this.cursor % this.COLS);
|
||||
success = this.setCursor(this.cursor - this.COLS);
|
||||
}
|
||||
} else if (canMoveDown) {
|
||||
success = this.setCursor(Math.min(this.cursor + this.COLS, this.currentTotal - itemOffset - 1));
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
if (this.cursor % this.COLS === 0) {
|
||||
success = this.setCursor(Math.min(this.cursor + this.COLS - 1, this.currentTotal - itemOffset - 1));
|
||||
} else {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
if ((this.cursor + 1) % this.COLS === 0 || (this.cursor + itemOffset) === (this.currentTotal - 1)) {
|
||||
success = this.setCursor(this.cursor - this.cursor % this.COLS);
|
||||
} else {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case Button.DOWN:
|
||||
const canMoveDown = itemOffset + 1 < this.currentTotal;
|
||||
if (rowIndex >= this.ROWS - 1) {
|
||||
if (this.scrollCursor < Math.ceil(this.currentTotal / this.COLS) - this.ROWS && canMoveDown) {
|
||||
// scroll down one row
|
||||
success = this.setScrollCursor(this.scrollCursor + 1);
|
||||
} else {
|
||||
// wrap back to the first row
|
||||
success = this.setScrollCursor(0) && this.setCursor(this.cursor % this.COLS);
|
||||
}
|
||||
} else if (canMoveDown) {
|
||||
success = this.setCursor(Math.min(this.cursor + this.COLS, this.currentTotal - itemOffset - 1));
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
if (this.cursor % this.COLS === 0) {
|
||||
success = this.setCursor(Math.min(this.cursor + this.COLS - 1, this.currentTotal - itemOffset - 1));
|
||||
} else {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
if ((this.cursor + 1) % this.COLS === 0 || (this.cursor + itemOffset) === (this.currentTotal - 1)) {
|
||||
success = this.setCursor(this.cursor - this.cursor % this.COLS);
|
||||
} else {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,22 +316,22 @@ export default class AchvsUiHandler extends MessageUiHandler {
|
|||
|
||||
if (update || pageChange) {
|
||||
switch (this.currentPage) {
|
||||
case Page.ACHIEVEMENTS:
|
||||
if (pageChange) {
|
||||
this.titleBg.width = 174;
|
||||
this.titleText.x = this.titleBg.width / 2;
|
||||
this.scoreContainer.setVisible(true);
|
||||
}
|
||||
this.showAchv(achvs[Object.keys(achvs)[cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.VOUCHERS:
|
||||
if (pageChange) {
|
||||
this.titleBg.width = 220;
|
||||
this.titleText.x = this.titleBg.width / 2;
|
||||
this.scoreContainer.setVisible(false);
|
||||
}
|
||||
this.showVoucher(vouchers[Object.keys(vouchers)[cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.ACHIEVEMENTS:
|
||||
if (pageChange) {
|
||||
this.titleBg.width = 174;
|
||||
this.titleText.x = this.titleBg.width / 2;
|
||||
this.scoreContainer.setVisible(true);
|
||||
}
|
||||
this.showAchv(achvs[Object.keys(achvs)[cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.VOUCHERS:
|
||||
if (pageChange) {
|
||||
this.titleBg.width = 220;
|
||||
this.titleText.x = this.titleBg.width / 2;
|
||||
this.scoreContainer.setVisible(false);
|
||||
}
|
||||
this.showVoucher(vouchers[Object.keys(vouchers)[cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -358,14 +358,14 @@ export default class AchvsUiHandler extends MessageUiHandler {
|
|||
}
|
||||
|
||||
switch (this.currentPage) {
|
||||
case Page.ACHIEVEMENTS:
|
||||
this.updateAchvIcons();
|
||||
this.showAchv(achvs[Object.keys(achvs)[this.cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.VOUCHERS:
|
||||
this.updateVoucherIcons();
|
||||
this.showVoucher(vouchers[Object.keys(vouchers)[this.cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.ACHIEVEMENTS:
|
||||
this.updateAchvIcons();
|
||||
this.showAchv(achvs[Object.keys(achvs)[this.cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
case Page.VOUCHERS:
|
||||
this.updateVoucherIcons();
|
||||
this.showVoucher(vouchers[Object.keys(vouchers)[this.cursor + this.scrollCursor * this.COLS]]);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -215,20 +215,20 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
|
|||
// Creates a proxy object to decide which text object needs to be updated
|
||||
let textObject: Phaser.GameObjects.Text;
|
||||
switch (fieldEffectInfo.effecType) {
|
||||
case ArenaEffectType.PLAYER:
|
||||
textObject = this.flyoutTextPlayer;
|
||||
break;
|
||||
case ArenaEffectType.PLAYER:
|
||||
textObject = this.flyoutTextPlayer;
|
||||
break;
|
||||
|
||||
case ArenaEffectType.WEATHER:
|
||||
case ArenaEffectType.TERRAIN:
|
||||
case ArenaEffectType.FIELD:
|
||||
textObject = this.flyoutTextField;
|
||||
case ArenaEffectType.WEATHER:
|
||||
case ArenaEffectType.TERRAIN:
|
||||
case ArenaEffectType.FIELD:
|
||||
textObject = this.flyoutTextField;
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case ArenaEffectType.ENEMY:
|
||||
textObject = this.flyoutTextEnemy;
|
||||
break;
|
||||
case ArenaEffectType.ENEMY:
|
||||
textObject = this.flyoutTextEnemy;
|
||||
break;
|
||||
}
|
||||
|
||||
textObject.text += fieldEffectInfo.name;
|
||||
|
@ -253,81 +253,81 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
|
|||
|
||||
let foundIndex: number;
|
||||
switch (arenaEffectChangedEvent.constructor) {
|
||||
case TagAddedEvent:
|
||||
const tagAddedEvent = arenaEffectChangedEvent as TagAddedEvent;
|
||||
const isArenaTrapTag = this.battleScene.arena.getTag(tagAddedEvent.arenaTagType) instanceof ArenaTrapTag;
|
||||
let arenaEffectType: ArenaEffectType;
|
||||
case TagAddedEvent:
|
||||
const tagAddedEvent = arenaEffectChangedEvent as TagAddedEvent;
|
||||
const isArenaTrapTag = this.battleScene.arena.getTag(tagAddedEvent.arenaTagType) instanceof ArenaTrapTag;
|
||||
let arenaEffectType: ArenaEffectType;
|
||||
|
||||
if (tagAddedEvent.arenaTagSide === ArenaTagSide.BOTH) {
|
||||
arenaEffectType = ArenaEffectType.FIELD;
|
||||
} else if (tagAddedEvent.arenaTagSide === ArenaTagSide.PLAYER) {
|
||||
arenaEffectType = ArenaEffectType.PLAYER;
|
||||
} else {
|
||||
arenaEffectType = ArenaEffectType.ENEMY;
|
||||
}
|
||||
|
||||
const existingTrapTagIndex = isArenaTrapTag ? this.fieldEffectInfo.findIndex(e => tagAddedEvent.arenaTagType === e.tagType && arenaEffectType === e.effecType) : -1;
|
||||
let name: string = getFieldEffectText(ArenaTagType[tagAddedEvent.arenaTagType]);
|
||||
|
||||
if (isArenaTrapTag) {
|
||||
if (existingTrapTagIndex !== -1) {
|
||||
const layers = tagAddedEvent.arenaTagMaxLayers > 1 ? ` (${tagAddedEvent.arenaTagLayers})` : "";
|
||||
this.fieldEffectInfo[existingTrapTagIndex].name = `${name}${layers}`;
|
||||
break;
|
||||
} else if (tagAddedEvent.arenaTagMaxLayers > 1) {
|
||||
name = `${name} (${tagAddedEvent.arenaTagLayers})`;
|
||||
if (tagAddedEvent.arenaTagSide === ArenaTagSide.BOTH) {
|
||||
arenaEffectType = ArenaEffectType.FIELD;
|
||||
} else if (tagAddedEvent.arenaTagSide === ArenaTagSide.PLAYER) {
|
||||
arenaEffectType = ArenaEffectType.PLAYER;
|
||||
} else {
|
||||
arenaEffectType = ArenaEffectType.ENEMY;
|
||||
}
|
||||
}
|
||||
|
||||
this.fieldEffectInfo.push({
|
||||
name,
|
||||
effecType: arenaEffectType,
|
||||
maxDuration: tagAddedEvent.duration,
|
||||
duration: tagAddedEvent.duration,
|
||||
tagType: tagAddedEvent.arenaTagType
|
||||
});
|
||||
break;
|
||||
case TagRemovedEvent:
|
||||
const tagRemovedEvent = arenaEffectChangedEvent as TagRemovedEvent;
|
||||
foundIndex = this.fieldEffectInfo.findIndex(info => info.tagType === tagRemovedEvent.arenaTagType);
|
||||
const existingTrapTagIndex = isArenaTrapTag ? this.fieldEffectInfo.findIndex(e => tagAddedEvent.arenaTagType === e.tagType && arenaEffectType === e.effecType) : -1;
|
||||
let name: string = getFieldEffectText(ArenaTagType[tagAddedEvent.arenaTagType]);
|
||||
|
||||
if (foundIndex !== -1) { // If the tag was being tracked, remove it
|
||||
this.fieldEffectInfo.splice(foundIndex, 1);
|
||||
}
|
||||
break;
|
||||
if (isArenaTrapTag) {
|
||||
if (existingTrapTagIndex !== -1) {
|
||||
const layers = tagAddedEvent.arenaTagMaxLayers > 1 ? ` (${tagAddedEvent.arenaTagLayers})` : "";
|
||||
this.fieldEffectInfo[existingTrapTagIndex].name = `${name}${layers}`;
|
||||
break;
|
||||
} else if (tagAddedEvent.arenaTagMaxLayers > 1) {
|
||||
name = `${name} (${tagAddedEvent.arenaTagLayers})`;
|
||||
}
|
||||
}
|
||||
|
||||
case WeatherChangedEvent:
|
||||
case TerrainChangedEvent:
|
||||
const fieldEffectChangedEvent = arenaEffectChangedEvent as WeatherChangedEvent | TerrainChangedEvent;
|
||||
this.fieldEffectInfo.push({
|
||||
name,
|
||||
effecType: arenaEffectType,
|
||||
maxDuration: tagAddedEvent.duration,
|
||||
duration: tagAddedEvent.duration,
|
||||
tagType: tagAddedEvent.arenaTagType
|
||||
});
|
||||
break;
|
||||
case TagRemovedEvent:
|
||||
const tagRemovedEvent = arenaEffectChangedEvent as TagRemovedEvent;
|
||||
foundIndex = this.fieldEffectInfo.findIndex(info => info.tagType === tagRemovedEvent.arenaTagType);
|
||||
|
||||
// Stores the old Weather/Terrain name in case it's in the array already
|
||||
const oldName =
|
||||
if (foundIndex !== -1) { // If the tag was being tracked, remove it
|
||||
this.fieldEffectInfo.splice(foundIndex, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case WeatherChangedEvent:
|
||||
case TerrainChangedEvent:
|
||||
const fieldEffectChangedEvent = arenaEffectChangedEvent as WeatherChangedEvent | TerrainChangedEvent;
|
||||
|
||||
// Stores the old Weather/Terrain name in case it's in the array already
|
||||
const oldName =
|
||||
getFieldEffectText(fieldEffectChangedEvent instanceof WeatherChangedEvent
|
||||
? WeatherType[fieldEffectChangedEvent.oldWeatherType]
|
||||
: TerrainType[fieldEffectChangedEvent.oldTerrainType]);
|
||||
// Stores the new Weather/Terrain info
|
||||
const newInfo = {
|
||||
name:
|
||||
// Stores the new Weather/Terrain info
|
||||
const newInfo = {
|
||||
name:
|
||||
getFieldEffectText(fieldEffectChangedEvent instanceof WeatherChangedEvent
|
||||
? WeatherType[fieldEffectChangedEvent.newWeatherType]
|
||||
: TerrainType[fieldEffectChangedEvent.newTerrainType]),
|
||||
effecType: fieldEffectChangedEvent instanceof WeatherChangedEvent
|
||||
? ArenaEffectType.WEATHER
|
||||
: ArenaEffectType.TERRAIN,
|
||||
maxDuration: fieldEffectChangedEvent.duration,
|
||||
duration: fieldEffectChangedEvent.duration };
|
||||
effecType: fieldEffectChangedEvent instanceof WeatherChangedEvent
|
||||
? ArenaEffectType.WEATHER
|
||||
: ArenaEffectType.TERRAIN,
|
||||
maxDuration: fieldEffectChangedEvent.duration,
|
||||
duration: fieldEffectChangedEvent.duration };
|
||||
|
||||
foundIndex = this.fieldEffectInfo.findIndex(info => [ newInfo.name, oldName ].includes(info.name));
|
||||
if (foundIndex === -1) {
|
||||
if (newInfo.name !== undefined) {
|
||||
this.fieldEffectInfo.push(newInfo); // Adds the info to the array if it doesn't already exist and is defined
|
||||
foundIndex = this.fieldEffectInfo.findIndex(info => [ newInfo.name, oldName ].includes(info.name));
|
||||
if (foundIndex === -1) {
|
||||
if (newInfo.name !== undefined) {
|
||||
this.fieldEffectInfo.push(newInfo); // Adds the info to the array if it doesn't already exist and is defined
|
||||
}
|
||||
} else if (!newInfo.name) {
|
||||
this.fieldEffectInfo.splice(foundIndex, 1); // Removes the old info if the new one is undefined
|
||||
} else {
|
||||
this.fieldEffectInfo[foundIndex] = newInfo; // Otherwise, replace the old info
|
||||
}
|
||||
} else if (!newInfo.name) {
|
||||
this.fieldEffectInfo.splice(foundIndex, 1); // Removes the old info if the new one is undefined
|
||||
} else {
|
||||
this.fieldEffectInfo[foundIndex] = newInfo; // Otherwise, replace the old info
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
this.updateFieldText();
|
||||
|
|
|
@ -90,12 +90,12 @@ export default class BallUiHandler extends UiHandler {
|
|||
}
|
||||
} else {
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
success = this.setCursor(this.cursor ? this.cursor - 1 : pokeballTypeCount);
|
||||
break;
|
||||
case Button.DOWN:
|
||||
success = this.setCursor(this.cursor < pokeballTypeCount ? this.cursor + 1 : 0);
|
||||
break;
|
||||
case Button.UP:
|
||||
success = this.setCursor(this.cursor ? this.cursor - 1 : pokeballTypeCount);
|
||||
break;
|
||||
case Button.DOWN:
|
||||
success = this.setCursor(this.cursor < pokeballTypeCount ? this.cursor + 1 : 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -376,66 +376,66 @@ export default class GameChallengesUiHandler extends UiHandler {
|
|||
} else {
|
||||
if (this.cursorObj?.visible && !this.startCursor.visible) {
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
if (this.cursor === 0) {
|
||||
if (this.scrollCursor === 0) {
|
||||
case Button.UP:
|
||||
if (this.cursor === 0) {
|
||||
if (this.scrollCursor === 0) {
|
||||
// When at the top of the menu and pressing UP, move to the bottommost item.
|
||||
if (this.scene.gameMode.challenges.length > rowsToDisplay) { // If there are more than 9 challenges, scroll to the bottom
|
||||
if (this.scene.gameMode.challenges.length > rowsToDisplay) { // If there are more than 9 challenges, scroll to the bottom
|
||||
// First, set the cursor to the last visible element, preparing for the scroll to the end.
|
||||
const successA = this.setCursor(rowsToDisplay - 1);
|
||||
// Then, adjust the scroll to display the bottommost elements of the menu.
|
||||
const successB = this.setScrollCursor(this.scene.gameMode.challenges.length - rowsToDisplay);
|
||||
success = successA && successB; // success is just there to play the little validation sound effect
|
||||
} else { // If there are 9 or less challenges, just move to the bottom one
|
||||
success = this.setCursor(this.scene.gameMode.challenges.length - 1);
|
||||
const successA = this.setCursor(rowsToDisplay - 1);
|
||||
// Then, adjust the scroll to display the bottommost elements of the menu.
|
||||
const successB = this.setScrollCursor(this.scene.gameMode.challenges.length - rowsToDisplay);
|
||||
success = successA && successB; // success is just there to play the little validation sound effect
|
||||
} else { // If there are 9 or less challenges, just move to the bottom one
|
||||
success = this.setCursor(this.scene.gameMode.challenges.length - 1);
|
||||
}
|
||||
} else {
|
||||
success = this.setScrollCursor(this.scrollCursor - 1);
|
||||
}
|
||||
} else {
|
||||
success = this.setScrollCursor(this.scrollCursor - 1);
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
}
|
||||
} else {
|
||||
success = this.setCursor(this.cursor - 1);
|
||||
}
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (this.cursor === rowsToDisplay - 1) {
|
||||
if (this.scrollCursor < this.scene.gameMode.challenges.length - rowsToDisplay) {
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (this.cursor === rowsToDisplay - 1) {
|
||||
if (this.scrollCursor < this.scene.gameMode.challenges.length - rowsToDisplay) {
|
||||
// When at the bottom and pressing DOWN, scroll if possible.
|
||||
success = this.setScrollCursor(this.scrollCursor + 1);
|
||||
} else {
|
||||
success = this.setScrollCursor(this.scrollCursor + 1);
|
||||
} else {
|
||||
// When at the bottom of a scrolling menu and pressing DOWN, move to the topmost item.
|
||||
// First, set the cursor to the first visible element, preparing for the scroll to the top.
|
||||
const successA = this.setCursor(0);
|
||||
// Then, adjust the scroll to display the topmost elements of the menu.
|
||||
const successB = this.setScrollCursor(0);
|
||||
success = successA && successB; // success is just there to play the little validation sound effect
|
||||
}
|
||||
} else if (this.scene.gameMode.challenges.length < rowsToDisplay && this.cursor === this.scene.gameMode.challenges.length - 1) {
|
||||
const successA = this.setCursor(0);
|
||||
// Then, adjust the scroll to display the topmost elements of the menu.
|
||||
const successB = this.setScrollCursor(0);
|
||||
success = successA && successB; // success is just there to play the little validation sound effect
|
||||
}
|
||||
} else if (this.scene.gameMode.challenges.length < rowsToDisplay && this.cursor === this.scene.gameMode.challenges.length - 1) {
|
||||
// When at the bottom of a non-scrolling menu and pressing DOWN, move to the topmost item.
|
||||
success = this.setCursor(0);
|
||||
} else {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
}
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
success = this.setCursor(0);
|
||||
} else {
|
||||
success = this.setCursor(this.cursor + 1);
|
||||
}
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
// Moves the option cursor left, if possible.
|
||||
success = this.getActiveChallenge().decreaseValue();
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
success = this.getActiveChallenge().decreaseValue();
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
// Moves the option cursor right, if possible.
|
||||
success = this.getActiveChallenge().increaseValue();
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
success = this.getActiveChallenge().increaseValue();
|
||||
if (success) {
|
||||
this.updateText();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,54 +89,54 @@ export default class CommandUiHandler extends UiHandler {
|
|||
if (button === Button.ACTION) {
|
||||
switch (cursor) {
|
||||
// Fight
|
||||
case Command.FIGHT:
|
||||
if ((this.scene.getCurrentPhase() as CommandPhase).checkFightOverride()) {
|
||||
return true;
|
||||
}
|
||||
ui.setMode(Mode.FIGHT, (this.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
||||
success = true;
|
||||
break;
|
||||
case Command.FIGHT:
|
||||
if ((this.scene.getCurrentPhase() as CommandPhase).checkFightOverride()) {
|
||||
return true;
|
||||
}
|
||||
ui.setMode(Mode.FIGHT, (this.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
||||
success = true;
|
||||
break;
|
||||
// Ball
|
||||
case Command.BALL:
|
||||
ui.setModeWithoutClear(Mode.BALL);
|
||||
success = true;
|
||||
break;
|
||||
case Command.BALL:
|
||||
ui.setModeWithoutClear(Mode.BALL);
|
||||
success = true;
|
||||
break;
|
||||
// Pokemon
|
||||
case Command.POKEMON:
|
||||
ui.setMode(Mode.PARTY, PartyUiMode.SWITCH, (this.scene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(), null, PartyUiHandler.FilterNonFainted);
|
||||
success = true;
|
||||
break;
|
||||
case Command.POKEMON:
|
||||
ui.setMode(Mode.PARTY, PartyUiMode.SWITCH, (this.scene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(), null, PartyUiHandler.FilterNonFainted);
|
||||
success = true;
|
||||
break;
|
||||
// Run
|
||||
case Command.RUN:
|
||||
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.RUN, 0);
|
||||
success = true;
|
||||
break;
|
||||
case Command.RUN:
|
||||
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.RUN, 0);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
(this.scene.getCurrentPhase() as CommandPhase).cancel();
|
||||
}
|
||||
} else {
|
||||
switch (button) {
|
||||
case Button.UP:
|
||||
if (cursor >= 2) {
|
||||
success = this.setCursor(cursor - 2);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (cursor < 2) {
|
||||
success = this.setCursor(cursor + 2);
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
if (cursor % 2 === 1) {
|
||||
success = this.setCursor(cursor - 1);
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
if (cursor % 2 === 0) {
|
||||
success = this.setCursor(cursor + 1);
|
||||
}
|
||||
break;
|
||||
case Button.UP:
|
||||
if (cursor >= 2) {
|
||||
success = this.setCursor(cursor - 2);
|
||||
}
|
||||
break;
|
||||
case Button.DOWN:
|
||||
if (cursor < 2) {
|
||||
success = this.setCursor(cursor + 2);
|
||||
}
|
||||
break;
|
||||
case Button.LEFT:
|
||||
if (cursor % 2 === 1) {
|
||||
success = this.setCursor(cursor - 1);
|
||||
}
|
||||
break;
|
||||
case Button.RIGHT:
|
||||
if (cursor % 2 === 0) {
|
||||
success = this.setCursor(cursor + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,13 +142,13 @@ export class DailyRunScoreboard extends Phaser.GameObjects.Container {
|
|||
entryContainer.add(scoreLabel);
|
||||
|
||||
switch (this.category) {
|
||||
case ScoreboardCategory.DAILY:
|
||||
const waveLabel = addTextObject(this.scene, 68, 0, wave, TextStyle.WINDOW, { fontSize: "54px" });
|
||||
entryContainer.add(waveLabel);
|
||||
break;
|
||||
case ScoreboardCategory.WEEKLY:
|
||||
scoreLabel.x -= 16;
|
||||
break;
|
||||
case ScoreboardCategory.DAILY:
|
||||
const waveLabel = addTextObject(this.scene, 68, 0, wave, TextStyle.WINDOW, { fontSize: "54px" });
|
||||
entryContainer.add(waveLabel);
|
||||
break;
|
||||
case ScoreboardCategory.WEEKLY:
|
||||
scoreLabel.x -= 16;
|
||||
break;
|
||||
}
|
||||
|
||||
return entryContainer;
|
||||
|
|