@pkmn/sim 0.5.27 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/sim",
3
- "version": "0.5.27",
3
+ "version": "0.6.1",
4
4
  "description": "An automatically generated extraction of just the simulator portion of Pokémon Showdown",
5
5
  "homepage": "https://psim.us",
6
6
  "main": "build/sim/index.js",
@@ -27,11 +27,11 @@
27
27
  "sim"
28
28
  ],
29
29
  "dependencies": {
30
- "@pkmn/sets": "^3.1.1",
30
+ "@pkmn/sets": "^4.0.0",
31
31
  "@pkmn/streams": "^1.0.0"
32
32
  },
33
33
  "devDependencies": {
34
- "mocha": "^10.0.0"
34
+ "mocha": "^10.1.0"
35
35
  },
36
36
  "scripts": {
37
37
  "compile": "tsc -p .",
package/sim/battle.ts CHANGED
@@ -1829,8 +1829,8 @@ export class Battle {
1829
1829
  break;
1830
1830
  }
1831
1831
  this.runEvent('AfterEachBoost', target, source, effect, currentBoost);
1832
- } else if (effect && effect.effectType === 'Ability') {
1833
- if (isSecondary) this.add(msg, target, boostName, boostBy);
1832
+ } else if (effect?.effectType === 'Ability') {
1833
+ if (isSecondary || isSelf) this.add(msg, target, boostName, boostBy);
1834
1834
  } else if (!isSecondary && !isSelf) {
1835
1835
  this.add(msg, target, boostName, boostBy);
1836
1836
  }
package/sim/dex.ts CHANGED
@@ -176,7 +176,7 @@ export class ModdedDex {
176
176
  }
177
177
 
178
178
  forGen(gen: number) {
179
- if (!gen) return this;
179
+ if (gen < 1 || gen > 8) throw new Error(`Unsupported gen ${gen}`);
180
180
  return this.mod(`gen${gen}`);
181
181
  }
182
182