Support CAP and NatDex Inheritance (#10111)

* Support CAP and NatDex Inheritance

* Update formats.ts

---------

Co-authored-by: Kris Johnson <11083252+KrisXV@users.noreply.github.com>
This commit is contained in:
Hisuian Zoroark 2024-01-14 13:41:29 -05:00 committed by GitHub
parent e1cbc2718d
commit 377bcdd3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -963,11 +963,10 @@ export const Formats: FormatList = [
return species.id;
},
validateSet(set, teamHas) {
const unreleased = (pokemon: Species) => pokemon.tier === "Unreleased" && pokemon.isNonstandard === "Unobtainable";
if (!teamHas.abilityMap) {
teamHas.abilityMap = Object.create(null);
for (const pokemon of Dex.species.all()) {
if (pokemon.isNonstandard || (unreleased(pokemon) && !this.ruleTable.has('+unobtainable'))) continue;
if (pokemon.isNonstandard && !this.ruleTable.has(`+pokemontag:${this.toID(pokemon.isNonstandard)}`)) continue;
if (pokemon.battleOnly) continue;
if (this.ruleTable.isBannedSpecies(pokemon)) continue;
@ -987,7 +986,7 @@ export const Formats: FormatList = [
const species = this.dex.species.get(set.species);
if (!species.exists || species.num < 1) return [`The Pok\u00e9mon "${set.species}" does not exist.`];
if (species.isNonstandard || (unreleased(species) && !this.ruleTable.has('+unobtainable'))) {
if (species.isNonstandard && !this.ruleTable.has(`+pokemontag:${this.toID(species.isNonstandard)}`)) {
return [`${species.name} is not obtainable in Generation ${this.dex.gen}.`];
}