diff --git a/site/client/app/modules/deck-builder/components/deck-builder.js b/site/client/app/modules/deck-builder/components/deck-builder.js index 6f36998..cf0bd17 100644 --- a/site/client/app/modules/deck-builder/components/deck-builder.js +++ b/site/client/app/modules/deck-builder/components/deck-builder.js @@ -8,7 +8,7 @@ module.exports = { data: function() { return { cards: [], - deck: {}, + deck: [], leaders: [], leader: null, @@ -22,6 +22,18 @@ module.exports = { this.initDeck(); }, + filters: { + getType: function(c, type) { + var tmp = $.map(c, (item) => { + if(item.type == type) return item; + }); + + return tmp; + + return c; + } + }, + methods: { changeDeck: function(deck) { // todo: load animation @@ -45,11 +57,13 @@ module.exports = { }, initDeck: function() { - this.deck = {}; + this.deck = []; + var _deck = deck[this.factionFilter]; + + for(var item in _deck) { + this.deck.push(cards[_deck[item]]); + } - deck[this.factionFilter].forEach((x) => { - this.deck[x] = (this.deck[x] || 0) + 1; - }); }, // test diff --git a/site/client/app/modules/deck-builder/views/deck-builder.html b/site/client/app/modules/deck-builder/views/deck-builder.html index c32ce10..0888485 100644 --- a/site/client/app/modules/deck-builder/views/deck-builder.html +++ b/site/client/app/modules/deck-builder/views/deck-builder.html @@ -14,7 +14,7 @@