def test_trades_smart3(self):
        me = [Voidwalker()]
        opp = [ChillwindYeti()]

        trades = self.make_trades(me, opp)

        self.assertEqual(len(trades.trades()), 2)
        self.assertEqual(trades.trades()[0].opp_minion.__class__, Hero)
Exemple #2
0
    def test_trades_smart2(self):
        me = self.make_cards(Voidwalker())
        opp = self.make_cards(Wisp(), ChillwindYeti())

        trades = self.make_trades(me, opp)

        self.assertEqual(len(trades.trades()), 3)
        self.assertEqual(trades.trades()[0].opp_minion.name, "Wisp")
Exemple #3
0
    def test_trades_smart(self):
        me = self.make_cards(MagmaRager())
        opp = self.make_cards(Wisp(), ChillwindYeti())

        trades = self.make_trades(me, opp)

        self.assertEqual(len(trades.trades()), 3)
        self.assertEqual(trades.trades()[0].opp_minion.name, "Chillwind Yeti")
    def test_trades_smart2(self):
        game = self.make_game()
        me = self.make_cards(game.current_player, Voidwalker())
        opp = self.make_cards(game.other_player, Wisp(), ChillwindYeti())

        trades = self.make_trades(me, opp)

        self.assertEqual(len(trades.trades()), 3)
        self.assertEqual(trades.trades()[0].opp_minion.name, "Wisp")
    def test_lethal_with_two(self):
        me = [ChillwindYeti(), WarGolem()]
        opp = [AmaniBerserker()]

        a = self.make_trades2(me, opp)
        trades = a[1]
        game = a[0]
        game.players[1].hero.health = 10

        self.assertEqual(len(trades.trades()), 2)
        self.assertEqual(trades.trades()[0].opp_minion.__class__, Hero)
Exemple #6
0
    def test_RandomAgent(self):
        deck1 = Deck([
            GoldshireFootman(),
            GoldshireFootman(),
            MurlocRaider(),
            MurlocRaider(),
            BloodfenRaptor(),
            BloodfenRaptor(),
            FrostwolfGrunt(),
            FrostwolfGrunt(),
            RiverCrocolisk(),
            RiverCrocolisk(),
            IronfurGrizzly(),
            IronfurGrizzly(),
            MagmaRager(),
            MagmaRager(),
            SilverbackPatriarch(),
            SilverbackPatriarch(),
            ChillwindYeti(),
            ChillwindYeti(),
            KeeperOfTheGrove(),
            KeeperOfTheGrove(),
            SenjinShieldmasta(),
            SenjinShieldmasta(),
            BootyBayBodyguard(),
            BootyBayBodyguard(),
            FenCreeper(),
            FenCreeper(),
            BoulderfistOgre(),
            BoulderfistOgre(),
            WarGolem(),
            WarGolem(),
        ], Malfurion())

        deck2 = Deck([
            Shieldbearer(),
            Shieldbearer(),
            FlameImp(),
            FlameImp(),
            YoungPriestess(),
            YoungPriestess(),
            DarkIronDwarf(),
            DarkIronDwarf(),
            DireWolfAlpha(),
            DireWolfAlpha(),
            Voidwalker(),
            Voidwalker(),
            HarvestGolem(),
            HarvestGolem(),
            KnifeJuggler(),
            KnifeJuggler(),
            ShatteredSunCleric(),
            ShatteredSunCleric(),
            ArgentSquire(),
            ArgentSquire(),
            Doomguard(),
            Doomguard(),
            Soulfire(),
            Soulfire(),
            DefenderOfArgus(),
            DefenderOfArgus(),
            AbusiveSergeant(),
            AbusiveSergeant(),
            NerubianEgg(),
            NerubianEgg(),
        ], Guldan())

        game = Game([deck1, deck2], [RandomAgent(), RandomAgent()])
        game.pre_game()
        game.current_player = game.players[1]

        game.play_single_turn()

        self.assertEqual(0, len(game.current_player.minions))

        game.play_single_turn()
        self.assertEqual(2, len(game.current_player.minions))
        self.assertEqual(3, game.current_player.minions[1].health)
        self.assertEqual("Young Priestess",
                         game.current_player.minions[0].card.name)

        game.play_single_turn()
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual("Frostwolf Grunt",
                         game.current_player.minions[0].card.name)

        game.play_single_turn()
        self.assertEqual(0, len(game.other_player.minions))
        self.assertEqual(28, game.other_player.hero.health)
        self.assertEqual(3, len(game.current_player.minions))
        self.assertEqual("Dire Wolf Alpha",
                         game.current_player.minions[2].card.name)

        for turn in range(0, 13):
            game.play_single_turn()
            self.assertFalse(game.game_ended)

        game.play_single_turn()

        self.assertEqual(0, game.current_player.hero.health)
        self.assertEqual(21, game.other_player.hero.health)

        self.assertTrue(game.game_ended)