• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python testing_utils.generate_game_for函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.testing_utils.generate_game_for函数的典型用法代码示例。如果您正苦于以下问题:Python generate_game_for函数的具体用法?Python generate_game_for怎么用?Python generate_game_for使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了generate_game_for函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_Spellbender

    def test_Spellbender(self):
        game = generate_game_for([Spellbender, Wisp], Moonfire, CardTestingAgent, CardTestingAgent)

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

        # The moonfire should have been re-directed to the Spellbender, which should have taken one damage
        self.assertEqual(2, len(game.other_player.minions))
        self.assertEqual(2, game.other_player.minions[1].health)
        self.assertEqual(1, game.other_player.minions[1].calculate_attack())
        self.assertEqual("Spellbender", game.other_player.minions[1].card.name)

        # Now make sure it won't work when the hero is targeted
        random.seed(1857)
        game = generate_game_for(Spellbender, Moonfire, CardTestingAgent, CardTestingAgent)

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

        self.assertEqual(0, len(game.other_player.minions))
        self.assertEqual(1, len(game.other_player.secrets))
        self.assertEqual(23, game.other_player.hero.health)

        # Now make sure it doesn't activate when a non-targeted spell is used
        random.seed(1857)
        game = generate_game_for(Spellbender, ArcaneIntellect, CardTestingAgent, CardTestingAgent)

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

        # The arcane intellect should not have caused the Spellbender to activate
        self.assertEqual(0, len(game.other_player.minions))
        self.assertEqual(1, len(game.other_player.secrets))
开发者ID:5alamander,项目名称:hearthbreaker,代码行数:33,代码来源:mage_tests.py


示例2: test_Wrath

    def test_Wrath(self):
        game = generate_game_for(Wrath, StonetuskBoar, EnemyMinionSpellTestingAgent, MinionPlayingAgent)
        game.play_single_turn()
        game.play_single_turn()

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

        game.play_single_turn()

        self.assertEqual(0, len(game.other_player.minions))
        self.assertEqual(5, len(game.current_player.hand))

        random.seed(1857)
        game = generate_game_for(Wrath, MogushanWarden, EnemyMinionSpellTestingAgent, MinionPlayingAgent)
        game.players[0].agent.choose_option = Mock(side_effect=lambda one, three: three)
        for turn in range(0, 8):
            game.play_single_turn()

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

        game.play_single_turn()

        self.assertEqual(1, len(game.other_player.minions))
        #Two wraths will have been played
        self.assertEqual(1, game.other_player.minions[0].defense)
开发者ID:RushPu,项目名称:hearthstone-simulator,代码行数:25,代码来源:druid_tests.py


示例3: test_Wrath

    def test_Wrath(self):
        game = generate_game_for(Wrath, StonetuskBoar, EnemyMinionSpellTestingAgent, OneCardPlayingAgent)
        game.play_single_turn()
        game.play_single_turn()

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

        game.play_single_turn()

        self.assertEqual(0, len(game.other_player.minions))
        self.assertEqual(5, len(game.current_player.hand))

        random.seed(1857)
        game = generate_game_for(Wrath, MogushanWarden, EnemyMinionSpellTestingAgent, OneCardPlayingAgent)
        game.players[0].agent.choose_option = lambda options, player: options[1]
        for turn in range(0, 8):
            game.play_single_turn()

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

        game.play_single_turn()

        self.assertEqual(1, len(game.other_player.minions))
        # Two wraths will have been played
        self.assertEqual(1, game.other_player.minions[0].health)
开发者ID:Kogorushi,项目名称:hearthbreaker,代码行数:25,代码来源:druid_tests.py


示例4: test_IceBarrier

    def test_IceBarrier(self):
        game = generate_game_for(IceBarrier, StonetuskBoar, CardTestingAgent, PredictableAgent)
        for turn in range(0, 5):
            game.play_single_turn()

        self.assertEqual(1, len(game.current_player.secrets))
        self.assertEqual("Ice Barrier", game.current_player.secrets[0].name)

        game.play_single_turn()
        # only one minion because PredictableAgent will shoot its own minions if there isn't anything else to shoot.
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(7, game.other_player.hero.armor)

        # Attacked twice on the first turn, then fireballed before getting the armor up
        self.assertEqual(27, game.other_player.hero.health)

        # Make sure we can't have two identical secrets at the same time
        random.seed(1857)
        game = generate_game_for(IceBarrier, StonetuskBoar, CardTestingAgent, DoNothingAgent)
        for turn in range(0, 6):
            game.play_single_turn()

        self.assertEqual(1, len(game.other_player.secrets))
        self.assertEqual("Ice Barrier", game.other_player.secrets[0].name)

        game.play_single_turn()
        self.assertEqual(1, len(game.current_player.secrets))
        self.assertEqual("Ice Barrier", game.current_player.secrets[0].name)
开发者ID:5alamander,项目名称:hearthbreaker,代码行数:28,代码来源:mage_tests.py


示例5: test_ExplosiveTrap

    def test_ExplosiveTrap(self):
        game = generate_game_for(ExplosiveTrap, StonetuskBoar, SpellTestingAgent, PlayAndAttackAgent)

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

        self.assertEqual(1, len(game.current_player.secrets))
        self.assertEqual(1, len(game.other_player.minions))

        game.play_single_turn()

        self.assertEqual(0, len(game.other_player.secrets))
        self.assertEqual(0, len(game.current_player.minions))
        self.assertEqual(28, game.current_player.hero.health)
        self.assertEqual(29, game.other_player.hero.health)

        random.seed(1857)
        game = generate_game_for(ExplosiveTrap, Frostbolt, SpellTestingAgent, SpellTestingAgent)

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

        self.assertEqual(1, len(game.other_player.secrets))
        self.assertEqual(30, game.current_player.hero.health)
        self.assertEqual(27, game.other_player.hero.health)
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:25,代码来源:hunter_tests.py


示例6: test_Snowchugger

    def test_Snowchugger(self):
        game = generate_game_for(Snowchugger, StonetuskBoar, PredictableAgent, DoNothingAgent)

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

        self.assertEqual(27, game.other_player.hero.health)
        self.assertFalse(game.other_player.hero.frozen_this_turn)
        self.assertFalse(game.other_player.hero.frozen)
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(2, game.current_player.minions[0].calculate_attack())
        self.assertEqual(3, game.current_player.minions[0].health)
        self.assertEqual("Snowchugger", game.current_player.minions[0].card.name)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(25, game.other_player.hero.health)

        # Always false after the end of a turn
        self.assertFalse(game.other_player.hero.frozen_this_turn)
        self.assertTrue(game.other_player.hero.frozen)

        # Now make sure that attacking the Snowchugger directly will freeze a character
        random.seed(1857)
        game = generate_game_for(Snowchugger, IronbarkProtector, OneCardPlayingAgent, PredictableAgent)
        for turn in range(0, 4):
            game.play_single_turn()

        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(2, game.other_player.minions[0].health)
        # The player should be frozen because of weapon attack
        self.assertEqual(29, game.current_player.hero.health)
        self.assertTrue(game.current_player.hero.frozen)

        game.play_single_turn()
        game.play_single_turn()

        # The player should still be frozen from last turn, and thus shouldn't have attacked
        self.assertEqual(29, game.current_player.hero.health)

        # If Snowchugger gets 0 attack, and is being attacked so will the minion NOT be frozen since no damage was dealt
        game = generate_game_for(Snowchugger, StonetuskBoar, PredictableAgent, PredictableAgent)

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

        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual("Snowchugger", game.players[1].minions[0].card.name)
        # Cheat
        game.players[1].minions[0].base_attack = 0
        self.assertEqual(0, game.players[1].minions[0].calculate_attack())
        self.assertEqual(3, game.players[1].minions[0].health)

        # Stonetusk should have attacked the Snowchugger, and will NOT be frozen since they didn't take damage
        game.play_single_turn()
        self.assertEqual(1, game.players[1].minions[0].health)
        self.assertFalse(game.players[0].minions[0].frozen_this_turn)
        self.assertFalse(game.players[0].minions[0].frozen)
开发者ID:randomflyingtaco,项目名称:hearthbreaker-fork,代码行数:59,代码来源:mage_tests.py


示例7: test_DarkWispers

    def test_DarkWispers(self):
        game = generate_game_for(DarkWispers, SaltyDog, CardTestingAgent, OneCardPlayingAgent)
        game.players[0].agent.choose_option = lambda options, player: options[1]
        for turn in range(0, 10):
            game.play_single_turn()

        # 1 Salty Dog on the field
        self.assertEqual(0, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(7, game.players[1].minions[0].calculate_attack())
        self.assertEqual(4, game.players[1].minions[0].health)
        self.assertFalse(game.players[1].minions[0].taunt)

        # Chooses to buff enemy Salty Dog
        game.play_single_turn()

        self.assertEqual(0, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(12, game.players[1].minions[0].calculate_attack())
        self.assertEqual(9, game.players[1].minions[0].health)
        self.assertTrue(game.players[1].minions[0].taunt)

        random.seed(1857)
        game = generate_game_for(DarkWispers, SaltyDog, CardTestingAgent, OneCardPlayingAgent)
        for turn in range(0, 10):
            game.play_single_turn()

        # 1 Salty Dog on the field
        self.assertEqual(0, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))

        # Summons 5 Wisps
        game.play_single_turn()

        self.assertEqual(5, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(1, game.players[0].minions[0].calculate_attack())
        self.assertEqual(1, game.players[0].minions[0].health)
        self.assertEqual("Wisp", game.players[0].minions[0].card.name)
        self.assertEqual(1, game.players[0].minions[1].calculate_attack())
        self.assertEqual(1, game.players[0].minions[1].health)
        self.assertEqual("Wisp", game.players[0].minions[1].card.name)
        self.assertEqual(1, game.players[0].minions[2].calculate_attack())
        self.assertEqual(1, game.players[0].minions[2].health)
        self.assertEqual("Wisp", game.players[0].minions[2].card.name)
        self.assertEqual(1, game.players[0].minions[3].calculate_attack())
        self.assertEqual(1, game.players[0].minions[3].health)
        self.assertEqual("Wisp", game.players[0].minions[3].card.name)
        self.assertEqual(1, game.players[0].minions[4].calculate_attack())
        self.assertEqual(1, game.players[0].minions[4].health)
        self.assertEqual("Wisp", game.players[0].minions[4].card.name)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(7, len(game.players[0].minions))
开发者ID:Kogorushi,项目名称:hearthbreaker,代码行数:56,代码来源:druid_tests.py


示例8: test_KeeperOfTheGrove

    def test_KeeperOfTheGrove(self):
        # Test Moonfire option

        game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

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

        game.play_single_turn()

        self.assertEqual(2, len(game.other_player.minions))

        # Test Dispel option

        random.seed(1857)

        game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent)

        game.players[0].agent.choose_option = lambda options, player: options[1]

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        self.assertTrue(game.current_player.minions[0].charge())

        game.play_single_turn()

        self.assertFalse(game.other_player.minions[0].charge())

        # Test when there are no targets for the spell
        random.seed(1857)
        game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual("Keeper of the Grove", game.current_player.minions[0].card.name)
开发者ID:Kogorushi,项目名称:hearthbreaker,代码行数:53,代码来源:druid_tests.py


示例9: test_Nourish

    def test_Nourish(self):

        # Test gaining two mana
        game = generate_game_for(Nourish, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(7, game.current_player.max_mana)
        self.assertEqual(7, len(game.current_player.hand))

        # Ensure that the case where we would be over 10 mana is handled correctly

        game.play_single_turn()
        game.play_single_turn()
        # Nourish is played.  it brings the player to 10

        self.assertEqual(10, game.current_player.max_mana)
        self.assertEqual(5, game.current_player.mana)

        game.play_single_turn()
        game.play_single_turn()

        # Nourish is played.  It doesn't affect the max_mana, but it does fill in two crystals.
        # Tested on patch 2.1.0.7785
        self.assertEqual(10, game.current_player.max_mana)
        self.assertEqual(7, game.current_player.mana)

        # Test drawing three cards
        random.seed(1857)
        game = generate_game_for(Nourish, StonetuskBoar, CardTestingAgent, DoNothingAgent)
        game.players[0].agent.choose_option = lambda options, player: options[1]

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(10, len(game.current_player.hand))
        self.assertEqual(5, game.current_player.max_mana)
开发者ID:Kogorushi,项目名称:hearthbreaker,代码行数:52,代码来源:druid_tests.py


示例10: test_AncientOfLore

    def test_AncientOfLore(self):
        game = generate_game_for(AncientOfLore, Starfire, OneCardPlayingAgent, EnemySpellTestingAgent)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(game.other_player.hero.health, 25)

        game.play_single_turn()

        self.assertEqual(30, game.current_player.hero.health)
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(5, game.current_player.minions[0].health)
        self.assertEqual(5, game.current_player.minions[0].calculate_attack())
        self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name)

        random.seed(1857)

        game = generate_game_for(AncientOfLore, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent)

        game.players[0].agent.choose_option = lambda options, player: options[1]

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(10, len(game.current_player.hand))
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(5, game.current_player.minions[0].health)
        self.assertEqual(5, game.current_player.minions[0].calculate_attack())
        self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name)
开发者ID:Kogorushi,项目名称:hearthbreaker,代码行数:49,代码来源:druid_tests.py


示例11: test_AncientOfLore

    def test_AncientOfLore(self):
        game = generate_game_for(AncientOfLore, Starfire, MinionPlayingAgent, EnemySpellTestingAgent)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(game.other_player.health, 25)

        game.play_single_turn()

        self.assertEqual(30, game.current_player.health)
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(5, game.current_player.minions[0].health)
        self.assertEqual(5, game.current_player.minions[0].attack_power)
        self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name)

        random.seed(1857)

        game = generate_game_for(AncientOfLore, StonetuskBoar, MinionPlayingAgent, DoNothingBot)

        game.players[0].agent.choose_option = Mock(side_effect=lambda heal, draw: draw)

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(10, len(game.current_player.hand))
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(5, game.current_player.minions[0].health)
        self.assertEqual(5, game.current_player.minions[0].attack_power)
        self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name)
开发者ID:philic,项目名称:hearthstone-simulator,代码行数:49,代码来源:druid_tests.py


示例12: test_AncestralSpirit

    def test_AncestralSpirit(self):
        game = generate_game_for([ArgentCommander, AncestralSpirit], StonetuskBoar, MinionPlayingAgent, DoNothingBot)

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

        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual("Argent Commander", game.players[0].minions[0].card.name)
        self.assertEqual(2, game.players[0].minions[0].health)
        self.assertTrue(game.players[0].minions[0].divine_shield)

        game.play_single_turn()
        # Ancestral Spirit should be played on the Argent Commander
        game.play_single_turn()
        self.assertEqual(1, len(game.players[0].minions))
        game.players[0].minions[0].health = 1
        game.players[0].minions[0].divine_shield = False
        # Let the minion die in order to test Ancestral Spirit
        commander = game.players[0].minions[0]
        commander.die(None)
        commander.activate_delayed()
        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual("Argent Commander", game.players[0].minions[0].card.name)
        self.assertEqual(2, game.players[0].minions[0].health)
        self.assertTrue(game.players[0].minions[0].divine_shield)
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:25,代码来源:shaman_tests.py


示例13: test_FrostShock

    def test_FrostShock(self):
        game = generate_game_for(FrostShock, StonetuskBoar, SpellTestingAgent, DoNothingBot)

        # Frost Shock should be played
        game.play_single_turn()
        self.assertEqual(29, game.players[1].hero.health)
        self.assertTrue(game.players[1].hero.frozen)
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:7,代码来源:shaman_tests.py


示例14: test_BestialWrath

    def test_BestialWrath(self):

        def verify_bwrath():
            self.assertEqual(3, game.other_player.minions[0].calculate_attack())
            self.assertTrue(game.other_player.minions[0].immune)

        def verify_silence():
            self.assertFalse(game.other_player.minions[0].immune)
            self.assertEqual(1, game.other_player.minions[0].calculate_attack())

        game = generate_game_for(StonetuskBoar, [BestialWrath, BestialWrath, BestialWrath, Silence, BoulderfistOgre],
                                 OneCardPlayingAgent, EnemyMinionSpellTestingAgent)
        game.play_single_turn()
        game.other_player.bind_once("turn_ended", verify_bwrath)
        game.play_single_turn()
        self.assertEqual(1, len(game.other_player.minions))
        self.assertFalse(game.other_player.minions[0].immune)
        self.assertEqual(1, game.other_player.minions[0].calculate_attack())

        game.play_single_turn()
        game.other_player.bind_once("turn_ended", verify_silence)
        game.play_single_turn()
        self.assertEqual(2, len(game.other_player.minions))
        self.assertFalse(game.other_player.minions[0].immune)
        self.assertEqual(1, game.other_player.minions[0].calculate_attack())
        self.assertEqual(2, len(game.players[1].hand))
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:26,代码来源:hunter_tests.py


示例15: test_UnboundElemental

    def test_UnboundElemental(self):
        game = generate_game_for([UnboundElemental, DustDevil, DustDevil], StonetuskBoar, MinionPlayingAgent,
                                 DoNothingBot)

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

        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual("Unbound Elemental", game.players[0].minions[0].card.name)
        self.assertEqual(2, game.players[0].minions[0].calculate_attack())
        self.assertEqual(4, game.players[0].minions[0].calculate_max_health())

        # One Dust Devil should be played, giving the Unbound Elemental +1/+1
        game.play_single_turn()
        self.assertEqual(2, len(game.players[0].minions))
        self.assertEqual(3, game.players[0].minions[-1].calculate_attack())
        self.assertEqual(5, game.players[0].minions[-1].calculate_max_health())
        # Test the silence
        game.players[0].minions[-1].silence()
        self.assertEqual(2, game.players[0].minions[-1].calculate_attack())
        self.assertEqual(4, game.players[0].minions[-1].calculate_max_health())

        # Another Dust Devil, nothing should happen because of silence
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(3, len(game.players[0].minions))
        self.assertEqual(2, game.players[0].minions[-1].calculate_attack())
        self.assertEqual(4, game.players[0].minions[-1].calculate_max_health())
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:28,代码来源:shaman_tests.py


示例16: test_FreezingTrap_many_cards

    def test_FreezingTrap_many_cards(self):
        class FreezingTrapAgent(DoNothingAgent):
            def do_turn(self, player):
                if player.mana == 6:
                    game.play_card(player.hand[0])
                if player.mana == 7:
                    player.minions[0].attack()
        game = generate_game_for(FreezingTrap, BoulderfistOgre, SpellTestingAgent, FreezingTrapAgent)

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

        self.assertEqual(1, len(game.current_player.minions))
        death_mock = mock.Mock()
        game.players[1].minions[0].bind_once("died", death_mock)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(10, len(game.current_player.hand))
        self.assertEqual(0, len(game.current_player.minions))
        for card in game.current_player.hand:
            if card.name != "The Coin":
                self.assertEqual(6, card.mana_cost(game.current_player))
        self.assertEqual(30, game.other_player.hero.health)
        death_mock.assert_called_once_with(None)
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:26,代码来源:hunter_tests.py


示例17: test_TundraRhino

    def test_TundraRhino(self):
        game = generate_game_for([StonetuskBoar, OasisSnapjaw, TundraRhino], StonetuskBoar,
                                 PlayAndAttackAgent, DoNothingAgent)
        for turn in range(0, 6):
            game.play_single_turn()

        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(27, game.players[1].hero.health)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(2, len(game.players[0].minions))
        self.assertEqual(26, game.players[1].hero.health)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(3, len(game.players[0].minions))
        self.assertEqual(21, game.players[1].hero.health)
        self.assertTrue(game.players[0].minions[0].charge)
        self.assertTrue(game.players[0].minions[1].charge)
        self.assertTrue(game.players[0].minions[2].charge)

        game.players[0].minions[2].silence()
        self.assertTrue(game.players[0].minions[2].charge)
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:26,代码来源:hunter_tests.py


示例18: test_Flare

    def test_Flare(self):

        game = generate_game_for(Vaporize, [WorgenInfiltrator, WorgenInfiltrator, ArcaneShot, Flare],
                                 SpellTestingAgent, SpellTestingAgent)

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

        # Vaporize is in place and two Infiltrators are down
        self.assertEqual(1, len(game.current_player.secrets))
        self.assertEqual(2, len(game.other_player.minions))
        self.assertTrue(game.other_player.minions[0].stealth)
        self.assertTrue(game.other_player.minions[1].stealth)
        self.assertEqual(4, len(game.other_player.hand))

        old_play = game.other_player.agent.do_turn

        def _play_and_attack(player):
            old_play(player)
            player.minions[2].attack()

        # Flare, The Coin, two Worgens and Arcane shot are played
        # Arcane shot kills one of the active Worgens, because Flare has removed its stealth
        game.other_player.agent.do_turn = _play_and_attack
        game.play_single_turn()
        self.assertEqual(0, len(game.other_player.secrets))
        self.assertEqual(3, len(game.current_player.minions))
        self.assertFalse(game.current_player.minions[2].stealth)
        self.assertEqual(1, len(game.current_player.hand))
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:29,代码来源:hunter_tests.py


示例19: test_PitLord

 def test_PitLord(self):
     game = generate_game_for(PitLord, StonetuskBoar, MinionPlayingAgent, DoNothingBot)
     for turn in range(0, 7):
         game.play_single_turn()
         # play Pit Lord, 5 damage to own hero
     self.assertEqual(1, len(game.players[0].minions))
     self.assertEqual(25, game.players[0].hero.health)
开发者ID:JonathanFlynn,项目名称:hearthstone-simulator,代码行数:7,代码来源:warlock_tests.py


示例20: test_LightsJustice

    def test_LightsJustice(self):
        game = generate_game_for(LightsJustice, StonetuskBoar, PredictableAgent, DoNothingAgent)

        # Light's Justice should be played
        game.play_single_turn()
        self.assertEqual(1, game.players[0].hero.weapon.base_attack)
        self.assertEqual(4, game.players[0].hero.weapon.durability)
开发者ID:eyalzek,项目名称:hearthbreaker,代码行数:7,代码来源:paladin_tests.py



注:本文中的tests.testing_utils.generate_game_for函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testingutils.autospec_method函数代码示例发布时间:2022-05-27
下一篇:
Python testing.make_environ函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap