From d716b9b107202ceec397ca8b70a6645e715d0a6f Mon Sep 17 00:00:00 2001 From: Luc Dube Date: Sun, 21 Apr 2024 17:36:32 -0400 Subject: [PATCH] implemented teatime --- src/data/move.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 9bba34b09..eb5efb65e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1104,12 +1104,20 @@ export class EatBerryAttr extends MoveEffectAttr { protected chosenBerry: BerryModifier; constructor() { super(true, MoveEffectTrigger.HIT); + this.chosenBerry = undefined; } apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { if (!super.apply(user, target, move, args)) return false; + if(this.chosenBerry === undefined) { // if no berry has been provided, pick a random berry from their inventory + const heldBerries = this.getTargetHeldBerries(target); + if(heldBerries.length <= 0) + return false; + this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)]; + } + getBerryEffectFunc(this.chosenBerry.berryType)(target); if (!--this.chosenBerry.stackCount) @@ -4690,8 +4698,7 @@ export function initMoves() { .makesContact(false) .ignoresProtect(), new AttackMove(Moves.PLUCK, Type.FLYING, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) - .attr(StealEatBerryAttr) - .partial(), + .attr(StealEatBerryAttr), new StatusMove(Moves.TAILWIND, Type.FLYING, -1, 15, -1, 0, 4) .windMove() .target(MoveTarget.USER_SIDE) @@ -4927,8 +4934,7 @@ export function initMoves() { new AttackMove(Moves.JUDGMENT, Type.NORMAL, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 4) .partial(), new AttackMove(Moves.BUG_BITE, Type.BUG, MoveCategory.PHYSICAL, 60, 100, 20, -1, 0, 4) - .attr(StealEatBerryAttr) - .partial(), + .attr(StealEatBerryAttr), new AttackMove(Moves.CHARGE_BEAM, Type.ELECTRIC, MoveCategory.SPECIAL, 50, 90, 10, 70, 0, 4) .attr(StatChangeAttr, BattleStat.SPATK, 1, true), new AttackMove(Moves.WOOD_HAMMER, Type.GRASS, MoveCategory.PHYSICAL, 120, 100, 15, -1, 0, 4) @@ -5713,8 +5719,8 @@ export function initMoves() { .makesContact(false) .partial(), new StatusMove(Moves.TEATIME, Type.NORMAL, -1, 10, -1, 0, 8) - .target(MoveTarget.ALL) - .attr(EatBerryAttr), + .attr(EatBerryAttr) + .target(MoveTarget.ALL), new StatusMove(Moves.OCTOLOCK, Type.FIGHTING, 100, 15, -1, 0, 8) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, true, 1) .partial(),