use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.
the class WeddingRingTriggeredAbility method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (player == null || permanent == null) {
return false;
}
return new CreateTokenCopyTargetEffect(player.getId()).setTargetPointer(new FixedTarget(permanent, game)).apply(game, source);
}
use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.
the class CleaverSkaabEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = CardUtil.castStream(source.getCosts().stream(), SacrificeTargetCost.class).map(SacrificeTargetCost::getPermanents).flatMap(Collection::stream).findFirst().orElse(null);
if (permanent == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect();
effect.setSavedPermanent(permanent);
effect.setNumber(2);
return effect.apply(game, source);
}
use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.
the class JaceMirrorMageDrawEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (permanent == null) {
return false;
}
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 1);
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
effect.setIsntLegendary(true);
effect.setStartingLoyalty(1);
return effect.apply(game, source);
}
use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.
the class BrambleSovereignEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(permanent.getControllerId());
effect.setTargetPointer(targetPointer);
effect.apply(game, source);
}
return true;
}
use of mage.abilities.effects.common.CreateTokenCopyTargetEffect in project mage by magefree.
the class KikiJikiMirrorBreakerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (permanent != null) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true);
effect.setTargetPointer(new FixedTarget(permanent, game));
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanents()) {
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId());
sacrificeEffect.setTargetPointer(new FixedTarget(addedToken.getId()));
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
}
return true;
}
return false;
}
Aggregations