コード例 #1
0
 def __from_json__(md, player, game):
     from hearthbreaker.engine import card_lookup
     minion = Minion(md['attack'], md['max_health'])
     GameObject.__from_json__(minion, **md)
     minion.health = md['max_health'] - md['damage']
     minion.exhausted = md['exhausted']
     minion.active = not md['already_attacked']
     minion.born = md['sequence_id']
     if 'enrage' in md:
         minion.enrage = Enrage.from_json(**md['enrage'])
     minion.deathrattle = []
     for rattle in md['deathrattles']:
         minion.deathrattle.append(Deathrattle.from_json(**rattle))
     minion.card = card_lookup(md["name"])
     minion.game = game
     minion.player = player
     return minion
コード例 #2
0
        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(player.game, **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 '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)