@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
ManaCostsImpl cost = new ManaCostsImpl("{2}");
if (player != null) {
if (cost.canPay(source, source.getSourceId(), player.getId(), game)
&& player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
StackAbility ability = (StackAbility) getValue("stackAbility");
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (ability != null && controller != null && sourcePermanent != null) {
ability.createCopyOnStack(game, source, source.getControllerId(), true);
game.informPlayers(sourcePermanent.getIdName() + ": " + controller.getLogName() + " copied activated ability");
return true;
}
return false;
}
}
return true;
}
return false;
}
}