mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-16 14:55:22 +01:00
Hotfix 1.11.1 to Main
Hotfix 1.11.1 to Main
This commit is contained in:
commit
650ddd2a85
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "pokemon-rogue-battle",
|
"name": "pokemon-rogue-battle",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.11.0",
|
"version": "1.11.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start:prod": "vite --mode production",
|
"start:prod": "vite --mode production",
|
||||||
|
|||||||
@ -163,15 +163,15 @@ export const biomePokemonPools: BiomePokemonPools = {
|
|||||||
[BiomePoolTier.UNCOMMON]: {
|
[BiomePoolTier.UNCOMMON]: {
|
||||||
[TimeOfDay.DAWN]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
[TimeOfDay.DAWN]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
||||||
[TimeOfDay.DAY]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
[TimeOfDay.DAY]: [ SpeciesId.SUNKERN, SpeciesId.COMBEE ],
|
||||||
[TimeOfDay.DUSK]: [ SpeciesId.SEEDOT, SpeciesId.NOIBAT ],
|
[TimeOfDay.DUSK]: [ SpeciesId.SEEDOT ],
|
||||||
[TimeOfDay.NIGHT]: [ SpeciesId.SEEDOT, SpeciesId.NOIBAT ],
|
[TimeOfDay.NIGHT]: [ SpeciesId.SEEDOT ],
|
||||||
[TimeOfDay.ALL]: [ SpeciesId.MILTANK, SpeciesId.CHERUBI, SpeciesId.FOONGUS, ]
|
[TimeOfDay.ALL]: [ SpeciesId.MILTANK, SpeciesId.CHERUBI, SpeciesId.FOONGUS, ]
|
||||||
},
|
},
|
||||||
[BiomePoolTier.RARE]: {
|
[BiomePoolTier.RARE]: {
|
||||||
[TimeOfDay.DAWN]: [],
|
[TimeOfDay.DAWN]: [],
|
||||||
[TimeOfDay.DAY]: [],
|
[TimeOfDay.DAY]: [],
|
||||||
[TimeOfDay.DUSK]: [],
|
[TimeOfDay.DUSK]: [ SpeciesId.NOIBAT ],
|
||||||
[TimeOfDay.NIGHT]: [],
|
[TimeOfDay.NIGHT]: [ SpeciesId.NOIBAT ],
|
||||||
[TimeOfDay.ALL]: [ SpeciesId.BULBASAUR, SpeciesId.GROWLITHE, SpeciesId.TURTWIG, SpeciesId.BONSLY ]
|
[TimeOfDay.ALL]: [ SpeciesId.BULBASAUR, SpeciesId.GROWLITHE, SpeciesId.TURTWIG, SpeciesId.BONSLY ]
|
||||||
},
|
},
|
||||||
[BiomePoolTier.SUPER_RARE]: { [TimeOfDay.DAWN]: [], [TimeOfDay.DAY]: [], [TimeOfDay.DUSK]: [], [TimeOfDay.NIGHT]: [], [TimeOfDay.ALL]: [] },
|
[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, [
|
[SpeciesId.NOIBAT, PokemonType.FLYING, PokemonType.DRAGON, [
|
||||||
[BiomeId.CAVE, BiomePoolTier.UNCOMMON],
|
[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, [
|
[SpeciesId.NOIVERN, PokemonType.FLYING, PokemonType.DRAGON, [
|
||||||
|
|||||||
@ -253,7 +253,7 @@ const SLOT_3_FIGHT_2 = [
|
|||||||
SpeciesId.MACHOP,
|
SpeciesId.MACHOP,
|
||||||
SpeciesId.GASTLY,
|
SpeciesId.GASTLY,
|
||||||
SpeciesId.MAGNEMITE,
|
SpeciesId.MAGNEMITE,
|
||||||
SpeciesId.RHYDON,
|
SpeciesId.RHYHORN,
|
||||||
SpeciesId.TANGELA,
|
SpeciesId.TANGELA,
|
||||||
SpeciesId.PORYGON,
|
SpeciesId.PORYGON,
|
||||||
SpeciesId.ELEKID,
|
SpeciesId.ELEKID,
|
||||||
@ -298,7 +298,7 @@ const SLOT_3_FIGHT_3 = [
|
|||||||
SpeciesId.RHYDON,
|
SpeciesId.RHYDON,
|
||||||
SpeciesId.TANGROWTH,
|
SpeciesId.TANGROWTH,
|
||||||
SpeciesId.PORYGON2,
|
SpeciesId.PORYGON2,
|
||||||
SpeciesId.ELECTIVIRE,
|
SpeciesId.ELECTABUZZ,
|
||||||
SpeciesId.MAGMAR,
|
SpeciesId.MAGMAR,
|
||||||
SpeciesId.AZUMARILL,
|
SpeciesId.AZUMARILL,
|
||||||
SpeciesId.URSARING,
|
SpeciesId.URSARING,
|
||||||
|
|||||||
@ -6388,12 +6388,14 @@ export class EnemyPokemon extends Pokemon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const eventBossVariant = getDailyEventSeedBossVariant(globalScene.seed);
|
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;
|
this.shiny = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.shiny) {
|
if (this.shiny) {
|
||||||
this.variant = eventBossVariant ?? this.generateShinyVariant();
|
this.variant = eventBossVariantEnabled ? eventBossVariant : this.generateShinyVariant();
|
||||||
if (Overrides.ENEMY_VARIANT_OVERRIDE !== null) {
|
if (Overrides.ENEMY_VARIANT_OVERRIDE !== null) {
|
||||||
this.variant = Overrides.ENEMY_VARIANT_OVERRIDE;
|
this.variant = Overrides.ENEMY_VARIANT_OVERRIDE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -286,7 +286,7 @@ export class MovePhase extends PokemonPhase {
|
|||||||
|
|
||||||
// Apply queenly majesty / dazzling
|
// Apply queenly majesty / dazzling
|
||||||
if (!failed) {
|
if (!failed) {
|
||||||
const defendingSidePlayField = user.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
const defendingSidePlayField = user.isPlayer() ? globalScene.getEnemyField() : globalScene.getPlayerField();
|
||||||
const cancelled = new BooleanHolder(false);
|
const cancelled = new BooleanHolder(false);
|
||||||
defendingSidePlayField.forEach((pokemon: Pokemon) => {
|
defendingSidePlayField.forEach((pokemon: Pokemon) => {
|
||||||
applyAbAttrs("FieldPriorityMoveImmunityAbAttr", {
|
applyAbAttrs("FieldPriorityMoveImmunityAbAttr", {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import { sortInSpeedOrder } from "#app/utils/speed-order";
|
|||||||
*/
|
*/
|
||||||
export class PostSummonPhasePriorityQueue extends PokemonPhasePriorityQueue<PostSummonPhase> {
|
export class PostSummonPhasePriorityQueue extends PokemonPhasePriorityQueue<PostSummonPhase> {
|
||||||
protected override reorder(): void {
|
protected override reorder(): void {
|
||||||
this.queue = sortInSpeedOrder(this.queue, false);
|
this.queue = sortInSpeedOrder(this.queue);
|
||||||
this.queue.sort((phaseA, phaseB) => phaseB.getPriority() - phaseA.getPriority());
|
this.queue.sort((phaseA, phaseB) => phaseB.getPriority() - phaseA.getPriority());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1586,9 +1586,8 @@ export class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.updateOptionsWithModifierTransferMode(pokemon);
|
this.updateOptionsWithModifierTransferMode(pokemon);
|
||||||
break;
|
break;
|
||||||
case PartyUiMode.SWITCH:
|
case PartyUiMode.SWITCH:
|
||||||
this.options.push(PartyOption.RELEASE);
|
|
||||||
break;
|
|
||||||
case PartyUiMode.RELEASE:
|
case PartyUiMode.RELEASE:
|
||||||
|
case PartyUiMode.CHECK:
|
||||||
this.options.push(PartyOption.RELEASE);
|
this.options.push(PartyOption.RELEASE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -776,7 +776,8 @@ export class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|| (this.tmMoves.length === 0 && o === MenuOptions.TM_MOVES)
|
|| (this.tmMoves.length === 0 && o === MenuOptions.TM_MOVES)
|
||||||
|| (!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
|| (!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
||||||
&& o === MenuOptions.RIBBONS
|
&& 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 color = getTextColor(isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, false);
|
||||||
const shadow = getTextColor(isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, true);
|
const shadow = getTextColor(isDark ? TextStyle.SHADOW_TEXT : TextStyle.SETTINGS_VALUE, true);
|
||||||
return `[shadow=${shadow}][color=${color}]${label}[/color][/shadow]`;
|
return `[shadow=${shadow}][color=${color}]${label}[/color][/shadow]`;
|
||||||
@ -1778,6 +1779,7 @@ export class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
} else if (
|
} else if (
|
||||||
!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
!globalScene.gameData.dexData[this.species.speciesId].ribbons.getRibbons()
|
||||||
&& !globalScene.showMissingRibbons
|
&& !globalScene.showMissingRibbons
|
||||||
|
&& !globalScene.gameData.starterData[this.species.speciesId]?.classicWinCount
|
||||||
) {
|
) {
|
||||||
ui.showText(i18next.t("pokedexUiHandler:noRibbons"));
|
ui.showText(i18next.t("pokedexUiHandler:noRibbons"));
|
||||||
error = true;
|
error = true;
|
||||||
|
|||||||
@ -12,15 +12,13 @@ interface hasPokemon {
|
|||||||
/**
|
/**
|
||||||
* Sorts an array of {@linkcode Pokemon} by speed, taking Trick Room into account.
|
* Sorts an array of {@linkcode Pokemon} by speed, taking Trick Room into account.
|
||||||
* @param pokemonList - The list of Pokemon or objects containing Pokemon
|
* @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}
|
* @returns The sorted array of {@linkcode Pokemon}
|
||||||
*/
|
*/
|
||||||
export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[], shuffleFirst = true): T[] {
|
export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[]): T[] {
|
||||||
if (shuffleFirst) {
|
const grouped = groupPokemon(pokemonList);
|
||||||
shufflePokemonList(pokemonList);
|
shufflePokemonList(grouped);
|
||||||
}
|
sortBySpeed(grouped);
|
||||||
sortBySpeed(pokemonList);
|
return grouped.flat();
|
||||||
return pokemonList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,7 +26,7 @@ export function sortInSpeedOrder<T extends Pokemon | hasPokemon>(pokemonList: T[
|
|||||||
* @param pokemonList - The array of Pokemon or objects containing Pokemon
|
* @param pokemonList - The array of Pokemon or objects containing Pokemon
|
||||||
* @returns The same array instance that was passed in, shuffled.
|
* @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
|
// This is seeded with the current turn to prevent an inconsistency where it
|
||||||
// was varying based on how long since you last reloaded
|
// was varying based on how long since you last reloaded
|
||||||
globalScene.executeWithSeedOffset(
|
globalScene.executeWithSeedOffset(
|
||||||
@ -36,7 +34,6 @@ function shufflePokemonList<T extends Pokemon | hasPokemon>(pokemonList: T[]): T
|
|||||||
globalScene.currentBattle.turn * 1000 + pokemonList.length,
|
globalScene.currentBattle.turn * 1000 + pokemonList.length,
|
||||||
globalScene.waveSeed,
|
globalScene.waveSeed,
|
||||||
);
|
);
|
||||||
return pokemonList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Type guard for {@linkcode sortBySpeed} to avoid importing {@linkcode Pokemon} */
|
/** 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";
|
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) */
|
/** Sorts an array of {@linkcode Pokemon} by speed (without shuffling) */
|
||||||
function sortBySpeed<T extends Pokemon | hasPokemon>(pokemonList: T[]): void {
|
function sortBySpeed<T extends Pokemon | hasPokemon>(groupedPokemonList: T[][]): void {
|
||||||
pokemonList.sort((a, b) => {
|
groupedPokemonList.sort((a, b) => {
|
||||||
const aSpeed = (isPokemon(a) ? a : a.getPokemon()).getEffectiveStat(Stat.SPD);
|
const aSpeed = getPokemon(a[0]).getEffectiveStat(Stat.SPD);
|
||||||
const bSpeed = (isPokemon(b) ? b : b.getPokemon()).getEffectiveStat(Stat.SPD);
|
const bSpeed = getPokemon(b[0]).getEffectiveStat(Stat.SPD);
|
||||||
|
|
||||||
return bSpeed - aSpeed;
|
return bSpeed - aSpeed;
|
||||||
});
|
});
|
||||||
@ -57,6 +58,21 @@ function sortBySpeed<T extends Pokemon | hasPokemon>(pokemonList: T[]): void {
|
|||||||
const speedReversed = new BooleanHolder(false);
|
const speedReversed = new BooleanHolder(false);
|
||||||
globalScene.arena.applyTags(ArenaTagType.TRICK_ROOM, speedReversed);
|
globalScene.arena.applyTags(ArenaTagType.TRICK_ROOM, speedReversed);
|
||||||
if (speedReversed.value) {
|
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