Tarot game: invalid cards management

- tarot plugin: card validity check, new signal tarotGameInvalidCards
- wix: when an invalid cards signal is received, the cards are back in the hand, and the state change so the player as to play again.
This commit is contained in:
Goffi 2010-06-18 15:19:32 +08:00
commit e337d590e3

View file

@ -193,6 +193,29 @@ class CardPanel(wx.Panel):
self.played[player] = pl_cards[0]
self.Refresh()
def invalidCards(self, phase, played_cards, invalid_cards):
"""Invalid cards have been played
@param phase: phase of the game
@param played_cards: all the cards played
@param invalid_cards: cards which are invalid"""
if phase == "play":
self.state = "play"
elif phase == "ecart":
self.state = "ecart"
else:
error ('INTERNAL ERROR: unmanaged game phase')
for suit, value in played_cards:
self.hand.append(self.cards[suit, value])
self._recalc_ori()
self.Refresh()
self.hand.sort()
wx.MessageDialog(self, _("Cards played are invalid !"), _("Error"), wx.OK | wx.ICON_ERROR).ShowModal()
def _is_on_hand(self, pos_x, pos_y):
"""Return True if the coordinate are on the hand cards"""