def __init__(self):
            init_dict = {
                'name': card_def['name'],
                'mana': card_def['mana'],
                'rarity': CARD_RARITY.from_str(card_def['rarity'])
            }
            if 'character_class' in card_def:
                init_dict['character_class'] = CHARACTER_CLASS.from_str(card_def['character_class'])

            if 'minion_type' in card_def:
                init_dict['minion_type'] = MINION_TYPE.from_str(card_def['minion_type'])

            if 'battlecry' in card_def:
                init_dict['battlecry'] = tuple(Battlecry.from_json(**battlecry) for battlecry in card_def['battlecry'])

            if 'choices' in card_def:
                init_dict['choices'] = [Choice.from_json(**choice) for choice in card_def['choices']]

            if 'combo' in card_def:
                init_dict['combo'] = Battlecry.from_json(**card_def['combo'])

            if 'overload' in card_def:
                init_dict['overload'] = card_def['overload']

            if 'buffs' in card_def:
                init_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]
            if 'auras' in card_def:
                init_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]
            if 'effects' in card_def:
                init_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            MinionCard.__init__(self, **init_dict)
        def __init_weapon__(self):
            init_dict = {
                'name': card_def['name'],
                'mana': card_def['mana'],
                'rarity': CARD_RARITY.from_str(card_def['rarity'])
            }
            if 'character_class' in card_def:
                init_dict['character_class'] = CHARACTER_CLASS.from_str(card_def['character_class'])

            if 'battlecry' in card_def:
                init_dict['battlecry'] = Battlecry.from_json(**card_def['battlecry'])

            if 'combo' in card_def:
                init_dict['combo'] = Battlecry.from_json(**card_def['combo'])

            if 'overload' in card_def:
                init_dict['overload'] = card_def['overload']

            if 'buffs' in card_def:
                init_dict['buffs'] = [Buff.from_json(**buff) for buff in card_def['buffs']]
            if 'auras' in card_def:
                init_dict['auras'] = [Aura.from_json(**aura) for aura in card_def['auras']]
            if 'effects' in card_def:
                init_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

            WeaponCard.__init__(self, **init_dict)
    def __from_json__(self, buffs=None, effects=None, auras=None):
        if effects:  # To allow for give to work with effects as well, we check at load time
            return GiveEffect.__new__(GiveEffect).__from_json__(effects)

        if auras:  # To allow for give to work with auras as well, we check at load time
            return GiveAura.__new__(GiveAura).__from_json__(auras)

        self.buffs = []
        for buff in buffs:
            if "until" in buff:
                self.buffs.append(BuffUntil.from_json(**buff))
            else:
                self.buffs.append(Buff.from_json(**buff))
        return self
Example #4
0
 def __from_json__(minion, effects=None, auras=None, buffs=None, **kwargs):
     if effects:
         minion.effects = [Effect.from_json(**effect) for effect in effects]
     else:
         minion.effects = []
     if auras:
         minion.auras = [AuraUntil.from_json(**aura) if 'until' in aura else Aura.from_json(**aura)
                         for aura in auras]
     else:
         minion.auras = []
     if buffs:
         minion.buffs = [BuffUntil.from_json(**buff) if 'until' in buff else Buff.from_json(**buff)
                         for buff in buffs]
     else:
         minion.buffs = []
        def create_weapon(self, player):
            create_dict = {
                'attack_power': card_def['attack'],
                'durability': card_def['durability']
            }
            if 'effects' in card_def:
                create_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

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

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

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

            return Weapon(**create_dict)
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            if 'effects' in card_def:
                create_dict['effects'] = [Effect.from_json(**effect) for effect in card_def['effects']]

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

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

            if 'enrage' in card_def:
                create_dict['enrage'] = Enrage.from_json(**card_def['enrage'])

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

            return Minion(**create_dict)
        def create_minion(self, player):
            create_dict = {
                'attack': card_def['attack'],
                'health': card_def['health']
            }
            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 'enrage' in card_def:
                create_dict['enrage'] = [Aura.from_json(**enrage) for enrage in card_def['enrage']]

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

            return Minion(**create_dict)
Example #8
0
 def __init__(self):
     super().__init__("Ancient of War", 7, CHARACTER_CLASS.DRUID, CARD_RARITY.EPIC, choices=[
         Choice(Health(), Give([Buff(ChangeHealth(5)), Buff(Taunt())]), SelfSelector()),
         Choice(Attack(), Give([Buff(ChangeAttack(5))]), SelfSelector()),
     ])
Example #9
0
 def __init__(self):
     super().__init__("Anodized Robo Cub", 2, CHARACTER_CLASS.DRUID, CARD_RARITY.COMMON,
                      minion_type=MINION_TYPE.MECH,
                      choices=[Choice(AttackMode(), Give([Buff(ChangeAttack(1))]), SelfSelector()),
                               Choice(TankMode(), Give([Buff(ChangeHealth(1))]), SelfSelector())])
Example #10
0
 def __init__(self):
     super().__init__("Volcanic Lumberer", 9, CHARACTER_CLASS.DRUID, CARD_RARITY.RARE,
                      buffs=[Buff(ManaChange(Count(DeadMinionSelector(players=BothPlayer())), -1))])
Example #11
0
 def __init__(self):
     super().__init__("Edwin VanCleef", 3, CHARACTER_CLASS.ROGUE, CARD_RARITY.LEGENDARY,
                      battlecry=Battlecry(Give([Buff(ChangeAttack(Attribute("cards_played", PlayerSelector()), 2)),
                                                Buff(ChangeHealth(Attribute("cards_played", PlayerSelector()), 2))]),
                                          SelfSelector()))
Example #12
0
 def create_minion(self, player):
     return Minion(2, 2, effects=[Effect(TurnEnded(), ActionTag(Give([Buff(ChangeAttack(2)), Buff(ChangeHealth(2))]),
                                         MinionSelector(IsType(MINION_TYPE.MECH), picker=RandomPicker())))])
Example #13
0
 def create_minion(self, player):
     return Minion(0, 5, buffs=[Buff(AttackEqualsHealth())])
Example #14
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_buff(Buff(Frozen()))
Example #15
0
 def reduce_cost(card):
     if card.is_minion() and card.minion_type == MINION_TYPE.BEAST:
         card.add_buff(Buff(ManaChange(-4)))
Example #16
0
    def use(self, player, game):
        super().use(player, game)

        self.target.add_buff(Buff(_Windfury()))
Example #17
0
 def use(self, player, game):
     super().use(player, game)
     for minion in game.other_player.minions:
         minion.add_buff(Buff(Frozen()))
Example #18
0
 def use(self, player, game):
     super().use(player, game)
     query = CardQuery(conditions=[IsMinion()])
     new_minon = query.get_card(player, player, self)
     new_minon.add_buff(Buff(ManaChange(-3)))
     player.hand.append(new_minon)
Example #19
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_buff(Buff(Taunt()))
Example #20
0
    def use(self, player, game):
        super().use(player, game)

        self.target.bounce()
        self.target.card.add_buff(Buff(ManaChange(-3)))
Example #21
0
 def reduce_cost(card):
     card.add_buff(Buff(ManaChange(-3)))
Example #22
0
 def use(self, player, game):
     super().use(player, game)
     self.target.add_buff(Buff(DoubleAttack()))
Example #23
0
 def set_attack_to(self, new_attack):
     """
     Sets the amount of total attack this :class:`Character` has.
     :param new_attack: An integer specifying what this character's new attack should be
     """
     self.buffs.append(Buff(SetAttack(new_attack)))
Example #24
0
 def _reveal(self, attacker, target):
     if isinstance(attacker, Minion) and not attacker.removed:
         attacker.bounce()
         attacker.card.add_buff(Buff(ManaChange(2)))
         super().reveal()