@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Card card = (Card)game.getObject(source.getFirstTarget());
if (controller != null && card != null && controller.removeFromGraveyard(card, game)) {
controller.moveCards(card, Zone.HAND, source, game);
if (!card.isLand()) {
int damage = card.getConvertedManaCost();
Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
permanent.damage(damage, source.getSourceId(), game, false, true);
}
Player targetPlayer = game.getPlayer(source.getTargets().get(1).getFirstTarget());
if (targetPlayer != null) {
targetPlayer.damage(damage, source.getSourceId(), game, false, true);
}
}
return true;
}
return false;
}