function toId(text) { text = text || ''; if (typeof text !== 'string') return ''; //??? return text.replace(/ /g, ''); } function clone(object) { var newObj = (object instanceof Array) ? [] : {}; for (var i in object) { if (object[i] && typeof object[i] == "object") { newObj[i] = clone(object[i]); } else newObj[i] = object[i] } return newObj; }; function BattleTools() { var selfT = this; this.getImmunity = function(type, target) { for (var i=0; i4) return; // avoid infinite recursion if (format.banlistTable && !subformat) { banlistTable = format.banlistTable; } else { if (!format.banlistTable) format.banlistTable = {}; if (!format.setBanTable) format.setBanTable = []; if (!format.teamBanTable) format.teamBanTable = []; banlistTable = format.banlistTable; if (!subformat) subformat = format; if (subformat.banlist) { for (var i=0; i 0) { var plusPlusPos = subformat.banlist[i].indexOf('++'); if (plusPlusPos && plusPlusPos > 0) { var complexList = subformat.banlist[i].split('++'); for (var j=0; j 510) { problems.push(set.name+" has more than 510 total EVs."); } var ability = selfT.getAbility(set.ability).name; if (ability !== template.abilities['0'] && ability !== template.abilities['1'] && ability !== template.abilities['DW']) { problems.push(set.name+" ("+set.species+") can't have "+set.ability+"."); } if (ability === template.abilities['DW']) { source = 'DW'; unreleasedDW = { Serperior: 1, Chandelure: 1, Ditto: 1, Breloom: 1, Zapdos: 1, Feraligatr: 1, Gothitelle: 1, 'Ho-Oh': 1, Lugia: 1, Raikou: 1, Cinccino: 1 }; if (unreleasedDW[set.species] && banlistTable['Unreleased']) { problems.push(set.name+" ("+set.species+")'s Dream World ability is unreleased."); } else if (template.num >= 494 && set.species !== 'Darmanitan' && set.species !== 'Munna') { problems.push(set.name+" ("+set.species+")'s Dream World ability is unreleased."); } } } var limit1 = 0; if (!set.moves || !set.moves.length) { problems.push(set.name+" has no moves."); } else for (var i=0; i 1) { problems.push(set.name+" ("+set.species+") can't Sketch "+move.name+" - it's limited to 1 Sketch move"); } } } setHas[toId(template.tier)] = true; if (banlistTable[template.tier]) { problems.push(set.name+" is in "+template.tier+", which is banned."); } if (teamHas) { for (var i in setHas) { teamHas[i] = true; } } for (var i=0; i