{ "version": 3, "sources": ["../../../../../data/mods/potd/random-teams.ts"], "sourcesContent": ["import {RandomTeams} from './../../random-teams';\n\nconst potdPokemon = [\n\t\"hoopa\", \"groudon\", \"dachsbun\", \"squawkabilly\", \"cacturne\", \"typhlosion\", \"jolteon\", \"masquerain\", \"falinks\",\n\t\"wyrdeer\", \"gardevoir\", \"decidueye\", \"hawlucha\", \"azelf\", \"gothitelle\", \"donphan\", \"pikachu\", \"zaciancrowned\",\n\t\"quagsire\", \"uxie\", \"dondozo\", \"orthworm\", \"klawf\", \"dunsparce\", \"avalugg\", \"pawmot\", \"qwilfish\", \"lilliganthisui\",\n];\n\nexport class RandomPOTDTeams extends RandomTeams {\n\trandomTeam() {\n\t\tthis.enforceNoDirectCustomBanlistChanges();\n\n\t\tconst seed = this.prng.seed;\n\t\tconst ruleTable = this.dex.formats.getRuleTable(this.format);\n\t\tconst pokemon: RandomTeamsTypes.RandomSet[] = [];\n\n\t\t// For Monotype\n\t\tconst isMonotype = !!this.forceMonotype || ruleTable.has('sametypeclause');\n\t\tconst isDoubles = this.format.gameType !== 'singles';\n\t\tconst typePool = this.dex.types.names();\n\t\tconst type = this.forceMonotype || this.sample(typePool);\n\n\t\t// PotD stuff\n\t\tconst day = new Date().getDate();\n\t\tconst potd = this.dex.species.get(potdPokemon[day > 28 ? 27 : day - 1]);\n\n\t\tconst baseFormes: {[k: string]: number} = {};\n\n\t\tconst tierCount: {[k: string]: number} = {};\n\t\tconst typeCount: {[k: string]: number} = {};\n\t\tconst typeComboCount: {[k: string]: number} = {};\n\t\tconst typeWeaknesses: {[k: string]: number} = {};\n\t\tconst teamDetails: RandomTeamsTypes.TeamDetails = {};\n\n\t\tconst pokemonList = isDoubles ? Object.keys(this.randomDoublesSets) : Object.keys(this.randomSets);\n\t\tconst [pokemonPool, baseSpeciesPool] = this.getPokemonPool(\n\t\t\ttype, pokemon, isMonotype, pokemonList.filter(m => this.dex.species.get(m).baseSpecies !== potd.baseSpecies)\n\t\t);\n\n\t\t// Add PotD to type counts\n\t\tfor (const typeName of potd.types) {\n\t\t\ttypeCount[typeName] = 1;\n\t\t}\n\t\ttypeComboCount[potd.types.slice().sort().join()] = 1;\n\n\t\t// Increment weakness counter\n\t\tfor (const typeName of this.dex.types.names()) {\n\t\t\t// it's weak to the type\n\t\t\tif (this.dex.getEffectiveness(typeName, potd) > 0) {\n\t\t\t\ttypeWeaknesses[typeName] = 1;\n\t\t\t}\n\t\t}\n\n\t\twhile (baseSpeciesPool.length && pokemon.length < this.maxTeamSize) {\n\t\t\tconst baseSpecies = this.sampleNoReplace(baseSpeciesPool);\n\t\t\tlet species = this.dex.species.get(this.sample(pokemonPool[baseSpecies]));\n\t\t\tif (!species.exists) continue;\n\n\t\t\t// Limit to one of each species (Species Clause)\n\t\t\tif (baseFormes[species.baseSpecies]) continue;\n\n\t\t\t// Illusion shouldn't be on the last slot\n\t\t\tif (species.baseSpecies === 'Zoroark' && pokemon.length >= (this.maxTeamSize - 1)) continue;\n\n\t\t\t// If Zoroark is in the team, the sixth slot should not be a Pokemon with extremely low level\n\t\t\tif (\n\t\t\t\tpokemon.some(pkmn => pkmn.name === 'Zoroark') &&\n\t\t\t\tpokemon.length >= (this.maxTeamSize - 1) &&\n\t\t\t\tthis.getLevel(species, isDoubles) < 72 &&\n\t\t\t\t!this.adjustLevel\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Pokemon with Last Respects, Intrepid Sword, and Dauntless Shield shouldn't be leading\n\t\t\tif (['Basculegion', 'Houndstone', 'Zacian', 'Zamazenta'].includes(species.baseSpecies) && !pokemon.length) continue;\n\n\t\t\tconst tier = species.tier;\n\t\t\tconst types = species.types;\n\t\t\tconst typeCombo = types.slice().sort().join();\n\t\t\t// Dynamically scale limits for different team sizes. The default and minimum value is 1.\n\t\t\tconst limitFactor = Math.round(this.maxTeamSize / 6) || 1;\n\n\t\t\t// Limit one Pokemon per tier, two for Monotype\n\t\t\t// Disable this for now, since it is still a new gen\n\t\t\t// Unless you want to have a lot of Ubers!\n\t\t\t// if (\n\t\t\t// \t(tierCount[tier] >= (this.forceMonotype || isMonotype ? 2 : 1) * limitFactor) &&\n\t\t\t// \t!this.randomChance(1, Math.pow(5, tierCount[tier]))\n\t\t\t// ) {\n\t\t\t// \tcontinue;\n\t\t\t// }\n\n\t\t\tif (!isMonotype && !this.forceMonotype) {\n\t\t\t\tlet skip = false;\n\n\t\t\t\t// Limit two of any type\n\t\t\t\tfor (const typeName of types) {\n\t\t\t\t\tif (typeCount[typeName] >= 2 * limitFactor) {\n\t\t\t\t\t\tskip = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (skip) continue;\n\n\t\t\t\t// Limit three weak to any type\n\t\t\t\tfor (const typeName of this.dex.types.names()) {\n\t\t\t\t\t// it's weak to the type\n\t\t\t\t\tif (this.dex.getEffectiveness(typeName, species) > 0) {\n\t\t\t\t\t\tif (!typeWeaknesses[typeName]) typeWeaknesses[typeName] = 0;\n\t\t\t\t\t\tif (typeWeaknesses[typeName] >= 3 * limitFactor) {\n\t\t\t\t\t\t\tskip = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (skip) continue;\n\t\t\t}\n\n\t\t\t// Limit one of any type combination, two in Monotype\n\t\t\tif (!this.forceMonotype && typeComboCount[typeCombo] >= (isMonotype ? 2 : 1) * limitFactor) continue;\n\n\t\t\t// The Pokemon of the Day\n\t\t\tif (potd?.exists && (pokemon.length === 1 || this.maxTeamSize === 1)) species = potd;\n\n\t\t\tconst set = this.randomSet(species, teamDetails, pokemon.length === 0, isDoubles);\n\n\t\t\t// Okay, the set passes, add it to our team\n\t\t\tpokemon.push(set);\n\t\t\tif (pokemon.length === this.maxTeamSize) {\n\t\t\t\t// Set Zoroark's level to be the same as the last Pokemon\n\t\t\t\tconst illusion = teamDetails.illusion;\n\t\t\t\tif (illusion) pokemon[illusion - 1].level = pokemon[this.maxTeamSize - 1].level;\n\n\t\t\t\t// Don't bother tracking details for the last Pokemon\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// Now that our Pokemon has passed all checks, we can increment our counters\n\t\t\tbaseFormes[species.baseSpecies] = 1;\n\n\t\t\t// Increment tier counter\n\t\t\tif (tierCount[tier]) {\n\t\t\t\ttierCount[tier]++;\n\t\t\t} else {\n\t\t\t\ttierCount[tier] = 1;\n\t\t\t}\n\n\t\t\t// Don't increment type/weakness counters for POTD, since they were added at the beginning\n\t\t\tif (pokemon.length !== 1 && this.maxTeamSize !== 1) {\n\t\t\t\t// Increment type counters\n\t\t\t\tfor (const typeName of types) {\n\t\t\t\t\tif (typeName in typeCount) {\n\t\t\t\t\t\ttypeCount[typeName]++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttypeCount[typeName] = 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeCombo in typeComboCount) {\n\t\t\t\t\ttypeComboCount[typeCombo]++;\n\t\t\t\t} else {\n\t\t\t\t\ttypeComboCount[typeCombo] = 1;\n\t\t\t\t}\n\n\t\t\t\t// Increment weakness counter\n\t\t\t\tfor (const typeName of this.dex.types.names()) {\n\t\t\t\t\t// it's weak to the type\n\t\t\t\t\tif (this.dex.getEffectiveness(typeName, species) > 0) {\n\t\t\t\t\t\ttypeWeaknesses[typeName]++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Track what the team has\n\t\t\tif (set.ability === 'Drizzle' || set.moves.includes('raindance')) teamDetails.rain = 1;\n\t\t\tif (set.ability === 'Drought' || set.moves.includes('sunnyday')) teamDetails.sun = 1;\n\t\t\tif (set.ability === 'Sand Stream') teamDetails.sand = 1;\n\t\t\tif (set.ability === 'Snow Warning' || set.moves.includes('snowscape') || set.moves.includes('chillyreception')) {\n\t\t\t\tteamDetails.snow = 1;\n\t\t\t}\n\t\t\tif (set.moves.includes('spikes')) teamDetails.spikes = (teamDetails.spikes || 0) + 1;\n\t\t\tif (set.moves.includes('stealthrock')) teamDetails.stealthRock = 1;\n\t\t\tif (set.moves.includes('stickyweb')) teamDetails.stickyWeb = 1;\n\t\t\tif (set.moves.includes('stoneaxe')) teamDetails.stealthRock = 1;\n\t\t\tif (set.moves.includes('toxicspikes')) teamDetails.toxicSpikes = 1;\n\t\t\tif (set.moves.includes('defog')) teamDetails.defog = 1;\n\t\t\tif (set.moves.includes('rapidspin')) teamDetails.rapidSpin = 1;\n\t\t\tif (set.moves.includes('mortalspin')) teamDetails.rapidSpin = 1;\n\t\t\tif (set.moves.includes('tidyup')) teamDetails.rapidSpin = 1;\n\t\t\tif (set.moves.includes('auroraveil') || (set.moves.includes('reflect') && set.moves.includes('lightscreen'))) {\n\t\t\t\tteamDetails.screens = 1;\n\t\t\t}\n\t\t\tif (set.role === 'Tera Blast user') teamDetails.teraBlast = 1;\n\n\t\t\t// For setting Zoroark's level\n\t\t\tif (set.ability === 'Illusion') teamDetails.illusion = pokemon.length;\n\t\t}\n\t\tif (pokemon.length < this.maxTeamSize && pokemon.length < 12) { // large teams sometimes cannot be built\n\t\t\tthrow new Error(`Could not build a random team for ${this.format} (seed=${seed})`);\n\t\t}\n\n\t\treturn pokemon;\n\t}\n}\n\nexport default RandomPOTDTeams;\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA0B;AAE1B,MAAM,cAAc;AAAA,EACnB;AAAA,EAAS;AAAA,EAAW;AAAA,EAAY;AAAA,EAAgB;AAAA,EAAY;AAAA,EAAc;AAAA,EAAW;AAAA,EAAc;AAAA,EACnG;AAAA,EAAW;AAAA,EAAa;AAAA,EAAa;AAAA,EAAY;AAAA,EAAS;AAAA,EAAc;AAAA,EAAW;AAAA,EAAW;AAAA,EAC9F;AAAA,EAAY;AAAA,EAAQ;AAAA,EAAW;AAAA,EAAY;AAAA,EAAS;AAAA,EAAa;AAAA,EAAW;AAAA,EAAU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