|
|
|
@ -89,9 +89,6 @@ class Board{
|
|
|
|
this.drawShield();
|
|
|
|
this.drawShield();
|
|
|
|
this.drawShieldOpponent();
|
|
|
|
this.drawShieldOpponent();
|
|
|
|
|
|
|
|
|
|
|
|
this.drawHand();
|
|
|
|
|
|
|
|
this.drawOpponentHand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.drawMana();
|
|
|
|
this.drawMana();
|
|
|
|
|
|
|
|
|
|
|
|
this.drawPlayerNames('Nathan', 'Evil Nathan');
|
|
|
|
this.drawPlayerNames('Nathan', 'Evil Nathan');
|
|
|
|
@ -417,50 +414,6 @@ class Board{
|
|
|
|
ctx.fillText(opponentDeck.length, cardWidth*1.5 + (ctx.measureText(opponentDeck.length).width) + 10, cardHeight*1.9);
|
|
|
|
ctx.fillText(opponentDeck.length, cardWidth*1.5 + (ctx.measureText(opponentDeck.length).width) + 10, cardHeight*1.9);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Naming's getting awkward here...
|
|
|
|
|
|
|
|
// Draw the cards in hand
|
|
|
|
|
|
|
|
drawHand(){
|
|
|
|
|
|
|
|
// Player Hand/Cards in Hand
|
|
|
|
|
|
|
|
for (let i = 0; i < playerHand.length; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let name = 'cardInHand_'+(i+1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let cardPadding = 10;
|
|
|
|
|
|
|
|
let fill = '#'+i+i+'FF00';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: fix positionX, actually have some maffs
|
|
|
|
|
|
|
|
let positionX = canvas.width/2 - (cardWidth * (playerHand.length - (i+1)) - (cardPadding * (i+1)));
|
|
|
|
|
|
|
|
let positionY = canvas.height-cardWidth*1.5-20;
|
|
|
|
|
|
|
|
let width = cardWidth;
|
|
|
|
|
|
|
|
let height = cardHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.drawCard(playerHand, i, name, positionX, positionY, width, height, fill);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawOpponentHand(){
|
|
|
|
|
|
|
|
// Opponents Hand/Cards in Hand
|
|
|
|
|
|
|
|
for (let i = 0; i < opponentHand.length; i++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let name = 'cardInOpponentsHand_'+(i+1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let cardPadding = 10;
|
|
|
|
|
|
|
|
let fill = '#'+i+i+'DD00';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: fix positionX, actually have some maffs
|
|
|
|
|
|
|
|
let positionX = canvas.width/2 - (cardWidth * (opponentHand.length - (i+1)) - (cardPadding * (i+1)));
|
|
|
|
|
|
|
|
let positionY = 20;
|
|
|
|
|
|
|
|
let width = cardWidth;
|
|
|
|
|
|
|
|
let height = cardHeight;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.drawCard(opponentHand, i, name, positionX, positionY, width, height, fill);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drawCards(){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addFromBoardElement(playerFrom, fromPosition, elementFrom, elementTo, toPosition=null, playerTo=null){
|
|
|
|
addFromBoardElement(playerFrom, fromPosition, elementFrom, elementTo, toPosition=null, playerTo=null){
|
|
|
|
if(playerTo == null){
|
|
|
|
if(playerTo == null){
|
|
|
|
playerTo = playerFrom;
|
|
|
|
playerTo = playerFrom;
|
|
|
|
|