コード例 #1
0
ファイル: paladin.py プロジェクト: WabiWasabi/hearthbreaker
    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
コード例 #2
0
    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
コード例 #3
0
ファイル: engine.py プロジェクト: AlexSafatli/hearthbreaker
    def __from_json__(cls, pd, game, agent):
        deck = Deck.__from__to_json__(pd["deck"], hero_from_name(pd["hero"]["name"]))
        player = Player("whatever", deck, agent, game)
        hero = Hero.__from_json__(pd["hero"], player)
        player.hero = hero
        hero.player = player
        if pd["weapon"]:
            player.weapon = Weapon.__from_json__(pd["weapon"], player)
            player.weapon.player = player
        player.mana = pd["mana"]
        player.max_mana = pd["max_mana"]
        player.upcoming_overload = pd["upcoming_overload"]
        player.current_overload = pd["current_overload"]
        player.name = pd["name"]
        player.hand = []
        for card_def in pd["hand"]:
            card = card_lookup(card_def["name"])
            card.__from_json__(card, **card_def)
            card.attach(card, player)
            player.hand.append(card)
        player.graveyard = pd["graveyard"]

        player.secrets = []
        for secret_name in pd["secrets"]:
            secret = card_lookup(secret_name)
            secret.player = player
            player.secrets.append(secret)
        i = 0
        player.minions = []
        for md in pd["minions"]:
            minion = Minion.__from_json__(md, player, game)
            minion.index = i
            player.minions.append(minion)
            i += 1
        return player
コード例 #4
0
        def create_weapon(self, player):
            create_dict = {
                'attack_power': card_def['attack'],
                'durability': card_def['durability']
            }
            if "impl" in card_def:
                impl = card_def['impl']
                if 'effects' in impl:
                    create_dict['effects'] = [
                        Effect.from_json(**effect)
                        for effect in impl['effects']
                    ]

                if 'auras' in impl:
                    create_dict['auras'] = [
                        Aura.from_json(**aura) for aura in impl['auras']
                    ]

                if 'buffs' in impl:
                    create_dict['buffs'] = [
                        Buff.from_json(**buff) for buff in impl['buffs']
                    ]

            if 'deathrattle' in card_def:
                create_dict['deathrattle'] = Deathrattle.from_json(
                    **card_def['deathrattle'])

            return Weapon(**create_dict)
コード例 #5
0
    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
コード例 #6
0
 def create_weapon(self, player):
     return Weapon(4,
                   2,
                   effects=[
                       Effect(CharacterAttack(IsHero()),
                              ActionTag(Heal(2), HeroSelector()))
                   ])
コード例 #7
0
ファイル: warrior.py プロジェクト: mharris717/hearthbreaker
 def create_weapon(self, player):
     def maybe_increase_durability(target):
         if isinstance(target, Minion):
             weapon.durability += 1
     weapon = Weapon(7, 1)
     player.hero.bind("attack", maybe_increase_durability)
     return weapon
コード例 #8
0
ファイル: paladin.py プロジェクト: WabiWasabi/hearthbreaker
    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
コード例 #9
0
 def create_weapon(self, player):
     return Weapon(3,
                   2,
                   effects=[
                       Effect(
                           SecretRevealed(),
                           ActionTag(IncreaseDurability(), HeroSelector()))
                   ])
コード例 #10
0
 def create_weapon(self, player):
     return Weapon(7,
                   1,
                   effects=[
                       Effect(
                           CharacterAttack(And(IsHero(), TargetIsMinion())),
                           ActionTag(IncreaseDurability(), HeroSelector()))
                   ])
コード例 #11
0
ファイル: shaman.py プロジェクト: futouyiba/HyperbolaAI
 def create_weapon(self, player):
     return Weapon(3,
                   2,
                   deathrattle=Deathrattle(
                       Give([Buff(ChangeHealth(2)),
                             Buff(ChangeAttack(2))]),
                       MinionSelector(IsType(MINION_TYPE.MECH),
                                      picker=RandomPicker())))
コード例 #12
0
ファイル: warrior.py プロジェクト: mharris717/hearthbreaker
    def create_weapon(self, player):
        def deal_one_to_all(weapon):
            targets = copy.copy(weapon.player.minions)
            targets.extend(weapon.player.opponent.minions)
            for minion in targets:
                minion.damage(1, None)

        return Weapon(4, 2, deathrattle=deal_one_to_all)
コード例 #13
0
 def create_weapon(self, player):
     return Weapon(1,
                   3,
                   buffs=[
                       Buff(
                           ChangeAttack(2),
                           GreaterThan(Count(
                               MinionSelector(IsType(MINION_TYPE.MECH))),
                                       value=0))
                   ])
コード例 #14
0
    def create_weapon(self, player):
        def deal_damage(w):
            if w.card.target is not None:
                if player.cards_played > 0:
                    w.card.target.damage(2, self)
                else:
                    w.card.target.damage(1, self)

        weapon = Weapon(2, 2, battlecry=deal_damage)
        return weapon
コード例 #15
0
 def create_weapon(self, player):
     return Weapon(5,
                   2,
                   effects=[
                       Effect(
                           CharacterAttack(IsHero()),
                           ActionTag(
                               Give(BuffUntil(Immune(), AttackCompleted())),
                               HeroSelector()))
                   ])
コード例 #16
0
    def create_weapon(self, player):
        def deal_one_to_all(weapon):
            targets = copy.copy(weapon.player.minions)
            targets.extend(weapon.player.opponent.minions)
            for minion in targets:
                minion.damage(1, None)

        return Weapon(4,
                      2,
                      deathrattle=Deathrattle(
                          Damage(1), MinionSelector(players=BothPlayer())))
コード例 #17
0
 def create_weapon(self, player):
     return Weapon(
         1,
         5,
         effects=[
             Effect(
                 MinionSummoned(),
                 ActionTag(
                     Give([Buff(ChangeAttack(1)),
                           Buff(ChangeHealth(1))]), TargetSelector())),
             Effect(MinionSummoned(),
                    ActionTag(DecreaseDurability(), WeaponSelector()))
         ])
コード例 #18
0
 def create_weapon(self, player):
     return Weapon(
         7,
         1,
         effects=[
             Effect(CharacterAttack(And(IsHero(), TargetIsMinion())), [
                 ActionTag(IncreaseDurability(), HeroSelector()),
                 ActionTag(IncreaseWeaponAttack(-1), HeroSelector()),
                 ActionTag(
                     Give(BuffUntil(ChangeAttack(1), AttackCompleted())),
                     HeroSelector())
             ])
         ])
コード例 #19
0
    def create_weapon(self, player):
        def apply_effect(w, p):
            def increase_durability(s):
                w.durability += 1

            p.bind("secret_revealed", increase_durability)
            w.bind_once(
                "destroyed",
                lambda: p.unbind("secret_revealed", increase_durability))
            w.bind("copied", apply_effect)

        weapon = Weapon(3, 2)
        apply_effect(weapon, player)
        return weapon
コード例 #20
0
 def create_weapon(self, player):
     return Weapon(4,
                   2,
                   effects=[
                       Effect(
                           CharacterAttack(IsHero()),
                           ActionTag(
                               ChangeTarget(
                                   CharacterSelector(
                                       NotCurrentTarget(), EnemyPlayer(),
                                       RandomPicker())), HeroSelector(),
                               And(OneIn(2),
                                   OpponentMinionCountIsGreaterThan(0))))
                   ])
コード例 #21
0
    def create_weapon(self, player):
        def add_effect(w, p):
            def make_immune(ignored_target):
                p.hero.immune = True

            def end_immune():
                p.hero.immune = False

            def on_destroy():
                p.hero.unbind("attack", make_immune)
                p.hero.unbind("attack_completed", end_immune)

            p.hero.bind("attack", make_immune)
            p.hero.bind("attack_completed", end_immune)
            w.bind_once("destroyed", on_destroy)
            w.bind("copied", add_effect)

        weapon = Weapon(5, 2)
        add_effect(weapon, player)
        return weapon
コード例 #22
0
ファイル: engine.py プロジェクト: icelure/hearthstone-sim
    def __from_json__(cls, pd, game, agent):
        deck = Deck.__from__to_json__(pd["deck"],
                                      hero_from_name(pd["hero"]["name"]))
        player = Player("whatever", deck, agent, game)
        hero = Hero.__from_json__(pd["hero"], player)
        player.hero = hero
        hero.player = player
        if pd['weapon']:
            player.weapon = Weapon.__from_json__(pd['weapon'], player)
            player.weapon.player = player
        player.mana = pd["mana"]
        player.max_mana = pd["max_mana"]
        player.upcoming_overload = pd['upcoming_overload']
        player.current_overload = pd['current_overload']
        player.name = pd['name']
        player.hand = []
        for card_def in pd['hand']:
            card = card_lookup(card_def['name'])
            card.__from_json__(card, **card_def)
            card.attach(card, player)
            player.hand.append(card)
        player.graveyard = pd["graveyard"]

        player.secrets = []
        for secret_name in pd["secrets"]:
            secret = card_lookup(secret_name)
            secret.player = player
            player.secrets.append(secret)
        i = 0
        player.minions = []
        for md in pd["minions"]:
            minion = Minion.__from_json__(md, player, game)
            minion.index = i
            player.minions.append(minion)
            i += 1
        return player
コード例 #23
0
 def create_weapon(self, player):
     return Weapon(4,
                   2,
                   deathrattle=Deathrattle(
                       Damage(1), MinionSelector(players=BothPlayer())))
コード例 #24
0
 def create_weapon(self, player):
     return Weapon(1, 3)
コード例 #25
0
 def create_weapon(self, player):
     weapon = Weapon(5, 3)
     return weapon
コード例 #26
0
ファイル: shaman.py プロジェクト: futouyiba/HyperbolaAI
 def create_weapon(self, player):
     return Weapon(2, 8, buffs=[Buff(Windfury())])
コード例 #27
0
 def create_weapon(self, player):
     weapon = Weapon(2, 8)
     player.hero.windfury = True
     return weapon