From 398d7061d6c3556a43632af2cfb14e042dce2754 Mon Sep 17 00:00:00 2001 From: William Jackson Date: Sun, 5 Jan 2025 14:31:12 +0000 Subject: [PATCH] Apply type effectiveness in two stages to match implementation This avoids any truncation in certain cases where the first type effectiveness is 0.5 --- calc/src/mechanics/gen3.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/calc/src/mechanics/gen3.ts b/calc/src/mechanics/gen3.ts index b2d42f4a2..7383325ce 100644 --- a/calc/src/mechanics/gen3.ts +++ b/calc/src/mechanics/gen3.ts @@ -159,7 +159,8 @@ export function calculateADV( baseDamage = calculateFinalModsADV(baseDamage, attacker, move, field, desc, isCritical); - baseDamage = Math.floor(baseDamage * typeEffectiveness); + baseDamage = Math.floor(baseDamage * type1Effectiveness); + baseDamage = Math.floor(baseDamage * type2Effectiveness); result.damage = []; for (let i = 85; i <= 100; i++) { result.damage[i - 85] = Math.max(1, Math.floor((baseDamage * i) / 100)); @@ -187,7 +188,8 @@ export function calculateADV( Math.floor((Math.floor((2 * lv) / 5 + 2) * newAt * newBp) / df) / 50 ); newBaseDmg = calculateFinalModsADV(newBaseDmg, attacker, move, field, desc, isCritical); - newBaseDmg = Math.floor(newBaseDmg * typeEffectiveness); + newBaseDmg = Math.floor(baseDamage * type1Effectiveness); + newBaseDmg = Math.floor(baseDamage * type2Effectiveness); let damageMultiplier = 85; result.damage = result.damage.map(affectedAmount => {