Add a stateful «turnCard» variable like «selected» to fix the «double card» bug when choosing a card in the river after a Turned card step

This commit is contained in:
Tissevert 2019-10-18 19:01:13 +02:00
parent 6dfaaee385
commit b03c7fd087

View file

@ -9,6 +9,7 @@ function Game(modules) {
};
var sets = buildSets();
var selected = null;
var turnedCard = null;
var queue = [];
function buildSets() {
@ -174,7 +175,8 @@ function Game(modules) {
movingCards.push([sets[side].hand, dest, card]);
} else {
var cardSet = {};
cardSet[card.name] = new TurnedCard(card.name);
cardSet[card.name] = turnedCard || new TurnedCard(card.name);
turnedCard = null;
movingCards.push([{card: cardSet, dom: deck}, dest, card]);
}
return movingCards;
@ -189,7 +191,7 @@ function Game(modules) {
function moveCard(fromSet, toSet, card) {
var from, originalCard;
var slot = modules.dom.make('li', {class: ['card', 'slot']});
var slot = modules.dom.make('li', {class: ['card', 'slot']});
if (fromSet.card[card.name] != undefined) {
originalCard = fromSet.card[card.name].dom;
delete fromSet.card[card.name];