def __init__(self, info, owner): super(Token, self).__init__(owner) if isinstance(info, dict): info = CardDatabase.convertToTxt(info) CardDatabase.execCode(self, info) self.out_battlefield_role = self.stack_role = TokenNonBattlefieldRole self.in_battlefield_role = TokenPermanent self._add_to_map(self.base_name)
def __init__(self, cardname, owner): super(Card, self).__init__(owner) CardDatabase.loadCardFromDB(self, cardname) if self.base_types == Land: self.stack_role = NoRole self.out_battlefield_role = LandNonBattlefieldRole else: self.stack_role = SpellRole self.out_battlefield_role = OtherNonBattlefieldRole if (self.base_types == Instant or self.base_types == Sorcery): self.in_battlefield_role = NoRole else: self.in_battlefield_role = Permanent self._add_to_map(self.base_name)
def __init__(self, info, owner, tag=None): super(Token, self).__init__(owner) if isinstance(info, dict): if not tag: tag = "" if "P/T" in info: tag += "%d/%d"%info["P/T"] for attr in ("color", "supertypes", "subtypes", "types", "abilities", "name"): if attr in info: tag += " %s"%(' '.join(info[attr]) if isinstance(info[attr], (list, tuple)) else info[attr]) if not tag: tag = "NO TAG" # Empty info dictionary (usually used by token copies) info = CardDatabase.convertToTxt(info) elif not tag: print "Non-dict token (%s...) has no tag!"%repr(info[:30]) tag = "NO TAG" CardDatabase.execCode(self, info) self.out_battlefield_role = self.stack_role = TokenNonBattlefieldRole self.in_battlefield_role = TokenPermanent self._add_to_map(tag)