Exemple #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")
Exemple #2
0
    def test_Throne_Room_on_Workshop(self):
        tu.print_test_header("test Throne Room workshop")
        throne_room = base.Throne_Room(self.game, self.player1)
        workshop = base.Workshop(self.game, self.player1)
        self.player1.hand.add(workshop)
        self.player1.hand.add(throne_room)

        select_future = gen.Future()
        select_from_supply_future = gen.Future()
        select_from_supply_future2 = gen.Future()
        self.player1.select = unittest.mock.MagicMock(
            return_value=select_future)
        self.player1.select_from_supply = unittest.mock.MagicMock(side_effect=[
            select_from_supply_future, select_from_supply_future2
        ])
        self.player1.gain = unittest.mock.Mock(wraps=self.player1.gain)

        throne_room.play()
        select_future.set_result(["Workshop"])
        yield gen.moment

        select_from_supply_future.set_result(["Silver"])
        yield gen.moment
        self.player1.gain.assert_called_once_with("Silver")

        select_from_supply_future2.set_result(["Estate"])
        yield gen.moment
        self.player1.gain.assert_called_with("Estate")
Exemple #3
0
	def test_Torturer_Throne_Room(self):
		tu.print_test_header("test Torturer Throne Room")
		throne_room = base.Throne_Room(self.game, self.player1)
		torturer = intrigue.Torturer(self.game, self.player1)
		self.player1.hand.add(torturer)

		throne_room.play()
		#Throne room a torturer
		yield tu.send_input(self.player1, "post_selection", ["Torturer"])
		#Player 2 is choosing, everyone else waits
		self.assertTrue(self.player1.last_mode["mode"] == "wait")
		self.assertTrue("player2" in self.player1.last_mode["msg"])
		self.assertTrue(self.player3.last_mode["mode"] == "wait")

		yield tu.send_input(self.player2, "post_selection", ["Gain a Curse"])
		#player3's turn to get torturered
		self.assertTrue("player3" in self.player1.last_mode["msg"])
		self.assertTrue(self.player3.last_mode["mode"] != "wait")
		self.assertTrue(self.player2.last_mode["mode"] == "wait")
		self.assertTrue(self.player1.last_mode["mode"] == "wait")

		yield tu.send_input(self.player3, "post_selection", ["Gain a Curse"])
		self.assertTrue("Curse" in self.player3.hand)
		yield gen.sleep(.1)
		#Second torturer
		yield tu.send_input(self.player2, "post_selection", ["Discard 2 cards"])
		self.assertTrue(self.player1.last_mode["mode"] == "wait")
		self.assertTrue(self.player3.last_mode["mode"] == "wait")
		yield tu.send_input(self.player2, "post_selection", ["Curse", "Copper"])
		self.assertTrue(self.player3.last_mode["mode"] != "wait")
		yield tu.send_input(self.player3, "post_selection", ["Gain a Curse"])
		self.assertTrue(self.player1.last_mode["mode"] != "wait")
Exemple #4
0
    def test_Crossroads_Throne_Room(self):
        tu.print_test_header("test Crossroads Throne Room")
        crossroads = hl.Crossroads(self.game, self.player1)
        throneroom = base.Throne_Room(self.game, self.player1)
        self.player1.hand.add(throneroom)
        self.player1.hand.add(crossroads)

        tu.send_input(self.player1, "play", "Throne Room")
        yield tu.send_input(self.player1, "post_selection", ["Crossroads"])
        self.assertTrue(self.player1.actions == 3)
Exemple #5
0
	def test_Minion_Throne_Room(self):
		tu.print_test_header("test Minion Throne Room")
		minion = intrigue.Minion(self.game, self.player1)
		throneroom = base.Throne_Room(self.game, self.player1)
		self.player1.hand.add(minion)
		self.player1.hand.add(throneroom)
		throneroom.play()
		yield tu.send_input(self.player1, "post_selection", ["Minion"])
		yield tu.send_input(self.player1, "post_selection", ["+$2"])
		yield tu.send_input(self.player1, "post_selection", ["discard hand and draw 4 cards"])
		self.assertTrue(len(self.player1.hand) == 4)
		self.assertTrue(self.player1.balance == 2)
Exemple #6
0
	def test_Conspirator_Throne_Room(self):
		tu.print_test_header("test Conspirator Throne Room")
		conspirator = intrigue.Conspirator(self.game, self.player1)
		throne_room = base.Throne_Room(self.game, self.player1)
		tu.set_player_hand(self.player1, [conspirator, throne_room])
		throne_room.play()
		handsize = len(self.player1.hand)
		yield tu.send_input(self.player1, "post_selection", ["Conspirator"])
		self.assertTrue(self.player1.actions == 1)
		self.assertTrue(self.player1.balance == 4)
		#discard conspirator, draw 1 card should have same handsize
		self.assertTrue(handsize == len(self.player1.hand))
Exemple #7
0
	def test_Mining_Village_Throne_Room(self):
		tu.print_test_header("test Mining Village Throne Room")
		mining_village = intrigue.Mining_Village(self.game, self.player1)
		mining_village2 = intrigue.Mining_Village(self.game, self.player1)
		throne_room = base.Throne_Room(self.game, self.player1)
		self.player1.hand.add(mining_village)
		self.player1.hand.add(mining_village2)
		self.player1.hand.add(throne_room)

		throne_room.play()
		yield tu.send_input(self.player1, "post_selection", ["Mining Village"])
		self.assertTrue(self.player1.actions, 2)
		yield tu.send_input(self.player1, "post_selection", ["Yes"])
		self.assertTrue(self.player1.balance == 2)
		yield tu.send_input(self.player1, "post_selection", ["Yes"])
		self.assertTrue(self.player1.balance == 2)
Exemple #8
0
	def test_Upgrade_Selection_issue_21(self):
		tu.print_test_header("test Upgrade selection issue 21")
		upgrade = intrigue.Upgrade(self.game, self.player1)
		throne_room = base.Throne_Room(self.game, self.player1)
		self.player1.deck.append(supply_cards.Estate(self.game, self.player1))
		self.player1.deck.append(supply_cards.Silver(self.game, self.player1))

		self.player1.hand.add(upgrade)
		self.player1.hand.add(throne_room)
		throne_room.play()
		yield tu.send_input(self.player1, "post_selection", ["Upgrade"])
		yield tu.send_input(self.player1, "post_selection", ["Silver"])
		yield tu.send_input(self.player1, "selectSupply", ["Coppersmith"])
		self.assertTrue(self.player1.discard_pile[-1].title == "Coppersmith")
		yield gen.moment
		yield tu.send_input(self.player1, "post_selection", ["Estate"])
		yield tu.send_input(self.player1, "selectSupply", ["Silver"])
		self.assertTrue(self.player1.discard_pile[-1].title == "Silver")
Exemple #9
0
    def test_Throne_Room_Scheme(self):
        tu.print_test_header("test Throne Room Scheme")
        scheme = hl.Scheme(self.game, self.player1)
        tr = base.Throne_Room(self.game, self.player1)
        self.player1.hand.add(scheme)
        self.player1.hand.add(tr)

        tr.play()
        yield tu.send_input(self.player1, "post_selection", ["Scheme"])
        self.player1.end_turn()
        self.assertTrue(self.player1.last_mode["mode"] == "select")
        self.assertTrue(self.player1.last_mode["max_cards"] == 2)
        num_cards = len(self.player1.all_cards())
        yield tu.send_input(self.player1, "post_selection",
                            ["Throne Room", "Scheme"])
        self.assertTrue(num_cards == len(self.player1.all_cards()))
        self.assertTrue("Throne Room" in self.player1.hand)
        self.assertTrue("Scheme" in self.player1.hand)
Exemple #10
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)
Exemple #11
0
	def test_Coppersmith_Throne_Room(self):
		tu.print_test_header("test Coppersmith Throne Room")
		coppersmith = intrigue.Coppersmith(self.game, self.player1)
		throneroom = base.Throne_Room(self.game, self.player1)
		copper = supply_cards.Copper(self.game, self.player1)
		self.player1.hand.add(coppersmith)
		self.player1.hand.add(throneroom)
		self.player1.hand.add(copper)

		throneroom.play()
		yield tu.send_input(self.player1, "post_selection", ["Coppersmith"])
		copper.play()
		self.assertTrue(self.player1.balance == 3)
		#we played throne room, coppersmith, copper
		self.assertTrue(len(self.player1.played_cards) == 3)
		self.player1.end_turn()
		self.assertTrue(copper.value == 1)
		#make sure we only have 1 coppersmith in our deck
		coppersmiths = [x for x in self.player1.all_cards() if x.title == "Coppersmith"]
		self.assertTrue(len(coppersmiths) == 1)
Exemple #12
0
    def test_tr_tr_duration(self):
        tu.print_test_header("Test throne room throne room duration")
        tr = base.Throne_Room(self.game, self.player1)
        caravan = sea.Caravan(self.game, self.player1)
        tu.add_many_to_hand(self.player1, tr, 2)
        tu.add_many_to_hand(self.player1, caravan, 2)

        player1_tr_1_select_future = gen.Future()
        player1_tr_2_select_future = gen.Future()
        player1_tr_3_select_future = gen.Future()
        self.player1.select = unittest.mock.Mock(side_effect=[
            player1_tr_1_select_future, player1_tr_2_select_future,
            player1_tr_3_select_future
        ])
        tr.play()
        player1_tr_1_select_future.set_result(["Throne Room"])
        yield gen.moment
        player1_tr_2_select_future.set_result(["Caravan"])
        yield gen.moment
        player1_tr_3_select_future.set_result(["Caravan"])
        yield gen.moment
        self.assertTrue(len(self.player1.durations) == 3)
        self.assertTrue(len(self.player1.played_cards) == 1)
        self.assertTrue(len(self.player1.duration_cbs) == 6)
Exemple #13
0
    def test_throne_room_duration(self):
        tu.print_test_header("Test throne room duration end effect")
        throne_room = base.Throne_Room(self.game, self.player1)
        lighthouse = sea.Lighthouse(self.game, self.player1)
        self.player1.hand.add(throne_room)
        self.player1.hand.add(lighthouse)
        yield tu.send_input(self.player1, "play", "Throne Room")
        yield tu.send_input(self.player1, "post_selection", ["Lighthouse"])
        self.assertTrue(throne_room in self.player1.durations)
        self.assertTrue(lighthouse in self.player1.durations)
        self.assertTrue(throne_room not in self.player1.played_cards)
        self.assertTrue(lighthouse not in self.player1.played_cards)
        self.assertTrue(self.player1.actions == 2)
        self.assertTrue(self.player1.balance == 2)

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

        self.assertTrue(throne_room not in self.player1.durations)
        self.assertTrue(lighthouse not in self.player1.durations)
        self.assertTrue(throne_room in self.player1.played_cards)
        self.assertTrue(lighthouse in self.player1.played_cards)
        self.assertTrue(self.player1.balance == 2)