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


Python Minion.bind_once方法代码示例

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


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

示例1: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def draw_card():
            player.draw()

        minion = Minion(0, 3)
        player.bind("turn_ended", draw_card)
        minion.bind_once("silenced", lambda: player.unbind("turn_ended", draw_card))
        return minion
开发者ID:mharris717,项目名称:hearthbreaker,代码行数:10,代码来源:shaman.py

示例2: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def increase_attack(card):
            minion.change_attack(1)

        minion = Minion(1, 3)
        player.bind("spell_cast", increase_attack)
        minion.bind_once("silenced", lambda: player.unbind("spell_cast", increase_attack))
        return minion
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:10,代码来源:mage.py

示例3: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def gain_one_attack(m):
            minion.change_attack(1)

        minion = Minion(2, 4)
        player.game.bind("minion_damaged", gain_one_attack)
        minion.bind_once("silenced", lambda: player.game.unbind("minion_damaged", gain_one_attack))
        return minion
开发者ID:hertzg,项目名称:hearthstone-simulator,代码行数:10,代码来源:warrior.py

示例4: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def draw_card():
            player.draw()

        minion = Minion(1, 3)
        player.game.bind("minion_healed", draw_card)
        minion.bind_once("silenced", lambda: player.game.unbind("minion_healed", draw_card))
        return minion
开发者ID:anuragpapineni,项目名称:Hearthbreaker-evolved-agent,代码行数:10,代码来源:priest.py

示例5: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def poisonous(amount, target):
            if type(target) is Minion:
                target.die(self)

        minion = Minion(1, 1, stealth=True)
        minion.bind("did_damage", poisonous)
        minion.bind_once("silenced", lambda: minion.unbind("did_damage", poisonous))
        return minion
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:11,代码来源:rogue.py

示例6: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        class Filter:
            def __init__(self):
                self.amount = 2
                self.filter = lambda c: isinstance(c, MinionCard)
                self.min = 1

        mana_filter = Filter()
        minion = Minion(0, 4)
        minion.bind_once("silenced", lambda: player.mana_filters.remove(mana_filter))
        player.mana_filters.append(mana_filter)
        return minion
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:14,代码来源:warlock.py

示例7: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):
        def silence():
            player.heal_does_damage = False

            # If another Auchenai Soulpriest is alive and not silenced, keep
            # heal_does_damage as True
            for m in player.minions:
                if m.card.name == "Auchenai Soulpriest" and not m.silenced and m is not minion:
                    player.heal_does_damage = True

        minion = Minion(3, 5)
        minion.bind_once("silenced", silence)
        player.heal_does_damage = True
        return minion
开发者ID:tokkot,项目名称:hearthbreaker,代码行数:16,代码来源:priest.py

示例8: create_minion

# 需要导入模块: from hearthbreaker.game_objects import Minion [as 别名]
# 或者: from hearthbreaker.game_objects.Minion import bind_once [as 别名]
    def create_minion(self, player):

        # These are basically placeholders to give the agent something to
        # choose
        class IncreaseStats(Card):
            def __init__(self):
                super().__init__("Give your other minions +2/+2 and taunt", 0,
                                 CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

            def use(self, player, game):
                for minion in player.minions:
                    if minion is not cenarius:
                        minion.change_attack(2)
                        minion.increase_health(2)
                        minion.taunt = True

            def invoke(self, minion, index):
                self.use(minion.player, minion.game)

        class SummonTreants(Card):
            def __init__(self):
                super().__init__("Summon two 2/2 Treants with taunt", 0,
                                 CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

            def use(self, player, game):
                class Treant(MinionCard):
                    def __init__(self):
                        super().__init__("Treant", 1, CHARACTER_CLASS.DRUID,
                                         CARD_RARITY.COMMON)

                    def create_minion(self, p):
                        minion = Minion(2, 2, MINION_TYPE.NONE)
                        minion.taunt = True
                        return minion
                ltreant = Treant()
                ltreant.summon(player, game, cenarius.index)
                rtreant = Treant()
                rtreant.summon(player, game, cenarius.index + 1)

            def invoke(self, minion, index):
                self.use(minion.player, minion.game)

        option = player.agent.choose_option(IncreaseStats(), SummonTreants())
        cenarius = Minion(5, 8)
        cenarius.bind_once("added_to_board", option.invoke)
        return cenarius
开发者ID:nilrogen,项目名称:CGS-AI-UML,代码行数:48,代码来源:druid.py


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