diff --git a/cardGen.js b/cardGen.js index f69e03e..430b1d1 100644 --- a/cardGen.js +++ b/cardGen.js @@ -344,7 +344,8 @@ function requestDeck(itemData = null){ itemData.listPosition = listPosition; itemData.cardFace = cardFace; itemData.cardColours = cardColours; - //itemData.cardSprite = cardSprite; + itemData.cardAttack = cardAttack; + itemData.cardSprite = cardSprite; // item, itemCount, deckData, cardData, boardElement //console.log(cardData); diff --git a/public/board.js b/public/board.js index 505b91d..60ff107 100644 --- a/public/board.js +++ b/public/board.js @@ -867,70 +867,8 @@ function loadBoard(data) { // rewritten/made into generateItems or something, for each match // Decks can be as-is for getting deckLists for deckselection, but // TODO: for matches need something to generate and return every item, and attribute - -if(false){ - // Temp solution - // Loop all items, and set their related missing attributes - // TODO: some more jank to get it 'playable' with DB entries - let player0DeckCount = 0; - let player1DeckCount = 0; - for(let i = 0; i < itemCount; i++){ - // Set player for decks (to just be their array index for now) TODO: Properly - if(boardElement[i] == 'realDeck'){ - player[i] = i; // Jank... - //player[i] = deckData[i]; - //console.log(deckData[i]); - }else{ - // Everything else missing in a jank fashion - player[i] = deckIn[i]; // 1-1 here, but likely not in future - } - - cardStatus[i] = null; // Just building on first load, as deck gen - // substite at the mo, so all cards are free of status - cardFace[i] = 0; // As above, deck gen sub. Everything starts facedown - // Set position for cards in each deck... - // TODO: JANK, tidy, remove, make good!! - // using the new player set just above, which in itself is jank - if(player[i] == 0 && boardElement[i] != 'realDeck'){ - listPosition[i] = player0DeckCount+1; - player0DeckCount++; - } - // Just an else, as in DB/for this test only 2 decks - // TODO: MAKE BETTER! - else{ - listPosition[i] = player0DeckCount+1; - player0DeckCount++; - } - - // TODO: JANK IN, CHANGE CODE TO USE NEW ARRAY!! - // Temp jank, set colour to first colour req. - if(cardData[i] !== undefined){ // i may not have carddata, as realDeck - cardData[i].colour = 0;//cardData[itemCount].colour[0]; - // 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 - switch (cardData[i].colour){ - case 0: // White - cardSprite[i] = [0,0]; - break; - case 1: // Blue - cardSprite[i] = [0,1]; - break; - case 2: // Red - cardSprite[i] = [1,0]; - break; - case 3: // Green - cardSprite[i] = [1,1]; - break; - default: - break; - } - } - - } - -} // END FALSE/TEMP DISABLE + // TODO: Loop these for the amount of players in players (and use the correct itemKey) shuffleDeck(0); // Shuffle player 0 deck shuffleDeck(1); // Shuffle player 1 deck @@ -1026,6 +964,8 @@ canvas.addEventListener('click', function(event) { if(boardElement[itemKey] == 'deck'){ continue; }else{ + // Will print everything that's clickable (or should be clickable) + // any undefined attributes and such should display with this too //printECSData([itemKey]); } @@ -1221,7 +1161,7 @@ function calculateItemSizePosition(itemKey){ let i = listPosition[itemKey]; //console.log('cardName: '+cardData[itemKey].name+' listPosition/i: '+i); - + if(itemPlayer == 1 && itemElement == 'realDeck'){ positionX = 40; positionY = 60; diff --git a/roomMod.js b/roomMod.js index 61ac1b0..8223345 100644 --- a/roomMod.js +++ b/roomMod.js @@ -25,9 +25,11 @@ function setPlayers(playerCount = 2, itemData){ let playerNo = 0 + itemData['itemCount']; // Start loop from current itemCount playerCount = playerCount + itemData['itemCount']; // End at playerCount diff from itemCount for(playerNo; playerNo < playerCount; playerNo++){ - itemData['item'].push(playerNo); - itemData['player'][itemData['itemCount']] = playerNo; // The player belongs to itself - itemData['itemCount']++; + // REMOVED PLAYERS AS ITEM, BECAUSE THEY WERE BORKING + // TODO: Add back at some point, or don't bother + //itemData['item'].push(playerNo); + //itemData['player'][itemData['itemCount']] = playerNo; // The player belongs to itself + //itemData['itemCount']++; itemData['players'].push(playerNo); // Add player no to array so can be looped } // Return related item and item attributes