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

View File

@ -10,13 +10,14 @@ import { NewBattlePhase } from "./new-battle-phase";
import { PokemonPhase } from "./pokemon-phase";
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 */
public forceFailEscape = false;
constructor(scene: BattleScene, fieldIndex: number) {
super(scene, fieldIndex);
}
start() {
super.start();