@Override public boolean activate(Game game, boolean noMana) { UUID defenderId = game.getCombat().getDefenderId(sourceId); if (defenderId != null) { FilterCreaturePermanent filter = filterTemplate.copy(); filter.add(new ControllerIdPredicate(defenderId)); this.getTargets().clear(); TargetCreaturePermanent target = new TargetCreaturePermanent(filter); target.setRequired(true); this.addTarget(target); return super.activate(game, noMana); } return false; }
public SerpentineSpike(UUID ownerId) { super( ownerId, 133, "Serpentine Spike", Rarity.RARE, new CardType[] {CardType.SORCERY}, "{5}{R}{R}"); this.expansionSetCode = "BFZ"; // Devoid Ability ability = new DevoidAbility(this.color); ability.setRuleAtTheTop(true); this.addAbility(ability); // Serpentine Spike deals 2 damage to target creature, 3 damage to another target creature, and // 4 damage to a third target creature. If a creature dealt damage this way would die this turn, // exile it instead. this.getSpellAbility().addEffect(new SerpentineSpikeEffect()); TargetCreaturePermanent target = new TargetCreaturePermanent(new FilterCreaturePermanent("creature (2 damage)")); target.setTargetTag(1); this.getSpellAbility().addTarget(target); FilterCreaturePermanent filter = new FilterCreaturePermanent("another target creature (3 damage)"); filter.add(new AnotherTargetPredicate(2)); target = new TargetCreaturePermanent(filter); target.setTargetTag(2); this.getSpellAbility().addTarget(target); filter = new FilterCreaturePermanent("another target creature (4 damage)"); filter.add(new AnotherTargetPredicate(3)); target = new TargetCreaturePermanent(filter); target.setTargetTag(3); this.getSpellAbility().addTarget(target); Effect effect = new DealtDamageToCreatureBySourceDies(this, Duration.EndOfTurn); effect.setText("If a creature dealt damage this way would die this turn, exile it instead"); this.getSpellAbility().addEffect(effect); this.getSpellAbility().addWatcher(new DamagedByWatcher()); }
public FateTransfer(UUID ownerId) { super( ownerId, 161, "Fate Transfer", Rarity.COMMON, new CardType[] {CardType.INSTANT}, "{1}{U/B}"); this.expansionSetCode = "SHM"; // Move all counters from target creature onto another target creature. this.getSpellAbility().addEffect(new FateTransferEffect()); TargetCreaturePermanent fromTarget = new TargetCreaturePermanent(filter); fromTarget.setTargetTag(1); this.getSpellAbility().addTarget(fromTarget); TargetCreaturePermanent toTarget = new TargetCreaturePermanent(filter2); filter2.add(new AnotherTargetPredicate(2)); toTarget.setTargetTag(2); this.getSpellAbility().addTarget(toTarget); }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); if (player != null) { int amount = (Integer) getValue("damage"); if (amount > 0) { FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + player.getLogName() + " controls"); filter.add(new ControllerIdPredicate(player.getId())); TargetCreaturePermanent target = new TargetCreaturePermanent(filter); if (target.canChoose(source.getControllerId(), game) && target.choose( Outcome.Damage, source.getControllerId(), source.getSourceId(), game)) { UUID creature = target.getFirstTarget(); if (creature != null) { game.getPermanent(creature).damage(amount, source.getSourceId(), game, false, true); return true; } } } } return false; }