def skip_next_turn(self, msg): def condition(keeper): if keeper.players.peek() == self: keeper.players.next() return True else: return False def skipTurn(keeper): keeper.newTurn() skipTurn.expire() return replace(Keeper, "newTurn", skipTurn, condition=condition, msg=msg)
def skip_next_turn(self, msg): def condition(keeper): if keeper.player_cycler.peek() == self: keeper.nextActivePlayer() return True else: return False def skipTurn(keeper): keeper.newTurn() skipTurn.expire() return replace(Keeper, "newTurn", skipTurn, condition=condition, msg=msg)
def redirect_to(planeswalker): from Player import Player def condition(self, amt, source, combat): controller = planeswalker.controller return self == controller and not (combat or source.controller == controller) def redirectDamage(self, amt, source, combat=False): redirect = source.controller.getIntention("", "Redirect %d damage to %s?"%(amt, planeswalker)) if redirect: dmg = planeswalker.assignDamage(amt, source, combat) else: dmg = self.assignDamage(amt, source, combat) return dmg return replace(Player, "assignDamage", redirectDamage, condition=condition, msg="Redirect damage to %s"%planeswalker)
def redirect_to(planeswalker): from Player import Player def condition(self, amt, source, combat): controller = planeswalker.controller return self == controller and not (combat or source.controller == controller) def redirectDamage(self, amt, source, combat=False): redirect = source.controller.getIntention( "", "Redirect %d damage to %s?" % (amt, planeswalker)) if redirect: dmg = planeswalker.assignDamage(amt, source, combat) else: dmg = self.assignDamage(amt, source, combat) return dmg return replace(Player, "assignDamage", redirectDamage, condition=condition, msg="Redirect damage to %s" % planeswalker)