Example #1
0
    def test_throne_room_throne_room(self):
        tu.print_test_header("Test throne room throne room")
        throneroom = base.Throne_Room(self.game, self.player1)
        throneroom2 = base.Throne_Room(self.game, self.player1)
        self.player1.hand.add(throneroom)
        self.player1.hand.add(throneroom2)
        yield tu.send_input(self.player1, "play", "Throne Room")
        yield tu.send_input(self.player1, "post_selection", ["Throne Room"])

        self.player1.end_turn()
        self.player2.end_turn()
        self.player3.end_turn()

        self.player1.hand.add(throneroom)
        self.player1.hand.add(throneroom2)
        self.player1.hand.add(base.Village(self.game, self.player1))
        self.player1.hand.add(base.Village(self.game, self.player1))
        self.player1.hand.add(base.Woodcutter(self.game, self.player1))
        yield tu.send_input(self.player1, "play", "Throne Room")
        yield tu.send_input(self.player1, "post_selection", ["Village"])
        self.assertTrue(self.player1.actions == 4)
        self.assertTrue(self.player1.last_mode["mode"] == "action")

        yield tu.send_input(self.player1, "play", "Throne Room")
        yield tu.send_input(self.player1, "post_selection", ["Woodcutter"])
        self.assertTrue(self.player1.balance == 4)
        self.assertTrue(self.player1.last_mode["mode"] == "action")
Example #2
0
    def test_quarry_peddler(self):
        tu.print_test_header("test Quarry Peddler")
        village = base.Village(self.game, self.player1)
        quarry = prosperity.Quarry(self.game, self.player1)

        supply_peddler = self.game.supply.get_card("Peddler")
        village.play()
        quarry.play()
        self.assertTrue(supply_peddler.get_price() == 8 - 2 - 2)
Example #3
0
 def test_Library(self):
     tu.print_test_header("test Library")
     library = base.Library(self.game, self.player1)
     village = base.Village(self.game, self.player1)
     copper = supply_cards.Copper(self.game, self.player1)
     self.player1.deck = [copper, village, copper]
     self.player1.hand.add(library)
     self.player1.hand.add = unittest.mock.Mock()
     select_future = gen.Future()
     self.player1.select = unittest.mock.Mock(return_value=select_future)
     library.play()
     self.player1.hand.add.assert_called_with(copper)
     select_future.set_result(["Yes"])
     yield gen.moment
     self.player1.hand.add.assert_called_with(copper)
     self.assertTrue("Village" not in self.player1.hand)
Example #4
0
    def test_Peddler(self):
        tu.print_test_header("test Peddler")
        village = base.Village(self.game, self.player1)
        copper = supply_cards.Copper(self.game, self.player1)
        self.player1.hand.add(copper)
        tu.add_many_to_hand(self.player1, village, 5)

        village.play()
        self.assertTrue(self.game.price_modifier["Peddler"] == 0)
        village.play()
        village.play()
        village.play()
        village.play()
        copper.play()
        self.assertTrue(self.game.price_modifier["Peddler"] == -10)
        self.assertTrue(self.game.card_from_title("Peddler").get_price() == 0)
Example #5
0
	def test_Conspirator(self):
		tu.print_test_header("test Conspirator")
		conspirator = intrigue.Conspirator(self.game, self.player1)
		tu.add_many_to_hand(self.player1, conspirator,2)

		village = base.Village(self.game, self.player1)
		self.player1.hand.add(village)

		village.play()
		conspirator.play()
		self.assertTrue(self.player1.actions == 1)
		self.assertTrue(self.player1.balance == 2)

		cards_in_hand = len(self.player1.hand)
		conspirator.play()
		self.assertTrue(self.player1.actions == 1)
		self.assertTrue(len(self.player1.hand) == cards_in_hand)
Example #6
0
	def test_Mining_Village_Conspirator(self):
		tu.print_test_header("test Mining Village Conspirator")
		mv = intrigue.Mining_Village(self.game, self.player1)
		village = base.Village(self.game, self.player1)
		conspirator = intrigue.Conspirator(self.game, self.player1)
		self.player1.hand.add(mv)
		self.player1.hand.add(village)
		self.player1.hand.add(conspirator)
		village.play()
		mv.play()
		yield tu.send_input(self.player1, "post_selection", ["Yes"])
		self.assertFalse(mv in self.player1.played_cards)
		self.assertTrue(mv in self.game.trash_pile)
		self.assertTrue(self.player1.actions == 3)
		conspirator.play()
		self.assertTrue(self.player1.actions == 3)
		self.player1.exec_commands({"command": "endTurn"})
		self.assertTrue(mv not in self.player1.discard_pile)
Example #7
0
    def test_inn_gain(self):
        tu.print_test_header("test Inn on gain")
        village = base.Village(self.game, self.player1)
        moat = base.Moat(self.game, self.player1)
        copper = supply_cards.Copper(self.game, self.player1)
        self.player1.discard_pile = [village, moat, copper]

        self.player1.gain('Inn')
        self.assertTrue(self.player1.last_mode["mode"] == "select")
        self.assertTrue("Village" in self.player1.last_mode["select_from"])
        self.assertTrue("Moat" in self.player1.last_mode["select_from"])
        self.assertTrue("Inn" in self.player1.last_mode["select_from"])
        self.assertTrue("Copper" not in self.player1.last_mode["select_from"])
        yield tu.send_input(self.player1, "post_selection",
                            ["Village", "Moat", "Inn"])
        self.assertTrue(self.player1.discard_pile == [copper])
        self.assertTrue(village in self.player1.deck)
        self.assertTrue(moat in self.player1.deck)
Example #8
0
    def test_Throne_Room_on_Village(self):
        tu.print_test_header("test Throne Room Village")
        throne_room_card = base.Throne_Room(self.game, self.player1)
        village = base.Village(self.game, self.player1)
        self.player1.hand.add(throne_room_card)
        self.player1.hand.add(village)

        village.play = unittest.mock.Mock()
        select_future = gen.Future()
        throne_room_selection = unittest.mock.MagicMock(
            return_value=select_future)

        self.player1.select = throne_room_selection

        throne_room_card.play()
        select_future.set_result(["Village"])
        yield gen.moment
        village.play.assert_called_with(True)
        self.assertTrue(village.play.call_count == 2)
Example #9
0
    def test_Cartographer(self):
        tu.print_test_header("test Cartographer")
        cart = hl.Cartographer(self.game, self.player1)
        village = base.Village(self.game, self.player1)
        silver = supply_cards.Silver(self.game, self.player1)
        self.player1.deck += [village, silver, village, village]
        #draw the gold with cartographer
        self.player1.deck.append(supply_cards.Gold(self.game, self.player1))
        self.player1.hand.add(cart)

        cart.play()
        self.assertTrue(self.player1.last_mode["mode"] == "select")
        self.assertTrue(self.player1.last_mode["max_cards"] == 4)
        yield tu.send_input(self.player1, "post_selection",
                            ["Village", "Village"])
        self.assertTrue(self.player1.discard_pile[-1].title == "Village")
        self.assertTrue(self.player1.discard_pile[-2].title == "Village")
        self.assertTrue(self.player1.last_mode["mode"] == "select")
        self.assertTrue(self.player1.last_mode["max_cards"] == 2)
        yield tu.send_input(self.player1, "post_selection",
                            ["Silver", "Village"])

        self.assertTrue(self.player1.deck[-1].title == "Village")
        self.assertTrue(self.player1.deck[-2].title == "Silver")