{ "version": 3, "sources": ["../../../../../data/mods/gen3/random-teams.ts"], "sourcesContent": ["import RandomGen4Teams from '../gen4/random-teams';\nimport {Utils} from '../../../lib';\nimport {PRNG, PRNGSeed} from '../../../sim/prng';\nimport type {MoveCounter} from '../gen8/random-teams';\n\n// Moves that restore HP:\nconst RECOVERY_MOVES = [\n\t'milkdrink', 'moonlight', 'morningsun', 'recover', 'slackoff', 'softboiled', 'synthesis',\n];\n// Conglomerate for ease of access\nconst SETUP = [\n\t'acidarmor', 'agility', 'bellydrum', 'bulkup', 'calmmind', 'curse', 'dragondance', 'growth', 'howl', 'irondefense',\n\t'meditate', 'raindance', 'sunnyday', 'swordsdance', 'tailglow',\n];\n// Moves that shouldn't be the only STAB moves:\nconst NO_STAB = [\n\t'eruption', 'explosion', 'fakeout', 'focuspunch', 'futuresight', 'icywind', 'knockoff', 'machpunch', 'pursuit',\n\t'quickattack', 'rapidspin', 'selfdestruct', 'skyattack', 'waterspout',\n];\n\n// Moves that should be paired together when possible\nconst MOVE_PAIRS = [\n\t['sleeptalk', 'rest'],\n\t['protect', 'wish'],\n\t['leechseed', 'substitute'],\n\t['focuspunch', 'substitute'],\n\t['batonpass', 'spiderweb'],\n];\n\nexport class RandomGen3Teams extends RandomGen4Teams {\n\tbattleHasDitto: boolean;\n\tbattleHasWobbuffet: boolean;\n\n\trandomSets: {[species: string]: RandomTeamsTypes.RandomSpeciesData} = require('./random-sets.json');\n\n\tconstructor(format: string | Format, prng: PRNG | PRNGSeed | null) {\n\t\tsuper(format, prng);\n\t\tthis.noStab = NO_STAB;\n\t\tthis.battleHasDitto = false;\n\t\tthis.battleHasWobbuffet = false;\n\t\tthis.moveEnforcementCheckers = {\n\t\t\tBug: (movePool, moves, abilities, types, counter, species) => (\n\t\t\t\t!counter.get('Bug') && ['armaldo', 'heracross', 'parasect'].includes(species.id)\n\t\t\t),\n\t\t\tDark: (movePool, moves, abilities, types, counter) => !counter.get('Dark'),\n\t\t\tElectric: (movePool, moves, abilities, types, counter) => !counter.get('Electric'),\n\t\t\tFighting: (movePool, moves, abilities, types, counter) => !counter.get('Fighting'),\n\t\t\tFire: (movePool, moves, abilities, types, counter) => !counter.get('Fire'),\n\t\t\tFlying: (movePool, moves, abilities, types, counter, species) => (!counter.get('Flying') && species.id !== 'crobat'),\n\t\t\tGhost: (movePool, moves, abilities, types, counter) => !counter.get('Ghost'),\n\t\t\tGround: (movePool, moves, abilities, types, counter) => !counter.get('Ground'),\n\t\t\tIce: (movePool, moves, abilities, types, counter) => !counter.get('Ice'),\n\t\t\tNormal: (movePool, moves, abilities, types, counter, species) => !counter.get('Normal'),\n\t\t\tPoison: (movePool, moves, abilities, types, counter) => !counter.get('Poison') && !counter.get('Bug'),\n\t\t\tPsychic: (movePool, moves, abilities, types, counter, species) => (\n\t\t\t\t!counter.get('Psychic') && species.baseStats.spa >= 100\n\t\t\t),\n\t\t\tRock: (movePool, moves, abilities, types, counter, species) => !counter.get('Rock'),\n\t\t\tSteel: (movePool, moves, abilities, types, counter, species) => (!counter.get('Steel') && species.id !== 'forretress'),\n\t\t\tWater: (movePool, moves, abilities, types, counter, species) => !counter.get('Water'),\n\t\t};\n\t}\n\n\tcullMovePool(\n\t\ttypes: string[],\n\t\tmoves: Set,\n\t\tabilities: Set,\n\t\tcounter: MoveCounter,\n\t\tmovePool: string[],\n\t\tteamDetails: RandomTeamsTypes.TeamDetails,\n\t\tspecies: Species,\n\t\tisLead: boolean,\n\t\tpreferredType: string,\n\t\trole: RandomTeamsTypes.Role,\n\t): void {\n\t\t// Pokemon cannot have multiple Hidden Powers in any circumstance\n\t\tlet hasHiddenPower = false;\n\t\tfor (const move of moves) {\n\t\t\tif (move.startsWith('hiddenpower')) hasHiddenPower = true;\n\t\t}\n\t\tif (hasHiddenPower) {\n\t\t\tlet movePoolHasHiddenPower = true;\n\t\t\twhile (movePoolHasHiddenPower) {\n\t\t\t\tmovePoolHasHiddenPower = false;\n\t\t\t\tfor (const moveid of movePool) {\n\t\t\t\t\tif (moveid.startsWith('hiddenpower')) {\n\t\t\t\t\t\tthis.fastPop(movePool, movePool.indexOf(moveid));\n\t\t\t\t\t\tmovePoolHasHiddenPower = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (moves.size + movePool.length <= this.maxMoveCount) return;\n\t\t// If we have two unfilled moves and only one unpaired move, cull the unpaired move.\n\t\tif (moves.size === this.maxMoveCount - 2) {\n\t\t\tconst unpairedMoves = [...movePool];\n\t\t\tfor (const pair of MOVE_PAIRS) {\n\t\t\t\tif (movePool.includes(pair[0]) && movePool.includes(pair[1])) {\n\t\t\t\t\tthis.fastPop(unpairedMoves, unpairedMoves.indexOf(pair[0]));\n\t\t\t\t\tthis.fastPop(unpairedMoves, unpairedMoves.indexOf(pair[1]));\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (unpairedMoves.length === 1) {\n\t\t\t\tthis.fastPop(movePool, movePool.indexOf(unpairedMoves[0]));\n\t\t\t}\n\t\t}\n\n\t\t// These moves are paired, and shouldn't appear if there is not room for them both.\n\t\tif (moves.size === this.maxMoveCount - 1) {\n\t\t\tfor (const pair of MOVE_PAIRS) {\n\t\t\t\tif (movePool.includes(pair[0]) && movePool.includes(pair[1])) {\n\t\t\t\t\tthis.fastPop(movePool, movePool.indexOf(pair[0]));\n\t\t\t\t\tthis.fastPop(movePool, movePool.indexOf(pair[1]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Team-based move culls\n\t\tif (teamDetails.rapidSpin) {\n\t\t\tif (movePool.includes('rapidspin')) this.fastPop(movePool, movePool.indexOf('rapidspin'));\n\t\t\tif (moves.size + movePool.length <= this.maxMoveCount) return;\n\t\t}\n\n\t\t// Develop additional move lists\n\t\tconst badWithSetup = ['knockoff', 'rapidspin', 'toxic'];\n\t\tconst statusMoves = this.dex.moves.all()\n\t\t\t.filter(move => move.category === 'Status')\n\t\t\t.map(move => move.id);\n\n\t\t// General incompatibilities\n\t\tconst incompatiblePairs = [\n\t\t\t// These moves don't mesh well with other aspects of the set\n\t\t\t[statusMoves, 'trick'],\n\t\t\t[SETUP, badWithSetup],\n\t\t\t['rest', ['protect', 'substitute']],\n\t\t\t[['selfdestruct', 'explosion'], ['destinybond', 'painsplit', 'rest']],\n\n\t\t\t// These attacks are redundant with each other\n\t\t\t['surf', 'hydropump'],\n\t\t\t[['bodyslam', 'return'], ['bodyslam', 'doubleedge']],\n\t\t\t['fireblast', 'flamethrower'],\n\n\t\t\t// Assorted hardcodes go here:\n\t\t\t// Granbull\n\t\t\t['bulkup', 'overheat'],\n\t\t\t// Heracross\n\t\t\t['endure', 'substitute'],\n\t\t];\n\n\t\tfor (const pair of incompatiblePairs) this.incompatibleMoves(moves, movePool, pair[0], pair[1]);\n\n\t\tconst statusInflictingMoves = ['stunspore', 'thunderwave', 'toxic', 'willowisp', 'yawn'];\n\t\tif (role !== 'Staller') {\n\t\t\tthis.incompatibleMoves(moves, movePool, statusInflictingMoves, statusInflictingMoves);\n\t\t}\n\t}\n\n\t// Generate random moveset for a given species, role, preferred type.\n\trandomMoveset(\n\t\ttypes: string[],\n\t\tabilities: Set,\n\t\tteamDetails: RandomTeamsTypes.TeamDetails,\n\t\tspecies: Species,\n\t\tisLead: boolean,\n\t\tmovePool: string[],\n\t\tpreferredType: string,\n\t\trole: RandomTeamsTypes.Role,\n\t): Set {\n\t\tconst preferredTypes = preferredType ? preferredType.split(',') : [];\n\t\tconst moves = new Set();\n\t\tlet counter = this.newQueryMoves(moves, species, preferredType, abilities);\n\t\tthis.cullMovePool(types, moves, abilities, counter, movePool, teamDetails, species, isLead,\n\t\t\tpreferredType, role);\n\n\t\t// If there are only four moves, add all moves and return early\n\t\tif (movePool.length <= this.maxMoveCount) {\n\t\t\t// Still need to ensure that multiple Hidden Powers are not added (if maxMoveCount is increased)\n\t\t\twhile (movePool.length) {\n\t\t\t\tconst moveid = this.sample(movePool);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t\treturn moves;\n\t\t}\n\n\t\tconst runEnforcementChecker = (checkerName: string) => {\n\t\t\tif (!this.moveEnforcementCheckers[checkerName]) return false;\n\t\t\treturn this.moveEnforcementCheckers[checkerName](\n\t\t\t\tmovePool, moves, abilities, new Set(types), counter, species, teamDetails\n\t\t\t);\n\t\t};\n\n\t\t// Add required move (e.g. Relic Song for Meloetta-P)\n\t\tif (species.requiredMove) {\n\t\t\tconst move = this.dex.moves.get(species.requiredMove).id;\n\t\t\tcounter = this.addMove(move, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\tmovePool, preferredType, role);\n\t\t}\n\n\t\t// Add other moves you really want to have, e.g. STAB, recovery, setup.\n\n\t\t// Enforce Seismic Toss and Spore\n\t\tfor (const moveid of ['seismictoss', 'spore']) {\n\t\t\tif (movePool.includes(moveid)) {\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce Substitute on non-Setup sets with Baton Pass\n\t\tif (!role.includes('Setup')) {\n\t\t\tif (movePool.includes('batonpass') && movePool.includes('substitute')) {\n\t\t\t\tcounter = this.addMove('substitute', moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce moves of all Preferred Types\n\t\tfor (const type of preferredTypes) {\n\t\t\tif (!counter.get(type)) {\n\t\t\t\tconst stabMoves = [];\n\t\t\t\tfor (const moveid of movePool) {\n\t\t\t\t\tconst move = this.dex.moves.get(moveid);\n\t\t\t\t\tconst moveType = this.getMoveType(move, species, abilities, preferredType);\n\t\t\t\t\tif (!this.noStab.includes(moveid) && (move.basePower || move.basePowerCallback) && type === moveType) {\n\t\t\t\t\t\tstabMoves.push(moveid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (stabMoves.length) {\n\t\t\t\t\tconst moveid = this.sample(stabMoves);\n\t\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Enforce STAB\n\t\tfor (const type of types) {\n\t\t\t// Check if a STAB move of that type should be required\n\t\t\tconst stabMoves = [];\n\t\t\tfor (const moveid of movePool) {\n\t\t\t\tconst move = this.dex.moves.get(moveid);\n\t\t\t\tconst moveType = this.getMoveType(move, species, abilities, preferredType);\n\t\t\t\tif (!this.noStab.includes(moveid) && (move.basePower || move.basePowerCallback) && type === moveType) {\n\t\t\t\t\tstabMoves.push(moveid);\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile (runEnforcementChecker(type)) {\n\t\t\t\tif (!stabMoves.length) break;\n\t\t\t\tconst moveid = this.sampleNoReplace(stabMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// If no STAB move was added, add a STAB move\n\t\tif (!counter.get('stab')) {\n\t\t\tconst stabMoves = [];\n\t\t\tfor (const moveid of movePool) {\n\t\t\t\tconst move = this.dex.moves.get(moveid);\n\t\t\t\tconst moveType = this.getMoveType(move, species, abilities, preferredType);\n\t\t\t\tif (!this.noStab.includes(moveid) && (move.basePower || move.basePowerCallback) && types.includes(moveType)) {\n\t\t\t\t\tstabMoves.push(moveid);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (stabMoves.length) {\n\t\t\t\tconst moveid = this.sample(stabMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce recovery\n\t\tif (['Bulky Support', 'Bulky Attacker', 'Bulky Setup', 'Staller'].includes(role)) {\n\t\t\tconst recoveryMoves = movePool.filter(moveid => RECOVERY_MOVES.includes(moveid));\n\t\t\tif (recoveryMoves.length) {\n\t\t\t\tconst moveid = this.sample(recoveryMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce Staller moves\n\t\tif (role === 'Staller') {\n\t\t\tconst enforcedMoves = ['protect', 'toxic', 'wish'];\n\t\t\tfor (const move of enforcedMoves) {\n\t\t\t\tif (movePool.includes(move)) {\n\t\t\t\t\tcounter = this.addMove(move, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Enforce setup\n\t\tif (role.includes('Setup') || role === 'Berry Sweeper') {\n\t\t\tconst setupMoves = movePool.filter(moveid => SETUP.includes(moveid));\n\t\t\tif (setupMoves.length) {\n\t\t\t\tconst moveid = this.sample(setupMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce Berry Sweeper moves\n\t\tif (role === 'Berry Sweeper') {\n\t\t\t// Enforce Flail/Reversal\n\t\t\tfor (const move of ['flail', 'reversal']) {\n\t\t\t\tif (movePool.includes(move)) {\n\t\t\t\t\tcounter = this.addMove(move, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Enforce one of Endure and Substitute, but not both\n\t\t\tconst hpControlMoves = [];\n\t\t\tfor (const moveid of movePool) {\n\t\t\t\tif (['endure', 'substitute'].includes(moveid)) hpControlMoves.push(moveid);\n\t\t\t}\n\t\t\tif (hpControlMoves.length) {\n\t\t\t\tconst moveid = this.sample(hpControlMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce a move not on the noSTAB list\n\t\tif (!counter.damagingMoves.size) {\n\t\t\t// Choose an attacking move\n\t\t\tconst attackingMoves = [];\n\t\t\tfor (const moveid of movePool) {\n\t\t\t\tconst move = this.dex.moves.get(moveid);\n\t\t\t\tif (!this.noStab.includes(moveid) && (move.category !== 'Status')) attackingMoves.push(moveid);\n\t\t\t}\n\t\t\tif (attackingMoves.length) {\n\t\t\t\tconst moveid = this.sample(attackingMoves);\n\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t}\n\t\t}\n\n\t\t// Enforce coverage move\n\t\tif (['Fast Attacker', 'Setup Sweeper', 'Bulky Attacker', 'Wallbreaker', 'Berry Sweeper'].includes(role)) {\n\t\t\tif (counter.damagingMoves.size === 1) {\n\t\t\t\t// Find the type of the current attacking move\n\t\t\t\tconst currentAttackType = counter.damagingMoves.values().next().value.type;\n\t\t\t\t// Choose an attacking move that is of different type to the current single attack\n\t\t\t\tconst coverageMoves = [];\n\t\t\t\tfor (const moveid of movePool) {\n\t\t\t\t\tconst move = this.dex.moves.get(moveid);\n\t\t\t\t\tconst moveType = this.getMoveType(move, species, abilities, preferredType);\n\t\t\t\t\tif (!this.noStab.includes(moveid) && (move.basePower || move.basePowerCallback)) {\n\t\t\t\t\t\tif (currentAttackType !== moveType) coverageMoves.push(moveid);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (coverageMoves.length) {\n\t\t\t\t\tconst moveid = this.sample(coverageMoves);\n\t\t\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Choose remaining moves randomly from movepool and add them to moves list:\n\t\twhile (moves.size < this.maxMoveCount && movePool.length) {\n\t\t\tconst moveid = this.sample(movePool);\n\t\t\tcounter = this.addMove(moveid, moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\tmovePool, preferredType, role);\n\t\t\tfor (const pair of MOVE_PAIRS) {\n\t\t\t\tif (moveid === pair[0] && movePool.includes(pair[1])) {\n\t\t\t\t\tcounter = this.addMove(pair[1], moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t\tif (moveid === pair[1] && movePool.includes(pair[0])) {\n\t\t\t\t\tcounter = this.addMove(pair[0], moves, types, abilities, teamDetails, species, isLead,\n\t\t\t\t\t\tmovePool, preferredType, role);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn moves;\n\t}\n\n\tshouldCullAbility(\n\t\tability: string,\n\t\ttypes: Set,\n\t\tmoves: Set,\n\t\tabilities: Set,\n\t\tcounter: MoveCounter,\n\t\tmovePool: string[],\n\t\tteamDetails: RandomTeamsTypes.TeamDetails,\n\t\tspecies: Species,\n\t\tpreferredType: string,\n\t\trole: RandomTeamsTypes.Role\n\t) {\n\t\tswitch (ability) {\n\t\tcase 'Rain Dish': case 'Sand Veil': case 'Soundproof': case 'Sticky Hold':\n\t\t\treturn true;\n\t\tcase 'Chlorophyll':\n\t\t\treturn !moves.has('sunnyday') && !teamDetails.sun;\n\t\tcase 'Hustle':\n\t\t\treturn !counter.get('Physical');\n\t\tcase 'Rock Head':\n\t\t\treturn !counter.get('recoil');\n\t\tcase 'Swarm':\n\t\t\treturn !counter.get('Bug');\n\t\tcase 'Swift Swim':\n\t\t\treturn (\n\t\t\t\t// Relicanth always wants Swift Swim if it doesn't have Double-Edge\n\t\t\t\t!moves.has('raindance') && !teamDetails.rain && !(species.id === 'relicanth' && !counter.get('recoil')) ||\n\t\t\t\t!moves.has('raindance') && abilities.has('Water Absorb')\n\t\t\t);\n\t\tcase 'Thick Fat':\n\t\t\treturn (species.id === 'snorlax' || (species.id === 'hariyama' && moves.has('sleeptalk')));\n\t\tcase 'Water Absorb':\n\t\t\treturn (species.id === 'mantine' && moves.has('raindance'));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tgetAbility(\n\t\ttypes: Set,\n\t\tmoves: Set,\n\t\tabilities: Set,\n\t\tcounter: MoveCounter,\n\t\tmovePool: string[],\n\t\tteamDetails: RandomTeamsTypes.TeamDetails,\n\t\tspecies: Species,\n\t\tpreferredType: string,\n\t\trole: RandomTeamsTypes.Role,\n\t): string {\n\t\tconst abilityData = Array.from(abilities).map(a => this.dex.abilities.get(a));\n\t\tUtils.sortBy(abilityData, abil => -abil.rating);\n\n\t\tif (abilityData.length <= 1) return abilityData[0].name;\n\n\t\t// Hard-code abilities here\n\t\tif (species.id === 'yanma' && counter.get('inaccurate')) return 'Compound Eyes';\n\t\tif (species.id === 'arcanine') return 'Intimidate';\n\t\tif (species.id === 'blissey') return 'Natural Cure';\n\t\tif (species.id === 'heracross' && role === 'Berry Sweeper') return 'Swarm';\n\t\tif (species.id === 'gardevoir') return 'Trace';\n\n\t\tlet abilityAllowed: Ability[] = [];\n\t\t// Obtain a list of abilities that are allowed (not culled)\n\t\tfor (const ability of abilityData) {\n\t\t\tif (ability.rating >= 1 && !this.shouldCullAbility(\n\t\t\t\tability.name, types, moves, abilities, counter, movePool, teamDetails, species, preferredType, role\n\t\t\t)) {\n\t\t\t\tabilityAllowed.push(ability);\n\t\t\t}\n\t\t}\n\n\t\t// If all abilities are rejected, re-allow all abilities\n\t\tif (!abilityAllowed.length) {\n\t\t\tfor (const ability of abilityData) {\n\t\t\t\tif (ability.rating > 0) abilityAllowed.push(ability);\n\t\t\t}\n\t\t\tif (!abilityAllowed.length) abilityAllowed = abilityData;\n\t\t}\n\n\t\tif (abilityAllowed.length === 1) return abilityAllowed[0].name;\n\t\t// Sort abilities by rating with an element of randomness\n\t\tif (abilityAllowed[0].rating <= abilityAllowed[1].rating) {\n\t\t\tif (this.randomChance(1, 2)) [abilityAllowed[0], abilityAllowed[1]] = [abilityAllowed[1], abilityAllowed[0]];\n\t\t} else if (abilityAllowed[0].rating - 0.5 <= abilityAllowed[1].rating) {\n\t\t\tif (this.randomChance(1, 3)) [abilityAllowed[0], abilityAllowed[1]] = [abilityAllowed[1], abilityAllowed[0]];\n\t\t}\n\n\t\t// After sorting, choose the first ability\n\t\treturn abilityAllowed[0].name;\n\t}\n\n\tgetItem(\n\t\tability: string,\n\t\ttypes: string[],\n\t\tmoves: Set,\n\t\tcounter: MoveCounter,\n\t\tteamDetails: RandomTeamsTypes.TeamDetails,\n\t\tspecies: Species,\n\t\tisLead: boolean,\n\t\tpreferredType: string,\n\t\trole: RandomTeamsTypes.Role,\n\t): string {\n\t\t// First, the high-priority items\n\t\tif (species.id === 'farfetchd') return 'Stick';\n\t\tif (species.id === 'latias' || species.id === 'latios') return 'Soul Dew';\n\t\tif (species.id === 'linoone' && role === 'Setup Sweeper') return 'Silk Scarf';\n\t\tif (species.id === 'marowak') return 'Thick Club';\n\t\tif (species.id === 'pikachu') return 'Light Ball';\n\t\tif (species.id === 'shedinja') return 'Lum Berry';\n\t\tif (species.id === 'shuckle') return 'Leftovers';\n\t\tif (species.id === 'unown') return counter.get('Physical') ? 'Choice Band' : 'Twisted Spoon';\n\n\t\tif (moves.has('trick')) return 'Choice Band';\n\t\tif (\n\t\t\tmoves.has('rest') && !moves.has('sleeptalk') &&\n\t\t\t// Altaria wants Chesto Berry on Dragon Dance + Rest\n\t\t\t(moves.has('dragondance') || !['Early Bird', 'Natural Cure', 'Shed Skin'].includes(ability))\n\t\t) return 'Chesto Berry';\n\n\t\t// Medium priority items\n\t\tif (counter.get('Physical') >= 4) return 'Choice Band';\n\t\tif (counter.get('Physical') >= 3 && (moves.has('batonpass') || (role === 'Wallbreaker' && counter.get('Special')))) {\n\t\t\treturn 'Choice Band';\n\t\t}\n\n\t\tif (\n\t\t\tmoves.has('dragondance') && ability !== 'Natural Cure' &&\n\t\t\t!moves.has('healbell') && !moves.has('substitute')\n\t\t) return 'Lum Berry';\n\t\tif (moves.has('bellydrum')) return moves.has('substitute') ? 'Salac Berry' : 'Lum Berry';\n\n\t\tif (moves.has('raindance') && counter.get('Special') >= 3) return 'Petaya Berry';\n\n\t\tif (role === 'Berry Sweeper') {\n\t\t\tif (moves.has('endure')) return 'Salac Berry';\n\t\t\tif (moves.has('flail') || moves.has('reversal')) return (species.baseStats.spe >= 90) ? 'Liechi Berry' : 'Salac Berry';\n\t\t\tif (moves.has('substitute') && counter.get('Physical') >= 3) return 'Liechi Berry';\n\t\t\tif (moves.has('substitute') && counter.get('Special') >= 3) return 'Petaya Berry';\n\t\t}\n\n\t\tconst salacReqs = species.baseStats.spe >= 60 && species.baseStats.spe <= 100 && !counter.get('priority');\n\n\t\tif (moves.has('bulkup') && moves.has('substitute') && counter.get('Status') === 2 && salacReqs) return 'Salac Berry';\n\n\t\tif (moves.has('swordsdance') && moves.has('substitute') && counter.get('Status') === 2) {\n\t\t\tif (salacReqs) return 'Salac Berry';\n\t\t\tif (species.baseStats.spe > 100 && counter.get('Physical') >= 2) return 'Liechi Berry';\n\t\t}\n\n\t\tif (moves.has('swordsdance') && counter.get('Status') === 1) {\n\t\t\tif (salacReqs) return 'Salac Berry';\n\t\t\tif (species.baseStats.spe > 100) {\n\t\t\t\treturn (counter.get('Physical') >= 3 && this.randomChance(1, 2)) ? 'Liechi Berry' : 'Lum Berry';\n\t\t\t}\n\t\t}\n\n\t\tif (species.id === 'deoxys' || species.id === 'deoxysattack') return 'White Herb';\n\n\t\t// Default to Leftovers\n\t\treturn 'Leftovers';\n\t}\n\n\trandomSet(\n\t\tspecies: string | Species,\n\t\tteamDetails: RandomTeamsTypes.TeamDetails = {},\n\t\tisLead = false\n\t): RandomTeamsTypes.RandomSet {\n\t\tspecies = this.dex.species.get(species);\n\t\tconst forme = this.getForme(species);\n\t\tconst sets = this.randomSets[species.id][\"sets\"];\n\n\t\tconst set = this.sampleIfArray(sets);\n\t\tconst role = set.role;\n\t\tconst movePool: string[] = Array.from(set.movepool);\n\t\tconst preferredTypes = set.preferredTypes;\n\t\t// In Gen 3, if a set has multiple preferred types, enforce all of them.\n\t\tconst preferredType = preferredTypes ? preferredTypes.join() : '';\n\n\t\tlet ability = '';\n\t\tlet item = undefined;\n\n\t\tconst evs = {hp: 85, atk: 85, def: 85, spa: 85, spd: 85, spe: 85};\n\t\tconst ivs = {hp: 31, atk: 31, def: 31, spa: 31, spd: 31, spe: 31};\n\n\t\tconst types = species.types;\n\t\tconst abilities = new Set(Object.values(species.abilities));\n\n\t\t// Get moves\n\t\tconst moves = this.randomMoveset(types, abilities, teamDetails, species, isLead, movePool,\n\t\t\tpreferredType, role);\n\t\tconst counter = this.newQueryMoves(moves, species, preferredType, abilities);\n\n\t\t// Get ability\n\t\tability = this.getAbility(new Set(types), moves, abilities, counter, movePool, teamDetails, species,\n\t\t\tpreferredType, role);\n\n\t\t// Get items\n\t\titem = this.getItem(ability, types, moves, counter, teamDetails, species, isLead, preferredType, role);\n\n\t\tconst level = this.getLevel(species);\n\n\t\t// We use a special variable to track Hidden Power\n\t\t// so that we can check for all Hidden Powers at once\n\t\tlet hasHiddenPower = false;\n\t\tfor (const move of moves) {\n\t\t\tif (move.startsWith('hiddenpower')) hasHiddenPower = true;\n\t\t}\n\n\t\tif (hasHiddenPower) {\n\t\t\tlet hpType;\n\t\t\tfor (const move of moves) {\n\t\t\t\tif (move.startsWith('hiddenpower')) hpType = move.substr(11);\n\t\t\t}\n\t\t\tif (!hpType) throw new Error(`hasHiddenPower is true, but no Hidden Power move was found.`);\n\t\t\tconst HPivs = this.dex.types.get(hpType).HPivs;\n\t\t\tlet iv: StatID;\n\t\t\tfor (iv in HPivs) {\n\t\t\t\tivs[iv] = HPivs[iv]!;\n\t\t\t}\n\t\t}\n\n\t\t// Prepare optimal HP\n\t\twhile (evs.hp > 1) {\n\t\t\tconst hp = Math.floor(Math.floor(2 * species.baseStats.hp + ivs.hp + Math.floor(evs.hp / 4) + 100) * level / 100 + 10);\n\t\t\tif (moves.has('substitute') && ['flail', 'reversal'].some(m => moves.has(m))) {\n\t\t\t\t// Flail/Reversal users should be able to use four Substitutes\n\t\t\t\tif (hp % 4 > 0) break;\n\t\t\t} else if (moves.has('substitute') && (item === 'Salac Berry' || item === 'Petaya Berry' || item === 'Liechi Berry')) {\n\t\t\t\t// Other pinch berry holders should have berries activate after three Substitutes\n\t\t\t\tif (hp % 4 === 0) break;\n\t\t\t} else if (moves.has('bellydrum')) {\n\t\t\t\t// Belly Drum users should be able to use Belly Drum twice\n\t\t\t\tif (hp % 2 > 0) break;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tevs.hp -= 4;\n\t\t}\n\n\t\t// Minimize confusion damage\n\t\tif (!counter.get('Physical') && !moves.has('transform')) {\n\t\t\tevs.atk = 0;\n\t\t\tivs.atk = hasHiddenPower ? (ivs.atk || 31) - 28 : 0;\n\t\t}\n\n\t\t// Prepare optimal HP\n\t\tlet hp = Math.floor(Math.floor(2 * species.baseStats.hp + ivs.hp + Math.floor(evs.hp / 4) + 100) * level / 100 + 10);\n\t\tif (moves.has('substitute') && ['endeavor', 'flail', 'reversal'].some(m => moves.has(m))) {\n\t\t\t// Endeavor/Flail/Reversal users should be able to use four Substitutes\n\t\t\tif (hp % 4 === 0) evs.hp -= 4;\n\t\t} else if (moves.has('substitute') && (item === 'Salac Berry' || item === 'Petaya Berry' || item === 'Liechi Berry')) {\n\t\t\t// Other pinch berry holders should have berries activate after three Substitutes\n\t\t\twhile (hp % 4 > 0) {\n\t\t\t\tevs.hp -= 4;\n\t\t\t\thp = Math.floor(Math.floor(2 * species.baseStats.hp + ivs.hp + Math.floor(evs.hp / 4) + 100) * level / 100 + 10);\n\t\t\t}\n\t\t}\n\n\t\t// shuffle moves to add more randomness to camomons\n\t\tconst shuffledMoves = Array.from(moves);\n\t\tthis.prng.shuffle(shuffledMoves);\n\n\t\treturn {\n\t\t\tname: species.baseSpecies,\n\t\t\tspecies: forme,\n\t\t\tgender: species.gender,\n\t\t\tshiny: this.randomChance(1, 1024),\n\t\t\tlevel,\n\t\t\tmoves: shuffledMoves,\n\t\t\tability,\n\t\t\tevs,\n\t\t\tivs,\n\t\t\titem,\n\t\t\trole,\n\t\t};\n\t}\n\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 typePool = this.dex.types.names();\n\t\tconst type = this.forceMonotype || this.sample(typePool);\n\n\t\tconst baseFormes: {[k: string]: number} = {};\n\t\tconst typeCount: {[k: string]: number} = {};\n\t\tconst typeWeaknesses: {[k: string]: number} = {};\n\t\tconst teamDetails: RandomTeamsTypes.TeamDetails = {};\n\t\tlet numMaxLevelPokemon = 0;\n\n\t\tconst pokemonList = (this.gen === 3) ? Object.keys(this.randomSets) : Object.keys(this.randomData);\n\t\tconst [pokemonPool, baseSpeciesPool] = this.getPokemonPool(type, pokemon, isMonotype, pokemonList);\n\t\twhile (baseSpeciesPool.length && pokemon.length < this.maxTeamSize) {\n\t\t\tconst baseSpecies = this.sampleNoReplace(baseSpeciesPool);\n\t\t\tconst 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// Limit to one Wobbuffet per battle (not just per team)\n\t\t\tif (species.name === 'Wobbuffet' && this.battleHasWobbuffet) continue;\n\t\t\t// Limit to one Ditto per battle in Gen 2\n\t\t\tif (this.dex.gen < 3 && species.name === 'Ditto' && this.battleHasDitto) continue;\n\n\t\t\tconst types = species.types;\n\n\t\t\tif (!isMonotype && !this.forceMonotype) {\n\t\t\t\t// Dynamically scale limits for different team sizes. The default and minimum value is 1.\n\t\t\t\tconst limitFactor = Math.round(this.maxTeamSize / 6) || 1;\n\n\t\t\t\t// Limit two of any type\n\t\t\t\tlet skip = false;\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\n\t\t\t\t// Limit one level 100 Pokemon\n\t\t\t\tif (!this.adjustLevel && (this.getLevel(species) === 100) && numMaxLevelPokemon >= limitFactor) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Okay, the set passes, add it to our team\n\t\t\tconst set = this.randomSet(species, teamDetails);\n\t\t\tpokemon.push(set);\n\n\t\t\t// Don't bother tracking details for the last Pokemon\n\t\t\tif (pokemon.length === this.maxTeamSize) break;\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 type counters\n\t\t\tfor (const typeName of types) {\n\t\t\t\tif (typeName in typeCount) {\n\t\t\t\t\ttypeCount[typeName]++;\n\t\t\t\t} else {\n\t\t\t\t\ttypeCount[typeName] = 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increment weakness counter\n\t\t\tfor (const typeName of this.dex.types.names()) {\n\t\t\t\t// it's weak to the type\n\t\t\t\tif (this.dex.getEffectiveness(typeName, species) > 0) {\n\t\t\t\t\ttypeWeaknesses[typeName]++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increment level 100 counter\n\t\t\tif (set.level === 100) numMaxLevelPokemon++;\n\n\t\t\t// Update team details\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.moves.includes('spikes')) teamDetails.spikes = 1;\n\t\t\tif (set.moves.includes('rapidspin')) teamDetails.rapidSpin = 1;\n\n\t\t\t// In Gen 3, Shadow Tag users can prevent each other from switching out, possibly causing and endless battle or at least causing a long stall war\n\t\t\t// To prevent this, we prevent more than one Wobbuffet in a single battle.\n\t\t\tif (species.id === 'wobbuffet') this.battleHasWobbuffet = true;\n\t\t\tif (species.id === 'ditto') this.battleHasDitto = true;\n\t\t}\n\n\t\tif (pokemon.length < this.maxTeamSize && !isMonotype && !this.forceMonotype && pokemon.length < 12) {\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 RandomGen3Teams;\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAA4B;AAC5B,iBAAoB;AAKpB,MAAM,iBAAiB;AAAA,EACtB;AAAA,EAAa;AAAA,EAAa;AAAA,EAAc;AAAA,EAAW;AAAA,EAAY;AAAA,EAAc;AAC9E;AAEA,MAAM,QAAQ;AAAA,EACb;AAAA,EAAa;AAAA,EAAW;AAAA,EAAa;AAAA,EAAU;AAAA,EAAY;AAAA,EAAS;AAAA,EAAe;AAAA,EAAU;AAAA,EAAQ;AAAA,EACrG;AAAA,EAAY;AAAA,EAAa;AAAA,EAAY;AAAA,EAAe;AACrD;AAEA,MAAM,UAAU;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