def create_weapon(self, player): def heal(attacker): player.hero.heal(player.effective_heal_power(2), self) def on_destroy(): player.hero.unbind("attack", heal) weapon = Weapon(4, 2) player.hero.bind("attack", heal) weapon.bind_once("destroyed", on_destroy) return weapon
def create_weapon(self, player): def buff_minion(minion): if minion.player is player: minion.increase_health(1) minion.change_attack(1) weapon.durability -= 1 if weapon.durability == 0: weapon.destroy() def on_destroy(): player.unbind("minion_summoned", buff_minion) weapon = Weapon(1, 5) player.bind("minion_summoned", buff_minion) weapon.bind_once("destroyed", on_destroy) return weapon