Esempio n. 1
0
    def test_step1(self):
        species1 = Species(3, 4, 5)
        species2 = Species(3, 3, 3)
        speciesList1 = [species1, species2]
        dealer_hand = [TraitCard(CARNIVORE), TraitCard(AMBUSH), TraitCard(WARNING_CALL), TraitCard(LONG_NECK),
                         TraitCard(CARNIVORE), TraitCard(AMBUSH), TraitCard(WARNING_CALL), TraitCard(LONG_NECK),
                         TraitCard(CARNIVORE), TraitCard(AMBUSH)]

        play_strat1 = Player(1)
        play_strat2 = Player(2)
        player1 = PlayerState(1, 0, [], [], play_strat1)
        player2 = PlayerState(2, 2, speciesList1, [], play_strat2)

        expected_player1 = copy.deepcopy(player1)
        expected_player1.species.append(Species(0, 0, 1))
        expected_player1.trait_cards = [TraitCard(AMBUSH), TraitCard(CARNIVORE),
                                        TraitCard(LONG_NECK), TraitCard(WARNING_CALL)]
        expected_player2 = copy.deepcopy(player2)
        expected_player2.trait_cards = [TraitCard(AMBUSH), TraitCard(CARNIVORE), TraitCard(CARNIVORE),
                                        TraitCard(LONG_NECK), TraitCard(WARNING_CALL)]

        dealer = Dealer([player1, player2], 4, dealer_hand)
        dealer.step1()

        self.assertEquals(player1.player_reference.playerState, expected_player1)
        self.assertEquals(player2.player_reference.playerState, expected_player2)
        self.assertEquals(dealer.hand, [TraitCard(AMBUSH)])
Esempio n. 2
0
    def test_get_player_choices(self):
        species1 = Species(3, 4, 5)
        species2 = Species(3, 3, 3)
        speciesList1 = [species1, species2]
        traits = [TraitCard(AMBUSH, -2), TraitCard(CARNIVORE, -2), TraitCard(LONG_NECK, -2), TraitCard(WARNING_CALL, -2)]
        traits2 = [TraitCard(AMBUSH, -1), TraitCard(AMBUSH, 0), TraitCard(AMBUSH, 1), TraitCard(CARNIVORE, -1),
                   TraitCard(CARNIVORE), TraitCard(CARNIVORE, 1), TraitCard(LONG_NECK), TraitCard(LONG_NECK, 1),
                         TraitCard(WARNING_CALL), TraitCard(WARNING_CALL, 1)]

        play_strat1 = Player(1)
        play_strat2 = Player(2)
        player1 = PlayerState(1, 0, [], [], play_strat1)
        player2 = PlayerState(2, 2, speciesList1, traits, play_strat2)

        dealer = Dealer([player1, player2], 4, traits2)
        dealer.step1()
        play_act1 = PlayerAction(0, [GrowPopulation(1, 3)], [], [BoardTrade(1, [2])], [])
        play_act2 = PlayerAction(0, [GrowPopulation(2, 5)], [GrowBody(2, 2)], [BoardTrade(1, [4])],
                                    [ReplaceTrait(2, 0, 6)])

        choices = dealer.get_player_choices()
        self.assertEquals(choices, [play_act1, play_act2])