Tarot game:

- draw game managed
- we can now play continuously \o/
This commit is contained in:
Goffi 2011-05-23 00:46:51 +02:00
commit 2ff3e80b08

View file

@ -27,7 +27,7 @@ from sat.tools.jid import JID
class QuickCardGame():
def __init__(self, parent, referee, players, player_nick):
self._autoplay = None #XXX: use 0 to activate fake play, None else
self._autoplay = 0 #None #XXX: use 0 to activate fake play, None else
self.parent = parent
self.referee = referee
self.players = players
@ -50,6 +50,15 @@ class QuickCardGame():
self.to_show = []
self.state = None
def resetRound(self):
"""Reset the game's variables to be reatty to start the next round"""
del self.selected[:]
del self.hand[:]
del self.to_show[:]
self.state = None
for pl in self.played:
self.played[pl] = None
def getPlayerLocation(self, nick):
"""return player location (top,bottom,left or right)"""
for location in ['top','left','bottom','right']:
@ -91,10 +100,10 @@ class QuickCardGame():
self.to_show = []
for suit, value in cards:
self.to_show.append(self.cards[suit, value])
if game_stage == "chien" and data['attaquant'] == self.player_nick:
self.state = "wait_for_ecart"
else:
self.state = "chien"
if game_stage == "chien" and data['attaquant'] == self.player_nick:
self.state = "wait_for_ecart"
else:
self.state = "chien"
def myTurn(self):
"""Called when we have to play :)"""