Better way to handle ignored

This commit is contained in:
kiichan 2020-04-25 02:38:07 -05:00
parent bc770b55aa
commit ae60dee283

View file

@ -77,6 +77,7 @@
} }
function pickem (id) { function pickem (id) {
picked[Number(id)] = null;
var available = pkmn.filter(i => !ignored_pkmn.includes(i) & !picked.includes(i)); var available = pkmn.filter(i => !ignored_pkmn.includes(i) & !picked.includes(i));
var ix = Math.floor(Math.random()*available.length); var ix = Math.floor(Math.random()*available.length);
var elem = document.getElementById(id); var elem = document.getElementById(id);
@ -104,7 +105,6 @@
if (!ignored_pkmn.includes(to_ignore)) { if (!ignored_pkmn.includes(to_ignore)) {
ignored_pkmn[ignored_pkmn.length] = to_ignore; ignored_pkmn[ignored_pkmn.length] = to_ignore;
} }
picked[i] = null;
elem.style.color = "white"; elem.style.color = "white";
} }
ignored_pkmn.sort(); ignored_pkmn.sort();
@ -115,7 +115,6 @@
for (i=0; i<6; i++) { for (i=0; i<6; i++) {
var elem = document.getElementById(i.toString()); var elem = document.getElementById(i.toString());
elem.innerHTML = ""; elem.innerHTML = "";
picked[i] = null;
elem.style.color = "white"; elem.style.color = "white";
} }
} }