mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Patch beta again
This commit is contained in:
commit
edad58cc2b
@ -1,9 +1,42 @@
|
||||
import { BattlePhase } from "./battle-phase";
|
||||
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;
|
||||
|
||||
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 {
|
||||
const field = this.scene.getField(true).filter(p => p.summonData);
|
||||
field.forEach(pokemon => func(pokemon));
|
||||
|
@ -983,10 +983,12 @@ export class GameData {
|
||||
const sessionData = this.parseSessionData(sessionDataStr);
|
||||
sessionData.autoSlot = autoSlot!;
|
||||
for (let i = 0; i <= 5; i++) {
|
||||
const speciesToCheck = getPokemonSpecies(sessionData.party[i]?.species);
|
||||
if (sessionData.party[i]?.abilityIndex === 1) {
|
||||
if (speciesToCheck.ability1 === speciesToCheck.ability2 && speciesToCheck.abilityHidden !== Abilities.NONE && speciesToCheck.abilityHidden !== speciesToCheck.ability1) {
|
||||
sessionData.party[i].abilityIndex = 2;
|
||||
if (sessionData.party[i]) {
|
||||
const speciesToCheck = getPokemonSpecies(sessionData.party[i]?.species);
|
||||
if (sessionData.party[i]?.abilityIndex === 1) {
|
||||
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