def test_watchtower_trader(self): tu.print_test_header("test Watchtower Trader") watchtower = prosperity.Watchtower(self.game, self.player1) trader = hl.Trader(self.game, self.player1) self.player1.hand.add(watchtower) self.player1.hand.add(trader) self.player1.spend_all_money() yield tu.send_input(self.player1, "buyCard", "Copper") self.assertTrue(self.player1.last_mode["mode"] == "select") #order reactions, reveal trader then watchtower yield tu.send_input(self.player1, "post_selection", ["Watchtower", "Trader"]) self.assertTrue(self.player1.last_mode["mode"] == "select") #reveal trader yield tu.send_input(self.player1, "post_selection", ["Reveal"]) self.assertTrue(self.game.supply.get_count("Copper") == 30) #gaining silver now yield tu.send_input(self.player1, "post_selection", ["Watchtower", "Trader"]) # trader's reaction is ignored since its for silver # reveal watchtower yield tu.send_input(self.player1, "post_selection", ["Reveal"]) yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"]) self.assertTrue(self.player1.deck[-1].title == "Silver") #watchtower from the copper earlier yield tu.send_input(self.player1, "post_selection", ["Reveal"]) yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"]) self.assertTrue(self.player1.deck[-1].title == "Silver")
def test_Watchtower_play(self): tu.print_test_header("testing Watchtower play action") watchtower = prosperity.Watchtower(self.game, self.player1) watchtower2 = prosperity.Watchtower(self.game, self.player1) estate = supply_cards.Estate(self.game, self.player1) tu.set_player_hand(self.player1, [watchtower, estate, watchtower2]) self.player1.actions = 2 watchtower.play() #3 cards in hand self.assertTrue(len(self.player1.hand) == 6) #7 cards in hand tu.set_player_hand( self.player1, [estate, estate, watchtower2, estate, estate, estate, estate]) watchtower2.play() self.assertTrue(len(self.player1.hand) == 6)
def test_Watchtower_react(self): tu.print_test_header("testing Watchtower reaction") watchtower = prosperity.Watchtower(self.game, self.player1) tu.set_player_hand(self.player1, [watchtower]) self.player1.buy_card("Silver") #0 buys should end turn normally but we have a reaction so should still be player1's turn self.assertTrue(self.game.get_turn_owner().name == self.player1.name) #shouldn't trigger reaction wait for opponents self.assertTrue(self.player2.last_mode["mode"] != "wait") self.assertTrue(self.player3.last_mode["mode"] != "wait") yield tu.send_input(self.player1, "post_selection", ["Reveal"]) yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"]) self.assertTrue(len(self.player1.discard_pile) == 0) self.assertTrue(self.player1.deck[-1].title == "Silver")
def test_duchess_watchtower(self): tu.print_test_header("test Duchess Watchtower") feast = base.Feast(self.game, self.player1) watchtower = prosperity.Watchtower(self.game, self.player1) self.player1.hand.add(watchtower) self.player1.hand.add(feast) tu.send_input(self.player1, "play", "Feast") yield tu.send_input(self.player1, "selectSupply", ["Duchy"]) #choose to gain the duchess yield tu.send_input(self.player1, "post_selection", ["Yes"]) self.assertTrue(self.player1.discard_pile[-1].title == "Duchess") #choose to reveal Watchtower yield tu.send_input(self.player1, "post_selection", ["Reveal"]) yield tu.send_input(self.player1, "post_selection", ["Put on top of deck"]) self.assertTrue(self.player1.deck[-1].title == "Duchess") yield tu.send_input(self.player1, "post_selection", ["Hide"])
def test_Watchtower_Witch(self): tu.print_test_header("testing Watchtower witch") self.player1.end_turn() self.assertTrue(self.game.get_turn_owner().name == self.player2.name) witch = base.Witch(self.game, self.player2) self.player2.hand.add(witch) watchtower2 = prosperity.Watchtower(self.game, self.player1) self.player1.hand.add(watchtower2) witch.play() self.assertTrue(self.player2.last_mode["mode"] == "wait") self.assertTrue(self.player3.discard_pile[-1].title == "Curse") yield tu.send_input(self.player1, "post_selection", ["Reveal"]) self.assertTrue(self.player2.last_mode["mode"] == "wait") yield tu.send_input(self.player1, "post_selection", ["Trash"]) yield gen.sleep(.1) self.assertTrue(self.player2.last_mode["mode"] != "wait") self.assertTrue(self.game.trash_pile[-1].title == "Curse")