Optimize banning things from newer gens

This commit is contained in:
Guangcong Luo 2013-04-27 11:21:06 -07:00
parent b263daeea0
commit df8c66d937
4 changed files with 18 additions and 73 deletions

View File

@ -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<set.moves.length; i++) {
var move = this.getMove(set.moves[i]);
if (move.isNonstandard) {
if (move.gen > 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.');
}

View File

@ -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);

View File

@ -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) {

View File

@ -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'];
}
}
}