diff --git a/src/data/move.ts b/src/data/move.ts index 46216eb75..c89d8bd56 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2344,9 +2344,13 @@ export class HitCountPowerAttr extends VariablePowerAttr { } } +const countPositiveStats = (pokemon: Pokemon): number => { + return pokemon.summonData.battleStats.reduce((total, stat) => stat > 0 && stat ? total + stat : total, 0); +} + export class StatChangeCountPowerAttr extends VariablePowerAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - const positiveStats: number = user.summonData.battleStats.reduce((total, stat) => stat > 0 && stat ? total + stat : total, 0); + const positiveStats: number = countPositiveStats(user); (args[0] as Utils.NumberHolder).value += positiveStats * 20; @@ -2354,6 +2358,22 @@ export class StatChangeCountPowerAttr extends VariablePowerAttr { } } +export class PunishmentPowerAttr extends VariablePowerAttr { + PUNISHMENT_MIN_BASE_POWER = 60; + PUNISHMENT_MAX_BASE_POWER = 200; + + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + const positiveStats: number = countPositiveStats(target); + + (args[0] as Utils.NumberHolder).value = Math.min( + this.PUNISHMENT_MAX_BASE_POWER, + this.PUNISHMENT_MIN_BASE_POWER + positiveStats * 20 + ); + + return true; + } +} + export class PresentPowerAttr extends VariablePowerAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { @@ -5439,7 +5459,8 @@ export function initMoves() { new StatusMove(Moves.GUARD_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4) .unimplemented(), new AttackMove(Moves.PUNISHMENT, Type.DARK, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4) - .unimplemented(), + .attr(PunishmentPowerAttr) + .makesContact(), new AttackMove(Moves.LAST_RESORT, Type.NORMAL, MoveCategory.PHYSICAL, 140, 100, 5, -1, 0, 4) .attr(LastResortAttr), new StatusMove(Moves.WORRY_SEED, Type.GRASS, 100, 10, -1, 0, 4)