@Override public ReturnToHandChosenPermanentEffect copy() { return new ReturnToHandChosenPermanentEffect(this); }
public ReturnToHandChosenPermanentEffect(FilterControlledPermanent filter, int number) { super(Outcome.ReturnToHand); this.filter = filter; this.number = number; this.staticText = getText(); }
@Override public boolean apply(Game game, Ability source) { this.targetPointer = new FixedTarget(source.getControllerId()); return super.apply(game, source); }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (player != null) { int available = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game); if (available > 0) { TargetControlledPermanent target = new TargetControlledPermanent(Math.min(number, available), number, filter, true); if (player.chooseTarget(this.outcome, target, source, game)) { player.moveCards(new CardsImpl(target.getTargets()), Zone.HAND, source, game); } } return true; } return false; }
public Overburden(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); // Whenever a player puts a nontoken creature onto the battlefield, that player returns a land he or she controls to its owner's hand. this.addAbility(new EntersBattlefieldAllTriggeredAbility( Zone.BATTLEFIELD, new ReturnToHandChosenPermanentEffect(RETURN_FILTER), ENTERS_BATTLEFIELD_FILTER, false, SetTargetPointer.PLAYER, "Whenever a player puts a nontoken creature onto the battlefield," + " that player returns a land he or she controls to its owner's hand.")); }