def effects(card): card.kicked = kicked() yield ( do_override(card, "_get_additional_costs", lambda self: KickerCost(cost)), do_override( card, "modifyNewRole", lambda self, new, zone: setattr(new, "kicked", self.kicked)))
def effects(card): card.kicked = kicked() #yield (do_override(card, "_get_additional_costs", lambda self: KickerCost(cost)), # do_override(card, "modifyNewRole", lambda self, new, zone: setattr(new, "kicked", self.kicked))) def modifyNewRole(self, new, zone): if str(zone) == "battlefield": setattr(new, "kicked", self.kicked) yield (do_override(card, "_get_additional_costs", lambda self: KickerCost(cost)), do_override(card, "modifyNewRole", modifyNewRole))
def detain(controller, card): do_until( combine( do_override(card, "canAttack", lambda self: False), do_override(card, "canBlock", lambda self: False), do_override(ActivatedAbility, "playable", lambda self: not self.source == card), ), NewTurnEvent(), lambda player: player == controller, )
def doesnt_untap_your_next_untap_step(target): # This is different than doesnt_untap_controllers_next_untap_step because it specifies # YOU, not controller # So we don't set it up until the start of your turn, after which it will expire controller = target.controller # save the current controller def canUntap(self): canUntap.expire() return False do_when(lambda: do_override(target, "canUntapDuringUntapStep", canUntap), UntapStepEvent(), lambda player: player==controller)
def move_to(self, zone, position="top"): # Now move to the battlefield if before(self): perm = self.move_to(zone, position) # At this point the card hasn't actually moved (it will on the next timestep event), so we can modify it's enteringZone function. This basically relies on the fact that entering battlefield is batched and done on the timestep. if not perm == self: # We weren't prevented from moving remove_entering = do_override(perm, "modifyEntering", lambda self: during(self)) return perm else: # Don't actually move the card return self
def effects(card): yield do_override(card, "_get_additional_costs", lambda self: cost)
def effects(card): yield do_override(card, "_get_alternative_costs", lambda self: [cost])
def optionally_untap(target): return do_override(target, "canUntapDuringUntapStep", lambda self: self.canUntap() and self.controller.getIntention("Untap %s"%self))
def effects(source): source.evoked = False yield (do_override(source, "_get_alternative_costs", lambda self: [EvokeCost(cost)]), do_override(source, "modifyNewRole", lambda self, new, zone: setattr(new, "evoked",self.evoked)))
def doesnt_untap_controllers_next_untap_step(target): def canUntap(self): canUntap.expire() return False do_override(target, "canUntapDuringUntapStep", canUntap)
def unblockable(target): def canBeBlocked(self): return False return do_override(target, "canBeBlocked", canBeBlocked)
def effects_2(source): yield do_override(source, "canBlock", lambda self: False)
def protection_effect(target): yield combine(prevent_damage(target, -1, txt="Protection effect", condition=prevent_condition), do_override(target, "canBeAttachedBy", canBeAttachedBy), do_override(target, "canBeBlockedBy", canBeBlockedBy), do_override(target, "canBeTargetedBy", canBeTargetedBy))
def effects(source): yield do_override(source, "_playable_timing", timing)
def indestructible(target): def shouldDestroy(self): return False def destroy(self, regenerate=True): return False return combine(do_override(target, "shouldDestroy", shouldDestroy), do_override(target, "destroy", destroy))
def effects(target): yield combine(*[do_override(target, func_name, mk_override(cond)) for func_name, cond in [("canBeAttachedBy", lambda o: not o==aura and condition(o)), ("canBeBlockedBy", condition), ("canBeTargetedBy", condition)]]+[prevent_damage(target, -1, txt="Protection effect", condition=prevent_condition)])
def shadow_effects(source): yield do_override(source, "canBeBlockedBy", canBeBlockedBy), do_override(source, "canBlockAttacker", canBlockAttacker)
def effects(card): card.kicked = kicked() yield (do_override(card, "_get_additional_costs", lambda self: KickerCost(cost)), do_override(card, "modifyNewRole", lambda self, new, zone: setattr(new, "kicked", self.kicked)))