Hackmons Cup: Stop banning all natures when there are custom bans (#9440)

* Hackmons Cup: Stop banning all natures when there are custom bans

* remove logging

* linter
This commit is contained in:
adrivrie 2023-03-06 01:06:57 +01:00 committed by GitHub
parent b18aeca71c
commit 1031bea203
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 36 deletions

View File

@ -745,28 +745,26 @@ export class RandomGen8Teams {
let naturePool: Nature[] = [];
if (doNaturesExist) {
if (!hasCustomBans) {
if (!hasCustomBans) {
naturePool = [...this.dex.natures.all()];
} else {
const hasAllNaturesBan = ruleTable.check('pokemontag:allnatures');
for (const nature of this.dex.natures.all()) {
let banReason = ruleTable.check('nature:' + nature.id);
if (banReason) continue;
if (banReason !== '' && nature.id) {
if (hasAllNaturesBan) continue;
if (nature.isNonstandard) {
banReason = ruleTable.check('pokemontag:' + toID(nature.isNonstandard));
if (banReason) continue;
if (banReason !== '' && nature.isNonstandard !== 'Unobtainable') {
if (hasNonexistentBan) continue;
if (!hasNonexistentWhitelist) continue;
}
naturePool = [...this.dex.natures.all()];
} else {
const hasAllNaturesBan = ruleTable.check('pokemontag:allnatures');
for (const nature of this.dex.natures.all()) {
let banReason = ruleTable.check('nature:' + nature.id);
if (banReason) continue;
if (banReason !== '' && nature.id) {
if (hasAllNaturesBan) continue;
if (nature.isNonstandard) {
banReason = ruleTable.check('pokemontag:' + toID(nature.isNonstandard));
if (banReason) continue;
if (banReason !== '' && nature.isNonstandard !== 'Unobtainable') {
if (hasNonexistentBan) continue;
if (!hasNonexistentWhitelist) continue;
}
}
naturePool.push(nature);
}
// There is no 'nature:nonature' rule so do not constrain pool size
naturePool.push(nature);
}
// There is no 'nature:nonature' rule so do not constrain pool size
}
}

View File

@ -2004,28 +2004,26 @@ export class RandomTeams {
let naturePool: Nature[] = [];
if (doNaturesExist) {
if (!hasCustomBans) {
if (!hasCustomBans) {
naturePool = [...this.dex.natures.all()];
} else {
const hasAllNaturesBan = ruleTable.check('pokemontag:allnatures');
for (const nature of this.dex.natures.all()) {
let banReason = ruleTable.check('nature:' + nature.id);
if (banReason) continue;
if (banReason !== '' && nature.id) {
if (hasAllNaturesBan) continue;
if (nature.isNonstandard) {
banReason = ruleTable.check('pokemontag:' + toID(nature.isNonstandard));
if (banReason) continue;
if (banReason !== '' && nature.isNonstandard !== 'Unobtainable') {
if (hasNonexistentBan) continue;
if (!hasNonexistentWhitelist) continue;
}
naturePool = [...this.dex.natures.all()];
} else {
const hasAllNaturesBan = ruleTable.check('pokemontag:allnatures');
for (const nature of this.dex.natures.all()) {
let banReason = ruleTable.check('nature:' + nature.id);
if (banReason) continue;
if (banReason !== '' && nature.id) {
if (hasAllNaturesBan) continue;
if (nature.isNonstandard) {
banReason = ruleTable.check('pokemontag:' + toID(nature.isNonstandard));
if (banReason) continue;
if (banReason !== '' && nature.isNonstandard !== 'Unobtainable') {
if (hasNonexistentBan) continue;
if (!hasNonexistentWhitelist) continue;
}
}
naturePool.push(nature);
}
// There is no 'nature:nonature' rule so do not constrain pool size
naturePool.push(nature);
}
// There is no 'nature:nonature' rule so do not constrain pool size
}
}