use of mage.game.events.CopyStackObjectEvent in project mage by magefree.
the class StackObjectImpl method createCopyOnStack.
@Override
public void createCopyOnStack(Game game, Ability source, UUID newControllerId, boolean chooseNewTargets, int amount, StackObjectCopyApplier applier) {
GameEvent gameEvent = new CopyStackObjectEvent(source, this, newControllerId, amount);
if (game.replaceEvent(gameEvent)) {
return;
}
Iterator<MageObjectReferencePredicate> newTargetTypeIterator = new NewTargetTypeIterator(game, newControllerId, gameEvent.getAmount(), applier);
for (int i = 0; i < gameEvent.getAmount(); i++) {
createSingleCopy(newControllerId, applier, newTargetTypeIterator.next(), game, source, chooseNewTargets);
}
Player player = game.getPlayer(newControllerId);
if (player == null) {
return;
}
game.informPlayers(player.getName() + " created " + CardUtil.numberToText(gameEvent.getAmount(), "a") + " cop" + (gameEvent.getAmount() == 1 ? "y" : "ies") + " of " + getIdName());
}
Aggregations