pkmn / ps

Modular Pokémon Showdown
MIT License
110 stars 16 forks source link

Events .canLearn() #33

Closed Glazelf closed 1 month ago

Glazelf commented 1 month ago

Describe the bug:

Using learnsets.canLearn() from newer generations returns true for event-exclusive moves from old generations despite them not being possible to be transferred upwards.

Example:

import { Dex } from '@pkmn/dex';
const gens = new Generations(Dex);
let genData = gens.get(9);
let testLearn = await genData.learnsets.canLearn("Darkrai", "Spacial Rend");
console.log(testLearn);

The above will log true.

Expected behavior:

The above code example should log false, as it is not possible to get a Darkrai with Spacial Rend in gen 9.

Additional context:

Seems to go for all event moves. Tested with Spacial Rend Darkrai, Spacial Rend Arceus and Eruption Heatran.

scheibo commented 1 month ago

I think this is sadly going to be closed as WAI, the learnset UI is always going to be limited compared to the TeamValidator, and this is documented:

Image

It's possibly @pkmn/sim's getFullLearnset or getMovePool functions are suitable here (they seem to be able to handle this specific case), but if you're pulling in the @pkmn/sim dep already at that point it would make sense to just use the TeamValidator