mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-15 06:15:20 +01:00
Merge branch 'hotfix-1.11.2' into quick-claw
This commit is contained in:
commit
a0d3e42f3b
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pokemon-rogue-battle",
|
||||
"private": true,
|
||||
"version": "1.11.0",
|
||||
"version": "1.11.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start:prod": "vite --mode production",
|
||||
|
||||
@ -163,15 +163,15 @@ export const biomePokemonPools: BiomePokemonPools = {
|
||||
[BiomePoolTier.UNCOMMON]: {
|
||||
[TimeOfDay.DAWN]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
||||
[TimeOfDay.DAY]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
||||
[TimeOfDay.DUSK]: [ SpeciesId.SEEDOT, SpeciesId.NOIBAT ],
|
||||
[TimeOfDay.NIGHT]: [ SpeciesId.SEEDOT, SpeciesId.NOIBAT ],
|
||||
[TimeOfDay.DUSK]: [ SpeciesId.SEEDOT ],
|
||||
[TimeOfDay.NIGHT]: [ SpeciesId.SEEDOT ],
|
||||
[TimeOfDay.ALL]: [ SpeciesId.MILTANK, SpeciesId.CHERUBI, SpeciesId.FOONGUS, ]
|
||||
},
|
||||
[BiomePoolTier.RARE]: {
|
||||
[TimeOfDay.DAWN]: [],
|
||||
[TimeOfDay.DAY]: [],
|
||||
[TimeOfDay.DUSK]: [],
|
||||
[TimeOfDay.NIGHT]: [],
|
||||
[TimeOfDay.DUSK]: [ SpeciesId.NOIBAT ],
|
||||
[TimeOfDay.NIGHT]: [ SpeciesId.NOIBAT ],
|
||||
[TimeOfDay.ALL]: [ SpeciesId.BULBASAUR, SpeciesId.GROWLITHE, SpeciesId.TURTWIG, SpeciesId.BONSLY ]
|
||||
},
|
||||
[BiomePoolTier.SUPER_RARE]: { [TimeOfDay.DAWN]: [], [TimeOfDay.DAY]: [], [TimeOfDay.DUSK]: [], [TimeOfDay.NIGHT]: [], [TimeOfDay.ALL]: [] },
|
||||
|
||||
@ -3547,7 +3547,7 @@ export function initBiomes() {
|
||||
],
|
||||
[SpeciesId.NOIBAT, PokemonType.FLYING, PokemonType.DRAGON, [
|
||||
[BiomeId.CAVE, BiomePoolTier.UNCOMMON],
|
||||
[BiomeId.GRASS, BiomePoolTier.UNCOMMON, [TimeOfDay.DUSK, TimeOfDay.NIGHT]]
|
||||
[BiomeId.GRASS, BiomePoolTier.RARE, [TimeOfDay.DUSK, TimeOfDay.NIGHT]]
|
||||
]
|
||||
],
|
||||
[SpeciesId.NOIVERN, PokemonType.FLYING, PokemonType.DRAGON, [
|
||||
|
||||
@ -253,7 +253,7 @@ const SLOT_3_FIGHT_2 = [
|
||||
SpeciesId.MACHOP,
|
||||
SpeciesId.GASTLY,
|
||||
SpeciesId.MAGNEMITE,
|
||||
SpeciesId.RHYDON,
|
||||
SpeciesId.RHYHORN,
|
||||
SpeciesId.TANGELA,
|
||||
SpeciesId.PORYGON,
|
||||
SpeciesId.ELEKID,
|
||||
@ -298,7 +298,7 @@ const SLOT_3_FIGHT_3 = [
|
||||
SpeciesId.RHYDON,
|
||||
SpeciesId.TANGROWTH,
|
||||
SpeciesId.PORYGON2,
|
||||
SpeciesId.ELECTIVIRE,
|
||||
SpeciesId.ELECTABUZZ,
|
||||
SpeciesId.MAGMAR,
|
||||
SpeciesId.AZUMARILL,
|
||||
SpeciesId.URSARING,
|
||||
|
||||
@ -6388,12 +6388,14 @@ export class EnemyPokemon extends Pokemon {
|
||||
}
|
||||
|
||||
const eventBossVariant = getDailyEventSeedBossVariant(globalScene.seed);
|
||||
if (eventBossVariant != null && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex)) {
|
||||
const eventBossVariantEnabled =
|
||||
eventBossVariant != null && globalScene.gameMode.isWaveFinal(globalScene.currentBattle.waveIndex);
|
||||
if (eventBossVariantEnabled) {
|
||||
this.shiny = true;
|
||||
}
|
||||
|
||||
if (this.shiny) {
|
||||
this.variant = eventBossVariant ?? this.generateShinyVariant();
|
||||
this.variant = eventBossVariantEnabled ? eventBossVariant : this.generateShinyVariant();
|
||||
if (Overrides.ENEMY_VARIANT_OVERRIDE !== null) {
|
||||
this.variant = Overrides.ENEMY_VARIANT_OVERRIDE;
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ export class MovePhase extends PokemonPhase {
|
||||
|
||||
// Apply queenly majesty / dazzling
|
||||
if (!failed) {
|
||||
const defendingSidePlayField = user.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
||||
const defendingSidePlayField = user.isPlayer() ? globalScene.getEnemyField() : globalScene.getPlayerField();
|
||||
const cancelled = new BooleanHolder(false);
|
||||
defendingSidePlayField.forEach((pokemon: Pokemon) => {
|
||||
applyAbAttrs("FieldPriorityMoveImmunityAbAttr", {
|
||||
|
||||
@ -11,7 +11,7 @@ import { sortInSpeedOrder } from "#app/utils/speed-order";
|
||||
*/
|
||||
export class PostSummonPhasePriorityQueue extends PokemonPhasePriorityQueue<PostSummonPhase> {
|
||||
protected override reorder(): void {
|
||||
this.queue = sortInSpeedOrder(this.queue, false);
|
||||
this.queue = sortInSpeedOrder(this.queue);
|
||||
this.queue.sort((phaseA, phaseB) => phaseB.getPriority() - phaseA.getPriority());
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
|
||||
let pokemonIconX = -20;
|
||||
let pokemonIconY = 6;
|
||||
|
||||
if (["de", "es-ES", "es-419", "fr", "ko", "pt-BR", "ja", "ru"].includes(currentLanguage)) {
|
||||
if (["de", "es-ES", "es-419", "fr", "ko", "pt-BR", "ja", "ru", "tr"].includes(currentLanguage)) {
|
||||
gachaTextStyle = TextStyle.SMALLER_WINDOW_ALT;
|
||||
gachaX = 2;
|
||||
gachaY = 2;
|
||||
@ -89,7 +89,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
|
||||
|
||||
let legendaryLabelX = gachaX;
|
||||
let legendaryLabelY = gachaY;
|
||||
if (["de", "es-ES", "es-419"].includes(currentLanguage)) {
|
||||
if (["de", "es-ES", "es-419", "tr"].includes(currentLanguage)) {
|
||||
pokemonIconX = -25;
|
||||
pokemonIconY = 10;
|
||||
legendaryLabelX = -6;
|
||||
@ -108,8 +108,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
|
||||
let xOffset = 0;
|
||||
const pokemonIcon = globalScene.add.sprite(pokemonIconX, pokemonIconY, "pokemon_icons_0");
|
||||
|
||||
// Intentionally left as "array includes" instead of an equality check to allow for future languages to reuse
|
||||
if (["pt-BR"].includes(currentLanguage)) {
|
||||
if (["pt-BR", "tr"].includes(currentLanguage)) {
|
||||
xOffset = 2;
|
||||
pokemonIcon.setX(pokemonIconX - 2);
|
||||
}
|
||||
@ -120,14 +119,14 @@ export class EggGachaUiHandler extends MessageUiHandler {
|
||||
}
|
||||
break;
|
||||
case GachaType.MOVE:
|
||||
if (["de", "es-ES", "fr", "pt-BR", "ru"].includes(currentLanguage)) {
|
||||
if (["de", "es-ES", "fr", "pt-BR", "ru", "tr"].includes(currentLanguage)) {
|
||||
gachaUpLabel.setAlign("center").setY(0);
|
||||
}
|
||||
|
||||
gachaUpLabel.setText(i18next.t("egg:moveUpGacha")).setX(0).setOrigin(0.5, 0);
|
||||
break;
|
||||
case GachaType.SHINY:
|
||||
if (["de", "fr", "ko", "ru"].includes(currentLanguage)) {
|
||||
if (["de", "fr", "ko", "ru", "tr"].includes(currentLanguage)) {
|
||||
gachaUpLabel.setAlign("center").setY(0);
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +251,7 @@ export class GameStatsUiHandler extends UiHandler {
|
||||
const resolvedLang = i18next.resolvedLanguage ?? "en";
|
||||
// NOTE TO TRANSLATION TEAM: Add more languages that want to display
|
||||
// in a single-column inside of the `[]` (e.g. `["ru", "fr"]`)
|
||||
return ["fr", "es-ES", "es-419", "it", "ja", "pt-BR", "ru"].includes(resolvedLang);
|
||||
return ["fr", "es-ES", "es-419", "it", "ja", "pt-BR", "ru", "tr"].includes(resolvedLang);
|
||||
}
|
||||
/** The number of columns used by this menu in the resolved language */
|
||||
private get columnCount(): 1 | 2 {
|
||||
|
||||
@ -1586,9 +1586,8 @@ export class PartyUiHandler extends MessageUiHandler {
|
||||
this.updateOptionsWithModifierTransferMode(pokemon);
|
||||
break;
|
||||
case PartyUiMode.SWITCH:
|
||||
this.options.push(PartyOption.RELEASE);
|
||||
break;
|
||||
case PartyUiMode.RELEASE:
|
||||
case PartyUiMode.CHECK:
|
||||
this.options.push(PartyOption.RELEASE);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -776,7 +776,8 @@ export class PokedexPageUiHandler extends MessageUiHandler {
|
||||
|| (this.tmMoves.length === 0 && o === MenuOptions.TM_MOVES)
|
||||
|| (!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
||||
&& o === MenuOptions.RIBBONS
|
||||
&& !globalScene.showMissingRibbons);
|
||||
&& !globalScene.showMissingRibbons
|
||||
&& !globalScene.gameData.starterData[this.species.speciesId]?.classicWinCount);
|
||||
const color = getTextColor(isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, false);
|
||||
const shadow = getTextColor(isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, true);
|
||||
return `[shadow=${shadow}][color=${color}]${label}[/color][/shadow]`;
|
||||
@ -1778,6 +1779,7 @@ export class PokedexPageUiHandler extends MessageUiHandler {
|
||||
} else if (
|
||||
!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
||||
&& !globalScene.showMissingRibbons
|
||||
&& !globalScene.gameData.starterData[this.species.speciesId]?.classicWinCount
|
||||
) {
|
||||
ui.showText(i18next.t("pokedexUiHandler:noRibbons"));
|
||||
error = true;
|
||||
|
||||
@ -155,6 +155,7 @@ const languageSettings: { [key: string]: LanguageSetting } = {
|
||||
tr: {
|
||||
starterInfoTextSize: "56px",
|
||||
instructionTextSize: "38px",
|
||||
starterInfoXPos: 34,
|
||||
},
|
||||
ro: {
|
||||
starterInfoTextSize: "56px",
|
||||
|
||||
@ -12,15 +12,13 @@ interface hasPokemon {
|
||||
/**
|
||||
* Sorts an array of {@linkcode Pokemon} by speed, taking Trick Room into account.
|
||||
* @param pokemonList - The list of Pokemon or objects containing Pokemon
|
||||
* @param shuffleFirst - Whether to shuffle the list before sorting (to handle speed ties). Default `true`.
|
||||
* @returns The sorted array of {@linkcode Pokemon}
|
||||
*/
|
||||
export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[], shuffleFirst = true): T[] {
|
||||
if (shuffleFirst) {
|
||||
shufflePokemonList(pokemonList);
|
||||
}
|
||||
sortBySpeed(pokemonList);
|
||||
return pokemonList;
|
||||
export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[]): T[] {
|
||||
const grouped = groupPokemon(pokemonList);
|
||||
shufflePokemonList(grouped);
|
||||
sortBySpeed(grouped);
|
||||
return grouped.flat();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -28,7 +26,7 @@ export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[
|
||||
* @param pokemonList - The array of Pokemon or objects containing Pokemon
|
||||
* @returns The same array instance that was passed in, shuffled.
|
||||
*/
|
||||
function shufflePokemonList<T extends Pokemon | hasPokemon>(pokemonList: T[]): T[] {
|
||||
function shufflePokemonList<T extends Pokemon | hasPokemon>(pokemonList: T[][]): void {
|
||||
// This is seeded with the current turn to prevent an inconsistency where it
|
||||
// was varying based on how long since you last reloaded
|
||||
globalScene.executeWithSeedOffset(
|
||||
@ -36,7 +34,6 @@ function shufflePokemonList<T extends Pokemon | hasPokemon>(pokemonList: T[]): T
|
||||
globalScene.currentBattle.turn * 1000 + pokemonList.length,
|
||||
globalScene.waveSeed,
|
||||
);
|
||||
return pokemonList;
|
||||
}
|
||||
|
||||
/** Type guard for {@linkcode sortBySpeed} to avoid importing {@linkcode Pokemon} */
|
||||
@ -44,11 +41,15 @@ function isPokemon(p: Pokemon | hasPokemon): p is Pokemon {
|
||||
return typeof (p as hasPokemon).getPokemon !== "function";
|
||||
}
|
||||
|
||||
function getPokemon(p: Pokemon | hasPokemon): Pokemon {
|
||||
return isPokemon(p) ? p : p.getPokemon();
|
||||
}
|
||||
|
||||
/** Sorts an array of {@linkcode Pokemon} by speed (without shuffling) */
|
||||
function sortBySpeed<T extends Pokemon | hasPokemon>(pokemonList: T[]): void {
|
||||
pokemonList.sort((a, b) => {
|
||||
const aSpeed = (isPokemon(a) ? a : a.getPokemon()).getEffectiveStat(Stat.SPD);
|
||||
const bSpeed = (isPokemon(b) ? b : b.getPokemon()).getEffectiveStat(Stat.SPD);
|
||||
function sortBySpeed<T extends Pokemon | hasPokemon>(groupedPokemonList: T[][]): void {
|
||||
groupedPokemonList.sort((a, b) => {
|
||||
const aSpeed = getPokemon(a[0]).getEffectiveStat(Stat.SPD);
|
||||
const bSpeed = getPokemon(b[0]).getEffectiveStat(Stat.SPD);
|
||||
|
||||
return bSpeed - aSpeed;
|
||||
});
|
||||
@ -57,6 +58,21 @@ function sortBySpeed<T extends Pokemon | hasPokemon>(pokemonList: T[]): void {
|
||||
const speedReversed = new BooleanHolder(false);
|
||||
globalScene.arena.applyTags(ArenaTagType.TRICK_ROOM, speedReversed);
|
||||
if (speedReversed.value) {
|
||||
pokemonList.reverse();
|
||||
groupedPokemonList.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
function groupPokemon<T extends Pokemon | hasPokemon>(pokemonList: T[]): T[][] {
|
||||
const runs: T[][] = [];
|
||||
for (const pkmn of pokemonList) {
|
||||
const pokemon = getPokemon(pkmn);
|
||||
const lastGroup = runs.at(-1);
|
||||
if (lastGroup != null && lastGroup.length > 0 && getPokemon(lastGroup[0]) === pokemon) {
|
||||
lastGroup.push(pkmn);
|
||||
} else {
|
||||
runs.push([pkmn]);
|
||||
}
|
||||
}
|
||||
|
||||
return runs;
|
||||
}
|
||||
|
||||
58
test/utils/speed-order.test.ts
Normal file
58
test/utils/speed-order.test.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { GameManager } from "#test/test-utils/game-manager";
|
||||
import { sortInSpeedOrder } from "#utils/speed-order";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
describe("Utils - Speed Order", () => {
|
||||
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
|
||||
.battleStyle("single")
|
||||
.startingLevel(100)
|
||||
.enemyLevel(100)
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.enemyAbility(AbilityId.BALL_FETCH)
|
||||
.ability(AbilityId.BALL_FETCH)
|
||||
.enemySpecies(SpeciesId.REGIELEKI);
|
||||
});
|
||||
|
||||
it("Sorts correctly in the basic case", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWPOKE, SpeciesId.MEW]);
|
||||
const [slowpoke, mew] = game.field.getPlayerParty();
|
||||
const regieleki = game.field.getEnemyPokemon();
|
||||
const pkmnList = [slowpoke, regieleki, mew];
|
||||
|
||||
expect(sortInSpeedOrder(pkmnList)).toEqual([regieleki, mew, slowpoke]);
|
||||
});
|
||||
|
||||
it("Correctly sorts grouped pokemon", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWPOKE, SpeciesId.MEW, SpeciesId.DITTO]);
|
||||
const [slowpoke, mew, ditto] = game.field.getPlayerParty();
|
||||
const regieleki = game.field.getEnemyPokemon();
|
||||
ditto.stats[Stat.SPD] = slowpoke.getStat(Stat.SPD);
|
||||
|
||||
const pkmnList = [slowpoke, slowpoke, ditto, ditto, mew, regieleki, regieleki];
|
||||
const sorted = sortInSpeedOrder(pkmnList);
|
||||
|
||||
expect([
|
||||
[regieleki, regieleki, mew, slowpoke, slowpoke, ditto, ditto],
|
||||
[regieleki, regieleki, mew, ditto, ditto, slowpoke, slowpoke],
|
||||
]).toContainEqual(sorted);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user