@Override public ExileAndGainLifeEqualPowerTargetEffect copy() { return new ExileAndGainLifeEqualPowerTargetEffect(this); }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (permanent != null) { Player player = game.getPlayer(permanent.getControllerId()); if (player != null) { int creaturePower = permanent.getPower().getValue(); permanent.moveToExile(null, null, source.getSourceId(), game); game.applyEffects(); player.gainLife(creaturePower, game, source); } return true; } return false; } }
public SwordsToPlowshares(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); // Exile target creature. Its controller gains life equal to its power. this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new ExileAndGainLifeEqualPowerTargetEffect()); }
public AjaniUnyielding(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{G}{W}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.AJANI); this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); // +2: Reveal the top three cards of your library. Put all nonland permanent cards revealed this way into your hand and the rest on the bottom of your library in any order. this.addAbility(new LoyaltyAbility(new RevealLibraryPutIntoHandEffect(3, nonlandPermanentFilter, Zone.LIBRARY), 2)); // -2: Exile target creature. Its controller gains life equal to its power. LoyaltyAbility ajaniAbility2 = new LoyaltyAbility(new ExileAndGainLifeEqualPowerTargetEffect(), -2); ajaniAbility2.addTarget(new TargetCreaturePermanent()); this.addAbility(ajaniAbility2); // -9: Put five +1/+1 counters on each creature you control and five loyalty counters on each other planeswalker you control. LoyaltyAbility ajaniAbility3 = new LoyaltyAbility(new AddCountersAllEffect(CounterType.P1P1.createInstance(5), new FilterControlledCreaturePermanent()), -9); ajaniAbility3.addEffect(new AddCountersAllEffect(CounterType.LOYALTY.createInstance(5), planeswalkerFilter)); this.addAbility(ajaniAbility3); }