From d6ca09e4317fa60b15abcd4b7ede5a71d3c9ebea Mon Sep 17 00:00:00 2001 From: Xavion3 Date: Thu, 2 May 2024 06:36:47 +1000 Subject: [PATCH] Implement Belch --- src/data/berry.ts | 12 ++++++++++++ src/data/move.ts | 2 +- src/field/pokemon.ts | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/data/berry.ts b/src/data/berry.ts index b28772373..1228bb549 100644 --- a/src/data/berry.ts +++ b/src/data/berry.ts @@ -99,6 +99,8 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { case BerryType.SITRUS: case BerryType.ENIGMA: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); const hpHealed = new Utils.NumberHolder(Math.floor(pokemon.getMaxHp() / 4)); applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, hpHealed); pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(), @@ -106,6 +108,8 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { }; case BerryType.LUM: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); if (pokemon.status) { pokemon.scene.queueMessage(getPokemonMessage(pokemon, getStatusEffectHealText(pokemon.status.effect))); pokemon.resetStatus(); @@ -119,6 +123,8 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { case BerryType.APICOT: case BerryType.SALAC: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); const battleStat = (berryType - BerryType.LIECHI) as BattleStat; const statLevels = new Utils.NumberHolder(1); applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, statLevels); @@ -126,16 +132,22 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { }; case BerryType.LANSAT: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); pokemon.addTag(BattlerTagType.CRIT_BOOST); }; case BerryType.STARF: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); const statLevels = new Utils.NumberHolder(2); applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, statLevels); pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ BattleStat.RAND ], statLevels.value)); }; case BerryType.LEPPA: return (pokemon: Pokemon) => { + if (pokemon.battleData) + pokemon.battleData.berriesEaten.push(berryType); const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()); ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); diff --git a/src/data/move.ts b/src/data/move.ts index 78c47e1ea..8b94756d0 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5301,7 +5301,7 @@ export function initMoves() { new StatusMove(Moves.MAT_BLOCK, Type.FIGHTING, -1, 10, -1, 0, 6) .unimplemented(), new AttackMove(Moves.BELCH, Type.POISON, MoveCategory.SPECIAL, 120, 90, 10, -1, 0, 6) - .partial(), + .condition((user, target, move) => user.battleData.berriesEaten.length > 0), new StatusMove(Moves.ROTOTILLER, Type.GROUND, -1, 10, 100, 0, 6) .target(MoveTarget.ALL) .unimplemented(), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 55036e190..ed248f7cc 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -43,6 +43,7 @@ import { Nature, getNatureStatMultiplier } from '../data/nature'; import { SpeciesFormChange, SpeciesFormChangeActiveTrigger, SpeciesFormChangeMoveLearnedTrigger, SpeciesFormChangePostMoveTrigger, SpeciesFormChangeStatusEffectTrigger } from '../data/pokemon-forms'; import { TerrainType } from '../data/terrain'; import { TrainerSlot } from '../data/trainer-config'; +import { BerryType } from '../data/berry'; import { ABILITY_OVERRIDE, MOVE_OVERRIDE, OPP_ABILITY_OVERRIDE, OPP_MOVE_OVERRIDE, OPP_SHINY_OVERRIDE, OPP_VARIANT_OVERRIDE } from '../overrides'; export enum FieldPosition { @@ -2993,6 +2994,7 @@ export class PokemonSummonData { export class PokemonBattleData { public hitCount: integer = 0; public endured: boolean = false; + public berriesEaten: BerryType[] = []; } export class PokemonBattleSummonData {