File size: 5,265 Bytes
5c2ed06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import type { Learnset } from "../../../sim/dex-species";

export const Rulesets: import('../../../sim/dex-formats').ModdedFormatDataTable = {
	obtainablemoves: {
		inherit: true,
		banlist: [
			// https://www.smogon.com/forums/threads/implementing-all-old-gens-in-ps-testers-required.3483261/post-5420130
			// confirmed by Marty
			'Kakuna + Poison Sting + Harden', 'Kakuna + String Shot + Harden',
			'Beedrill + Poison Sting + Harden', 'Beedrill + String Shot + Harden',

			// https://www.smogon.com/forums/threads/rby-and-gsc-illegal-movesets.78638/
			'Nidoking + Fury Attack + Thrash',
			'Exeggutor + Poison Powder + Stomp', 'Exeggutor + Sleep Powder + Stomp', 'Exeggutor + Stun Spore + Stomp',
			'Eevee + Tackle + Growl',
			'Vaporeon + Tackle + Growl',
			'Jolteon + Tackle + Growl', 'Jolteon + Focus Energy + Thunder Shock',
			'Flareon + Tackle + Growl', 'Flareon + Focus Energy + Ember',

			// https://github.com/smogon/pokemon-showdown/pull/8869
			'Rapidash + Pay Day + Growl',
			'Rapidash + Pay Day + Tail Whip',
			'Fearow + Pay Day + Peck',
			'Fearow + Pay Day + Mirror Move',
			'Magikarp + Dragon Rage + Tackle',
		],
	},
	standard: {
		effectType: 'ValidatorRule',
		name: 'Standard',
		ruleset: ['Obtainable', 'Sleep Clause Mod', 'Freeze Clause Mod', 'Species Clause', 'Nickname Clause', 'OHKO Clause', 'Evasion Items Clause', 'Evasion Moves Clause', 'Endless battle Clause', 'HP Percentage Mod', 'Cancel Mod'],
		banlist: [
			'Hypnosis + Mean Look',
			'Hypnosis + Spider Web',
			'Lovely Kiss + Mean Look',
			'Lovely Kiss + Spider Web',
			'Sing + Mean Look',
			'Sing + Spider Web',
			'Sleep Powder + Mean Look',
			'Sleep Powder + Spider Web',
			'Spore + Mean Look',
			'Spore + Spider Web',
		],
	},
	nc2000movelegality: {
		effectType: 'ValidatorRule',
		name: 'NC 2000 Move Legality',
		desc: "Prevents Pok\u00e9mon from having moves that would only be obtainable in Pok\u00e9mon Crystal.",
		onValidateSet(set) {
			const illegalCombos: { [speciesid: string]: { [moveid: string]: 'E' | 'L' | 'S' } } = {
				arbok: { crunch: 'E' },
				sandslash: { metalclaw: 'E' },
				golduck: { crosschop: 'E' },
				marowak: { swordsdance: 'E' },
				electabuzz: { crosschop: 'E' },
				magmar: { crosschop: 'E' },
				jolteon: { batonpass: 'L' },
				vaporeon: { batonpass: 'L' },
				flareon: { batonpass: 'L' },
				espeon: { batonpass: 'L' },
				umbreon: { batonpass: 'L' },
				dragonite: { extremespeed: 'S' },
				meganium: { swordsdance: 'E' },
				typhlosion: { submission: 'E' },
				ariados: { agility: 'L' },
				yanma: { wingattack: 'L' },
				murkrow: { skyattack: 'E' },
				qwilfish: { spikes: 'L' },
				sneasel: { metalclaw: 'L' },
				ursaring: { metalclaw: 'E' },
				piloswine: { amnesia: 'L' },
				skarmory: { skyattack: 'E' },
				donphan: { watergun: 'E' },
				suicune: { aurorabeam: 'L' },
				dugtrio: { triattack: 'L' },
				magneton: { triattack: 'L' },
				cloyster: { spikes: 'L' },
			};

			const moveSources: NonNullable<Learnset['learnset']> = Object.fromEntries(
				set.moves.map(move => [this.toID(move), []])
			);

			const species = this.dex.species.get(set.species);
			for (const { learnset } of this.dex.species.getFullLearnset(species.id)) {
				for (const moveid in moveSources) {
					moveSources[moveid].push(...(learnset[moveid] || []));
				}
			}

			const notUsableAsTM = ['icebeam', 'flamethrower', 'thunderbolt'];
			const legalityList = illegalCombos[species.id];
			const problems = [];
			for (const moveid of set.moves.map(this.toID)) {
				// Diglett Magnemite Shellder
				if (!moveSources[moveid]) continue;
				if (legalityList) {
					const list = moveSources[moveid].filter(x => !x.includes(legalityList[moveid]));
					if (!list.length) {
						switch (legalityList[moveid]) {
						case 'L':
							// Converted to a set to remove duplicate entries
							const levels = new Set(moveSources[moveid].filter(x => x.includes(legalityList[moveid])).map(x => x.slice(2)));
							problems.push(
								`${species.name} can't learn ${this.dex.moves.get(moveid).name}.`,
								`(It learns ${this.dex.moves.get(moveid).name} in Pok\u00e9mon Crystal at the following levels: ${[...levels].join(', ')})`
							);
							break;
						case 'S':
							problems.push(
								`${species.name} can't learn ${this.dex.moves.get(moveid).name}.`,
								`(It only learns ${this.dex.moves.get(moveid).name} in Pok\u00e9mon Crystal via special in-game events.)`
							);
							break;
						case 'E':
							problems.push(
								`${species.name} can't learn ${this.dex.moves.get(moveid).name}.`,
								`(It only learns ${this.dex.moves.get(moveid).name} as an egg move in Pok\u00e9mon Crystal.)`
							);
							break;
						}
					}
				}
				for (const id of notUsableAsTM) {
					if (moveid === id && moveSources[id] && !moveSources[id].filter(x => !x.includes('2T')).length) {
						problems.push(`${species.name} can't learn ${this.dex.moves.get(id).name}.`);
					}
				}
			}
			if (problems.some(x => notUsableAsTM.map(y => this.dex.moves.get(y).name).some(z => x.includes(z)))) {
				problems.push(
					`(${notUsableAsTM.map(y => this.dex.moves.get(y).name).join(' / ')} aren't learnable outside of Pok\u00e9mon Crystal.)`
				);
			}
			return problems;
		},
	},
};