From 61a08a831a2243bbedd4d92cfa226d97f24f16c9 Mon Sep 17 00:00:00 2001 From: Hexugory Date: Sat, 1 Apr 2023 03:26:30 -0500 Subject: [PATCH] ah i'm silly --- src/battle.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/battle.ts b/src/battle.ts index 316b98d..69f46ae 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -233,13 +233,15 @@ export class Battle { if (effect.damage) { let damage = effect.damage; //multiply by damageChange sum - damage *= self.potencyEffects + damage *= Math.max(0, + self.potencyEffects .filter(status => {return status.type === 'damage'}) - .reduce((a, b) => a + (b.potency/100), 1); + .reduce((a, b) => a + (b.potency/100), 1)); //multiply by resistanceChange sum - damage *= self.potencyEffects + damage *= Math.max(0, + self.potencyEffects .filter(status => {return status.type === 'resistance'}) - .reduce((a, b) => a - (b.potency/100), 1); + .reduce((a, b) => a - (b.potency/100), 1)); damage = Math.round(damage) this.appendLog(`(${target.team}) ${target.character.nameShort} took ${damage} damage!`); @@ -451,9 +453,10 @@ export class Battle { reverseHierarchy: (self: BattleUnit, target: BattleUnit, battle: Battle) => { let damage = 10+Math.floor(target.defaultHealth/10)*3; //multiply by damageChange sum - damage *= self.potencyEffects + damage *= Math.max(0, + self.potencyEffects .filter(status => {return status.type === 'damage'}) - .reduce((a, b) => a + (b.potency/100), 1); + .reduce((a, b) => a + (b.potency/100), 1)); //multiply by resistanceChange sum damage *= Math.max(0, self.potencyEffects @@ -467,13 +470,15 @@ export class Battle { issunBoushi: (self: BattleUnit, target: BattleUnit, battle: Battle) => { let damage = Math.floor(target.defaultHealth/10)*5; //multiply by damageChange sum - damage *= self.potencyEffects + damage *= Math.max(0, + self.potencyEffects .filter(status => {return status.type === 'damage'}) - .reduce((a, b) => a + (b.potency/100), 1); + .reduce((a, b) => a + (b.potency/100), 1)); //multiply by resistanceChange sum - damage *= self.potencyEffects + damage *= Math.max(0, + self.potencyEffects .filter(status => {return status.type === 'resistance'}) - .reduce((a, b) => a - (b.potency/100), 1); + .reduce((a, b) => a - (b.potency/100), 1)); damage = Math.round(damage) this.appendLog(`(${target.team}) ${target.character.nameShort} took ${damage} damage!`);