Spaces:
Running
Running
File size: 10,360 Bytes
5c2ed06 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var teams_exports = {};
__export(teams_exports, {
RandomLetsGoTeams: () => RandomLetsGoTeams,
default: () => teams_default
});
module.exports = __toCommonJS(teams_exports);
var import_teams = require("../gen8/teams");
class RandomLetsGoTeams extends import_teams.RandomGen8Teams {
constructor(format, prng) {
super(format, prng);
this.randomData = require("./data.json");
this.moveEnforcementCheckers = {
Dark: (movePool, moves, abilities, types, counter) => !counter.get("Dark"),
Dragon: (movePool, moves, abilities, types, counter) => !counter.get("Dragon"),
Electric: (movePool, moves, abilities, types, counter) => !counter.get("Electric"),
Fighting: (movePool, moves, abilities, types, counter) => !counter.get("Fighting") && (!!counter.setupType || !counter.get("Status")),
Fire: (movePool, moves, abilities, types, counter) => !counter.get("Fire"),
Ghost: (movePool, moves, abilities, types, counter) => !types.has("Dark") && !counter.get("Ghost"),
Ground: (movePool, moves, abilities, types, counter) => !counter.get("Ground"),
Ice: (movePool, moves, abilities, types, counter) => !counter.get("Ice"),
Water: (movePool, moves, abilities, types, counter) => !counter.get("Water") || !counter.get("stab")
};
}
shouldCullMove(move, types, moves, abilities, counter, movePool, teamDetails) {
switch (move.id) {
case "bulkup":
case "swordsdance":
return {
cull: counter.setupType !== "Physical" || counter.get("physicalsetup") > 1 || counter.get("Physical") + counter.get("physicalpool") < 2,
isSetup: true
};
case "calmmind":
case "nastyplot":
case "quiverdance":
return {
cull: counter.setupType !== "Special" || counter.get("specialsetup") > 1 || counter.get("Special") + counter.get("specialpool") < 2,
isSetup: true
};
case "growth":
case "shellsmash":
return {
cull: counter.setupType !== "Mixed" || counter.damagingMoves.size + counter.get("physicalpool") + counter.get("specialpool") < 2,
isSetup: true
};
case "agility":
return {
cull: counter.damagingMoves.size < 2 && !counter.setupType,
isSetup: !counter.setupType
};
case "dragontail":
return { cull: !!counter.setupType || !!counter.get("speedsetup") || ["encore", "roar", "whirlwind"].some((m) => moves.has(m)) };
case "fakeout":
case "uturn":
case "teleport":
return { cull: !!counter.setupType || !!counter.get("speedsetup") || moves.has("substitute") };
case "haze":
case "leechseed":
case "roar":
case "whirlwind":
return { cull: !!counter.setupType || !!counter.get("speedsetup") || moves.has("dragontail") };
case "protect":
return { cull: !!counter.setupType || ["rest", "lightscreen", "reflect"].some((m) => moves.has(m)) };
case "seismictoss":
return { cull: counter.damagingMoves.size > 1 || !!counter.setupType };
case "stealthrock":
return { cull: !!counter.setupType || !!counter.get("speedsetup") || !!teamDetails.stealthRock };
case "leechlife":
case "substitute":
return { cull: moves.has("uturn") };
case "dragonpulse":
return { cull: moves.has("dragontail") || moves.has("outrage") };
case "thunderbolt":
return { cull: moves.has("thunder") };
case "flareblitz":
case "flamethrower":
return { cull: moves.has("fireblast") || moves.has("firepunch") };
case "megadrain":
return { cull: moves.has("petaldance") || moves.has("powerwhip") };
case "bonemerang":
return { cull: moves.has("earthquake") };
case "icebeam":
return { cull: moves.has("blizzard") };
case "rockslide":
return { cull: moves.has("stoneedge") };
case "hydropump":
case "willowisp":
return { cull: moves.has("scald") };
case "surf":
return { cull: moves.has("hydropump") || moves.has("scald") };
}
if (move.priority !== 0 && !!counter.get("speedsetup"))
return { cull: true };
if (move.category === "Physical" && counter.setupType === "Special" || move.category === "Special" && counter.setupType === "Physical") {
if (!types.has(move.type) || counter.get("stab") > 1 || counter.get(move.category) < 2)
return { cull: true };
}
return { cull: false };
}
randomSet(species, teamDetails = {}) {
species = this.dex.species.get(species);
let forme = species.name;
if (typeof species.battleOnly === "string") {
forme = species.battleOnly;
}
const data = this.randomData[species.id];
const movePool = [...data.moves || this.dex.species.getMovePool(species.id)];
const types = new Set(species.types);
const moves = /* @__PURE__ */ new Set();
let counter;
do {
while (moves.size < this.maxMoveCount && movePool.length) {
const moveid = this.sampleNoReplace(movePool);
moves.add(moveid);
}
counter = this.queryMoves(moves, species.types, [], movePool);
for (const moveid of moves) {
const move = this.dex.moves.get(moveid);
let { cull, isSetup } = this.shouldCullMove(move, types, moves, [], counter, movePool, teamDetails);
if (!isSetup && counter.setupType && counter.setupType !== "Mixed" && move.category !== counter.setupType && counter.get(counter.setupType) < 2 && // Mono-attacking with setup and RestTalk is allowed
// Reject Status moves only if there is nothing else to reject
(move.category !== "Status" || counter.get(counter.setupType) + counter.get("Status") > 3 && counter.get("physicalsetup") + counter.get("specialsetup") < 2)) {
cull = true;
}
const moveIsRejectable = !move.damage && (move.category !== "Status" || !move.flags.heal) && (move.category === "Status" || !types.has(move.type) || move.selfSwitch || move.basePower && move.basePower < 40 && !move.multihit);
if (moveIsRejectable && !cull && !isSetup && counter.get("physicalsetup") + counter.get("specialsetup") < 2 && (!counter.setupType || counter.setupType === "Mixed" || move.category !== counter.setupType && move.category !== "Status" || counter.get(counter.setupType) + counter.get("Status") > 3)) {
if ((counter.damagingMoves.size === 0 || !counter.get("stab")) && (counter.get("physicalpool") || counter.get("specialpool"))) {
cull = true;
} else {
for (const type of types) {
if (this.moveEnforcementCheckers[type]?.(movePool, moves, [], types, counter, species, teamDetails))
cull = true;
}
}
}
if (cull && movePool.length) {
moves.delete(moveid);
break;
}
}
} while (moves.size < this.maxMoveCount && movePool.length);
const ivs = { hp: 31, atk: 31, def: 31, spa: 31, spd: 31, spe: 31 };
if (!counter.get("Physical") && !moves.has("transform"))
ivs.atk = 0;
const requiredItem = species.requiredItem || (species.requiredItems ? this.sample(species.requiredItems) : null);
return {
name: species.baseSpecies,
species: forme,
level: this.adjustLevel || 100,
gender: species.gender,
happiness: 70,
shiny: this.randomChance(1, 1024),
item: requiredItem || "",
ability: "No Ability",
evs: { hp: 20, atk: 20, def: 20, spa: 20, spd: 20, spe: 20 },
moves: Array.from(moves),
ivs
};
}
randomTeam() {
this.enforceNoDirectCustomBanlistChanges();
const pokemon = [];
const pokemonPool = [];
for (const id in this.dex.data.FormatsData) {
const species = this.dex.species.get(id);
if (species.num < 1 || species.num > 151 && ![808, 809].includes(species.num) || species.gen > 7 || species.nfe || !this.randomData[species.id]?.moves || this.forceMonotype && !species.types.includes(this.forceMonotype)) {
continue;
}
pokemonPool.push(id);
}
const typeCount = {};
const typeComboCount = {};
const baseFormes = {};
const teamDetails = {};
while (pokemonPool.length && pokemon.length < this.maxTeamSize) {
const species = this.dex.species.get(this.sampleNoReplace(pokemonPool));
if (!species.exists)
continue;
if (baseFormes[species.baseSpecies])
continue;
const types = species.types;
let skip = false;
for (const type of species.types) {
if (typeCount[type] > 1 && this.randomChance(4, 5)) {
skip = true;
break;
}
}
if (skip)
continue;
const typeCombo = types.slice().sort().join();
if (!this.forceMonotype && typeComboCount[typeCombo] >= 1)
continue;
const set = this.randomSet(species, teamDetails);
pokemon.push(set);
baseFormes[species.baseSpecies] = 1;
for (const type of types) {
if (type in typeCount) {
typeCount[type]++;
} else {
typeCount[type] = 1;
}
}
if (typeCombo in typeComboCount) {
typeComboCount[typeCombo]++;
} else {
typeComboCount[typeCombo] = 1;
}
if (set.moves.includes("stealthrock"))
teamDetails.stealthRock = 1;
if (set.moves.includes("rapidspin"))
teamDetails.rapidSpin = 1;
}
return pokemon;
}
}
var teams_default = RandomLetsGoTeams;
//# sourceMappingURL=teams.js.map
|