def madness_effects(source): def madness_exile(self, zone, position="top"): madnessed[0] = True return self.move_to("exile") def madness_discard(self, card): if self.you_may("exile %s with madness" % card.name): expire = replace( card, "move_to", madness_exile, msg="Madness - Exile %s instead of putting it into the graveyard" % card.name, condition=lambda self, zone, position="top": str(zone) == "graveyard", ) newcard = self.discard(card) expire() return newcard else: return self.discard(card) yield replace( source.controller, "discard", madness_discard, msg="Madness - If a player would discard this card, that player discards it, but may exile it instead of putting it into his or her graveyard.", condition=lambda self, card: card == source, )
def madness_discard(self, card): if self.you_may("exile %s with madness" % card.name): expire = replace( card, "move_to", madness_exile, msg="Madness - Exile %s instead of putting it into the graveyard" % card.name, condition=lambda self, zone, position="top": str(zone) == "graveyard", ) newcard = self.discard(card) expire() return newcard else: return self.discard(card)
def exile_not_graveyard(card): def move_to(self, zone, position="top"): return self.move_to("exile") yield replace(card, "move_to", move_to, msg="Flashback - Exile this card instead of putting it anywhere else any time it would leave the stack.", condition=lambda self, zone, position="top": not str(zone) == 'exile' and self.flashbacked)