Fix multiple makeAttack cases being hit

develop
Nathan Steel 1 year ago
parent 9890f5302b
commit 221e621fa4

@ -999,6 +999,7 @@ canvas.addEventListener('click', function(event) {
// check like 'canUseOpponentsBoard' or something
if(!inEvent && cardStatus[itemKey] != 'tapped' && playerId == yourPlayerId){
board.startAttack(itemKey);
break;
}
// opponentBoard
// If there's an attack event, target other cards
@ -1006,6 +1007,7 @@ canvas.addEventListener('click', function(event) {
if(inEvent && inEvent[0] == 'attack' && inEvent[1] != itemKey && playerId != yourPlayerId){
// Make attack on the card clicked, with card in inEvent[1]
board.makeAttack(itemKey);
break;
}
// If no event, and clicked an OPPONENT CARD (for now)
@ -1014,19 +1016,19 @@ canvas.addEventListener('click', function(event) {
// inspect the card (zoom in on it)
if(!inEvent && playerId != yourPlayerId){
board.inspectCard(itemKey);
break;
}
else if(inEvent && inEvent[0] == 'inspect' && inEvent[1] == itemKey){
board.cancelInspect();
break;
}
board.drawBoard();
break;
case 'hand':
// Can be played
// Play 1 item in listPosition, from hand, to board (case from leftmost, etc)
// from playerId, to playerId
board.playCardToBoard(listPosition[itemKey], 'hand', 'board', playerId, playerId, 1);
board.drawBoard();
break;
case 'shield':
// TODO:
@ -1037,6 +1039,7 @@ canvas.addEventListener('click', function(event) {
}
break;
}
board.drawBoard();
}
}
}

Loading…
Cancel
Save