@Override public ConditionalRestrictionEffect copy() { return new ConditionalRestrictionEffect(this); }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (!initDone) { // if simpleStaticAbility, init won't be called init(source, game); } conditionState = condition.apply(game, source); if (conditionState) { effect.setTargetPointer(this.targetPointer); return effect.applies(permanent, source, game); } else if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.applies(permanent, source, game); } if (effect.getDuration() == Duration.OneUse) { used = true; } if (effect.getDuration() == Duration.Custom) { this.discard(); } return false; }
public MetathranElite(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); this.subtype.add(SubType.METATHRAN); this.subtype.add(SubType.SOLDIER); this.power = new MageInt(2); this.toughness = new MageInt(3); // Metathran Elite is unblockable as long as it's enchanted. ConditionalRestrictionEffect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new EnchantedSourceCondition()); effect.setText(rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public BubblingBeebles(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}"); this.subtype.add(SubType.BEEBLE); this.power = new MageInt(3); this.toughness = new MageInt(3); // Bubbling Beebles can't be blocked as long as defending player controls an enchantment. Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new DefendingPlayerControlsCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT)); effect.setText("{this} can't be blocked as long as defending player controls an enchantment"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public SlipperyScoundrel(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.PIRATE); this.power = new MageInt(2); this.toughness = new MageInt(2); // Ascend this.addAbility(new AscendAbility()); // As long as you have the city's blessing Slippery Scoundrel has Hexproof and can't be blocked. ContinuousEffect boostSource = new GainAbilitySourceEffect(HexproofAbility.getInstance(), Duration.WhileOnBattlefield); ConditionalContinuousEffect effect = new ConditionalContinuousEffect(boostSource, CitysBlessingCondition.instance, "As long as you have the city's blessing {this} has Hexproof"); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); RestrictionEffect restrictionEffect = new CantBeBlockedSourceEffect(Duration.WhileOnBattlefield); Effect effect2 = new ConditionalRestrictionEffect(restrictionEffect, CitysBlessingCondition.instance) .setText("and can't be blocked"); ability.addEffect(effect2); this.addAbility(ability); }
public BarrageOfBoulders(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{R}"); // Barrage of Boulders deals 1 damage to each creature you don't control. this.getSpellAbility().addEffect(new DamageAllEffect(1, filter)); // Ferocious - If you control a creature with power 4 or greater, creatures can't block this turn Effect effect = new ConditionalRestrictionEffect( Duration.EndOfTurn, new CantBlockAllEffect(FILTER_PERMANENT_CREATURES, Duration.EndOfTurn), new LockedInCondition(FerociousCondition.instance), null); effect.setText("<br/><i>Ferocious</i> — If you control a creature with power 4 or greater, creatures can't block this turn"); this.getSpellAbility().addEffect(effect); }
public HazyHomunculus(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); this.subtype.add(SubType.HOMUNCULUS); this.subtype.add(SubType.ILLUSION); this.power = new MageInt(1); this.toughness = new MageInt(1); // Hazy Homunculus can't be blocked as long as defending player controls an untapped land. Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new DefendingPlayerControlsCondition(filter)); effect.setText("{this} can't be blocked as long as defending player controls an untapped land"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public ScrapdiverSerpent (UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}"); this.subtype.add(SubType.SERPENT); this.power = new MageInt(5); this.toughness = new MageInt(5); // Scrapdiver Serpent can't be blocked as long as defending player controls an artifact Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new DefendingPlayerControlsCondition(new FilterArtifactPermanent())); effect.setText("{this} can't be blocked as long as defending player controls an artifact"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public DeepSeaTerror(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{U}{U}"); this.subtype.add(SubType.SERPENT); this.power = new MageInt(6); this.toughness = new MageInt(6); // Deep-Sea Terror can't attack unless there are seven or more cards in your graveyard. Effect effect = new ConditionalRestrictionEffect( new CantAttackAnyPlayerSourceEffect(Duration.WhileOnBattlefield), new InvertCondition(new CardsInControllerGraveCondition(7))); effect.setText("{this} can't attack unless there are seven or more cards in your graveyard"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public DreamProwler(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}"); this.subtype.add(SubType.ILLUSION); this.power = new MageInt(1); this.toughness = new MageInt(5); // Dream Prowler can't be blocked as long as it's attacking alone. Effect effect = new ConditionalRestrictionEffect(new CantBeBlockedSourceEffect(), new PermanentsOnTheBattlefieldCondition(new FilterAttackingCreature(), ComparisonType.FEWER_THAN, 2)); effect.setText("{this} can't be blocked as long as it's attacking alone"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public Tanglewalker(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); this.subtype.add(SubType.DRYAD); this.power = new MageInt(2); this.toughness = new MageInt(2); // Each creature you control can't be blocked as long as defending player controls an artifact land. Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedAllEffect(new FilterControlledCreaturePermanent("Creatures you control"), Duration.WhileOnBattlefield), new DefendingPlayerControlsCondition(filter)); effect.setText("Each creature you control can't be blocked as long as defending player controls an artifact land"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public BouncingBeebles(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}"); this.subtype.add(SubType.BEEBLE); this.power = new MageInt(2); this.toughness = new MageInt(2); //Bouncing Beebles can't be blocked as long as defending player controls an artifact. Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new DefendingPlayerControlsCondition(new FilterArtifactPermanent())); effect.setText("{this} can't be blocked as long as defending player controls an artifact"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public Togglodyte(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); this.subtype.add(SubType.GOLEM); this.power = new MageInt(4); this.toughness = new MageInt(4); // Togglodyte enters the battlefield turned on. this.addAbility(new EntersBattlefieldAbility(new TogglodyteEntersEffect())); // Whenever a player casts a spell, toggle Togglodyte’s ON/OFF switch. this.addAbility(new SpellCastAllTriggeredAbility(new TogglodyteToggleEffect(), false)); // As long as Togglodyte is turned off, it can’t attack or block, and prevent all damage it would deal. Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalRestrictionEffect(new TogglodyteRestrictionEffect(), new TogglodyteCondition())); ability.addEffect(new ConditionalReplacementEffect(new TogglodytePreventionEffect(), new TogglodyteCondition())); this.addAbility(ability); }
public NeurokSpy(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.ROGUE); this.power = new MageInt(2); this.toughness = new MageInt(2); //Neurok Spy can't be blocked as long as defending player controls an artifact. Effect effect = new ConditionalRestrictionEffect( new CantBeBlockedSourceEffect(), new DefendingPlayerControlsCondition(new FilterArtifactPermanent())); effect.setText("{this} can't be blocked as long as defending player controls an artifact"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public JeskaiInfiltrator(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.MONK); this.power = new MageInt(2); this.toughness = new MageInt(3); // Jeskai Infiltrator can't be blocked as long as you control no other creatures. Effect effect = new ConditionalRestrictionEffect(new CantBeBlockedSourceEffect(), new CreatureCountCondition(1, TargetController.YOU)); effect.setText("{this} can't be blocked as long as you control no other creatures"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); // Whenever Jeskai Infiltrator deals combat damage to a player, exile it and the top card of your library in a face-down pile, shuffle that pile, then manifest those cards. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new JeskaiInfiltratorEffect(), false)); }
public MedomaiTheAgeless(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{U}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.SPHINX); this.power = new MageInt(4); this.toughness = new MageInt(4); // Flying this.addAbility(FlyingAbility.getInstance()); // Whenever Medomai the Ageless deals combat damage to a player, take an extra turn after this one. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AddExtraTurnControllerEffect(), false)); // Medomai the Ageless can't attack during extra turns. Effect effect = new ConditionalRestrictionEffect(new CantAttackAnyPlayerSourceEffect(Duration.WhileOnBattlefield), ExtraTurnCondition.instance); effect.setText("{this} can't attack during extra turns"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public WayOfTheThief(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted creature gets +2/+2. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield))); // Enchanted creature can't be blocked as long as you control a Gate. Effect effect = new ConditionalRestrictionEffect(new CantBeBlockedAttachedEffect(AttachmentType.AURA), new PermanentsOnTheBattlefieldCondition(filter)); effect.setText(rule); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public ChildhoodHorror(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}"); this.subtype.add(SubType.HORROR); this.power = new MageInt(2); this.toughness = new MageInt(2); // Flying this.addAbility(FlyingAbility.getInstance()); // Threshold - As long as seven or more cards are in your graveyard, Childhood Horror gets +2/+2 and can't block. Ability thresholdAbility = new SimpleStaticAbility( Zone.BATTLEFIELD, new ConditionalContinuousEffect( new BoostSourceEffect(2, 2, Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7), "If seven or more cards are in your graveyard, Childhood Horror gets +2/+2" )); Effect effect = new ConditionalRestrictionEffect( new CantBlockSourceEffect(Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7)); effect.setText("and can't block"); thresholdAbility.addEffect(effect); thresholdAbility.setAbilityWord(AbilityWord.THRESHOLD); this.addAbility(thresholdAbility); }
public Hobble(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // When Hobble enters the battlefield, draw a card. this.addAbility(new EntersBattlefieldTriggeredAbility(new DrawCardSourceControllerEffect(1))); // Enchanted creature can't attack. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAttachedEffect(AttachmentType.AURA))); // Enchanted creature can't block if it's black. Effect effect = new ConditionalRestrictionEffect(new CantBlockAttachedEffect(AttachmentType.AURA), new EnchantedCreatureColorCondition(ObjectColor.BLACK)); effect.setText("Enchanted creature can't block if it's black."); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }
public BondsOfFaith(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Neutral)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted creature gets +2/+2 as long as it's a Human. Otherwise, it can't attack or block. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(new BoostEquippedEffect(2, 2), new EquippedHasSubtypeCondition(SubType.HUMAN), rule))); Effect effect = new ConditionalRestrictionEffect(new CantAttackBlockAttachedEffect(AttachmentType.AURA), new InvertCondition(new EquippedHasSubtypeCondition(SubType.HUMAN))); effect.setText("Otherwise, it can't attack or block"); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); }