Skip to content

Commit

Permalink
Apply type effectiveness in two stages to match implementation
Browse files Browse the repository at this point in the history
This avoids any issues arising from lack of truncation in certain cases
  • Loading branch information
will-jj committed Jan 6, 2025
1 parent a5095a9 commit d33d23d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions calc/src/mechanics/gen3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit d33d23d

Please sign in to comment.