pokemon-showdown/data/mods/gen4/rulesets.js
Guangcong Luo 2d3614f325 Refactor battle.dex out of battle
In most other similar systems, like TeamValidator, we use `thing.dex`
instead of having it extend `ModdedDex`. Battle has always extended
`ModdedDex`, though. This changes Battle to match the others.

This should fix an issue with `Battle.data` not being cached.

This also frees up Battle to extend ObjectReadWriteStream<string> in
a future update.
2019-10-06 04:50:35 +11:00

25 lines
764 B
JavaScript

'use strict';
/**@type {{[k: string]: ModdedFormatsData}} */
let BattleFormats = {
validatestats: {
inherit: true,
onValidateSet(set) {
let template = this.dex.getTemplate(set.species);
let item = this.dex.getItem(set.item);
if (item && item.id === 'griseousorb' && template.num !== 487) {
return ['Griseous Orb can only be held by Giratina in Generation 4.'];
}
if (template.num === 493 && set.evs && (set.moves.includes('roaroftime') || set.moves.includes('shadowforce') || set.moves.includes('spacialrend'))) {
for (let stat in set.evs) {
// @ts-ignore
if (set.evs[stat] > 100) return ["Event Arceus may not have more than 100 of any EVs in Generation 4."];
}
}
},
},
};
exports.BattleFormats = BattleFormats;