Compare commits

...

5 Commits

Author SHA1 Message Date
Matthew Olker
fda81ddac9 fix comments 2024-05-22 11:30:00 -04:00
Matthew Olker
2d936cc34b PR Comments 2024-05-16 19:00:53 -04:00
Matthew Olker
a11d0f8243 Use getStat 2024-05-16 19:00:53 -04:00
Matthew Olker
75063482e1 remove log statement 2024-05-16 19:00:53 -04:00
Matthew Olker
d8fe0b1c22 QOL update for running in double battle 2024-05-16 19:00:51 -04:00

View File

@ -2047,12 +2047,19 @@ export class TurnStartPhase extends FieldPhase {
this.scene.unshiftPhase(new AttemptCapturePhase(this.scene, turnCommand.targets[0] % 2, turnCommand.cursor));
break;
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:
const isSwitch = turnCommand.command === Command.POKEMON;
if (isSwitch)
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, pokemon.getFieldIndex(), turnCommand.cursor, true, turnCommand.args[0] as boolean, pokemon.isPlayer()));
else
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, pokemon.getFieldIndex()));
let runningPokemon = pokemon;
if (this.scene.currentBattle.double) {
const playerActivePokemon = field.filter(pokemon => pokemon.isPlayer());
// 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(Abilities.RUN_AWAY));
runningPokemon = hasRunAway !== undefined ? hasRunAway : fasterPokemon;
}
this.scene.unshiftPhase(new AttemptRunPhase(this.scene, runningPokemon.getFieldIndex()));
break;
}
}