Convergence: Allow custom validation (#9453)

Adds some compatibility with NatDex and CAP formats
This commit is contained in:
Hisuian Zoroark 2023-03-11 18:34:04 -05:00 committed by GitHub
parent 0c0dad3b0a
commit 507dcb8da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2400,7 +2400,8 @@ export const Rulesets: {[k: string]: FormatData} = {
const obtainableAbilityPool = new Set<string>();
const matchingSpecies = this.dex.species.all()
.filter(species => (
!species.isNonstandard && species.types.every(type => curSpecies.types.includes(type)) &&
(!species.isNonstandard || this.ruleTable.has(`+pokemontag:${this.toID(species.isNonstandard)}`)) &&
species.types.every(type => curSpecies.types.includes(type)) &&
species.types.length === curSpecies.types.length && !this.ruleTable.isBannedSpecies(species)
));
for (const species of matchingSpecies) {
@ -2416,7 +2417,8 @@ export const Rulesets: {[k: string]: FormatData} = {
checkCanLearn(move, species, setSources, set) {
const matchingSpecies = this.dex.species.all()
.filter(s => (
!s.isNonstandard && s.types.every(type => species.types.includes(type)) &&
(!s.isNonstandard || this.ruleTable.has(`+pokemontag:${this.toID(s.isNonstandard)}`)) &&
s.types.every(type => species.types.includes(type)) &&
s.types.length === species.types.length && !this.ruleTable.isBannedSpecies(s)
));
const someCanLearn = matchingSpecies.some(s => this.checkCanLearn(move, s, setSources, set) === null);