@pkmn/randoms 0.4.24 → 0.4.25

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/src/gen8.ts CHANGED
@@ -1758,12 +1758,19 @@ export class RandomTeams {
1758
1758
 
1759
1759
  const moves = new Set<string>();
1760
1760
  let counter: MoveCounter;
1761
+ // This is just for BDSP Unown;
1762
+ // it can be removed from this file if BDSP gets its own random-teams file in the future.
1763
+ let hasHiddenPower = false;
1761
1764
 
1762
1765
  do {
1763
1766
  // Choose next 4 moves from learnset/viable moves and add them to moves list:
1764
1767
  const pool = (movePool.length ? movePool : rejectedPool);
1765
1768
  while (moves.size < 4 && pool.length) {
1766
1769
  const moveid = this.sampleNoReplace(pool);
1770
+ if (moveid.startsWith('hiddenpower')) {
1771
+ if (hasHiddenPower) continue;
1772
+ hasHiddenPower = true;
1773
+ }
1767
1774
  moves.add(moveid);
1768
1775
  }
1769
1776
 
@@ -1854,11 +1861,13 @@ export class RandomTeams {
1854
1861
 
1855
1862
  // Remove rejected moves from the move list
1856
1863
  if (cull && movePool.length) {
1864
+ if (moveid.startsWith('hiddenpower')) hasHiddenPower = false;
1857
1865
  if (move.category !== 'Status' && !move.damage) rejectedPool.push(moveid);
1858
1866
  moves.delete(moveid);
1859
1867
  break;
1860
1868
  }
1861
1869
  if (cull && rejectedPool.length) {
1870
+ if (moveid.startsWith('hiddenpower')) hasHiddenPower = false;
1862
1871
  moves.delete(moveid);
1863
1872
  break;
1864
1873
  }
@@ -1998,22 +2007,8 @@ export class RandomTeams {
1998
2007
  level = customScale[species.id] || tierScale[tier];
1999
2008
  // BDSP tier levelling
2000
2009
  } else if (this.dex.currentMod === 'gen8bdsp') {
2001
- const tierScale: {[k: string]: number} = {
2002
- Uber: 76,
2003
- OU: 80,
2004
- UUBL: 81,
2005
- UU: 82,
2006
- RUBL: 83,
2007
- RU: 84,
2008
- NUBL: 85,
2009
- NU: 86,
2010
- PUBL: 87,
2011
- PU: 88, "(PU)": 88, NFE: 88,
2012
- };
2013
- // to override tier scaling if needed
2014
- const customScale: {[k: string]: number} = {};
2015
-
2016
- level = customScale[species.id] || tierScale[species.tier];
2010
+ // TODO: figure out BDSP levelling based on the in-room poll
2011
+ level = 80;
2017
2012
  // Arbitrary levelling base on data files (typically winrate-influenced)
2018
2013
  } else if (species.randomBattleLevel) {
2019
2014
  level = species.randomBattleLevel;
@@ -2185,7 +2180,10 @@ export class RandomTeams {
2185
2180
  const limitFactor = Math.round(this.maxTeamSize / 6) || 1;
2186
2181
 
2187
2182
  // Limit one Pokemon per tier, two for Monotype
2183
+ // This limitation is not applied to BD/SP team generation, because tiering for BD/SP is not yet complete,
2184
+ // meaning that most Pokémon are in OU.
2188
2185
  if (
2186
+ this.dex.currentMod !== 'gen8bdsp' &&
2189
2187
  (tierCount[tier] >= (this.forceMonotype || isMonotype ? 2 : 1) * limitFactor) &&
2190
2188
  !this.randomChance(1, Math.pow(5, tierCount[tier]))
2191
2189
  ) {
@@ -2215,7 +2213,6 @@ export class RandomTeams {
2215
2213
 
2216
2214
  // Okay, the set passes, add it to our team
2217
2215
  pokemon.push(set);
2218
-
2219
2216
  if (pokemon.length === this.maxTeamSize) {
2220
2217
  // Set Zoroark's level to be the same as the last Pokemon
2221
2218
  const illusion = teamDetails.illusion;