From df8c66d937bd5c8b64fd07a49dee74a193d76061 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 27 Apr 2013 11:21:06 -0700 Subject: [PATCH] Optimize banning things from newer gens --- data/formats.js | 20 ++++++++++++++++---- mods/gen1/scripts.js | 27 --------------------------- mods/gen3/scripts.js | 22 +--------------------- mods/gen4/scripts.js | 22 +--------------------- 4 files changed, 18 insertions(+), 73 deletions(-) diff --git a/data/formats.js b/data/formats.js index 572a6d2250..75fcea0760 100644 --- a/data/formats.js +++ b/data/formats.js @@ -1134,22 +1134,34 @@ exports.BattleFormats = { set.species = 'Keldeo'; } } - if (template.isNonstandard) { + if (template.gen > this.gen) { + problems.push(set.species+' does not exist in gen '+this.gen+'.'); + } else if (template.isNonstandard) { problems.push(set.species+' is not a real Pokemon.'); } if (set.ability) { var ability = this.getAbility(set.ability); - if (ability.isNonstandard) { + if (ability.gen > this.gen) { + problems.push(ability.name+' does not exist in gen '+this.gen+'.'); + } else if (ability.isNonstandard) { problems.push(ability.name+' is not a real ability.'); } } if (set.moves) for (var i=0; i this.gen) { + problems.push(move.name+' does not exist in gen '+this.gen+'.'); + } else if (move.isNonstandard) { problems.push(move.name+' is not a real move.'); } } - if (item && item.isNonstandard) problems.push(item.name + ' is not a real item.'); + if (item) { + if (item.gen > this.gen) { + problems.push(item.name+' does not exist in gen '+this.gen+'.'); + } else if (item.isNonstandard) { + problems.push(item.name + ' is not a real item.'); + } + } if (set.moves && set.moves.length > 4) { problems.push((set.name||set.species) + ' has more than four moves.'); } diff --git a/mods/gen1/scripts.js b/mods/gen1/scripts.js index fff2edbb83..4cfa493e03 100644 --- a/mods/gen1/scripts.js +++ b/mods/gen1/scripts.js @@ -4,33 +4,6 @@ */ exports.BattleScripts = { gen: 1, - init: function() { - // We check for everything that didn't exist back in gen 1 and make it Illegal - for (var i in this.data.Pokedex) { - var template = this.getTemplate(i); - if (template.gen > 1) { - this.modData('Pokedex', i).isNonstandard = true; - } - } - for (var i in this.data.Movedex) { - var move = this.getMove(i); - if (move.gen > 1) { - this.modData('Movedex', i).isNonstandard = true; - } - } - for (var i in this.data.Abilities) { - var ability = this.getAbility(i); - if (ability.gen > 1) { - this.modData('Abilities', i).isNonstandard = true; - } - } - for (var i in this.data.Items) { - var item = this.getItem(i); - if (item.gen > 1) { - this.modData('Items', i).isNonstandard = true; - } - } - }, debug: function(activity) { if (this.getFormat().debug) { this.add('debug', activity); diff --git a/mods/gen3/scripts.js b/mods/gen3/scripts.js index 7a19c1e8a7..1a80ff49b8 100644 --- a/mods/gen3/scripts.js +++ b/mods/gen3/scripts.js @@ -2,27 +2,7 @@ exports.BattleScripts = { gen: 3, init: function() { for (var i in this.data.Pokedex) { - var template = this.getTemplate(i); - if (template.gen > 3) template.isNonstandard = true; - delete template.abilities['DW']; - } - for (var i in this.data.Movedex) { - var move = this.getMove(i); - if (move.gen > 3) { - this.modData('Movedex', i).isNonstandard = true; - } - } - for (var i in this.data.Abilities) { - var ability = this.getAbility(i); - if (ability.gen > 3) { - this.modData('Abilities', i).isNonstandard = true; - } - } - for (var i in this.data.Items) { - var item = this.getItem(i); - if (item.gen > 3) { - this.modData('Items', i).isNonstandard = true; - } + delete this.data.Pokedex[i].abilities['DW']; } }, getCategory: function(move) { diff --git a/mods/gen4/scripts.js b/mods/gen4/scripts.js index 166cb976d1..2709c5b06e 100644 --- a/mods/gen4/scripts.js +++ b/mods/gen4/scripts.js @@ -13,27 +13,7 @@ exports.BattleScripts = { } } for (var i in this.data.Pokedex) { - var template = this.getTemplate(i); - if (template.gen > 4) template.isNonstandard = true; - delete template.abilities['DW']; - } - for (var i in this.data.Movedex) { - var move = this.getMove(i); - if (move.gen > 4) { - this.modData('Movedex', i).isNonstandard = true; - } - } - for (var i in this.data.Abilities) { - var ability = this.getAbility(i); - if (ability.gen > 4) { - this.modData('Abilities', i).isNonstandard = true; - } - } - for (var i in this.data.Items) { - var item = this.getItem(i); - if (item.gen > 4) { - this.modData('Items', i).isNonstandard = true; - } + delete this.data.Pokedex[i].abilities['DW']; } } }