From 31b65e8e9922ddddd5957b4a06de336c65b887d3 Mon Sep 17 00:00:00 2001 From: Mendess2526 Date: Mon, 26 Feb 2018 23:19:00 +0000 Subject: [PATCH] Adds power, toughness, loyalty, and flavor_text methods to card object --- scrython/cards/cards_object.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scrython/cards/cards_object.py b/scrython/cards/cards_object.py index 2490d9f..f0933e7 100644 --- a/scrython/cards/cards_object.py +++ b/scrython/cards/cards_object.py @@ -402,3 +402,29 @@ class CardsObject(object): raise KeyError("This card has no key \'story_spotlight_uri\'") return self.scryfallJson['story_spotlight_uri'] + + def power(self): + if self.__checkForKey('power') is None: + raise KeyError("This card has no key \'power\'") + + return self.scryfallJson['power'] + + def toughness(self): + if self.__checkForKey('toughness') is None: + raise KeyError("This card has no key \'toughness\'") + + return self.scryfallJson['toughness'] + + def loyalty(self): + if self.__checkForKey('loyalty') is None: + raise KeyError("This card has no key \'loyalty\'") + + return self.scryfallJson['loyalty'] + + def flavor_text(self): + if self.__checkForKey('flavor_text') is None: + raise KeyError("This card has no key \'flavor_text\'") + + return self.scryfallJson['flavor_text'] + + \ No newline at end of file