当前位置: 首页>>代码示例>>Python>>正文


Python Game.current_player方法代码示例

本文整理汇总了Python中hearthbreaker.game_objects.Game.current_player方法的典型用法代码示例。如果您正苦于以下问题:Python Game.current_player方法的具体用法?Python Game.current_player怎么用?Python Game.current_player使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hearthbreaker.game_objects.Game的用法示例。


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

示例1: test_MarkOfNature

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_MarkOfNature(self):
        deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), MarkOfNature()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE)
        game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()])

        game.current_player = 1
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(5, game.other_player.minions[0].calculate_attack())

        deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), MarkOfNature()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE)
        agent = OneCardPlayingAgent()
        agent.choose_option = lambda *options: options[1]
        game = Game([deck1, deck2], [agent, OneCardPlayingAgent()])

        game.current_player = 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.assertEqual(5, game.other_player.minions[0].calculate_max_health())
        self.assertEqual(5, game.other_player.minions[0].health)
        self.assertTrue(game.other_player.minions[0].taunt)
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:33,代码来源:druid_tests.py

示例2: test_Swipe

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_Swipe(self):
        deck1 = StackedDeck([BloodfenRaptor(), StonetuskBoar(), StonetuskBoar()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([Swipe()], CHARACTER_CLASS.DRUID, )
        game = Game([deck1, deck2], [OneCardPlayingAgent(), EnemyMinionSpellTestingAgent()])
        game.pre_game()
        game.current_player = game.players[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()
        spell_damage_mock = mock.Mock()
        game.current_player.minions[0].bind('damaged_by_spell', spell_damage_mock)
        game.current_player.minions[1].bind('damaged_by_spell', spell_damage_mock)
        game.current_player.minions[2].bind('damaged_by_spell', spell_damage_mock)
        swipe_card = game.other_player.hand[0]
        game.play_single_turn()

        self.assertListEqual([mock.call(4, swipe_card), mock.call(1, swipe_card), mock.call(1, swipe_card)],
                             spell_damage_mock.call_args_list)

        # The bloodfen raptor should be left, with one hp
        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(1, game.other_player.minions[0].health)
        self.assertEqual(29, game.other_player.hero.health)
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:29,代码来源:druid_tests.py

示例3: test_SavageRoar

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_SavageRoar(self):
        deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), SavageRoar()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE)
        game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()])

        game.current_player = 1
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()

        minion_increase_mock = mock.Mock()

        game.other_player.minions[0].bind("attack_changed", minion_increase_mock)
        game.other_player.minions[1].bind("attack_changed", minion_increase_mock)

        player_increase_mock = mock.Mock()

        game.other_player.hero.bind("attack_changed", player_increase_mock)

        game.play_single_turn()

        self.assertEqual(0, game.current_player.mana)

        # Make sure the attack got increased
        self.assertListEqual([mock.call(2), mock.call(2)], minion_increase_mock.call_args_list)
        self.assertListEqual([mock.call(2)], player_increase_mock.call_args_list)

        # And make sure that it went down again
        self.assertEqual(1, game.current_player.minions[0].calculate_attack())
        self.assertEqual(1, game.current_player.minions[1].calculate_attack())
        self.assertEqual(0, game.current_player.hero.calculate_attack())
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:34,代码来源:druid_tests.py

示例4: test_ManaWyrm

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_ManaWyrm(self):
        deck1 = StackedDeck([ManaWyrm(), IceLance(), ManaWyrm(), IceLance(), IceLance(), IceLance()],
                            CHARACTER_CLASS.MAGE)
        deck2 = StackedDeck([IronbeakOwl()], CHARACTER_CLASS.PALADIN)
        game = Game([deck1, deck2], [CardTestingAgent(), OneCardPlayingAgent()])
        game.pre_game()
        game.current_player = 1

        game.play_single_turn()
        self.assertEqual(1, len(game.current_player.minions))
        self.assertEqual(1, game.current_player.minions[0].calculate_attack())
        self.assertEqual(3, game.current_player.minions[0].health)
        self.assertEqual(3, game.current_player.minions[0].calculate_max_health())
        self.assertEqual("Mana Wyrm", game.current_player.minions[0].card.name)

        game.play_single_turn()
        game.play_single_turn()

        self.assertEqual(2, len(game.current_player.minions))
        self.assertEqual(1, game.current_player.minions[0].calculate_attack())
        self.assertEqual(3, game.current_player.minions[0].health)
        self.assertEqual(3, game.current_player.minions[0].calculate_max_health())
        self.assertEqual(2, game.current_player.minions[1].calculate_attack())
        self.assertEqual(3, game.current_player.minions[1].health)
        self.assertEqual(3, game.current_player.minions[1].calculate_max_health())
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(2, len(game.current_player.minions))
        self.assertEqual(1, game.current_player.minions[0].calculate_attack())
        self.assertEqual(3, game.current_player.minions[0].health)
        self.assertEqual(3, game.current_player.minions[0].calculate_max_health())
        self.assertEqual(5, game.current_player.minions[1].calculate_attack())
        self.assertEqual(3, game.current_player.minions[1].health)
        self.assertEqual(3, game.current_player.minions[1].calculate_max_health())
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:36,代码来源:mage_tests.py

示例5: generate_game_for

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
def generate_game_for(card1, card2, first_agent_type, second_agent_type):
    if not isinstance(card1, collections.Sequence):
        card_set1 = [card1()]
    else:
        card_set1 = [card() for card in card1]
    class1 = CHARACTER_CLASS.MAGE
    for card in card_set1:
        if card.character_class != CHARACTER_CLASS.ALL:
            class1 = card.character_class
            break

    if not isinstance(card2, collections.Sequence):
        card_set2 = [card2()]
    else:
        card_set2 = [card() for card in card2]

    class2 = CHARACTER_CLASS.MAGE
    for card in card_set2:
        if card.character_class != CHARACTER_CLASS.ALL:
            class2 = card.character_class
            break

    deck1 = StackedDeck(card_set1, class1)
    deck2 = StackedDeck(card_set2, class2)
    game = Game([deck1, deck2], [first_agent_type(), second_agent_type()])
    game.current_player = game.players[1]
    game.other_player = game.players[0]
    game.pre_game()
    return game
开发者ID:WabiWasabi,项目名称:hearthbreaker,代码行数:31,代码来源:testing_utils.py

示例6: test_SorcerersApprentice

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_SorcerersApprentice(self):
        deck1 = StackedDeck([SorcerersApprentice(), ArcaneMissiles(), SorcerersApprentice(), Frostbolt(), Frostbolt(),
                             Frostbolt()], CHARACTER_CLASS.MAGE)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.PRIEST)
        game = Game([deck1, deck2], [SpellTestingAgent(), DoNothingBot()])
        game.pre_game()
        game.current_player = game.players[1]

        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(game.current_player))
        self.assertEqual(1, game.current_player.hand[2].mana_cost(game.current_player))

        game.play_single_turn()
        game.play_single_turn()

        # Both Sorcer'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)
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:34,代码来源:mage_tests.py

示例7: test_PowerOfTheWild

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_PowerOfTheWild(self):
        deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), PowerOfTheWild()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE)

        # This is a test of the +1/+1 option of the Power Of the Wild Card
        game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()])
        game.current_player = game.players[1]

        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        game.play_single_turn()
        self.assertEqual(2, game.current_player.minions[0].calculate_attack())
        self.assertEqual(2, game.current_player.minions[0].health)
        self.assertEqual(2, game.current_player.minions[0].calculate_max_health())
        self.assertEqual(2, game.current_player.minions[1].calculate_attack())
        self.assertEqual(2, game.current_player.minions[1].calculate_max_health())

        # This is a test of the "Summon Panther" option of the Power of the Wild Card

        agent = OneCardPlayingAgent()
        agent.choose_option = mock.Mock(side_effect=lambda *options: options[1])

        deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), PowerOfTheWild()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE)
        game = Game([deck1, deck2], [agent, OneCardPlayingAgent()])
        game.current_player = game.players[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.assertEqual("Panther", game.current_player.minions[2].card.__class__.__name__)
        self.assertEqual(3, game.current_player.minions[2].calculate_attack())
        self.assertEqual(2, game.current_player.minions[2].calculate_max_health())
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:41,代码来源:druid_tests.py

示例8: test_CircleOfHealing

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_CircleOfHealing(self):
        deck1 = StackedDeck(
            [CircleOfHealing(), MogushanWarden(), CircleOfHealing(), CircleOfHealing(), CircleOfHealing(),
             CircleOfHealing(), CircleOfHealing()], CHARACTER_CLASS.PRIEST)
        deck2 = StackedDeck([MogushanWarden()], CHARACTER_CLASS.PALADIN)
        game = Game([deck1, deck2], [SpellTestingAgent(), MinionPlayingAgent()])
        game.pre_game()
        game.current_player = 1

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

        game.players[0].minions[0].health = 4
        game.players[1].minions[0].health = 4
        game.play_single_turn()  # Circle of Healing should be played
        self.assertEqual(game.players[0].minions[0].calculate_max_health(), game.players[0].minions[0].health)
        self.assertEqual(game.players[1].minions[0].calculate_max_health(), game.players[1].minions[0].health)
开发者ID:anuragpapineni,项目名称:Hearthbreaker-evolved-agent,代码行数:19,代码来源:priest_tests.py

示例9: test_HolyNova

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_HolyNova(self):
        deck1 = StackedDeck([MogushanWarden(), HolyNova()], CHARACTER_CLASS.PRIEST)
        deck2 = StackedDeck([MogushanWarden()], CHARACTER_CLASS.PALADIN)
        game = Game([deck1, deck2], [SpellTestingAgent(), MinionPlayingAgent()])
        game.pre_game()
        game.current_player = 1

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

        self.assertEqual(1, len(game.players[0].minions))
        self.assertEqual(1, len(game.players[1].minions))
        game.players[0].minions[0].health = 4  # Fake damage
        self.assertEqual(4, game.players[0].minions[0].health)
        self.assertEqual(7, game.players[1].minions[0].health)
        game.play_single_turn()  # Holy Nova should be played
        self.assertEqual(6, game.players[0].minions[0].health)
        self.assertEqual(5, game.players[1].minions[0].health)
开发者ID:anuragpapineni,项目名称:Hearthbreaker-evolved-agent,代码行数:20,代码来源:priest_tests.py

示例10: test_Swipe

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    def test_Swipe(self):
        deck1 = StackedDeck([BloodfenRaptor(), StonetuskBoar(), StonetuskBoar()], CHARACTER_CLASS.DRUID)
        deck2 = StackedDeck([Swipe()], CHARACTER_CLASS.DRUID, )
        game = Game([deck1, deck2], [OneCardPlayingAgent(), EnemyMinionSpellTestingAgent()])
        game.pre_game()
        game.current_player = game.players[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()

        # The bloodfen raptor should be left, with one hp
        self.assertEqual(1, len(game.other_player.minions))
        self.assertEqual(1, game.other_player.minions[0].health)
        self.assertEqual(29, game.other_player.hero.health)
开发者ID:eyalzek,项目名称:hearthbreaker,代码行数:21,代码来源:druid_tests.py

示例11: test_RandomAgent

# 需要导入模块: from hearthbreaker.game_objects import Game [as 别名]
# 或者: from hearthbreaker.game_objects.Game import current_player [as 别名]
    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(),
        ], CHARACTER_CLASS.DRUID)

        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(),
        ], CHARACTER_CLASS.WARLOCK)

        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, 21):
            game.play_single_turn()
            self.assertFalse(game.game_ended)

        game.play_single_turn()

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

        self.assertTrue(game.game_ended)
开发者ID:bussiere,项目名称:hearthbreaker,代码行数:102,代码来源:agent_tests.py


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