@pkmn/randoms 0.8.7 → 0.8.8

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/build/index.js CHANGED
@@ -10126,6 +10126,8 @@ var RandomTeams = class {
10126
10126
  this.maxMoveCount = ruleTable.maxMoveCount;
10127
10127
  const forceMonotype = ruleTable.valueRules.get("forcemonotype");
10128
10128
  this.forceMonotype = forceMonotype && this.dex.types.get(forceMonotype).exists ? this.dex.types.get(forceMonotype).name : void 0;
10129
+ const forceTeraType = ruleTable.valueRules.get("forceteratype");
10130
+ this.forceTeraType = forceTeraType && this.dex.types.get(forceTeraType).exists ? this.dex.types.get(forceTeraType).name : void 0;
10129
10131
  this.factoryTier = "";
10130
10132
  this.format = format;
10131
10133
  this.prng = prng && !Array.isArray(prng) ? prng : new (0, _sim.PRNG)(prng);
@@ -11723,7 +11725,7 @@ var RandomTeams = class {
11723
11725
  movePool.push(this.dex.moves.get(movename).id);
11724
11726
  }
11725
11727
  const teraTypes = set.teraTypes;
11726
- const teraType = this.sampleIfArray(teraTypes);
11728
+ let teraType = this.sampleIfArray(teraTypes);
11727
11729
  let ability = "";
11728
11730
  let item = void 0;
11729
11731
  const evs = { hp: 85, atk: 85, def: 85, spa: 85, spd: 85, spe: 85 };
@@ -11787,6 +11789,8 @@ var RandomTeams = class {
11787
11789
  evs.spe = 0;
11788
11790
  ivs.spe = 0;
11789
11791
  }
11792
+ if (this.forceTeraType)
11793
+ teraType = this.forceTeraType;
11790
11794
  const shuffledMoves = Array.from(moves);
11791
11795
  this.prng.shuffle(shuffledMoves);
11792
11796
  return {
@@ -12095,7 +12099,11 @@ var RandomTeams = class {
12095
12099
  shiny
12096
12100
  };
12097
12101
  if (this.gen === 9) {
12098
- set.teraType = this.sample(this.dex.types.all()).name;
12102
+ if (this.forceTeraType) {
12103
+ set.teraType = this.forceTeraType;
12104
+ } else {
12105
+ set.teraType = this.sample(this.dex.types.all()).name;
12106
+ }
12099
12107
  }
12100
12108
  team.push(set);
12101
12109
  }
@@ -12438,7 +12446,11 @@ var RandomTeams = class {
12438
12446
  shiny
12439
12447
  };
12440
12448
  if (this.gen === 9) {
12441
- set.teraType = this.sample(this.dex.types.all()).name;
12449
+ if (this.forceTeraType) {
12450
+ set.teraType = this.forceTeraType;
12451
+ } else {
12452
+ set.teraType = this.sample(this.dex.types.all()).name;
12453
+ }
12442
12454
  }
12443
12455
  team.push(set);
12444
12456
  }