def test_phases(self): c = mock.Mock() c.abilities = [] c.types = {"Creature"} self.assertFalse(m.phases(c)) c.abilities.append("Phasing (bla bla)") self.assertTrue(m.phases(c))
def untap(game): """ Perform the :ref:`untap-step`. What Happens ------------ 1. The active player's phased-in permanents phase out, and vice versa. 2. The active player's permanents that can be untapped are untapped. 3. No players get priority. """ player = game.turn.active_player # XXX: Technically the rules say all this is "simultaneous". # At some point that will probably matter, and we will need some tests # and an implementation of that. game.events.trigger( event=events.STEP_BEGAN, phase="beginning", step="untap", player=player, ) for permanent in player.battlefield: if match.phases(permanent): if permanent.is_phased_in: permanent.phase_out() else: permanent.phase_in() if permanent.is_tapped: # XXX: Check if the permanent says it can be untapped. permanent.untap() # XXX: Again, technically abilities can't activate / resolve here, they # should be deferred until the upkeep. game.events.trigger( event=events.STEP_ENDED, phase="beginning", step="untap", player=player, )
def test_match(self): breezekeeper = m.Card.query.get(u"Breezekeeper") self.assertTrue(match.phases(breezekeeper))