Skip to content

Commit

Permalink
rm random POTD
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Feb 10, 2025
1 parent fc8948f commit ce7c613
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
10 changes: 9 additions & 1 deletion import
Original file line number Diff line number Diff line change
Expand Up @@ -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 => [
Expand Down Expand Up @@ -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) {';
Expand All @@ -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.'));
Expand Down
6 changes: 1 addition & 5 deletions randoms/src/gen8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} = {};

Expand All @@ -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)
Expand Down Expand Up @@ -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'));
Expand Down
6 changes: 1 addition & 5 deletions randoms/src/gen9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} = {};

Expand All @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 0 additions & 6 deletions randoms/src/global.d.ts

This file was deleted.

0 comments on commit ce7c613

Please sign in to comment.