Commit 13f890e8 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

Blessing rules: add assertions

parent a3dc6616
......@@ -1266,7 +1266,12 @@ class TwofoldFortune(RuleCode):
class BlessingOfHeaven(RuleCode):
def appliesToHand(hand):
return hand.ownWind is East and hand.lastSource is TileSource.East14th
if hand.lastSource is not TileSource.East14th:
return False
if hand.ownWind is not East:
return False
assert hand.lastTile.isConcealed, '{}: Blessing of Heaven: last tile must be concealed'.format(hand)
return True
def selectable(hand):
"""for scoring game"""
......@@ -1278,10 +1283,12 @@ class BlessingOfHeaven(RuleCode):
class BlessingOfEarth(RuleCode):
def appliesToHand(hand):
result = hand.ownWind is not East and hand.lastSource is TileSource.East14th
if result:
assert hand.lastTile.isExposed, '{}: Blessing of Earth: last tile must be exposed'.format(hand)
return result
if hand.lastSource is not TileSource.East14th:
return False
if hand.ownWind is East:
return False
assert hand.lastTile.isExposed, '{}: Blessing of Earth: last tile must be exposed'.format(hand)
return True
def selectable(hand):
"""for scoring game"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment