From ce7c613f1cdcacd974e25b096c60e37236ff0a7d Mon Sep 17 00:00:00 2001 From: Kirk Scheibelhut Date: Mon, 10 Feb 2025 10:56:34 -0800 Subject: [PATCH] rm random POTD --- import | 10 +++++++++- randoms/src/gen8.ts | 6 +----- randoms/src/gen9.ts | 6 +----- randoms/src/global.d.ts | 6 ------ 4 files changed, 11 insertions(+), 17 deletions(-) delete mode 100644 randoms/src/global.d.ts diff --git a/import b/import index 4d7c5844..2a8b8504 100755 --- a/import +++ b/import @@ -557,6 +557,7 @@ const RANDOM_SETS = /^(\trandomSets:.*=) require\('\.\/sets\.json'\);(.*)/; const RANDOM_DOUBLES_SETS = /^(\trandomDoublesSets:.*=) require\('\.\/doubles-sets\.json'\);(.*)/; const RANDOM_DATA = /^(\trandomData:.*=) require\('\.\/data\.json'\);(.*)/; +const RANDOM_POTD = /potd/i; const DATA = { 'abilities.js': code => [ @@ -749,6 +750,8 @@ const changes = async (where, last, now, repo) => ({ if (m) return `${m[1]} randomDoublesSetsJSON;${m[2]}`; m = INLINE_REQUIRE.exec(line); if (m) return `${m[1]}{};`; + m = RANDOM_POTD.exec(line); + if (m) return undefined; // Bless me, Father, for I have sinned... if (line.startsWith('\tconstructor(format:')) { return '\tconstructor(dex: ModdedDex, format: Format, prng: PRNG | PRNGSeed | null) {'; @@ -759,10 +762,15 @@ const changes = async (where, last, now, repo) => ({ } else if (line === '\t\tthis.dex = Dex.forFormat(format);') { return '\t\tthis.dex = dex;'; // eslint-disable-next-line max-len + } else if (line === '\t\t\tlet species = this.dex.species.get(this.sample(pokemonPool[baseSpecies]));') { + // eslint-disable-next-line max-len + return '\t\t\tconst species = this.dex.species.get(this.sample(pokemonPool[baseSpecies]));'; + // eslint-disable-next-line max-len } else if (line === '\t\t\t\t\tmovePool, moves, abilities, types, counter, species as Species, teamDetails') { return '\t\t\t\t\tmovePool, moves, abilities, types, counter, species, teamDetails'; - } else if (line == '\t\t ) ? this.format.team + \'Team\' : \'\';') + } else if (line === '\t\t ) ? this.format.team + \'Team\' : \'\';') { return '\t\t) ? this.format.team + \'Team\' : \'\';'; + } return (line .replace('values().next().value', 'values().next().value!') .replace(/Dex\./g, 'this.dex.')); diff --git a/randoms/src/gen8.ts b/randoms/src/gen8.ts index 3f953978..6a7c0822 100644 --- a/randoms/src/gen8.ts +++ b/randoms/src/gen8.ts @@ -2510,9 +2510,6 @@ export class RandomGen8Teams { const typePool = this.dex.types.names(); const type = this.forceMonotype || this.sample(typePool); - // PotD stuff - const usePotD = global.Config && Config.potd && ruleTable.has('potd'); - const potd = usePotD ? this.dex.species.get(Config.potd) : null; const baseFormes: {[k: string]: number} = {}; @@ -2532,7 +2529,7 @@ export class RandomGen8Teams { const [pokemonPool, baseSpeciesPool] = this.getPokemonPool(type, pokemon, isMonotype, pokemonList); while (baseSpeciesPool.length && pokemon.length < this.maxTeamSize) { const baseSpecies = this.sampleNoReplace(baseSpeciesPool); - let species = this.dex.species.get(this.sample(pokemonPool[baseSpecies])); + const species = this.dex.species.get(this.sample(pokemonPool[baseSpecies])); if (!species.exists) continue; // Limit to one of each species (Species Clause) @@ -2617,7 +2614,6 @@ export class RandomGen8Teams { if (!this.forceMonotype && isMonotype && (typeComboCount[typeCombo] >= 3 * limitFactor)) continue; // The Pokemon of the Day - if (potd?.exists && (pokemon.length === 1 || this.maxTeamSize === 1)) species = potd; const set = this.randomSet(species, teamDetails, pokemon.length === 0, isDoubles, this.dex.formats.getRuleTable(this.format).has('dynamaxclause')); diff --git a/randoms/src/gen9.ts b/randoms/src/gen9.ts index 8e80d5cb..3baa7e6a 100644 --- a/randoms/src/gen9.ts +++ b/randoms/src/gen9.ts @@ -1676,9 +1676,6 @@ export class RandomTeams { const typePool = this.dex.types.names().filter(name => name !== "Stellar"); const type = this.forceMonotype || this.sample(typePool); - // PotD stuff - const usePotD = global.Config && Config.potd && ruleTable.has('potd'); - const potd = usePotD ? this.dex.species.get(Config.potd) : null; const baseFormes: {[k: string]: number} = {}; @@ -1695,7 +1692,7 @@ export class RandomTeams { let leadsRemaining = this.format.gameType === 'doubles' ? 2 : 1; while (baseSpeciesPool.length && pokemon.length < this.maxTeamSize) { const baseSpecies = this.sampleNoReplace(baseSpeciesPool); - let species = this.dex.species.get(this.sample(pokemonPool[baseSpecies])); + const species = this.dex.species.get(this.sample(pokemonPool[baseSpecies])); if (!species.exists) continue; // Limit to one of each species (Species Clause) @@ -1773,7 +1770,6 @@ export class RandomTeams { if (!this.forceMonotype && isMonotype && (typeComboCount[typeCombo] >= 3 * limitFactor)) continue; // The Pokemon of the Day - if (potd?.exists && (pokemon.length === 1 || this.maxTeamSize === 1)) species = potd; let set: RandomTeamsTypes.RandomSet; diff --git a/randoms/src/global.d.ts b/randoms/src/global.d.ts deleted file mode 100644 index c9db9fe0..00000000 --- a/randoms/src/global.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* eslint-disable no-var */ -export {}; - -declare global { - var Config: {potd?: string; allowrequestingties?: boolean}; -}