|
|
|
|
@ -15,7 +15,19 @@ clickableItems['board'] = [];
|
|
|
|
|
clickableItems['hand'] = [];
|
|
|
|
|
clickableItems['opponentHand'] = [];
|
|
|
|
|
|
|
|
|
|
// TODO: Uniform the arrays to player and opponent/different playesr
|
|
|
|
|
// Array of items, the 'Entity Manager' as such
|
|
|
|
|
let item = [];
|
|
|
|
|
let itemCount = 0;
|
|
|
|
|
// Component 1: Where on the board, hand, deck, mana, shield, etc.
|
|
|
|
|
// send back item, itemCount and individual comp. from server?
|
|
|
|
|
let boardElement = {};
|
|
|
|
|
let cardData = {};
|
|
|
|
|
let position = {};
|
|
|
|
|
let size = {};
|
|
|
|
|
//let shape = {};
|
|
|
|
|
let cardStatus = {}; // tapped, attacking, inspected, untargettable
|
|
|
|
|
let player = {};
|
|
|
|
|
|
|
|
|
|
let playerHand = [];
|
|
|
|
|
let opponentHand = [];
|
|
|
|
|
let playerBoard = [];
|
|
|
|
|
@ -421,7 +433,6 @@ class Board{
|
|
|
|
|
this.drawBoard();
|
|
|
|
|
}
|
|
|
|
|
playCardToBoardFromDeckOpponent(){
|
|
|
|
|
|
|
|
|
|
// Random card from deck
|
|
|
|
|
let cardToDraw = Math.floor(Math.random() * deckCount);
|
|
|
|
|
let cardPlayed = opponentDeck[cardToDraw];
|
|
|
|
|
@ -641,8 +652,8 @@ class Board{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TEMP!!
|
|
|
|
|
createDeckList(playerDeck, deckCount);
|
|
|
|
|
createDeckList(opponentDeck, deckCountOpponent);
|
|
|
|
|
createDeckList(playerDeck, deckCount, 0);
|
|
|
|
|
createDeckList(opponentDeck, deckCountOpponent, 1);
|
|
|
|
|
|
|
|
|
|
// Run board commands here for testing
|
|
|
|
|
let board = new Board;
|
|
|
|
|
@ -821,14 +832,17 @@ function clickableCheck(x,y,clickable){
|
|
|
|
|
|
|
|
|
|
// TEMP: Create a deck of X different cards that can be drawn/played
|
|
|
|
|
// for UI development, will be done on server and not shown to clients
|
|
|
|
|
function createDeckList(deck, deckCount){
|
|
|
|
|
function createDeckList(deck, deckCount, playerId){
|
|
|
|
|
for(let i = 0; i < deckCount; i++){
|
|
|
|
|
// Randomise colour
|
|
|
|
|
let colour = Math.floor(Math.random() * 2);
|
|
|
|
|
let effect = Math.floor(Math.random() * 5);
|
|
|
|
|
if(effect == 0){ effect = 'effect here'; } else{ effect = null }
|
|
|
|
|
|
|
|
|
|
deck.push({
|
|
|
|
|
|
|
|
|
|
item.push[itemCount];
|
|
|
|
|
boardElement[itemCount] = 'deck';
|
|
|
|
|
cardData[itemCount] = {
|
|
|
|
|
'name':'CardName '+(i+1)
|
|
|
|
|
, 'cost':1
|
|
|
|
|
, 'atk':1
|
|
|
|
|
@ -838,7 +852,12 @@ function createDeckList(deck, deckCount){
|
|
|
|
|
, 'type':'human'
|
|
|
|
|
, 'colour':colour
|
|
|
|
|
, 'tapped':false
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
player[playerId];
|
|
|
|
|
// Previous iteration, kept to prevent errors for now
|
|
|
|
|
deck.push(cardData[itemCount]);
|
|
|
|
|
|
|
|
|
|
itemCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|