Scrython/examples/get_and_format_card.py

35 lines
757 B
Python
Raw Normal View History

2018-02-07 01:36:36 +00:00
import scrython
2018-02-14 02:02:48 +00:00
getCard = str(input("What card would you like me to search? "))
2018-02-07 01:36:36 +00:00
card = scrython.cards.Named(fuzzy=getCard)
if card.object() == 'error':
print(card.scryfallJson['details'])
if card.type_line() == 'Creature':
PT = "({}/{})".format(card.power(), card.toughness())
else:
PT = ""
if card.cmc() == 0:
mana_cost = ""
else:
mana_cost = card.mana_cost()
string = """
{cardname} {mana_cost}
{type_line} {set_code} {rarity}
{oracle_text}{power_toughness}
""".format(
cardname=card.name(),
mana_cost=mana_cost,
type_line=card.type_line(),
set_code=card.set_code().upper(),
rarity=card.rarity(),
oracle_text=card.oracle_text(),
power_toughness=PT
)
print(string)