Scrython/scrython/symbology/parse_mana.py

95 lines
2.3 KiB
Python
Raw Normal View History

import sys
sys.path.append('..')
from scrython.foundation import FoundationObject
2018-02-19 17:20:05 +00:00
class ParseMana(FoundationObject):
2018-10-22 14:19:38 +00:00
"""
symbology/parse-mana
2018-02-22 00:17:22 +00:00
2018-10-26 14:45:05 +00:00
Args:
cost (string): The given mana cost you want. (`RUG`)
format (string, optional):
Returns data in the specified method. Defaults to JSON.
pretty (string, optional):
Returns a prettier version of the json object. Note that this may break functionality with Scrython.
2018-02-22 00:17:22 +00:00
2018-10-22 14:19:38 +00:00
Example usage:
>>> mana = scrython.symbology.ParseMana(cost="xcug")
>>> mana.colors()
"""
def __init__(self, cost):
self.cost = cost
self.url = 'symbology/parse-mana?cost=' + self.cost
super(ParseMana, self).__init__(self.url)
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def object(self):
2018-10-26 14:45:05 +00:00
"""Returns the type of object it is
(card, error, etc)
Returns:
string
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('object')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['object']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def mana_cost(self):
2018-10-26 14:45:05 +00:00
"""The formatted mana cost
Returns:
string
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('cost')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['cost']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def cmc(self):
2018-10-26 14:45:05 +00:00
"""The converted mana cost of the card 
Returns:
float
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('cmc')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['cmc']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def colors(self):
2018-10-26 14:45:05 +00:00
"""A list of all colors in the mana cost
Returns:
list
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('colors')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['colors']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def colorless(self):
2018-10-26 14:45:05 +00:00
"""True if the mana cost is colorless
Returns:
boolean
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('colorless')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['colorless']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def monocolored(self):
2018-10-26 14:45:05 +00:00
"""True if the mana cost is mono colored
Returns:
boolean
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('monocolored')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['monocolored']
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
def multicolored(self):
2018-10-26 14:45:05 +00:00
"""True if the mana cost is a multicolored cost
Returns:
boolean
"""
2018-10-22 14:19:38 +00:00
super(ParseMana, self)._checkForKey('multicolored')
2018-02-19 17:20:05 +00:00
2018-10-22 14:19:38 +00:00
return self.scryfallJson['multicolored']