adding new AbAttr in abiliity.ts for posterity

This commit is contained in:
PrabbyDD 2024-10-21 09:15:42 -07:00
parent 5bc36ba5a9
commit 902d8ba3f3
2 changed files with 12 additions and 13 deletions

View File

@ -3579,24 +3579,22 @@ export class MoodyAbAttr extends PostTurnAbAttr {
} }
} }
export class PostTurnStatStageChangeAbAttr extends PostTurnAbAttr { export class SpeedBoostAbAttr extends PostTurnAbAttr {
private stats: BattleStat[]; private stats: BattleStat[];
private stages: number; private stages: number;
constructor(stats: BattleStat[], stages: number) { constructor() {
super(true); super(true);
this.stats = Array.isArray(stats) this.stats = Array.isArray([ Stat.SPD ])
? stats ? [ Stat.SPD ]
: [ stats ]; : [ Stat.SPD ];
this.stages = stages; this.stages = 1;
} }
applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { applyPostTurn(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
if (!simulated) { if (!simulated) {
if (!pokemon.hasAbility(Abilities.SPEED_BOOST)) { if (!pokemon.turnData.switchedInThisTurn && !pokemon.turnData.failedRunAway) {
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.stages));
} else if (pokemon.hasAbility(Abilities.SPEED_BOOST) && !pokemon.turnData.switchedInThisTurn && !pokemon.turnData.failedRunAway) {
pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.stages)); pokemon.scene.unshiftPhase(new StatStageChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, this.stats, this.stages));
} else { } else {
return false; return false;
@ -4865,7 +4863,7 @@ export function initAbilities() {
.attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN) .attr(PostSummonWeatherChangeAbAttr, WeatherType.RAIN)
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.RAIN), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.RAIN),
new Ability(Abilities.SPEED_BOOST, 3) new Ability(Abilities.SPEED_BOOST, 3)
.attr(PostTurnStatStageChangeAbAttr, [ Stat.SPD ], 1), .attr(SpeedBoostAbAttr),
new Ability(Abilities.BATTLE_ARMOR, 3) new Ability(Abilities.BATTLE_ARMOR, 3)
.attr(BlockCritAbAttr) .attr(BlockCritAbAttr)
.ignorable(), .ignorable(),

View File

@ -10,13 +10,14 @@ import { NewBattlePhase } from "./new-battle-phase";
import { PokemonPhase } from "./pokemon-phase"; import { PokemonPhase } from "./pokemon-phase";
export class AttemptRunPhase extends PokemonPhase { export class AttemptRunPhase extends PokemonPhase {
constructor(scene: BattleScene, fieldIndex: number) {
super(scene, fieldIndex);
}
/** For testing purposes: this is to force the pokemon to fail and escape */ /** For testing purposes: this is to force the pokemon to fail and escape */
public forceFailEscape = false; public forceFailEscape = false;
constructor(scene: BattleScene, fieldIndex: number) {
super(scene, fieldIndex);
}
start() { start() {
super.start(); super.start();