Skip to content

Commit

Permalink
Gen3: Impl type effectiveness in two stages (#676)
Browse files Browse the repository at this point in the history
This avoids any issues arising from lack of truncation in certain cases

Brings implementation inline with Gen1 & 4

Fixes: #675
  • Loading branch information
will-jj authored Jan 7, 2025
1 parent a5095a9 commit aea76b0
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 aea76b0

Please sign in to comment.