use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class InfiniteReflectionEntersBattlefieldEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
MageObject toCopyToObject = ((EntersTheBattlefieldEvent) event).getTarget();
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && toCopyToObject != null && sourcePermanent.getAttachedTo() != null) {
Permanent toCopyFromPermanent = game.getPermanent(sourcePermanent.getAttachedTo());
if (toCopyFromPermanent != null) {
game.copyPermanent(toCopyFromPermanent, toCopyToObject.getId(), source, new EmptyCopyApplier());
}
}
return false;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class OkoTheTricksterCopyEffect 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) {
return false;
}
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
return true;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class RenegadeDoppelgangerEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent targetCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
if (targetCreature == null || permanent == null) {
return false;
}
game.copyPermanent(Duration.EndOfTurn, targetCreature, permanent.getId(), source, new EmptyCopyApplier());
return false;
}
use of mage.util.functions.EmptyCopyApplier in project mage by magefree.
the class TilonallisSkinshifterCopyEffect 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 AbsorbIdentityEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent copyFrom = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
if (controller == null || copyFrom == null) {
return false;
}
if (controller.chooseUse(outcome, "Have Shapeshifters you control become copies of " + copyFrom.getLogName() + " until end of turn?", source, game)) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("shapeshifter");
filter.add(SubType.SHAPESHIFTER.getPredicate());
for (Permanent copyTo : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyCopyApplier());
}
}
return true;
}
Aggregations