diff --git a/cardGen.js b/cardGen.js index 21970ae..17a8b98 100644 --- a/cardGen.js +++ b/cardGen.js @@ -428,7 +428,7 @@ function buildCards(cards, cardClasses, cardColourRequirements){ // Check the card exists (it should always, but don't want jank) if(colourReq.cardId in builtCards){ // Add the colours to the class array (cards can have multiple) - builtCards[colourReq.cardId].colourRequirements.push(colourReq.colourId, colourReq.cost); + builtCards[colourReq.cardId].colourRequirements.push([colourReq.colourId, colourReq.cost]); // TODO: As an array [classId, className] then // card.classes[x][0] can be compared as numeric in code diff --git a/public/board.js b/public/board.js index 6a44fc4..9433fbe 100644 --- a/public/board.js +++ b/public/board.js @@ -35,6 +35,10 @@ let player = {}; let listPosition = {}; let cardFace = {}; let cardSprite = {}; +let deckIn = {}; // NEW, may be used, for now player substitute +let deckData = {}; +let cardAttack = {}; // TODO: add to the logic +let cardColours = {}; let inEvent = null; // To disable drawing each time something changes @@ -839,10 +843,10 @@ function loadBoard(data) { cardSprite = {}; // TODO: ? Maybe, or this could be done clientside based // ^ on card id? - let deckIn = data.deckIn; // NEW, may be used, for now player substitute - let deckData = data.deckData; - let cardAttack = data.cardAttack; // TODO: add to the logic - let cardColours = data.cardColours; // TODO: add to the logic + deckIn = data.deckIn; // NEW, may be used, for now player substitute + deckData = data.deckData; + cardAttack = data.cardAttack; // TODO: add to the logic + cardColours = data.cardColours; // TODO: JANK IN, CHANGE CODE TO USE NEW ARRAY!! // Temp jank, set colour to first colour req. @@ -852,7 +856,7 @@ function loadBoard(data) { // after && to check if there is a colourReq record in cardColours if(cardData[i] !== undefined && i in cardColours){ // i may not have carddata, as realDeck console.log(i); - cardData[i].colour = cardColours[i][0]; + cardData[i].colour = cardColours[i][0][0]; // Colour Id of first req // Set the artwork (this would be done front-end I think) cardSprite[i] = [0,0]; // Temp sprite set based on colour TODO: Change to set correct sprite from DB