mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 08:22:16 +02:00
QOL update for running in double battle
This commit is contained in:
parent
3f571a366a
commit
d8fe0b1c22
@ -2047,12 +2047,20 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets[0] % 2, turnCommand.cursor));
|
this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets[0] % 2, turnCommand.cursor));
|
||||||
break;
|
break;
|
||||||
case Command.POKEMON:
|
case Command.POKEMON:
|
||||||
|
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, pokemon.getFieldIndex(), turnCommand.cursor, true, turnCommand.args[0] as boolean, pokemon.isPlayer()));
|
||||||
|
break;
|
||||||
case Command.RUN:
|
case Command.RUN:
|
||||||
const isSwitch = turnCommand.command === Command.POKEMON;
|
let runningPokemon = pokemon;
|
||||||
if (isSwitch)
|
// check if either active player pokemon has run away
|
||||||
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, pokemon.getFieldIndex(), turnCommand.cursor, true, turnCommand.args[0] as boolean, pokemon.isPlayer()));
|
if (this.scene.currentBattle.double) {
|
||||||
else
|
const playerPokemon = field.filter(pokemon => pokemon.isPlayer());
|
||||||
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, pokemon.getFieldIndex()));
|
// use the faster stats if not
|
||||||
|
const fasterPokemon = playerPokemon[0].stats[Stat.SPD] > playerPokemon[1].stats[Stat.SPD] ? playerPokemon[0] : playerPokemon[1];
|
||||||
|
const hasRunAway = playerPokemon.find(p => p.hasAbility(Abilities.RUN_AWAY));
|
||||||
|
runningPokemon = hasRunAway != undefined ? hasRunAway : fasterPokemon;
|
||||||
|
}
|
||||||
|
console.log(runningPokemon.name)
|
||||||
|
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, runningPokemon.getFieldIndex()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user