From de878b3c5babcc1fa5c0c381cccd779beef10cde Mon Sep 17 00:00:00 2001 From: Kris Johnson <11083252+KrisXV@users.noreply.github.com> Date: Fri, 8 May 2020 20:23:23 -0600 Subject: [PATCH] Fix `canLearn`'s filtering (#1512) --- src/battle-dex-search.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/battle-dex-search.ts b/src/battle-dex-search.ts index b6da22040..06475376e 100644 --- a/src/battle-dex-search.ts +++ b/src/battle-dex-search.ts @@ -697,8 +697,15 @@ abstract class BattleTypedSearch { return '' as ID; } protected canLearn(speciesid: ID, moveid: ID) { + if (this.dex.gen >= 8 && this.dex.getMove(moveid).isNonstandard === 'Past' && this.formatType !== 'natdex') { + return false; + } let genChar = `${this.dex.gen}`; - if (this.format.startsWith('vgc')) { + if ( + this.format.startsWith('vgc') || + this.format.startsWith('battlespot') || + this.format.startsWith('battlestadium') + ) { if (this.dex.gen === 8) { genChar = 'g'; } else if (this.dex.gen === 7) { @@ -1224,7 +1231,7 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> { let species = dex.getSpecies(this.species); const format = this.format; const isBH = (format === 'balancedhackmons' || format === 'bh'); - const galarBornLegality = (format.includes('battlestadium') || (format.slice(0, 3) === 'vgc' && this.dex.gen === 8)); + const galarBornLegality = (format.includes('battlestadium') || (format.startsWith('vgc') && this.dex.gen === 8)); const abilityid = this.set ? toID(this.set.ability) : '' as ID; const itemid = this.set ? toID(this.set.item) : '' as ID; @@ -1243,7 +1250,7 @@ class BattleMoveSearch extends BattleTypedSearch<'move'> { /* if (requirePentagon && learnsetEntry.indexOf('p') < 0) { continue; } */ - if (galarBornLegality && learnsetEntry.indexOf('g') < 0) { + if (galarBornLegality && !learnsetEntry.includes('g')) { continue; } else if (!learnsetEntry.includes(gen)) { continue;