@Override public AttackedByCreatureTriggeredAbility copy() { return new AttackedByCreatureTriggeredAbility(this); }
@Override public boolean checkTrigger(GameEvent event, Game game) { UUID defendingPlayer = game.getCombat().getDefendingPlayerId(event.getSourceId(), game); Permanent attackingCreature = game.getPermanent(event.getSourceId()); if (filter.match(attackingCreature, game) && isControlledBy(defendingPlayer) && attackingCreature != null) { switch (setTargetPointer) { case PERMANENT: this.getEffects().setTargetPointer(new FixedTarget(attackingCreature, game)); break; case PLAYER: this.getEffects().setTargetPointer(new FixedTarget(attackingCreature.getControllerId())); break; } return true; } return false; }
public HissingMiasma(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{B}{B}"); // Whenever a creature attacks you, its controller loses 1 life. this.addAbility(new AttackedByCreatureTriggeredAbility(new LoseLifeTargetEffect(1), false, SetTargetPointer.PLAYER)); }
public BriarPatch(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}{G}"); // Whenever a creature attacks you, it gets -1/-0 until end of turn. Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn); effect.setText("it gets -1/-0"); Ability ability = new AttackedByCreatureTriggeredAbility(Zone.BATTLEFIELD, effect, false, SetTargetPointer.PERMANENT); addAbility(ability); }
public BarbedFoliage(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{G}"); // Whenever a creature attacks you, it loses flanking until end of turn. this.addAbility(new AttackedByCreatureTriggeredAbility( new LoseAbilityTargetEffect(new FlankingAbility()) .setText("it loses flanking until end of turn"), false, SetTargetPointer.PERMANENT )); // Whenever a creature without flying attacks you, Barbed Foliage deals 1 damage to it. this.addAbility(new AttackedByCreatureTriggeredAbility( Zone.BATTLEFIELD, new DamageTargetEffect(1) .setText("{this} deals 1 damage to it"), false, SetTargetPointer.PERMANENT, filter )); }
/** * Emblem with "Whenever a creature attacks you, it gets +5/+5 and gains * trample until end of turn." */ public GarrukApexPredatorEmblem() { setName("Emblem Garruk"); Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn); effect.setText("it gets -1/-0"); Ability ability = new AttackedByCreatureTriggeredAbility(Zone.COMMAND, effect, false, SetTargetPointer.PERMANENT); effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); ability.addEffect(effect.concatBy("and")); this.getAbilities().add(ability); } }