use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class SakashimasWillCopyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetPermanent target = new TargetControlledCreaturePermanent();
target.setNotTarget(true);
if (!target.canChoose(source.getSourceId(), player.getId(), game)) {
return false;
}
player.choose(outcome, target, source.getSourceId(), game);
Permanent chosenCreature = game.getPermanent(target.getFirstTarget());
if (chosenCreature == null) {
return false;
}
for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_CREATURE, player.getId(), source.getSourceId(), game)) {
if (permanent == null || permanent.getId().equals(chosenCreature.getId())) {
continue;
}
game.copyPermanent(Duration.EndOfTurn, chosenCreature, permanent.getId(), source, new EmptyCopyApplier());
}
return true;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class MizziumTransreliquatCopyAndGainAbilityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (sourcePermanent != null && copyFromPermanent != null) {
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
return true;
}
return false;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class ThespiansStageCopyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (sourcePermanent != null && copyFromPermanent != null) {
Permanent newPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ThespiansStageCopyEffect(), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetLandPermanent());
newPermanent.addAbility(ability, source.getSourceId(), game);
return true;
}
return false;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class MirrorOfTheForebearsCopyEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (sourcePermanent != null && copyFromPermanent != null) {
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
game.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), source);
return true;
}
return false;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class MirrorWeaveEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
FilterCreaturePermanent filter = new FilterCreaturePermanent();
if (controller != null) {
Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (copyFromCreature != null) {
filter.add(Predicates.not(new PermanentIdPredicate(copyFromCreature.getId())));
for (Permanent copyToCreature : game.getBattlefield().getAllActivePermanents(filter, game)) {
if (copyToCreature != null) {
game.copyPermanent(Duration.EndOfTurn, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
}
}
}
return true;
}
return false;
}
Aggregations