View difference between Paste ID: BRQD137d and hsdxrRtJ
SHOW: | | - or go back to the newest paste.
1
/* config/formats.js */
2
3
{
4
	name: "Mega REvolution",
5
6
	mod: 'megarevolution',
7
	ruleset: ['OU'],
8
	validateSet: function (set) {
9
		var template = this.getTemplate(set.species);
10
		var item = this.getItem(set.item);
11
		if (item.megaStone) {
12
			if (template.baseStats && template.baseStats.hp > 110) {
13
				return ["" + (set.species || set.name) + " can't hold a Mega Stone as it has more than 110 base HP."];
14
			}
15-
			if (template.species === 'Smeargle') return ["Smeargle no puede ser equipado con una Mega Piedra."];
15+
			if (template.species === 'Smeargle') return ["Smeargle can't hold a Mega Stone."];
16
			var megaTemplate = this.getTemplate(item.megaStone);
17
			if (megaTemplate.baseSpecies !== template.species) {
18
				var megaAbility = toId(megaTemplate.abilities['0']);
19
				if (megaAbility in {'aerilate':1, 'pixilate':1, 'refrigerate':1}) return ["" + item.name + " can only be held by its rightful owner."];
20
			}
21
		}
22
	}
23
}
24
25
/* mods/megarevolution/scripts.js */
26
27
exports.BattleScripts = {
28
	init: function () {
29
		var onTakeMegaStone = function (item, source) {
30
			return false;
31
		};
32
		for (var id in this.data.Items) {
33
			if (!this.data.Items[id].megaStone) continue;
34
			this.modData('Items', id).onTakeItem = onTakeMegaStone;
35
		}
36
	},
37
	canMegaEvo: function (pokemon) {
38
		var altForme = pokemon.baseTemplate.otherFormes && this.getTemplate(pokemon.baseTemplate.otherFormes[0]);
39
		if (altForme && altForme.isMega && altForme.requiredMove && pokemon.set.moves.indexOf(toId(altForme.requiredMove)) > -1) return altForme.species;
40
		var item = pokemon.getItem();
41
		if (item.megaStone === pokemon.species) return false;
42
		return item.megaStone;
43
	}
44
};