Add beginning of DO/ECS

develop
Nathan Steel 1 year ago
parent 80078f2ba8
commit f753d5d3df

@ -15,7 +15,19 @@ clickableItems['board'] = [];
clickableItems['hand'] = []; clickableItems['hand'] = [];
clickableItems['opponentHand'] = []; 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 playerHand = [];
let opponentHand = []; let opponentHand = [];
let playerBoard = []; let playerBoard = [];
@ -421,7 +433,6 @@ class Board{
this.drawBoard(); this.drawBoard();
} }
playCardToBoardFromDeckOpponent(){ playCardToBoardFromDeckOpponent(){
// Random card from deck // Random card from deck
let cardToDraw = Math.floor(Math.random() * deckCount); let cardToDraw = Math.floor(Math.random() * deckCount);
let cardPlayed = opponentDeck[cardToDraw]; let cardPlayed = opponentDeck[cardToDraw];
@ -641,8 +652,8 @@ class Board{
} }
// TEMP!! // TEMP!!
createDeckList(playerDeck, deckCount); createDeckList(playerDeck, deckCount, 0);
createDeckList(opponentDeck, deckCountOpponent); createDeckList(opponentDeck, deckCountOpponent, 1);
// Run board commands here for testing // Run board commands here for testing
let board = new Board; 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 // 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 // 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++){ for(let i = 0; i < deckCount; i++){
// Randomise colour // Randomise colour
let colour = Math.floor(Math.random() * 2); let colour = Math.floor(Math.random() * 2);
let effect = Math.floor(Math.random() * 5); let effect = Math.floor(Math.random() * 5);
if(effect == 0){ effect = 'effect here'; } else{ effect = null } if(effect == 0){ effect = 'effect here'; } else{ effect = null }
deck.push({
item.push[itemCount];
boardElement[itemCount] = 'deck';
cardData[itemCount] = {
'name':'CardName '+(i+1) 'name':'CardName '+(i+1)
, 'cost':1 , 'cost':1
, 'atk':1 , 'atk':1
@ -838,7 +852,12 @@ function createDeckList(deck, deckCount){
, 'type':'human' , 'type':'human'
, 'colour':colour , 'colour':colour
, 'tapped':false , 'tapped':false
}); };
player[playerId];
// Previous iteration, kept to prevent errors for now
deck.push(cardData[itemCount]);
itemCount++;
} }
} }

Loading…
Cancel
Save