Example #1
0
File: Deck.py Project: jom9/autumn
    def getDeckList(self, filename):
        #gets deck list from txt file
        file = open(filename, 'r')
        mainBool = True

        for line in file.readlines():
            if line.isspace():
                mainBool = False

                continue
            numOfCpys = line[0]
            name = line[2:]
            c = Card()
            c.getCard(name)
            '''
            apiURL = 'https://api.scryfall.com/cards/named'
            p = {'exact':name}
            r = requests.get(url=apiURL,params=p)
            data = r.json()
            text = data['oracle_text']
            type = data['type_line']
            manaCost = data['mana_cost']
            colors = []
            for color in data['colors']:
                colors+=[color]
            '''

            for i in range(int(numOfCpys)):
                card = (c, i)
                if mainBool:
                    self.mainboard.append(card)
                else:
                    self.sideboard.append(card)
            delay = .2
            time.sleep(delay)