@Override public AttacksAttachedTriggeredAbility copy() { return new AttacksAttachedTriggeredAbility(this); }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent equipment = game.getPermanent(this.sourceId); if (equipment != null && equipment.getAttachedTo() != null && event.getSourceId().equals(equipment.getAttachedTo())) { for (Effect effect : this.getEffects()) { effect.setValue("sourceId", event.getSourceId()); } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (super.checkTrigger(event, game)) { Permanent equipment = game.getPermanent(getSourceId()); if (equipment != null && equipment.getAttachedTo() != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls"); UUID defenderId = game.getCombat().getDefendingPlayerId(equipment.getAttachedTo(), game); if (defenderId != null) { filter.add(new ControllerIdPredicate(defenderId)); this.getTargets().clear(); TargetCreaturePermanent target = new TargetCreaturePermanent(filter); this.addTarget(target); return true; } } } return false; }
public ExplorersScope(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature attacks, look at the top card of your library. If it's a land card, you may put it onto the battlefield tapped. this.addAbility(new AttacksAttachedTriggeredAbility(new ExplorersScopeEffect())); // Equip ({1}: Attach to target creature you control. Equip only as a sorcery.) this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1))); }
public TrepanationBlade(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature attacks, defending player reveals cards from the top of their library until he or she reveals a land card. // The creature gets +1/+0 until end of turn for each card revealed this way. That player puts the revealed cards into their graveyard. this.addAbility(new AttacksAttachedTriggeredAbility(new TrepanationBladeDiscardEffect())); // Equip {2} this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2))); }
public ArmoryOfIroas(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature attacks, put a +1/+1 counter on it. this.addAbility(new AttacksAttachedTriggeredAbility(new AddCountersAttachedEffect(CounterType.P1P1.createInstance(), "it"))); // Equip {2} this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2))); }
public MageSlayer(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}{R}{G}"); this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature attacks, it deals damage equal to its power to defending player. this.addAbility(new AttacksAttachedTriggeredAbility(new MageSlayerEffect(), false)); // Equip {3} this.addAbility(new EquipAbility(Outcome.Benefit, new GenericManaCost(3), new TargetControlledCreaturePermanent())); }
public ShardOfBrokenGlass(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +1/+0. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 0))); // Whenever equipped creature attacks, you may put the top two cards of your library into your graveyard. this.addAbility(new AttacksAttachedTriggeredAbility(new PutTopCardOfLibraryIntoGraveControllerEffect(2), true)); // Equip {1} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1))); }
public Contempt(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{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); // Whenever enchanted creature attacks, return it and Contempt to their owners' hands at end of combat. this.addAbility(new AttacksAttachedTriggeredAbility(new ContemptEffect())); }
public SwordOfTheAnimist(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1))); // Whenever equipped creature attacks, you may search your library for a basic land card, put it onto the battlefield tapped, then shuffle your library. TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_BASIC_LAND); this.addAbility(new AttacksAttachedTriggeredAbility(new SearchLibraryPutInPlayEffect(target, true), true)); // Equip {2} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); }
public MirrorMockery(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Copy)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Whenever enchanted creature attacks, you may create a token that's a copy of that creature. Exile that token at the end of combat. this.addAbility(new AttacksAttachedTriggeredAbility(new MirrorMockeryEffect(), AttachmentType.AURA, true)); }
public ArgentumArmor(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +6/+6. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(6, 6))); // Whenever equipped creature attacks, destroy target permanent. Ability ability = new AttacksAttachedTriggeredAbility(new DestroyTargetEffect()); ability.addTarget(new TargetPermanent()); this.addAbility(ability); // Equip {6} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(6))); }
public CaptainsClaws(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +1/+0. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 0))); // Whenever equipped creature attacks, create a 1/1 white Kor Ally creature token tapped and attacking. this.addAbility(new AttacksAttachedTriggeredAbility(new CreateTokenEffect(new KorAllyToken(), 1, true, true))); // Equip {1} this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(1))); }
public GrapplingHook(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature has double strike. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(DoubleStrikeAbility.getInstance(), AttachmentType.EQUIPMENT))); // Whenever equipped creature attacks, you may have target creature block it this turn if able. Ability ability = new AttacksAttachedTriggeredAbility(new GrapplingHookEffect(), true); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); // Equip {4} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(4))); }
public MoonsilverSpear(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature has first strike. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.EQUIPMENT))); // Whenever equipped creature attacks, create a 4/4 white Angel creature token with flying. this.addAbility(new AttacksAttachedTriggeredAbility(new CreateTokenEffect(new AngelToken()))); // Equip {4} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(4))); }
public ExtraArms(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{4}{R}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Whenever enchanted creature attacks, it deals 2 damage to any target. ability = new AttacksAttachedTriggeredAbility(new DamageTargetEffect(2, "it"), AttachmentType.AURA, false); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); }
public AqueousForm(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted creature can't be blocked. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedAttachedEffect(AttachmentType.AURA))); // Whenever enchanted creature attacks, scry 1. this.addAbility(new AttacksAttachedTriggeredAbility(new ScryEffect(1), AttachmentType.AURA,false)); }
public CloakingDevice(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); this.subtype.add(SubType.AURA); // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Enchanted creature can't be blocked. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedAttachedEffect(AttachmentType.AURA))); // Whenever enchanted creature attacks, defending player loses 1 life. this.addAbility(new AttacksAttachedTriggeredAbility(new CloakingDeviceLoseLifeDefendingPlayerEffect(1, true), AttachmentType.AURA, false)); }
public ThrowingKnife(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +2/+0. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0))); // Whenever equipped creature attacks, you may sacrifice Throwing Knife. If you do, Throwing Knife deals 2 damage to any target. Effect effect = new SacrificeSourceEffect(); effect.setText("you may sacrifice {this}. If you do, "); Ability ability = new AttacksAttachedTriggeredAbility(new SacrificeSourceEffect(), true); ability.addEffect(new DamageTargetEffect(2)); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); // Equip {2} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2))); }
public WritOfPassage(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{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); // Whenever enchanted creature attacks, if its power is 2 or less, it's unblockable this turn. FilterPermanent filter = new FilterPermanent("if enchanted creature's power is 2 or less"); filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3)); ability = new ConditionalInterveningIfTriggeredAbility(new AttacksAttachedTriggeredAbility( new WritOfPassageAttachedEffect(AttachmentType.AURA), AttachmentType.AURA, false), new AttachedToMatchesFilterCondition(filter), "Whenever enchanted creature attacks, if its power is 2 or less, it can't be blocked this turn."); this.addAbility(ability); // Forecast - {1}{U}, Reveal Writ of Passage from your hand: Target creature with power 2 or less is unblockable this turn. ForecastAbility ability2 = new ForecastAbility(new CantBeBlockedTargetEffect(), new ManaCostsImpl("{1}{U}")); FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature with power 2 or less"); filter2.add(new PowerPredicate(ComparisonType.FEWER_THAN, 3)); ability2.addTarget(new TargetCreaturePermanent(filter2)); this.addAbility(ability2); }