{"size": 2144, "ext": "js", "max_stars_repo_path": "mods/mixandmega/items.js", "max_stars_repo_name": "Picklesword/Pokemon-Showdown", "max_stars_repo_stars_event_min_datetime": "2017-03-29T13:05:57.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-31T00:38:45.000Z", "max_issues_repo_path": "mods/mixandmega/items.js", "max_issues_repo_name": "Picklesword/Pokemon-Showdown", "max_issues_repo_issues_event_min_datetime": "2016-08-14T02:02:22.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-23T22:23:47.000Z", "max_forks_repo_path": "mods/mixandmega/items.js", "max_forks_repo_name": "Picklesword/Pokemon-Showdown", "max_forks_repo_forks_event_min_datetime": "2017-03-29T13:49:09.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-10T21:01:43.000Z"}
{"max_stars_count": 15, "max_issues_count": 147, "max_forks_count": 117, "avg_line_length": 32.4848484848, "max_line_length": 126, "alphanum_fraction": 0.6305970149}
'use strict';

/**@type {{[k: string]: ModdedItemData}} */
let BattleItems = {
	blueorb: {
		inherit: true,
		onSwitchIn: function (pokemon) {
			if (pokemon.isActive && !pokemon.template.isPrimal) {
				this.insertQueue({pokemon: pokemon, choice: 'runPrimal'});
			}
		},
		onPrimal: function (pokemon) {
			/**@type {Template} */
			// @ts-ignore
			let template = this.getMixedTemplate(pokemon.originalSpecies, 'Kyogre-Primal');
			if (pokemon.originalSpecies === 'Kyogre') {
				pokemon.formeChange(template, this.effect, true);
			} else {
				pokemon.formeChange(template, this.effect, true);
				pokemon.baseTemplate = template;
				this.add('-start', pokemon, 'Blue Orb', '[silent]');
			}
		},
		onTakeItem: function (item) {
			return false;
		},
	},
	redorb: {
		inherit: true,
		onSwitchIn: function (pokemon) {
			if (pokemon.isActive && !pokemon.template.isPrimal) {
				this.insertQueue({pokemon: pokemon, choice: 'runPrimal'});
			}
		},
		onPrimal: function (pokemon) {
			/**@type {Template} */
			// @ts-ignore
			let template = this.getMixedTemplate(pokemon.originalSpecies, 'Groudon-Primal');
			if (pokemon.originalSpecies === 'Groudon') {
				pokemon.formeChange(template, this.effect, true);
			} else {
				pokemon.formeChange(template, this.effect, true);
				pokemon.baseTemplate = template;
				this.add('-start', pokemon, 'Red Orb', '[silent]');
				// @ts-ignore
				let oTemplate = this.getTemplate(pokemon.illusion || pokemon.originalSpecies);
				this.add('-start', pokemon, 'Red Orb', '[silent]');
				if (pokemon.illusion) {
					pokemon.ability = '';
					let types = oTemplate.types;
					if (types.length > 1 || types[types.length - 1] !== 'Fire') {
						this.add('-start', pokemon, 'typechange', (types[0] !== 'Fire' ? types[0] + '/' : '') + 'Fire', '[silent]');
					}
				} else if (oTemplate.types.length !== pokemon.template.types.length || oTemplate.types[1] !== pokemon.template.types[1]) {
					this.add('-start', pokemon, 'typechange', pokemon.template.types.join('/'), '[silent]');
				}
			}
		},
		onTakeItem: function (item) {
			return false;
		},
	},
};

exports.BattleItems = BattleItems;
