diff --git a/src/Game.hs b/src/Game.hs index dae8463..ff81076 100644 --- a/src/Game.hs +++ b/src/Game.hs @@ -65,6 +65,7 @@ extractPublicState game = PublicState { , river = KoiKoi.river game , step = KoiKoi.step game , trick = KoiKoi.trick game + , turns = 24 - length (KoiKoi.deck game) , rounds = KoiKoi.rounds game } diff --git a/www/game.css b/www/game.css index 1ccb1c9..d3fe2ff 100644 --- a/www/game.css +++ b/www/game.css @@ -111,39 +111,39 @@ margin: 0; } -#rest.init, #rest.count24 { +#rest.init, #rest.turn0 { box-shadow: 2px 3px 0 0 #555, 4px 6px 0 0 #555, 6px 9px 0 0 #555; } -#rest.count22 { +#rest.turn2 { box-shadow: 2px 3px 0 0 #555, 4px 6px 0 0 #555, 5.5px 8.3px 0 0 #555; } -#rest.count20 { +#rest.turn4 { box-shadow: 2px 3px 0 0 #555, 4px 6px 0 0 #555, 5px 7.5px 0 0 #555; } -#rest.count18 { +#rest.turn6 { box-shadow: 2px 3px 0 0 #555, 4px 6px 0 0 #555, 4.5px 6.8px 0 0 #555; } -#rest.count16 { +#rest.turn8 { box-shadow: 2px 3px 0 0 #555, 4px 6px 0 0 #555; } -#rest.count14 { +#rest.turn10 { box-shadow: 2px 3px 0 0 #555, 3.5px 5.3px 0 0 #555; } -#rest.count12 { +#rest.turn12 { box-shadow: 2px 3px 0 0 #555, 3px 4.5px 0 0 #555; } -#rest.count10 { +#rest.turn14 { box-shadow: 2px 3px 0 0 #555, 2.5px 3.8px 0 0 #555; } -#rest.count8 { +#rest.turn16 { box-shadow: 2px 3px 0 0 #555; } diff --git a/www/game.js b/www/game.js index 4e12136..dd31ddf 100644 --- a/www/game.js +++ b/www/game.js @@ -53,7 +53,7 @@ function Game(modules) { } function handleGameMessage(o) { - if(o.game.deck == 24) { // deck is full, means new round + if(o.game.publicState.turns == 0) { if(o.logs.length > 0) { // but still some logs, from the previous round return modules.async.sequence(applyDiff(o), setGame(o)); // so play the diff, then set the new round } else { @@ -99,7 +99,7 @@ function Game(modules) { setTurned(o.game.step.contents); } else { if(status.step == "ToPlay" && o.game.playing == o.game.oyake) { - rest.className = ["card", "count" + o.game.deck].join(' '); + rest.className = ["card", "turn" + o.game.publicState.turns].join(' '); } if(deck.lastChild.id != "rest") { deck.removeChild(deck.lastChild); @@ -294,7 +294,7 @@ function Game(modules) { function setTheirCards(game) { var turnsTheyPlayed = Math.floor( - (24 - game.deck + (modules.session.is(game.oyake) ? 0 : 1)) / 2 + (game.publicState.turns + (modules.session.is(game.oyake) ? 0 : 1)) / 2 ); modules.dom.clear(sets.them.hand.dom); for(var i = 0; i < 8 - turnsTheyPlayed; i++) {