示例#1
0
    def create_minion(self, player):
        def did_damage(amount, target):
            target.freeze()

        minion = Minion(3, 6)
        minion.bind("did_damage", did_damage)
        return minion
示例#2
0
    def create_minion(self, player):

        class Moonfire(Card):
            def __init__(self):
                super().__init__("Moonfire", 0, CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

        class Dispel(Card):
            def __init__(self):
                super().__init__("Dispel", 0, CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

        moonfire = Moonfire()
        dispell = Dispel()
        option = player.agent.choose_option(moonfire, dispell)
        minion = Minion(2, 4)
        if option == moonfire:
            action = deal_two_damage
            targets = hearthbreaker.targeting.find_battlecry_target(player.game, lambda m: not m.stealth)
        else:
            action = silence
            targets = hearthbreaker.targeting.find_minion_battlecry_target(player.game, lambda m: not m.stealth)

        if targets is not None:
            self.target = player.agent.choose_target(targets)

        # here we have to set these things up to mimic a battlecry, although it is not a battlecry
        minion.card = self
        action(minion)

        return minion
示例#3
0
    def create_minion(self, player):
        minion = Minion(2, 2)
        for combo in range(0, player.cards_played):
            minion.increase_health(2)
            minion.change_attack(2)

        return minion
示例#4
0
            def create_minion(self, player):
                def add_effect(m, index):
                    m.add_aura(1, 0, [player], lambda mini: mini is not minion)

                minion = Minion(2, 4, MINION_TYPE.BEAST)
                minion.bind("added_to_board", add_effect)
                return minion
    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
0
    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
示例#7
0
    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
示例#8
0
    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
示例#9
0
    def create_minion(self, player):
        def add_fireball(c):
            if len(player.hand) < 10:
                player.hand.append(hearthbreaker.cards.Fireball())

        minion = Minion(5, 7)
        player.bind("spell_cast", add_fireball)
        minion.bind_once("silenced", lambda: player.unbind("spell_cast", add_fireball))
        return minion
示例#10
0
    def create_minion(self, player):
        def buff_minion():
            minion.increase_health(1)
            minion.change_attack(1)

        minion = Minion(2, 4)
        player.bind("overloaded", buff_minion)
        minion.bind_once("silenced", lambda: player.unbind("overloaded", buff_minion))
        return minion
示例#11
0
    def create_minion(self, player):
        def gain_one_armor(minion):
            if minion.player is player:
                player.hero.increase_armor(1)

        minion = Minion(1, 4)
        player.game.bind("minion_damaged", gain_one_armor)
        minion.bind_once("silenced", lambda: player.game.unbind("minion_damaged", gain_one_armor))
        return minion
    def create_minion(self, player):
        def silence():
            player.heal_multiplier //= 2
            player.spell_multiplier //= 2

        minion = Minion(7, 7)
        minion.bind_once("silenced", silence)
        player.heal_multiplier *= 2
        player.spell_multiplier *= 2
        return minion
    def create_minion(self, player):
        def heal_damaged_friendly_character():
            targets = hearthbreaker.targeting.find_friendly_spell_target(
                player.game, lambda character: character.health != character.calculate_max_health())
            if len(targets) != 0:
                player.game.random_choice(targets).heal(player.effective_heal_power(3), minion)

        minion = Minion(0, 5)
        player.bind("turn_started", heal_damaged_friendly_character)
        minion.bind_once("silenced", lambda: player.unbind("turn_started", heal_damaged_friendly_character))
        return minion
    def create_minion(self, player):
        def attack_equal_to_health():
            return minion.health

        def silence():
            minion.calculate_attack = old_calculate

        minion = Minion(0, 5)
        old_calculate = minion.calculate_attack
        minion.calculate_attack = attack_equal_to_health
        minion.bind_once("silenced", silence)
        return minion
示例#15
0
    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
示例#16
0
    def create_minion(self, player):
        class Filter:
            def __init__(self):
                self.amount = 1
                self.filter = lambda c: c.is_spell()
                self.min = 0

        mana_filter = Filter()
        minion = Minion(3, 2)
        minion.bind_once("silenced", lambda: player.mana_filters.remove(mana_filter))
        player.mana_filters.append(mana_filter)
        return minion
示例#17
0
    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
示例#18
0
    def create_minion(self, player):
        def buff_ally_health():
            targets = copy.copy(player.game.current_player.minions)
            targets.remove(minion)
            if len(targets) > 0:
                target = targets[player.game.random(0, len(targets) - 1)]
                target.increase_health(1)

        minion = Minion(0, 1, MINION_TYPE.DEMON)
        minion.stealth = True
        player.bind("turn_ended", buff_ally_health)
        minion.bind_once("silenced", lambda: player.unbind("turn_ended", buff_ally_health))
        return minion
示例#19
0
    def create_minion(self, player):
        def give_charge(m):
            if m is not minion and m.calculate_attack() <= 3:
                m.charge = True
                m.exhausted = False

        def silence():
            player.unbind("minion_placed", give_charge)

        minion = Minion(2, 3)
        player.bind("minion_placed", give_charge)
        minion.bind_once("silenced", silence)
        return minion
示例#20
0
    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
示例#21
0
    def __from_json__(cls, pd, game, agent):
        deck = Deck.__from__to_json__(pd["deck"],
                                      hearthbreaker.constants.CHARACTER_CLASS.from_str(pd["hero"]["character"]))
        player = Player("whatever", deck, agent, game)
        hero = Hero.__from_json__(pd["hero"], player)
        player.hero = hero
        hero.player = player
        if hero.weapon:
            hero.weapon.player = player
        player.mana = pd["mana"]
        player.max_mana = pd["max_mana"]
        player.name = pd['name']
        player.hand = [card_lookup(name) for name in pd["hand"]]
        player.graveyard = set()
        for card_name in pd["graveyard"]:
            player.graveyard.add(card_name)

        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
示例#22
0
    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_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
示例#24
0
    def create_minion(self, player):

        # These are basically placeholders to give the agent something to
        # choose
        class Health(Card):
            def __init__(self):
                super().__init__("+5 Health and Taunt", 0, CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

        class Attack(Card):
            def __init__(self):
                super().__init__("+5 Attack", 0, CHARACTER_CLASS.DRUID, CARD_RARITY.SPECIAL)

        health = Health()
        attack = Attack()
        option = player.agent.choose_option(health, attack)
        minion = Minion(5, 5)
        if option is health:
            minion.increase_health(5)
            minion._effects_to_add.append(Taunt())
        else:
            minion.change_attack(5)

        return minion
示例#25
0
    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
示例#26
0
    def create_minion(self, player):
        def increase_attack():
            minion.change_attack(6)

        def decrease_attack():
            minion.change_attack(-6)

        def silenced():
            minion.unbind("enraged", increase_attack)
            minion.unbind("unenraged", decrease_attack)

        minion = Minion(4, 9, charge=True)
        minion.bind("enraged", increase_attack)
        minion.bind("unenraged", decrease_attack)
        minion.bind("silenced", silenced)
        return minion
示例#27
0
 def create_minion(self, player):
     return Minion(1, 4, effects=[Effect(CharacterDamaged(condition=IsMinion()), ActionTag(IncreaseArmor(),
                                                                                           HeroSelector()))])
示例#28
0
 def create_minion(self, player):
     return Minion(3, 5, battlecry=destroy_own_crystal, taunt=True)
示例#29
0
 def create_minion(self, player):
     return Minion(1, 3, enrage=[Aura(ChangeAttack(1), SelfSelector())])
示例#30
0
 def create_minion(self, player):
     return Minion(3, 2, battlecry=flame_imp)
示例#31
0
 def create_minion(self, player):
     return Minion(3, 4, deathrattle=put_minion_on_board_from_hand)
示例#32
0
 def create_minion(self, player):
     return Minion(5, 6, battlecry=pit_lord)
示例#33
0
 def create_minion(self, player):
     res = Minion(self.base_attack, self.health, taunt=self.taunt)
     res.name = self.name
     return res
示例#34
0
 def create_minion(self, player):
     return Minion(2, 4, effects=[Effect(CharacterDamaged(player=BothPlayer(),
                                                          condition=IsMinion()), ActionTag(Give(ChangeAttack(1)),
                                                                                           SelfSelector()))])
示例#35
0
 def create_minion(self, player):
     return Minion(4, 9, charge=True, enrage=[Aura(ChangeAttack(6), SelfSelector())])
示例#36
0
 def create_minion(self, p):
     return Minion(3, 2, windfury=True)
示例#37
0
 def create_minion(self, player):
     return Minion(
         0,
         3,
         effects=[Effect(TurnEnded(), ActionTag(Heal(4), HeroSelector()))])
示例#38
0
 def create_minion(self, p):
     return Minion(2, 3, taunt=True)
示例#39
0
 def create_minion(self, player):
     return Minion(0, 2, spell_damage=1)
示例#40
0
 def create_minion(self, player):
     return Minion(7, 6, effects=[Effect(Damaged(),
                                         ActionTag(AddCard(CardList(spare_part_list)), PlayerSelector()))])
示例#41
0
 def create_minion(self, player):
     return Minion(2, 5, effects=[Effect(Damaged(), ActionTag(Damage(2), HeroSelector(EnemyPlayer())))])
示例#42
0
 def create_minion(self, player):
     return Minion(4, 3, battlecry=discard_one)
示例#43
0
 def create_minion(self, player):
     return Minion(6, 6, battlecry=deal_one_damage_all_characters)
示例#44
0
 def create_minion(self, player):
     return Minion(3, 5, taunt=True)
示例#45
0
 def create_minion(self, _):
     return Minion(3, 2, MINION_TYPE.BEAST)
示例#46
0
 def create_minion(self, player):
     return Minion(5, 7, charge=True)
示例#47
0
 def create_minion(self, player):
     return Minion(5, 5, effects=[Effect(ArmorIncreased(), ActionTag(Give(ChangeAttack(1)), SelfSelector()))])
示例#48
0
 def create_minion(self, p):
     return Minion(1, 3)
示例#49
0
 def create_minion(self, player):
     minion = Minion(4, 4, MINION_TYPE.BEAST)
     minion.taunt = True
     return minion
示例#50
0
 def create_minion(self, player):
     return Minion(2, 3, effects=[Effect(MinionPlaced(AttackLessThanOrEqualTo(3)),
                                         ActionTag(Give(Charge()), TargetSelector()))])
示例#51
0
 def create_minion(self, p):
     return Minion(4, 4, charge=True)
示例#52
0
 def create_minion(self, player):
     return Minion(5, 7, battlecry=discard_two, charge=True)
示例#53
0
 def create_minion(self, player):
     return Minion(
         0, 3, auras=[Aura(ChangeAttack(2), MinionSelector(Adjacent()))])
示例#54
0
 def create_minion(self, player):
     return Minion(
         0,
         3,
         effects=[Effect(TurnEnded(), ActionTag(Draw(), PlayerSelector()))])
示例#55
0
 def create_minion(self, p):
     minion = Minion(2, 2, MINION_TYPE.NONE)
     minion.taunt = True
     return minion
示例#56
0
 def create_minion(self, player):
     return Minion(
         0,
         4,
         auras=[Aura(ManaChange(-2, 1, minimum=1), MinionCardSelector())])
示例#57
0
 def create_minion(self, player):
     minion = Minion(4, 2, MINION_TYPE.BEAST)
     minion.charge = True
     return minion
示例#58
0
 def create_minion(self, player):
     return Minion(6, 6)
示例#59
0
 def create_minion(self, player):
     return Minion(3, 1, windfury=True)
示例#60
0
 def create_minion(self, player):
     return Minion(9, 7, deathrattle=[Deathrattle(AddCard(ObjectSource(SelfSelector()),
                                                          add_to_deck=True), PlayerSelector()),
                                      Deathrattle(Remove(), SelfSelector())])