2018-02-19 17:20:05 +00:00
|
|
|
from .symbology_object import SymbologyObject
|
|
|
|
|
|
|
|
class ParseMana(SymbologyObject):
|
2018-02-22 00:17:22 +00:00
|
|
|
"""
|
|
|
|
symbology/parse-mana
|
|
|
|
|
|
|
|
Positional arguments:
|
|
|
|
cost : str ....................... The given mana cost you want. (`RUG`)
|
|
|
|
|
|
|
|
Optional arguments:
|
|
|
|
All arguments are inherited from SymbologyObject
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
object : str ...... Returns the type of object it is. (card, error, etc)
|
|
|
|
mana_cost : str ............................... The formatted mana cost.
|
|
|
|
cmc : float ....................... The converted mana cost of the card.
|
|
|
|
colors : list ................... A list of all colors in the mana cost.
|
|
|
|
colorless : bool ................... True if the mana cost is colorless.
|
|
|
|
monocolored : bool .............. True if the mana cost is mono colored.
|
|
|
|
multicolored : bool ...... True if the mana cost is a multicolored cost.
|
|
|
|
|
|
|
|
Example usage:
|
|
|
|
>>> mana = scrython.symbology.ParseMana(cost="xcug")
|
|
|
|
>>> mana.colors()
|
|
|
|
"""
|
|
|
|
def __init__(self, cost):
|
|
|
|
self.cost = cost
|
2018-02-19 17:20:05 +00:00
|
|
|
self.url = 'symbology/parse-mana?cost=' + self.cost
|
|
|
|
super(ParseMana, self).__init__(self.url)
|
|
|
|
|
2018-03-03 23:31:30 +00:00
|
|
|
def _checkForKey(self, key):
|
2018-02-19 17:20:05 +00:00
|
|
|
try:
|
|
|
|
return self.scryfallJson[key]
|
2018-03-03 23:31:30 +00:00
|
|
|
except Exception:
|
|
|
|
raise KeyError('This object has no key \'{}\''.format(key))
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
def object(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('object')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['object']
|
|
|
|
|
|
|
|
def mana_cost(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('cost')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['cost']
|
|
|
|
|
|
|
|
def cmc(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('cmc')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['cmc']
|
|
|
|
|
|
|
|
def colors(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('colors')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['colors']
|
|
|
|
|
|
|
|
def colorless(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('colorless')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['colorless']
|
|
|
|
|
|
|
|
def monocolored(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('monocolored')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['monocolored']
|
|
|
|
|
|
|
|
def multicolored(self):
|
2018-03-03 23:31:30 +00:00
|
|
|
self._checkForKey('multicolored')
|
2018-02-19 17:20:05 +00:00
|
|
|
|
|
|
|
return self.scryfallJson['multicolored']
|