<commit_before>'use strict';

/**@type {{[k: string]: ModdedFormatsData}} */
let BattleFormats = {
	pokemon: {
		effectType: 'ValidatorRule',
		name: 'Pokemon',
		onValidateTeam: function (team, format) {
			let problems = [];
			if (team.length > 6) problems.push('Your team has more than six Pok\u00E9mon.');
			// ----------- legality line ------------------------------------------
			if (!format || !this.getRuleTable(format).has('-illegal')) return problems;
			// everything after this line only happens if we're doing legality enforcement
			let hasStarter = 0;
			for (const set of team) {
				if (set.species === 'Pikachu-Starter' || set.species === 'Eevee-Starter') {
					hasStarter++;
					if (hasStarter > 1) {
						problems.push(`You can only have one of Pikachu-Starter or Eevee-Starter on a team.`);
						break;
					}
				}
			}
			return problems;
		},
		onChangeSet: function (set, format) {
			let template = this.getTemplate(set.species);
			let baseTemplate = this.getTemplate(template.baseSpecies);
			let problems = [];
			let allowAVs = !!(format && this.getRuleTable(format).has('allowavs'));
			let allowCAP = !!(format && this.getRuleTable(format).has('allowcap'));

			if (set.species === set.name) delete set.name;
			if (((baseTemplate.num > 151 || baseTemplate.num < 1) && ![808, 809].includes(baseTemplate.num) &&
				!['Alola', 'Mega', 'Mega-X', 'Mega-Y', 'Starter'].includes(template.forme)) || template.speciesid.endsWith('totem')) {
				let usedSpecies = baseTemplate.species;
				if (template.speciesid.endsWith('totem')) {
					usedSpecies = template.species;
				}
				problems.push(
					`Only Pok\u00E9mon whose base formes are from Gen 1, Meltan, and Melmetal can be used.`,
					`(${usedSpecies} is from Gen ${baseTemplate.gen === 1 ? 7 : baseTemplate.gen}.)`
				);
			}
			if (set.moves) {
				for (const moveid of set.moves) {
					let move = this.getMove(moveid);
					if (move.gen > this.gen) {
						problems.push(move.name + ' does not exist in gen ' + this.gen + '.');
					} else if (!allowCAP && move.isNonstandard) {
						problems.push(move.name + ' does not exist.');
					}
				}
			}
			if (set.moves && set.moves.length > 4) {
				problems.push((set.name || set.species) + ' has more than four moves.');
			}
			if (set.level && set.level > 100) {
				problems.push((set.name || set.species) + ' is higher than level 100.');
			}

			if (!allowCAP || !template.tier.startsWith('CAP')) {
				if (template.isNonstandard && template.num > -5000) {
					problems.push(set.species + ' does not exist.');
				}
			}
<commit_msg>Fix forme validation in Let's Go<commit_after>'use strict';

/**@type {{[k: string]: ModdedFormatsData}} */
let BattleFormats = {
	pokemon: {
		effectType: 'ValidatorRule',
		name: 'Pokemon',
		onValidateTeam: function (team, format) {
			let problems = [];
			if (team.length > 6) problems.push('Your team has more than six Pok\u00E9mon.');
			// ----------- legality line ------------------------------------------
			if (!format || !this.getRuleTable(format).has('-illegal')) return problems;
			// everything after this line only happens if we're doing legality enforcement
			let hasStarter = 0;
			for (const set of team) {
				if (set.species === 'Pikachu-Starter' || set.species === 'Eevee-Starter') {
					hasStarter++;
					if (hasStarter > 1) {
						problems.push(`You can only have one of Pikachu-Starter or Eevee-Starter on a team.`);
						break;
					}
				}
			}
			return problems;
		},
		onChangeSet: function (set, format) {
			let template = this.getTemplate(set.species);
			let baseTemplate = this.getTemplate(template.baseSpecies);
			let problems = [];
			let allowAVs = !!(format && this.getRuleTable(format).has('allowavs'));
			let allowCAP = !!(format && this.getRuleTable(format).has('allowcap'));

			if (set.species === set.name) delete set.name;
			const validNum = (baseTemplate.num <= 151 && baseTemplate.num >= 1) || [808, 809].includes(baseTemplate.num);
			if (!validNum) {
				problems.push(
					`Only Pok\u00E9mon whose base formes are from Gen 1, Meltan, and Melmetal can be used.`,
					`(${set.species} is from Gen ${baseTemplate.gen === 1 ? 7 : baseTemplate.gen}.)`
				);
			}
			if (template.forme && !['Alola', 'Mega', 'Mega-X', 'Mega-Y', 'Starter'].includes(template.forme)) {
				problems.push(`${set.species}'s forme ${template.forme} is not available in Let's Go.`);
			}
			if (set.moves) {
				for (const moveid of set.moves) {
					let move = this.getMove(moveid);
					if (move.gen > this.gen) {
						problems.push(move.name + ' does not exist in gen ' + this.gen + '.');
					} else if (!allowCAP && move.isNonstandard) {
						problems.push(move.name + ' does not exist.');
					}
				}
			}
			if (set.moves && set.moves.length > 4) {
				problems.push((set.name || set.species) + ' has more than four moves.');
			}
			if (set.level && set.level > 100) {
				problems.push((set.name || set.species) + ' is higher than level 100.');
			}

			if (!allowCAP || !template.tier.startsWith('CAP')) {
				if (template.isNonstandard && template.num > -5000) {
					problems.push(set.species + ' does not exist.');
				}
			}

{'fraction_non_alphanumeric': 0.18283943443734263, 'fraction_numerical': 0.012783265543288786, 'mean_word_length': 2.876876876876877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1169498', 'n_tokens_mistral': 2112, 'n_tokens_neox': 1717, 'n_words': 429}