use of mage.abilities.effects.common.continuous.AddCardTypeTargetEffect in project mage by magefree.
the class DanceOfTheManseEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(source.getTargets().stream().map(Target::getTargets).flatMap(Collection::stream).map(game::getCard).filter(Objects::nonNull).collect(Collectors.toSet()));
player.moveCards(cards, Zone.BATTLEFIELD, source, game);
if (source.getManaCostsToPay().getX() < 6) {
return true;
}
cards.stream().map(game::getPermanent).filter(Objects::nonNull).forEach(permanent -> {
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.CREATURE);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
effect = new SetPowerToughnessTargetEffect(4, 4, Duration.EndOfGame);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
});
return true;
}
use of mage.abilities.effects.common.continuous.AddCardTypeTargetEffect in project mage by magefree.
the class SaheeliSublimeArtificerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent copyTo = game.getPermanent(getTargetPointer().getFirst(game, source));
if (copyTo != null) {
Permanent copyFrom = game.getPermanentOrLKIBattlefield(source.getTargets().get(1).getFirstTarget());
if (copyFrom != null) {
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyCopyApplier());
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT);
effect.setTargetPointer(new FixedTarget(copyTo, game));
game.addEffect(effect, source);
}
}
return true;
}
use of mage.abilities.effects.common.continuous.AddCardTypeTargetEffect in project mage by magefree.
the class ArbiterOfTheIdealEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller == null || sourceObject == null) {
return false;
}
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
if (filter.match(card, game) && controller.chooseUse(outcome, "Put " + card.getName() + "onto battlefield?", source, game)) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(CounterType.MANIFESTATION.createInstance(), source.getControllerId(), source, game);
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ENCHANTMENT);
effect.setTargetPointer(new FixedTarget(permanent, game));
game.addEffect(effect, source);
}
}
}
return true;
}
use of mage.abilities.effects.common.continuous.AddCardTypeTargetEffect in project mage by magefree.
the class KatsumasaTheAnimatorEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
game.addEffect(new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE), source);
game.addEffect(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), source);
if (permanent.hasSubtype(SubType.VEHICLE, game)) {
game.addEffect(new SetPowerToughnessTargetEffect(1, 1, Duration.EndOfTurn), source);
}
return true;
}
use of mage.abilities.effects.common.continuous.AddCardTypeTargetEffect in project mage by magefree.
the class RiseAndShineEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game.getBattlefield().getActivePermanents(RiseAndShine.filter, source.getControllerId(), source.getSourceId(), game);
if (permanents.isEmpty()) {
return false;
}
game.addEffect(new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE).setTargetPointer(new FixedTargets(permanents, game)), source);
game.addEffect(new SetPowerToughnessTargetEffect(0, 0, Duration.EndOfGame).setTargetPointer(new FixedTargets(permanents, game)), source);
for (Permanent permanent : permanents) {
permanent.addCounters(CounterType.P1P1.createInstance(4), source.getControllerId(), source, game);
}
return true;
}
Aggregations