From 1031bea20358edb8b20e92c86355ba7fd5e72222 Mon Sep 17 00:00:00 2001 From: adrivrie Date: Mon, 6 Mar 2023 01:06:57 +0100 Subject: [PATCH] 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 --- data/mods/gen8/random-teams.ts | 34 ++++++++++++++++------------------ data/random-teams.ts | 34 ++++++++++++++++------------------ 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/data/mods/gen8/random-teams.ts b/data/mods/gen8/random-teams.ts index cd5c1deab0..faeb7fc00a 100644 --- a/data/mods/gen8/random-teams.ts +++ b/data/mods/gen8/random-teams.ts @@ -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 } } diff --git a/data/random-teams.ts b/data/random-teams.ts index 25ff3572e4..ecb4a59a97 100644 --- a/data/random-teams.ts +++ b/data/random-teams.ts @@ -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 } }