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

Loading…
Cancel
Save