mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 09:19:31 +02:00
Fix stupid game
Patches some more bugs that occurred due to past me not fixing everything properly when I updated the game
This commit is contained in:
parent
0ae4669dd1
commit
50bbae7577
@ -1,9 +1,42 @@
|
|||||||
import { BattlePhase } from "./battle-phase";
|
import { BattlePhase } from "./battle-phase";
|
||||||
import Pokemon from "#app/field/pokemon";
|
import Pokemon from "#app/field/pokemon";
|
||||||
|
import { BattlerIndex } from "#app/battle.js";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
import { Stat } from "#app/enums/stat.js";
|
||||||
|
import { TrickRoomTag } from "#app/data/arena-tag.js";
|
||||||
|
|
||||||
type PokemonFunc = (pokemon: Pokemon) => void;
|
type PokemonFunc = (pokemon: Pokemon) => void;
|
||||||
|
|
||||||
export abstract class FieldPhase extends BattlePhase {
|
export abstract class FieldPhase extends BattlePhase {
|
||||||
|
getOrder(): BattlerIndex[] {
|
||||||
|
const playerField = this.scene.getPlayerField().filter(p => p.isActive()) as Pokemon[];
|
||||||
|
const enemyField = this.scene.getEnemyField().filter(p => p.isActive()) as Pokemon[];
|
||||||
|
|
||||||
|
// We shuffle the list before sorting so speed ties produce random results
|
||||||
|
let orderedTargets: Pokemon[] = playerField.concat(enemyField);
|
||||||
|
// We seed it with the current turn to prevent an inconsistency where it
|
||||||
|
// was varying based on how long since you last reloaded
|
||||||
|
this.scene.executeWithSeedOffset(() => {
|
||||||
|
orderedTargets = Utils.randSeedShuffle(orderedTargets);
|
||||||
|
}, this.scene.currentBattle.turn, this.scene.waveSeed);
|
||||||
|
|
||||||
|
orderedTargets.sort((a: Pokemon, b: Pokemon) => {
|
||||||
|
const aSpeed = a?.getBattleStat(Stat.SPD) || 0;
|
||||||
|
const bSpeed = b?.getBattleStat(Stat.SPD) || 0;
|
||||||
|
|
||||||
|
return bSpeed - aSpeed;
|
||||||
|
});
|
||||||
|
|
||||||
|
const speedReversed = new Utils.BooleanHolder(false);
|
||||||
|
this.scene.arena.applyTags(TrickRoomTag, speedReversed);
|
||||||
|
|
||||||
|
if (speedReversed.value) {
|
||||||
|
orderedTargets = orderedTargets.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
return orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : 0));
|
||||||
|
}
|
||||||
|
|
||||||
executeForAll(func: PokemonFunc): void {
|
executeForAll(func: PokemonFunc): void {
|
||||||
const field = this.scene.getField(true).filter(p => p.summonData);
|
const field = this.scene.getField(true).filter(p => p.summonData);
|
||||||
field.forEach(pokemon => func(pokemon));
|
field.forEach(pokemon => func(pokemon));
|
||||||
|
@ -983,10 +983,12 @@ export class GameData {
|
|||||||
const sessionData = this.parseSessionData(sessionDataStr);
|
const sessionData = this.parseSessionData(sessionDataStr);
|
||||||
sessionData.autoSlot = autoSlot!;
|
sessionData.autoSlot = autoSlot!;
|
||||||
for (let i = 0; i <= 5; i++) {
|
for (let i = 0; i <= 5; i++) {
|
||||||
const speciesToCheck = getPokemonSpecies(sessionData.party[i]?.species);
|
if (sessionData.party[i]) {
|
||||||
if (sessionData.party[i]?.abilityIndex === 1) {
|
const speciesToCheck = getPokemonSpecies(sessionData.party[i]?.species);
|
||||||
if (speciesToCheck.ability1 === speciesToCheck.ability2 && speciesToCheck.abilityHidden !== Abilities.NONE && speciesToCheck.abilityHidden !== speciesToCheck.ability1) {
|
if (sessionData.party[i]?.abilityIndex === 1) {
|
||||||
sessionData.party[i].abilityIndex = 2;
|
if (speciesToCheck.ability1 === speciesToCheck.ability2 && speciesToCheck.abilityHidden !== Abilities.NONE && speciesToCheck.abilityHidden !== speciesToCheck.ability1) {
|
||||||
|
sessionData.party[i].abilityIndex = 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user