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

Python testing_utils.generate_game_for函数代码示例

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

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



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

示例1: 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:jomyhuang,项目名称:sdwle,代码行数:25,代码来源:druid_tests.py


示例2: 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:jomyhuang,项目名称:sdwle,代码行数:28,代码来源:mage_tests.py


示例3: 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:jomyhuang,项目名称:sdwle,代码行数:33,代码来源:mage_tests.py


示例4: test_ExplosiveTrap

    def test_ExplosiveTrap(self):
        game = generate_game_for(ExplosiveTrap, StonetuskBoar, CardTestingAgent, 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, CardTestingAgent, CardTestingAgent)

        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:jomyhuang,项目名称:sdwle,代码行数:25,代码来源:hunter_tests.py


示例5: 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:jomyhuang,项目名称:sdwle,代码行数:56,代码来源:druid_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)
        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.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)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:56,代码来源:mage_tests.py


示例7: 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:jomyhuang,项目名称:sdwle,代码行数:53,代码来源:druid_tests.py


示例8: 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:jomyhuang,项目名称:sdwle,代码行数:52,代码来源:druid_tests.py


示例9: 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:jomyhuang,项目名称:sdwle,代码行数:49,代码来源:druid_tests.py


示例10: test_SorcerersApprentice

    def test_SorcerersApprentice(self):
        game = generate_game_for([SorcerersApprentice, ArcaneMissiles, SorcerersApprentice, Frostbolt, Frostbolt,
                                  Frostbolt], StonetuskBoar, CardTestingAgent, DoNothingAgent)

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

        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(3, game.current_player.minions[0].calculate_attack())
        self.assertEqual(2, game.current_player.minions[0].health)
        self.assertEqual("Sorcerer's Apprentice", game.current_player.minions[0].card.name)

        # Arcane missiles should also have been played, since it is now free
        self.assertEqual(27, game.other_player.hero.health)

        # Make sure the other frostbolts have been properly reduced
        self.assertEqual(1, game.current_player.hand[1].mana_cost())
        self.assertEqual(1, game.current_player.hand[2].mana_cost())

        game.play_single_turn()
        game.play_single_turn()

        # Both Sorcerer's Apprentices are killed by friendly Frostbolts.
        self.assertEqual(0, len(game.current_player.minions))

        # Make sure that the cards in hand are no longer reduced
        self.assertEqual(2, game.current_player.hand[0].mana_cost())
开发者ID:jomyhuang,项目名称:sdwle,代码行数:28,代码来源:mage_tests.py


示例11: test_PatientAssassin

    def test_PatientAssassin(self):
        game = generate_game_for([PatientAssassin, Shieldbearer, Shieldbearer, Shieldbearer, Shieldbearer, Shieldbearer,
                                  Shieldbearer], [Sunwalker, Malygos], PlayAndAttackAgent,
                                 OneCardPlayingAgent)

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

        # Lots of turns have passed. The opponent hero shouldn't have died of the poison effect
        self.assertEqual(7, len(game.players[0].minions))
        self.assertEqual(26, game.players[1].hero.health)
        self.assertFalse(game.players[1].hero.dead)
        # And Sunwalker should have been played
        self.assertEqual(1, len(game.players[1].minions))
        self.assertTrue(game.players[1].minions[0].divine_shield)

        # Patient Assassin should attack the Sunwalker, but only divine shield should be affected
        game.play_single_turn()
        self.assertEqual(6, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        self.assertFalse(game.players[1].minions[0].divine_shield)
        self.assertEqual(5, game.players[1].minions[0].health)

        # A new Patient Assassin should be played
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(7, len(game.players[0].minions))

        # Patient Assassin should attack again, this time killing the Sunwalker since it no longer has divine shield
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(6, len(game.players[0].minions))
        self.assertEqual(0, len(game.players[1].minions))
开发者ID:jomyhuang,项目名称:sdwle,代码行数:33,代码来源:rogue_tests.py


示例12: test_TradePrince_Gallywix_and_coin

    def test_TradePrince_Gallywix_and_coin(self):
        game = generate_game_for(TradePrinceGallywix, Blizzard, OneCardPlayingAgent, OneCardPlayingAgent)

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

        self.assertEqual("Gallywix's Coin", game.current_player.hand[-1].name)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:7,代码来源:rogue_tests.py


示例13: test_IronSensei

    def test_IronSensei(self):
        game = generate_game_for(IronSensei, Mechwarper, OneCardPlayingAgent, OneCardPlayingAgent)

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

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

        game.play_single_turn()

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

        game.play_single_turn()
        self.assertEqual(2, len(game.current_player.minions))
        self.assertEqual(3, game.current_player.minions[0].health)
        self.assertEqual(3, game.current_player.minions[1].health)
        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(2, game.other_player.minions[0].health)

        game.play_single_turn()
        self.assertEqual(2, len(game.current_player.minions))
        self.assertEqual(4, game.current_player.minions[0].health)
        self.assertEqual(4, game.current_player.minions[0].calculate_attack())
        self.assertEqual(4, game.current_player.minions[1].health)
        self.assertEqual(4, game.current_player.minions[1].calculate_attack())
        self.assertEqual(2, len(game.other_player.minions))
        self.assertEqual(3, game.other_player.minions[0].health)
        self.assertEqual(3, game.other_player.minions[1].health)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:32,代码来源:rogue_tests.py


示例14: test_GrommashHellscream

    def test_GrommashHellscream(self):
        game = generate_game_for(GrommashHellscream, ExplosiveTrap, PlayAndAttackAgent, CardTestingAgent)

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

        # Hellscream should be played, attacking (charge) and getting 2 damage by trap that will trigger enrage,
        # dealing 10 damage as result
        game.play_single_turn()
        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(10, game.players[0].minions[0].calculate_attack())
        self.assertEqual(7, game.players[0].minions[0].health)
        self.assertEqual(20, game.players[1].hero.health)

        game.players[0].minions[0].heal(2, None)
        self.assertEqual(4, game.players[0].minions[0].calculate_attack())
        game.players[0].minions[0].damage(2, None)
        self.assertEqual(10, game.players[0].minions[0].calculate_attack())

        game.players[0].minions[0].silence()
        self.assertEqual(4, game.players[0].minions[0].calculate_attack())
        game.players[0].minions[0].heal(2, None)
        self.assertEqual(4, game.players[0].minions[0].calculate_attack())
        game.players[0].minions[0].damage(2, None)
        self.assertEqual(4, game.players[0].minions[0].calculate_attack())
开发者ID:jomyhuang,项目名称:sdwle,代码行数:25,代码来源:warrior_tests.py


示例15: test_ShamanPower

    def test_ShamanPower(self):
        game = generate_game_for(AlAkirTheWindlord, MassDispel, PredictableAgent, CardTestingAgent)

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

        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual("Stoneclaw Totem", game.players[0].minions[0].card.name)
        self.assertTrue(game.players[0].minions[0].taunt)

        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(2, len(game.players[0].minions))
        self.assertEqual("Healing Totem", game.players[0].minions[1].card.name)

        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(3, len(game.players[0].minions))
        self.assertEqual("Searing Totem", game.players[0].minions[2].card.name)

        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(4, len(game.players[0].minions))
        self.assertEqual("Wrath of Air Totem", game.players[0].minions[3].card.name)
        self.assertEqual(1, game.players[0].spell_damage)

        # All Totems are out, nothing should be summoned
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(4, len(game.players[0].minions))
开发者ID:jomyhuang,项目名称:sdwle,代码行数:30,代码来源:power_tests.py


示例16: test_HunterPower

    def test_HunterPower(self):
        game = generate_game_for(HuntersMark, MogushanWarden, PredictableAgent, DoNothingAgent)

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

        self.assertEqual(28, game.other_player.hero.health)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:7,代码来源:power_tests.py


示例17: test_WeeSpellstopper

    def test_WeeSpellstopper(self):
        game = generate_game_for(WeeSpellstopper, ShadowBolt, OneCardPlayingAgent, OneCardPlayingAgent)
        for turn in range(0, 8):
            game.play_single_turn()

        # First Spellstopper gets Bolted but lives with 1 hp
        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(1, game.players[0].minions[0].health)

        # Once there are 2 Spellstoppers, they are both spell immune
        game.play_single_turn()
        game.play_single_turn()

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

        game.play_single_turn()
        game.players[0].minions[0].die(None)
        game.players[0].minions[1].die(None)
        game.check_delayed()
        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(1, game.players[0].minions[0].health)

        # Last Spellstopper is not immune and dies to Shadow Bolt
        game.play_single_turn()

        self.assertEqual(0, len(game.players[0].minions))
开发者ID:jomyhuang,项目名称:sdwle,代码行数:28,代码来源:mage_tests.py


示例18: test_BouncingBlades

    def test_BouncingBlades(self):
        game = generate_game_for([GoldshireFootman, EchoingOoze, BouncingBlade], [GoldshireFootman, EchoingOoze],
                                 CardTestingAgent, CardTestingAgent)

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

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

        game.play_single_turn()

        self.assertEqual(2, len(game.players[0].minions))
        self.assertEqual(3, len(game.players[1].minions))

        self.assertEqual(2, game.players[0].minions[0].health)
        self.assertEqual(1, game.players[0].minions[1].health)
        self.assertEqual(2, game.players[1].minions[0].health)
        self.assertEqual(2, game.players[1].minions[1].health)
        self.assertEqual(1, game.players[1].minions[2].health)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:26,代码来源:warrior_tests.py


示例19: test_CruelTaskmaster

    def test_CruelTaskmaster(self):
        game = generate_game_for(CruelTaskmaster, Shieldbearer, OneCardPlayingAgent, OneCardPlayingAgent)

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

        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(0, game.players[1].minions[0].calculate_attack())
        self.assertEqual(4, game.players[1].minions[0].health)

        # Cruel Taskmaster should be played, targeting the Shieldbearer
        game.play_single_turn()
        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(2, game.players[0].minions[0].calculate_attack())
        self.assertEqual(2, game.players[0].minions[0].health)
        self.assertEqual("Cruel Taskmaster", game.players[0].minions[0].card.name)
        self.assertEqual(1, len(game.players[1].minions))
        self.assertEqual(2, game.players[1].minions[0].calculate_attack())
        self.assertEqual(3, game.players[1].minions[0].health)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(2, len(game.players[0].minions))
        self.assertEqual(2, len(game.players[1].minions))
        self.assertEqual(2, game.players[0].minions[0].calculate_attack())
        self.assertEqual(2, game.players[0].minions[0].health)
        self.assertEqual(2, game.players[0].minions[1].calculate_attack())
        self.assertEqual(2, game.players[0].minions[1].health)
        self.assertEqual(2, game.players[1].minions[0].calculate_attack())
        self.assertEqual(3, game.players[1].minions[0].health)
        self.assertEqual(2, game.players[1].minions[1].calculate_attack())
        self.assertEqual(3, game.players[1].minions[1].health)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:33,代码来源:warrior_tests.py


示例20: test_HeroicStrike

    def test_HeroicStrike(self):
        game = generate_game_for(HeroicStrike, StonetuskBoar, PlayAndAttackAgent, DoNothingAgent)

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

        self.assertEqual(26, game.players[1].hero.health)
开发者ID:jomyhuang,项目名称:sdwle,代码行数:7,代码来源:warrior_tests.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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