From b12ade22e940ee6dcaa0d45ed072a4899a6955c7 Mon Sep 17 00:00:00 2001 From: Xiaphear Date: Wed, 13 Mar 2024 17:38:37 +0100 Subject: [PATCH] Attempted magnitude, not implemented. --- src/data/move.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/data/move.ts b/src/data/move.ts index d032bdbc07a..7fc1c49fe61 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1310,6 +1310,51 @@ export class VariablePowerAttr extends MoveAttr { } } +export class MagnitudePowerAttr extends VariablePowerAttr { + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + const power = args[0] as Utils.NumberHolder; + + //const rateNumberChance = Phaser.Math.RND.realInRange ( 5, 10, 20, 30, 20, 10, 5); + //const rateNumber = Phaser.Math.RND.realInRange ( 4, 5 , 6, 7, 8, 9, 10 ); + //const rateNumberPowers = Phaser.Math.RND.realInRange ( 10, 30, 50, 70, 90, 110, 150 ); + + let rateNumber: integer; + + const rand = user.randSeedInt(100); + const powerGrade = new Utils.IntegerHolder(rand); + if (powerGrade.value >= 95){ + power.value = 150; + rateNumber = 10; + } + else if (powerGrade.value >= 85){ + power.value = 110; + rateNumber = 9; + } + else if (powerGrade.value >= 65){ + power.value = 90; + rateNumber = 8; + } + else if (powerGrade.value >= 35){ + power.value = 70; + rateNumber = 7; + } + else if (powerGrade.value >= 15){ + power.value = 50; + rateNumber = 6; + } + else if (powerGrade.value >= 5){ + power.value = 30; + rateNumber = 5; + } + else (powerGrade.value >= 0); + power.value = 10; + rateNumber = 4; + + return false; + } + +} + export class MovePowerMultiplierAttr extends VariablePowerAttr { private powerMultiplierFunc: (user: Pokemon, target: Pokemon, move: Move) => number;