From 36b030d01920cf8bb5074ee5065d21519ab67c9a Mon Sep 17 00:00:00 2001 From: xDasone <149128906+xDasone@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:03:24 -0700 Subject: [PATCH] Implemented Frustration, and Return Damage Calcs --- src/data/move.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index cc88c40c5..79e909311 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1589,6 +1589,27 @@ export class SolarBeamPowerAttr extends VariablePowerAttr { } } +export class WinCountPowerMoveAttr extends VariablePowerAttr { + private invert: boolean; + + constructor(invert?: boolean) { + super(); + + this.invert = !!invert; + } + + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + const power = args[0] as Utils.NumberHolder; + + if (user instanceof PlayerPokemon) { + const winCount = Math.min(user.winCount, 100); + power.value = Math.max(!this.invert ? winCount : 100 - winCount, 1); + } + + return true; + } +} + export class VariableAccuracyAttr extends MoveAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { //const accuracy = args[0] as Utils.NumberHolder; @@ -2753,10 +2774,12 @@ export function initMoves() { .condition((user: Pokemon, target: Pokemon, move: Move) => user.status?.effect === StatusEffect.SLEEP), new SelfStatusMove(Moves.HEAL_BELL, "Heal Bell (N)", Type.NORMAL, -1, 5, -1, "Heals the user's party's status conditions.", -1, 0, 2) .target(MoveTarget.USER_AND_ALLIES), - new AttackMove(Moves.RETURN, "Return (N)", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, -1, "Power increases with higher Friendship.", -1, 0, 2), + new AttackMove(Moves.RETURN, "Return", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, -1, "Power increases with higher Friendship.", -1, 0, 2) + .attr(WinCountPowerMoveAttr), new AttackMove(Moves.PRESENT, "Present (N)", Type.NORMAL, MoveCategory.PHYSICAL, -1, 90, 15, -1, "Either deals damage or heals.", -1, 0, 2) .makesContact(false), - new AttackMove(Moves.FRUSTRATION, "Frustration (N)", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, -1, "Power decreases with higher Friendship.", -1, 0, 2), + new AttackMove(Moves.FRUSTRATION, "Frustration", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, -1, "Power decreases with higher Friendship.", -1, 0, 2) + .attr(WinCountPowerMoveAttr, true), new SelfStatusMove(Moves.SAFEGUARD, "Safeguard (N)", Type.NORMAL, -1, 25, -1, "The user's party is protected from status conditions.", -1, 0, 2) .target(MoveTarget.USER_SIDE), new StatusMove(Moves.PAIN_SPLIT, "Pain Split", Type.NORMAL, -1, 20, -1, "The user's and opponent's HP becomes the average of both.", -1, 0, 2)