Пример #1
0
	def makeCard( self, card_attr ) :
		newcard = magic_card()
		newcard.setType(card_attr[0])
		newcard.setColor(card_attr[1])
		newcard.setMana(card_attr[2])
		newcard.setRarity(card_attr[3])
		# Need to add comment
		for line in card_attr[5:] :
			newcard.appendToComment(line + ' ')
		return newcard		
Пример #2
0
	def createCard( self, deck ) :
		# Create new card
		newcard = magic_card()
		# Get attribute info about the card
		type = raw_input('Enter type: ')
		newcard.setType(type)
		color = raw_input('Enter color: ')
		newcard.setColor(color)
		cost = raw_input('Enter mana cost (integer): ')
		newcard.setMana(cost)
		rarity = raw_input('Enter rarity: ')
		newcard.setRarity(rarity)
		comment	= raw_input('Enter comment (optional): ')
		newcard.appendToComment(comment)
		howmany = raw_input('How many of this card would you like to add to ' + deck.getName() + ': ' )
		# To make sure the input is a number, if not, it's default is 1
		try:
			howmany = int(howmany)
		except ValueError:
			howmany = 1
		# Add the specified number of cards to the deck	for i in range(0,howmany) :
		deck.addCard(newcard)
		# Return the deck with the new card(s) added
		return deck