misc Tarot fixes
- wix, primitivus, quick_frontend: autoplay fonction is activated by changing self._autoplay from None to 0 in quick card game - primitivus: added forgotten import of log methods - primitivus: fix bad selected color for notification messages - primitivus: score are now shown
This commit is contained in:
parent
4d4c768fd5
commit
d2644f1258
1 changed files with 21 additions and 14 deletions
|
|
@ -27,7 +27,7 @@ from tools.jid import JID
|
|||
class QuickCardGame():
|
||||
|
||||
def __init__(self, parent, referee, players, player_nick):
|
||||
self.__fake_idx = 0 #gof:
|
||||
self._autoplay = None #XXX: use 0 to activate fake play, None else
|
||||
self.parent = parent
|
||||
self.referee = referee
|
||||
self.players = players
|
||||
|
|
@ -101,23 +101,26 @@ class QuickCardGame():
|
|||
if self.state == "chien":
|
||||
self.to_show = []
|
||||
self.state = "play"
|
||||
#self.__fakePlay() #gof:
|
||||
self.__fakePlay()
|
||||
|
||||
def __fakePlay(self):
|
||||
"""Convenience method for stupid autoplay
|
||||
/!\ don't forgot to comment any interactive dialog for invalid card"""
|
||||
#gof:
|
||||
if self.__fake_idx >= len(self.hand):
|
||||
self.__fake_idx = 0
|
||||
card = self.hand[self.__fake_idx]
|
||||
if self._autoplay == None:
|
||||
return
|
||||
if self._autoplay >= len(self.hand):
|
||||
self._autoplay = 0
|
||||
card = self.hand[self._autoplay]
|
||||
self.parent.host.bridge.tarotGamePlayCards(self.player_nick, self.referee, [(card.suit, card.value)], profile_key = self.parent.host.profile)
|
||||
del self.hand[self.__fake_idx]
|
||||
del self.hand[self._autoplay]
|
||||
self.state = "wait"
|
||||
self.__fake_idx+=1
|
||||
self._autoplay+=1
|
||||
|
||||
def showScores(self, xml_data, winners, loosers):
|
||||
"""Called when the player as to select hist contrat
|
||||
@param xml_data: SàT xml representation of the form"""
|
||||
"""Called at the end of a game
|
||||
@param xml_data: SàT xml representation of the scores
|
||||
@param winners: list of winners' nicks
|
||||
@param loosers: list of loosers' nicks"""
|
||||
raise NotImplementedError
|
||||
|
||||
def cardsPlayed(self, player, cards):
|
||||
|
|
@ -149,5 +152,5 @@ class QuickCardGame():
|
|||
self.hand.append(self.cards[suit, value])
|
||||
|
||||
self.hand.sort()
|
||||
#self.__fakePlay() #gof:
|
||||
self.__fakePlay()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue