Implemented Ball Fetch

pull/619/head
SamuelHudson 2024-05-07 15:54:56 -05:00
parent 08067d9937
commit 1b124e1730
3 changed files with 22 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import { BattleSpec } from "./enums/battle-spec";
import { PlayerGender } from "./system/game-data"; import { PlayerGender } from "./system/game-data";
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier"; import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
import { MoneyAchv } from "./system/achv"; import { MoneyAchv } from "./system/achv";
import { PokeballType } from "./data/pokeball";
export enum BattleType { export enum BattleType {
WILD, WILD,
@ -61,6 +62,7 @@ export default class Battle {
public battleSeed: string; public battleSeed: string;
private battleSeedState: string; private battleSeedState: string;
public moneyScattered: number; public moneyScattered: number;
public lastUsedPokeball: PokeballType;
private rngCounter: integer = 0; private rngCounter: integer = 0;
@ -86,6 +88,7 @@ export default class Battle {
this.battleSeed = Utils.randomString(16, true); this.battleSeed = Utils.randomString(16, true);
this.battleSeedState = null; this.battleSeedState = null;
this.moneyScattered = 0; this.moneyScattered = 0;
this.lastUsedPokeball = null;
} }
private initBattleSpec(): void { private initBattleSpec(): void {

View File

@ -22,6 +22,7 @@ import i18next, { Localizable } from "#app/plugins/i18n.js";
import { Command } from "../ui/command-ui-handler"; import { Command } from "../ui/command-ui-handler";
import Battle from "#app/battle.js"; import Battle from "#app/battle.js";
import { ability } from "#app/locales/en/ability.js"; import { ability } from "#app/locales/en/ability.js";
import { PokeballType, getPokeballName } from "./pokeball";
export class Ability implements Localizable { export class Ability implements Localizable {
public id: Abilities; public id: Abilities;
@ -2106,6 +2107,22 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
} }
} }
export class FetchBallAbAttr extends PostTurnAbAttr {
constructor() {
super();
}
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
let lastUsed = pokemon.scene.currentBattle.lastUsedPokeball;
if(lastUsed != null) {
pokemon.scene.pokeballCounts[lastUsed]++;
pokemon.scene.currentBattle.lastUsedPokeball = null;
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` found a\n${getPokeballName(lastUsed)}!`));
return true;
}
return false;
}
}
export class PostBiomeChangeAbAttr extends AbAttr { } export class PostBiomeChangeAbAttr extends AbAttr { }
export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr { export class PostBiomeChangeWeatherChangeAbAttr extends PostBiomeChangeAbAttr {
@ -2452,7 +2469,6 @@ export class SuppressFieldAbilitiesAbAttr extends AbAttr {
} }
} }
export class AlwaysHitAbAttr extends AbAttr { } export class AlwaysHitAbAttr extends AbAttr { }
export class UncopiableAbilityAbAttr extends AbAttr { export class UncopiableAbilityAbAttr extends AbAttr {
@ -3403,7 +3419,7 @@ export function initAbilities() {
new Ability(Abilities.LIBERO, 8) new Ability(Abilities.LIBERO, 8)
.unimplemented(), .unimplemented(),
new Ability(Abilities.BALL_FETCH, 8) new Ability(Abilities.BALL_FETCH, 8)
.unimplemented(), .attr(FetchBallAbAttr),
new Ability(Abilities.COTTON_DOWN, 8) new Ability(Abilities.COTTON_DOWN, 8)
.unimplemented(), .unimplemented(),
new Ability(Abilities.PROPELLER_TAIL, 8) new Ability(Abilities.PROPELLER_TAIL, 8)

View File

@ -4152,6 +4152,7 @@ export class AttemptCapturePhase extends PokemonPhase {
scale: 1 scale: 1
}); });
this.scene.currentBattle.lastUsedPokeball = this.pokeballType;
this.removePb(); this.removePb();
this.end(); this.end();
} }