Permalink
Browse files

Make give Count() a base class of LazyNum

  • Loading branch information...
jleclanche committed Jul 18, 2015
1 parent 0524dc8 commit 8a5d4228faedc703fd6813f7421db3d2f2691ab4
Showing with 7 additions and 2 deletions.
  1. +7 −2 fireplace/actions.py
@@ -25,7 +25,12 @@ def pick(self, source, game) -> str:
return random.choice(self.cards)
class Count:
class LazyNum:
def evaluate(self, source, game) -> int:
raise NotImplementedError
class Count(LazyNum):
"""
Lazily count the matches in a selector
"""
@@ -388,7 +393,7 @@ def evaluate_selectors(self, source, game):
def trigger(self, source, game):
ret = []
times = self.times
if isinstance(times, Count):
if isinstance(times, LazyNum):
times = times.evaluate(source, game)
for i in range(times):
args = self.evaluate_selectors(source, game)

0 comments on commit 8a5d422

Please sign in to comment.