mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 16:56:11 +00:00
Implement Ball Fetch (#1129)
* Implemented Ball Fetch * Added once per battle condition * Ability only functions on player side * Update ability.ts --------- Co-authored-by: SamuelHudson <samuel.hudson2017@gmail.com> Co-authored-by: Benjamin Odom <bennybroseph@gmail.com>
This commit is contained in:
parent
932e6e39f9
commit
3031cc1245
@ -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 {
|
||||||
|
@ -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;
|
||||||
@ -2276,6 +2277,33 @@ export class PostTurnFormChangeAbAttr extends PostTurnAbAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grabs the last failed Pokeball used
|
||||||
|
* @extends PostTurnAbAttr
|
||||||
|
* @see {@linkcode applyPostTurn} */
|
||||||
|
export class FetchBallAbAttr extends PostTurnAbAttr {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Adds the last used Pokeball back into the player's inventory
|
||||||
|
* @param pokemon {@linkcode Pokemon} with this ability
|
||||||
|
* @param passive N/A
|
||||||
|
* @param args N/A
|
||||||
|
* @returns true if player has used a pokeball and this pokemon is owned by the player
|
||||||
|
*/
|
||||||
|
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||||
|
let lastUsed = pokemon.scene.currentBattle.lastUsedPokeball;
|
||||||
|
if(lastUsed != null && pokemon.isPlayer) {
|
||||||
|
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 {
|
||||||
@ -2644,7 +2672,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 {
|
||||||
@ -3627,7 +3654,8 @@ 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)
|
||||||
|
.condition(getOncePerBattleCondition(Abilities.BALL_FETCH)),
|
||||||
new Ability(Abilities.COTTON_DOWN, 8)
|
new Ability(Abilities.COTTON_DOWN, 8)
|
||||||
.attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.SPD, -1, false, true)
|
.attr(PostDefendStatChangeAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattleStat.SPD, -1, false, true)
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
|
@ -4350,6 +4350,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
scale: 1
|
scale: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.scene.currentBattle.lastUsedPokeball = this.pokeballType;
|
||||||
this.removePb();
|
this.removePb();
|
||||||
this.end();
|
this.end();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user