Teambuilder: Support Monotype bans (#1841)

This commit is contained in:
Karthik 2021-09-08 17:41:16 -04:00 committed by GitHub
parent af72f0bd0f
commit 1caf07bc8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -341,6 +341,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const tierTable = {};
const overrideTier = {};
const zuBans = {};
const monotypeBans = {};
const nonstandardMoves = [];
for (const id of pokemon) {
const species = Dex.mod(gen).species.get(id);
@ -465,6 +466,12 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
zuBans[species.id] = 1;
}
}
if (genNum >= 5) {
const format = Dex.formats.get(gen + (isNatDex ? 'nationaldex' : '') + 'monotype');
if (Dex.formats.getRuleTable(format).isBannedSpecies(species)) {
monotypeBans[species.id] = 1;
}
}
}
nonstandardMoves.push(...Object.keys(Dex.data.Moves).filter(id => {
@ -481,6 +488,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable['natdex'] = {};
BattleTeambuilderTable['natdex'].tiers = tiers;
BattleTeambuilderTable['natdex'].items = items;
BattleTeambuilderTable['natdex'].monotypeBans = monotypeBans;
BattleTeambuilderTable['natdex'].formatSlices = formatSlices;
} else if (isMetBattle) {
BattleTeambuilderTable['metronome'] = {};
@ -512,6 +520,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
BattleTeambuilderTable.items = items;
BattleTeambuilderTable.overrideTier = overrideTier;
BattleTeambuilderTable.zuBans = zuBans;
BattleTeambuilderTable.monotypeBans = monotypeBans;
BattleTeambuilderTable.formatSlices = formatSlices;
} else {
BattleTeambuilderTable[gen] = {};
@ -522,6 +531,9 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
if (genNum >= 7) {
BattleTeambuilderTable[gen].zuBans = zuBans;
}
if (genNum >= 5) {
BattleTeambuilderTable[gen].monotypeBans = monotypeBans;
}
if (isDLC1) {
BattleTeambuilderTable[gen].nonstandardMoves = nonstandardMoves;
BattleTeambuilderTable[gen].learnsets = {};

View File

@ -893,6 +893,7 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
else if (format === 'anythinggoes' || format.endsWith('ag') || format.startsWith('ag')) {
tierSet = tierSet.slice(slices.AG);
} else if (format.includes('hackmons') || format.endsWith('bh')) tierSet = tierSet.slice(slices.AG);
else if (format === 'monotype') tierSet = tierSet.slice(slices.Uber);
else if (format === 'doublesubers') tierSet = tierSet.slice(slices.DUber);
else if (format === 'doublesou' && dex.gen > 4) tierSet = tierSet.slice(slices.DOU);
else if (format === 'doublesuu') tierSet = tierSet.slice(slices.DUU);
@ -921,6 +922,13 @@ class BattlePokemonSearch extends BattleTypedSearch<'pokemon'> {
});
}
if (format === 'monotype' && dex.gen >= 5) {
tierSet = tierSet.filter(([type, id]) => {
if (id in table.monotypeBans) return false;
return true;
});
}
if (format === 'vgc2016') {
tierSet = tierSet.filter(([type, id]) => {
let banned = [