本文整理汇总了Python中hsgame.game_objects.Minion.bind_once方法的典型用法代码示例。如果您正苦于以下问题:Python Minion.bind_once方法的具体用法?Python Minion.bind_once怎么用?Python Minion.bind_once使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hsgame.game_objects.Minion
的用法示例。
在下文中一共展示了Minion.bind_once方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
def increase_attack(card):
minion.increase_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
示例2: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
def draw_card():
player.draw()
minion = Minion(0, 3, MINION_TYPE.TOTEM)
player.bind("turn_ended", draw_card)
minion.bind_once("silenced", lambda: player.unbind("turn_ended", draw_card))
return minion
示例3: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
def poisonous(amount, target):
if type(target) is Minion and not target.dead:
target.die(self)
minion = Minion(2, 3, MINION_TYPE.BEAST)
minion.bind("did_damage", poisonous)
minion.bind_once("silenced", lambda: minion.unbind("did_damage", poisonous))
return minion
示例4: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
def poisonous(amount, target):
if type(target) is Minion and not target.dead:
target.die(self)
minion = Minion(1, 1)
minion.stealth = True
minion.bind("did_damage", poisonous)
minion.bind_once("silenced", lambda: minion.unbind("did_damage", poisonous))
return minion
示例5: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.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
示例6: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
class Filter:
def __init__(self):
self.amount = 1
self.filter = lambda c: c.is_spell()
self.min = 0
filter = Filter()
minion = Minion(3, 2)
minion.bind_once("silence", lambda: player.mana_filters.remove(filter))
minion.bind_once("died", lambda x: player.mana_filters.remove(filter))
player.mana_filters.append(filter)
return minion
示例7: create_minion
# 需要导入模块: from hsgame.game_objects import Minion [as 别名]
# 或者: from hsgame.game_objects.Minion import bind_once [as 别名]
def create_minion(self, player):
def increase_stats():
if len(player.secrets) > 0:
minion.change_attack(2)
minion.increase_health(2)
def silence():
player.unbind("turn_ended", increase_stats)
minion = Minion(3, 3)
player.bind("turn_ended", increase_stats)
minion.bind_once("silenced", silence)
return minion