Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement a CurrentPlayer evaluator
  • Loading branch information
jleclanche committed Sep 3, 2015
1 parent cfb0ead commit 14d4e9f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions fireplace/dsl/evaluator.py
Expand Up @@ -39,6 +39,22 @@ def trigger(self, source):
action.trigger(source)


class CurrentPlayer(Evaluator):
"""
Evaluates to True if the selector is the current player.
Selector must evaluate to only one player.
"""
def __init__(self, selector):
super().__init__()
self.selector = selector

def evaluate(self, source):
for target in self.selector.eval(source.game, source):
if not target.controller.current_player:
return False
return True


class Dead(Evaluator):
"""
Evaluates to True if every target in \a selector is dead
Expand Down

0 comments on commit 14d4e9f

Please sign in to comment.