Add attr. global board.js, and make colours array

develop
Nathan Steel 1 year ago
parent 51aa49ee63
commit 202f7523ec

@ -428,7 +428,7 @@ function buildCards(cards, cardClasses, cardColourRequirements){
// Check the card exists (it should always, but don't want jank) // Check the card exists (it should always, but don't want jank)
if(colourReq.cardId in builtCards){ if(colourReq.cardId in builtCards){
// Add the colours to the class array (cards can have multiple) // 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 // TODO: As an array [classId, className] then
// card.classes[x][0] can be compared as numeric in code // card.classes[x][0] can be compared as numeric in code

@ -35,6 +35,10 @@ let player = {};
let listPosition = {}; let listPosition = {};
let cardFace = {}; let cardFace = {};
let cardSprite = {}; 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; let inEvent = null;
// To disable drawing each time something changes // To disable drawing each time something changes
@ -839,10 +843,10 @@ function loadBoard(data) {
cardSprite = {}; // TODO: ? Maybe, or this could be done clientside based cardSprite = {}; // TODO: ? Maybe, or this could be done clientside based
// ^ on card id? // ^ on card id?
let deckIn = data.deckIn; // NEW, may be used, for now player substitute deckIn = data.deckIn; // NEW, may be used, for now player substitute
let deckData = data.deckData; deckData = data.deckData;
let cardAttack = data.cardAttack; // TODO: add to the logic cardAttack = data.cardAttack; // TODO: add to the logic
let cardColours = data.cardColours; // TODO: add to the logic cardColours = data.cardColours;
// TODO: JANK IN, CHANGE CODE TO USE NEW ARRAY!! // TODO: JANK IN, CHANGE CODE TO USE NEW ARRAY!!
// Temp jank, set colour to first colour req. // 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 // 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 if(cardData[i] !== undefined && i in cardColours){ // i may not have carddata, as realDeck
console.log(i); 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) // Set the artwork (this would be done front-end I think)
cardSprite[i] = [0,0]; cardSprite[i] = [0,0];
// Temp sprite set based on colour TODO: Change to set correct sprite from DB // Temp sprite set based on colour TODO: Change to set correct sprite from DB

Loading…
Cancel
Save