Fix DW and baby-only move compatibility checking

PS already tracks which evolution level an egg move or event pokemon
learns a move from, but apparently this was not tracked for DW moves.

This fixes a compatibility interaction between DW Marill and Azurill
moves.
This commit is contained in:
Guangcong Luo 2019-11-11 04:41:51 +13:00
parent 1ac1f2be5e
commit 7a90fa7622
2 changed files with 10 additions and 1 deletions

View File

@ -1545,6 +1545,9 @@ export class TeamValidator {
if (source.charAt(1) === 'E') {
if (babyEvo && source.slice(2) === babyEvo) return false;
}
if (source.charAt(1) === 'D') {
if (babyEvo && source.slice(2) === babyEvo) return false;
}
return true;
});
if (!setSources.sources.length && !setSources.sourcesBefore) {
@ -1748,7 +1751,7 @@ export class TeamValidator {
} else if (learned.charAt(1) === 'D') {
// DW moves:
// only if that was the source
moveSources.add(learned);
moveSources.add(learned + template.id);
} else if (learned.charAt(1) === 'V') {
// Virtual Console moves:
// only if that was the source

View File

@ -179,6 +179,12 @@ describe('Team Validator', function () {
illegal = TeamValidator.get('gen7ou').validateTeam(team);
assert(illegal);
team = [
{species: 'marill', ability: 'hugepower', moves: ['splash', 'aquajet'], evs: {hp: 1}},
];
illegal = TeamValidator.get('gen7ou').validateTeam(team);
assert(illegal);
team = [
{species: 'mamoswine', ability: 'oblivious', moves: ['tackle', 'iceshard', 'amnesia', 'furyattack'], evs: {hp: 1}},
];