@pkmn/dex 0.5.28 → 0.6.2

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/index.ts CHANGED
@@ -1175,7 +1175,7 @@ const DATA = {
1175
1175
  FormatsData: FormatsDataJSON as Data<FormatData>,
1176
1176
  };
1177
1177
 
1178
- const HP_TYPES = [
1178
+ const HP_TYPES: T.HPTypeName[] = [
1179
1179
  'Fighting', 'Flying', 'Poison', 'Ground', 'Rock', 'Bug', 'Ghost', 'Steel',
1180
1180
  'Fire', 'Water', 'Grass', 'Electric', 'Psychic', 'Ice', 'Dragon', 'Dark',
1181
1181
  ];
@@ -1244,7 +1244,7 @@ export class ModdedDex implements T.Dex {
1244
1244
  }
1245
1245
 
1246
1246
  forGen(gen: number) {
1247
- if (!gen) return this;
1247
+ if (gen < 1 || gen > 8) throw new Error(`Unsupported gen ${gen}`);
1248
1248
  return this.mod(`gen${gen}` as GenID);
1249
1249
  }
1250
1250
 
@@ -1303,7 +1303,7 @@ export class ModdedDex implements T.Dex {
1303
1303
  const speDV = tr(ivs.spe / 2);
1304
1304
  const spcDV = tr(ivs.spa / 2);
1305
1305
  return {
1306
- type: HP_TYPES[4 * (atkDV % 4) + (defDV % 4)] as T.TypeName,
1306
+ type: HP_TYPES[4 * (atkDV % 4) + (defDV % 4)],
1307
1307
  power: tr(
1308
1308
  (5 * ((spcDV >> 3) +
1309
1309
  (2 * (speDV >> 3)) +
@@ -1323,7 +1323,7 @@ export class ModdedDex implements T.Dex {
1323
1323
  i *= 2;
1324
1324
  }
1325
1325
  return {
1326
- type: HP_TYPES[tr(hpTypeX * 15 / 63)] as T.TypeName,
1326
+ type: HP_TYPES[tr(hpTypeX * 15 / 63)],
1327
1327
  // After Gen 6, Hidden Power is always 60 base power
1328
1328
  power: (this.gen && this.gen < 6) ? tr(hpPowerX * 40 / 63) + 30 : 60,
1329
1329
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkmn/dex",
3
- "version": "0.5.28",
3
+ "version": "0.6.2",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "unpkg": "build/production.min.js",
@@ -16,7 +16,7 @@
16
16
  "index.ts"
17
17
  ],
18
18
  "dependencies": {
19
- "@pkmn/dex-types": "^0.5.28"
19
+ "@pkmn/dex-types": "^0.6.2"
20
20
  },
21
21
  "scripts": {
22
22
  "lint": "eslint --cache *.ts",