Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
leondelee committed Sep 5, 2018
1 parent 9fc8f94 commit a442e3c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
15 changes: 8 additions & 7 deletions core/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def call_score_end(self):
for p in self.players:
p.send(response)
logger.info('Player[%d] IS LANDLORD[%s]', self.turn_player.uid, str(self.pokers))
# winner = self.players[-1]
# self.on_game_over(winner)
winner = self.players[0]
self.on_game_over(winner)

def go_next_turn(self):
self.whose_turn += 1
Expand Down Expand Up @@ -145,11 +145,12 @@ def on_game_over(self, winner):
# return
coin = self.room.entrance_fee * self.call_score * self.multiple
for p in self.players:
response = [Pt.RSP_GAME_OVER, p.uid, coin if p != winner else coin * 2 - 100]
print(response)
for pp in self.players:
if pp != p:
response.append([pp.uid, *pp.hand_pokers])
if p == winner:
response = [Pt.RSP_GAME_OVER, p.uid, coin if p != winner else coin * 2 - 100]

for pp in self.players:
if pp != p:
response.append([pp.uid, *pp.hand_pokers])
p.send(response)
# TODO deduct coin from database
# TODO store poker round to database
Expand Down
7 changes: 6 additions & 1 deletion static/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ PG.Game.prototype = {
this.players[loserASeat].cleanPokers();
this.players[loserBSeat].uiLeftPoker.kill();
this.players[loserASeat].uiLeftPoker.kill();
// this
// this.players[winner].uiLeftPoker.kill();
PG.Socket.send([PG.Protocol.REQ_RESTART]);
}
this.game.time.events.add(1000, gameOver, this);
Expand Down Expand Up @@ -163,7 +165,10 @@ PG.Game.prototype = {
this.players.push(PG.createPlay(0, this));
this.players.push(PG.createPlay(1, this));
this.players.push(PG.createPlay(2, this));
this.players[0].updateInfo(PG.playerInfo.uid, PG.playerInfo.username);
for (var i = 0; i < 3; i++) {
this.players[i].uiHead.kill();
this.players[i].updateInfo(this.players[i].uid, 'null');
}

// this.send_message([PG.Protocol.REQ_DEAL_POKEER, -1]);
// PG.Socket.send([PG.Protocol.REQ_JOIN_TABLE, this.tableId]);
Expand Down

0 comments on commit a442e3c

Please sign in to comment.