summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 15:04:48 (GMT)
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2016-08-25 15:16:03 (GMT)
commit5c4ab229ac0dfe0b877636b0d12e10ba343bbed2 (patch)
treee8dc8da9096e35a313cac21604643f853075a71e
parentae7bdee607d5ae6b78e9e10df9064ae55d3d7e00 (diff)
Player: changing lastSource now invalidates _hand
-rw-r--r--src/player.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/player.py b/src/player.py
index 0051b1b..f3bb857 100644
--- a/src/player.py
+++ b/src/player.py
@@ -141,8 +141,8 @@ class Player(StrMixin):
self.handCache = {}
self.cacheHits = 0
self.cacheMisses = 0
- self.clearHand()
self.__lastSource = TileSource.East14th
+ self.clearHand()
self.handBoard = None
def __lt__(self, other):
@@ -270,13 +270,15 @@ class Player(StrMixin):
return self.__lastSource
@lastSource.setter
- def lastSource(self, lastSource):
+ def lastSource(self, value):
"""the source of the last tile the player got"""
- self.__lastSource = lastSource
- if lastSource is TileSource.LivingWallDiscard and not self.game.wall.living:
- self.__lastSource = TileSource.LivingWallEndDiscard
- if lastSource is TileSource.LivingWall and not self.game.wall.living:
- self.__lastSource = TileSource.LivingWallEnd
+ if value is TileSource.LivingWallDiscard and not self.game.wall.living:
+ value = TileSource.LivingWallEndDiscard
+ if value is TileSource.LivingWall and not self.game.wall.living:
+ value = TileSource.LivingWallEnd
+ if self.__lastSource != value:
+ self.__lastSource = value
+ self._hand = None
@property
def nameid(self):