Skip to content

Commit

Permalink
Populate neutral nature stat associations (#377)
Browse files Browse the repository at this point in the history
* Populate neutral nature stat associations

Technically, the neutral natures are each associated with a plus and minus stat of the same value.  This would be nice to include, for lookup purposes.

I'm not 100% sure if this will break anything though, so definitely need another pair of eyes.

* calcStat accounts for plus and minus natures
  • Loading branch information
ajhyndman authored Mar 8, 2020
1 parent 7febbf4 commit 7e55b3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 5 additions & 5 deletions calc/src/data/natures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {Stat} from '../stats';

export const NATURES: {[name: string]: [Stat?, Stat?]} = {
Adamant: ['atk', 'spa'],
Bashful: [undefined, undefined],
Bashful: ['spa', 'spa'],
Bold: ['def', 'atk'],
Brave: ['atk', 'spe'],
Calm: ['spd', 'atk'],
Careful: ['spd', 'spa'],
Docile: [undefined, undefined],
Docile: ['def', 'def'],
Gentle: ['spd', 'def'],
Hardy: [undefined, undefined],
Hardy: ['atk', 'atk'],
Hasty: ['spe', 'def'],
Impish: ['def', 'spa'],
Jolly: ['spe', 'spa'],
Expand All @@ -21,11 +21,11 @@ export const NATURES: {[name: string]: [Stat?, Stat?]} = {
Naive: ['spe', 'spd'],
Naughty: ['atk', 'spd'],
Quiet: ['spa', 'spe'],
Quirky: [undefined, undefined],
Quirky: ['spd', 'spd'],
Rash: ['spa', 'spd'],
Relaxed: ['def', 'spe'],
Sassy: ['spd', 'spe'],
Serious: [undefined, undefined],
Serious: ['spe', 'spe'],
Timid: ['spe', 'atk'],
};

Expand Down
9 changes: 8 additions & 1 deletion calc/src/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ function calcStatADV(
const mods: [Stat?, Stat?] = nature ? NATURES[nature] : [undefined, undefined];
let n: number;
if (mods) {
n = mods[0] === stat ? 1.1 : mods[1] === stat ? 0.9 : 1;
n =
mods[0] === stat && mods[1] === stat
? 1
: mods[0] === stat
? 1.1
: mods[1] === stat
? 0.9
: 1;
} else {
n = 1;
}
Expand Down

0 comments on commit 7e55b3b

Please sign in to comment.