diff --git a/www/game.js b/www/game.js index 23c5ba3..3688ea1 100644 --- a/www/game.js +++ b/www/game.js @@ -5,8 +5,7 @@ function Game(modules) { dom: document.getElementById("status"), playing: false, step: null, - month: null, - played: 0 + month: null }; var sets = { river: { @@ -30,12 +29,12 @@ function Game(modules) { ['river', o.game.river, RiverCard], ['yourHand', o.game.players[modules.session.getKey()].hand, HandCard] ].forEach(function(args) {setCardSet.apply(null, args)}); - setTheirCards(o.game.oyake); + setTheirCards(o.game); if(status.step == "Turned") { setTurned(o.game.step.contents); } else { if(status.step == "ToPlay" && o.game.playing == o.game.oyake) { - rest.className = ["card", "count" + (24 - status.played)].join(' '); + rest.className = ["card", "count" + o.game.deck].join(' '); } if(deck.lastChild.id != "rest") { deck.removeChild(deck.lastChild); @@ -67,11 +66,6 @@ function Game(modules) { status.step = game.step.tag; if(game.month != status.month) { status.month = game.month; - status.played = 0; - } else { - if(status.step == "ToPlay") { - status.played++; - } } status.dom.appendChild( modules.dom.make('li', {textContent: "This month's flower is the " + status.month}) @@ -116,9 +110,9 @@ function Game(modules) { }); } - function setTheirCards(oyake) { + function setTheirCards(game) { var turnsTheyPlayed = Math.floor( - (status.played + (modules.session.is(oyake) ? 0 : 1)) / 2 + (24 - game.deck + (modules.session.is(game.oyake) ? 0 : 1)) / 2 ); modules.dom.clear(sets.theirHand.dom); for(var i = 0; i < 8 - turnsTheyPlayed; i++) {