mirror of
https://forge.murkfall.net/bluesaxman/deckard.git
synced 2026-03-13 02:34:20 -06:00
changed DDF syntax to follow JSON standards
This commit is contained in:
11
index.html
11
index.html
@@ -27,15 +27,18 @@ function updateEvent() {
|
||||
|
||||
function generateDeck(DDF) {
|
||||
var cards = [""];
|
||||
for (var attribute in DDF) {
|
||||
DDF.sort(function (a,b) {
|
||||
return a.dataIndex - b.dataIndex;
|
||||
});
|
||||
DDF.forEach( function (data) {
|
||||
var tempcards = [];
|
||||
cards.forEach( function (current) {
|
||||
DDF[attribute].forEach( function (value) {
|
||||
DDF.data.forEach( function (value) {
|
||||
tempcards.push(current+value);
|
||||
} );
|
||||
} );
|
||||
cards = tempcards.slice();
|
||||
}
|
||||
});
|
||||
return cards;
|
||||
}
|
||||
|
||||
@@ -49,7 +52,7 @@ function shuffleDeck(deck) {
|
||||
}
|
||||
|
||||
function deckFromJSON(ourFile) {
|
||||
if ( Array.isArray(ourFile) ) {
|
||||
if ( Array.isArray(ourFile[0]) ) {
|
||||
ourFile.forEach(function (deck) {
|
||||
window.deck = window.deck.concat(generateDeck(deck));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user