use of mage.abilities.effects.common.MayTapOrUntapTargetEffect in project mage by magefree.
the class ChainStasisEffect 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;
}
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
Effect effect = new MayTapOrUntapTargetEffect();
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return false;
}
Cost cost = new ManaCostsImpl("{2}{U}");
if (cost.pay(source, game, source, controller.getId(), false)) {
if (player.chooseUse(outcome, "Copy the spell?", source, game)) {
Spell spell = game.getStack().getSpell(source.getSourceId());
if (spell != null) {
spell.createCopyOnStack(game, source, player.getId(), true);
}
}
}
return true;
}
return false;
}
Aggregations