Solved the 'joker' problem unique cards and classes of cards implemented

This commit is contained in:
bluesaxman
2020-05-20 17:01:26 -06:00
parent 902940774d
commit 9b23be4bbb
3 changed files with 47 additions and 4 deletions

View File

@@ -54,7 +54,15 @@ buttonAdd("#menu","upload","Upload Deck", function () {
var myFile = new FileReader();
myFile.onload = function (file) {
// Probably validate the file somehow befor eating it
window.deck = generateDeck(JSON.parse(file.target.result));
var ourFile = JSON.parse(file.target.result);
if ( Array.isArray(ourFile) ) {
window.deck = [];
ourFile.forEach(function (deck) {
window.deck = window.deck.concat(generateDeck(deck));
});
} else {
window.deck = generateDeck(JSON.parse(file.target.result));
}
window.hand = [];
updateEvent();
}