mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Removed unecessary arg in turn start phase as refactor no longer needs it
This commit is contained in:
parent
0f2156b1b0
commit
3681fc5148
@ -1,6 +1,5 @@
|
||||
import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
||||
import { allMoves } from "#app/data/data-lists";
|
||||
import { AbilityId } from "#enums/ability-id";
|
||||
import { Stat } from "#app/enums/stat";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
import { PokemonMove } from "#app/data/moves/pokemon-move";
|
||||
@ -209,27 +208,8 @@ export class TurnStartPhase extends FieldPhase {
|
||||
break;
|
||||
case Command.RUN:
|
||||
{
|
||||
let runningPokemon = pokemon;
|
||||
if (globalScene.currentBattle.double) {
|
||||
const playerActivePokemon = field.filter(pokemon => {
|
||||
if (pokemon) {
|
||||
return pokemon.isPlayer() && pokemon.isActive();
|
||||
}
|
||||
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(AbilityId.RUN_AWAY));
|
||||
runningPokemon = hasRunAway !== undefined ? hasRunAway : fasterPokemon;
|
||||
}
|
||||
}
|
||||
phaseManager.unshiftNew("AttemptRunPhase", runningPokemon.getFieldIndex());
|
||||
//Team Based action, no need for checking individual pokemon or whether its doubles
|
||||
phaseManager.unshiftNew("AttemptRunPhase");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user