Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
thejetou authored Mar 5, 2024
1 parent eaccb91 commit 63ed23c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions calc/src/mechanics/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,20 +554,16 @@ export function getShellSideArmCategory(source: Pokemon, target: Pokemon): MoveC

export function getWeight(pokemon: Pokemon, desc: RawDesc, role: 'defender' | 'attacker') {
let weightHG = pokemon.weightkg * 10;
function modifyWeight(factor: number) {
weightHG = Math.max(Math.trunc(weightHG * factor), 1);
}

const abilityFactor = pokemon.hasAbility('Heavy Metal') ? 2
: pokemon.hasAbility('Light Metal') ? 0.5
: 1;
if (abilityFactor !== 1) {
modifyWeight(abilityFactor);
weightHG = Math.max(Math.trunc(weightHG * abilityFactor), 1);
desc[`${role}Ability`] = pokemon.ability;
}

if (pokemon.hasItem('Float Stone')) {
modifyWeight(0.5);
weightHG = Math.max(Math.trunc(weightHG * 0.5), 1);
desc[`${role}Item`] = pokemon.item;
}

Expand Down

0 comments on commit 63ed23c

Please sign in to comment.