Example #1
0
 def test_SoulOfTheForest(self):
     game = SavedGame("tests/replays/card_tests/SoulOfTheForest.rep")
     game.start()
     self.assertEqual(2, len(game.other_player.minions))
     self.assertEqual(2, game.other_player.minions[1].calculate_attack())
     self.assertEqual(2, game.other_player.minions[1].health)
     self.assertEqual("Treant", game.other_player.minions[1].card.name)
Example #2
0
 def test_SoulOfTheForest(self):
     game = SavedGame("tests/replays/card_tests/SoulOfTheForest.rep")
     game.start()
     self.assertEqual(2, len(game.other_player.minions))
     self.assertEqual(2, game.other_player.minions[1].calculate_attack())
     self.assertEqual(2, game.other_player.minions[1].health)
     self.assertEqual("Treant", game.other_player.minions[1].card.name)
 def test_option_replay(self):
     game = SavedGame("tests/replays/stonetusk_power.rep")
     game.start()
     panther = game.other_player.minions[0]
     self.assertEqual(panther.card.name, "Panther")
     self.assertEqual(panther.health, 3)
     self.assertEqual(panther.calculate_attack(), 4)
     self.assertEqual(panther.index, 0)
Example #4
0
 def test_BlessingOfWisdom(self):
     game = SavedGame("tests/replays/card_tests/BlessingOfWisdom.rep")
     game.start()
     self.assertEqual(3, len(game.current_player.minions))
     # 7 cards have been drawn.
     # 3 for starting first, 3 for new turn and 1 for minion attack with Blessing of Wisdom
     # (the second minion who had it got silenced)
     self.assertEqual(23, game.other_player.deck.left)
Example #5
0
 def test_option_replay(self):
     game = SavedGame("tests/replays/stonetusk_power.rep")
     game.start()
     panther = game.other_player.minions[0]
     self.assertEqual(panther.card.name, "Panther")
     self.assertEqual(panther.health, 3)
     self.assertEqual(panther.calculate_attack(), 4)
     self.assertEqual(panther.index, 0)
 def test_BlessingOfWisdom(self):
     game = SavedGame("tests/replays/card_tests/BlessingOfWisdom.rep")
     game.start()
     self.assertEqual(3, len(game.current_player.minions))
     # 7 cards have been drawn.
     # 3 for starting first, 3 for new turn and 1 for minion attack with Blessing of Wisdom
     # (the second minion who had it got silenced)
     self.assertEqual(23, game.other_player.deck.left)
    def test_loading_game(self):
        game = SavedGame("tests/replays/example.rep")

        game.start()

        self.assertEqual(game.current_player.deck.character_class, CHARACTER_CLASS.DRUID)
        self.assertEqual(game.other_player.deck.character_class, CHARACTER_CLASS.MAGE)

        self.assertEqual(game.current_player.hero.health, 29)
        self.assertTrue(game.current_player.hero.dead)
Example #8
0
    def test_ArcaneMissilesWithSpellPower(self):
        game = SavedGame("tests/replays/card_tests/ArcaneMissilesWithSpellDamage.rep")
        game.start()

        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(1, game.other_player.minions[0].health)
        self.assertEqual(2, game.other_player.minions[0].calculate_max_health())
        self.assertEqual(27, game.other_player.hero.health)

        return game
Example #9
0
    def test_loading_game(self):
        game = SavedGame("tests/replays/example.rep")

        game.start()

        self.assertEqual(game.current_player.deck.character_class,
                         CHARACTER_CLASS.DRUID)
        self.assertEqual(game.other_player.deck.character_class,
                         CHARACTER_CLASS.MAGE)

        self.assertEqual(game.current_player.hero.health, 29)
        self.assertTrue(game.current_player.hero.dead)
Example #10
0
    def test_ArcaneMissilesWithSpellPower(self):
        game = SavedGame(
            "tests/replays/card_tests/ArcaneMissilesWithSpellDamage.rep")
        game.start()

        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(1, game.other_player.minions[0].health)
        self.assertEqual(2,
                         game.other_player.minions[0].calculate_max_health())
        self.assertEqual(27, game.other_player.hero.health)

        return game
Example #11
0
    def test_NobleSacrifice(self):
        game = generate_game_for(NobleSacrifice, StonetuskBoar, SpellTestingAgent, PredictableBot)

        game.play_single_turn()  # NobleSacrifice should be played
        self.assertEqual(1, len(game.players[0].secrets))
        self.assertEqual("Noble Sacrifice", game.players[0].secrets[0].name)

        game.play_single_turn()
        # Attack with Stonetusk should happen, and the secret should trigger. Both minions should die.
        # One boar is left (after being summoned after the coin)
        self.assertEqual(0, len(game.players[0].secrets))
        self.assertEqual(0, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(29, game.players[0].hero.health)

        # Test with 7 minions
        game = SavedGame("tests/replays/card_tests/NobleSacrifice.rep")
        game.start()
        self.assertEqual(7, len(game.players[0].minions))
        self.assertEqual(29, game.players[0].hero.health)
        self.assertEqual(1, len(game.players[0].secrets))
        self.assertEqual("Noble Sacrifice", game.players[0].secrets[0].name)
Example #12
0
    def test_NobleSacrifice(self):
        game = generate_game_for(NobleSacrifice, StonetuskBoar,
                                 SpellTestingAgent, PredictableBot)

        game.play_single_turn()  # NobleSacrifice should be played
        self.assertEqual(1, len(game.players[0].secrets))
        self.assertEqual("Noble Sacrifice", game.players[0].secrets[0].name)

        game.play_single_turn()
        # Attack with Stonetusk should happen, and the secret should trigger. Both minions should die.
        # One boar is left (after being summoned after the coin)
        self.assertEqual(0, len(game.players[0].secrets))
        self.assertEqual(0, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(29, game.players[0].hero.health)

        # Test with 7 minions
        game = SavedGame("tests/replays/card_tests/NobleSacrifice.rep")
        game.start()
        self.assertEqual(7, len(game.players[0].minions))
        self.assertEqual(29, game.players[0].hero.health)
        self.assertEqual(1, len(game.players[0].secrets))
        self.assertEqual("Noble Sacrifice", game.players[0].secrets[0].name)
Example #13
0
    def test_Shadowform(self):
        game = generate_game_for(IronfurGrizzly, Shadowform,
                                 MinionPlayingAgent, PredictableBot)

        for turn in range(0, 9):
            game.play_single_turn()

        self.assertEqual("Lesser Heal", game.players[1].hero.power.__str__())

        # Shadowform should be played
        game.play_single_turn()
        self.assertEqual("Mind Spike", game.players[1].hero.power.__str__())

        # Nothing special
        game.play_single_turn()

        # Mind Spike should be used, and Shadowform should be played
        game.play_single_turn()
        self.assertEqual(1, game.players[0].minions[0].health)
        self.assertEqual("Mind Shatter", game.players[1].hero.power.__str__())

        # Nothing special
        game.play_single_turn()
        self.assertEqual(5, len(game.players[0].minions))

        # Mind Shatter should be used, and Shadowform should be played
        # (but nothing will happen, we are already at Mind Shatter)
        game.play_single_turn()
        self.assertEqual("Mind Shatter", game.players[1].hero.power.__str__())
        self.assertEqual(4, len(game.players[0].minions))

        # Test using the hero power, then cast Shadowform and use the new power (this is possible)
        game = SavedGame("tests/replays/card_tests/Shadowform.rep")
        game.start()
        self.assertEqual(10, game.players[0].max_mana)
        self.assertEqual(3, game.players[0].mana)
        self.assertEqual(28, game.players[1].hero.health)
    def test_Shadowform(self):
        game = generate_game_for(IronfurGrizzly, Shadowform, MinionPlayingAgent, PredictableBot)

        for turn in range(0, 9):
            game.play_single_turn()

        self.assertEqual("Lesser Heal", game.players[1].hero.power.__str__())

        # Shadowform should be played
        game.play_single_turn()
        self.assertEqual("Mind Spike", game.players[1].hero.power.__str__())

        # Nothing special
        game.play_single_turn()

        # Mind Spike should be used, and Shadowform should be played
        game.play_single_turn()
        self.assertEqual(1, game.players[0].minions[0].health)
        self.assertEqual("Mind Shatter", game.players[1].hero.power.__str__())

        # Nothing special
        game.play_single_turn()
        self.assertEqual(5, len(game.players[0].minions))

        # Mind Shatter should be used, and Shadowform should be played
        # (but nothing will happen, we are already at Mind Shatter)
        game.play_single_turn()
        self.assertEqual("Mind Shatter", game.players[1].hero.power.__str__())
        self.assertEqual(4, len(game.players[0].minions))

        # Test using the hero power, then cast Shadowform and use the new power (this is possible)
        game = SavedGame("tests/replays/card_tests/Shadowform.rep")
        game.start()
        self.assertEqual(10, game.players[0].max_mana)
        self.assertEqual(3, game.players[0].mana)
        self.assertEqual(28, game.players[1].hero.health)