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