Пример #1
0
 def test_should_automatically_end_turn_when_player_has_zero_cards(self):
     """
     Player should not be asked to drop cards if he has less card on hand than hp.
     """
     (game, running_game) = self.prepare_game(self.six_bangs())
     step = running_game.send(SkipCommand())
     self.assert_notification(step, PlayCard, game.state.players[1])
Пример #2
0
 def test_must_drop_cards_if_he_has_more_cards_than_hp_2(self):
     """
     If player has 1 health and 4 cards then he must drop cards.
     """
     (game, running_game) = self.prepare_game(self.six_bangs())
     game.state.current_player.health = 4
     step = running_game.send(SkipCommand())
     self.assert_notification(step, PlayCard, game.state.players[1])
Пример #3
0
 def test_must_drop_enough_cards_2(self):
     """
     If player has 1 health and 4 cards then he must drop cards.
     """
     (game, running_game) = self.prepare_game(self.six_bangs())
     game.state.current_player.health = 1
     running_game.send(SkipCommand())
     step = running_game.send(DropCardsCommand([1, 2, 3]))
     self.assert_notification(step, PlayCard, game.state.players[1])
Пример #4
0
 def test_must_drop_enough_cards(self):
     """
     If player has 1 health and 4 cards then he must drop cards.
     """
     (game, running_game) = self.prepare_game(self.six_bangs())
     game.state.current_player.health = 1
     running_game.send(SkipCommand())
     step = running_game.send(DropCardsCommand([1]))
     self.assert_error(step, Error.TOO_LITTLE_CARDS_DROPPED)
Пример #5
0
 def test_bang_with_error(self):
     (game, running_game) = self.prepare_game(["bang", "bang", "bang", "bang", "bang", "dodge"])
     running_game.send(BangCommand("julian"))
     # julian plays dodge event though he has only bang's on hand
     error = running_game.send(DodgeCommand())
     # he should be asked to repeat his move
     step = running_game.send(SkipCommand())
     # and it should not fail
     self.assert_notification(step, DamageReceivedAndEndTurn, game.state.find_player("julian"))
Пример #6
0
def skip_adapter(command):
    if command == "skip":
        return SkipCommand()
    return None