mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-26 02:39:38 -05:00
Add min source gen for event-only Pokemon (#10339)
This commit is contained in:
parent
8f86a9824e
commit
48059af0a2
|
|
@ -101,6 +101,10 @@ export class PokemonSources {
|
|||
* `null` = definitely not an event egg that can be used with the Pomeg glitch
|
||||
*/
|
||||
pomegEventEgg?: string | null;
|
||||
/**
|
||||
* For event-only Pokemon that do not have a minimum source gen identified by its moves
|
||||
*/
|
||||
eventOnlyMinSourceGen?: number;
|
||||
/**
|
||||
* Some Pokemon evolve by having a move in their learnset (like Piloswine
|
||||
* with Ancient Power). These can only carry three other moves from their
|
||||
|
|
@ -151,6 +155,7 @@ export class PokemonSources {
|
|||
this.limitedEggMoves = null;
|
||||
}
|
||||
minSourceGen() {
|
||||
if (this.eventOnlyMinSourceGen) return this.eventOnlyMinSourceGen;
|
||||
if (this.sourcesBefore) return this.sourcesAfter || 1;
|
||||
let min = 10;
|
||||
for (const source of this.sources) {
|
||||
|
|
@ -877,6 +882,7 @@ export class TeamValidator {
|
|||
let legal = false;
|
||||
for (const event of eventData) {
|
||||
if (this.validateEvent(set, setSources, event, eventSpecies)) continue;
|
||||
setSources.eventOnlyMinSourceGen = event.generation;
|
||||
legal = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,6 +150,18 @@ describe('Team Validator', function () {
|
|||
assert.false.legalTeam(team, 'gen7anythinggoes');
|
||||
});
|
||||
|
||||
it('should identify the minimum source gen of event-only Pokemon which haven\'t already been identified by its moves', function () {
|
||||
let team = [
|
||||
{species: 'jirachi', ability: 'serenegrace', shiny: true, moves: ['aurasphere'], evs: {hp: 1}, ivs: {hp: 31, atk: 0, def: 31, spa: 31, spd: 31, spe: 31}},
|
||||
];
|
||||
assert.legalTeam(team, 'gen9ou');
|
||||
|
||||
team = [
|
||||
{species: 'jirachi', ability: 'serenegrace', shiny: true, moves: ['hiddenpowerfighting'], nature: 'serious', evs: {hp: 1}, ivs: {hp: 31, atk: 0, def: 31, spa: 31, spd: 31, spe: 31}},
|
||||
];
|
||||
assert.false.legalTeam(team, 'gen7ou');
|
||||
});
|
||||
|
||||
it.skip('should allow evolved Pokemon obtainable from events at lower levels than they could otherwise be obtained', function () {
|
||||
const team = [
|
||||
{species: 'dragonite', ability: 'innerfocus', moves: ['dracometeor'], evs: {hp: 1}, level: 50},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user