@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Card card = game.getCard(source.getSourceId());
if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
UUID defendingPlayerId = null;
for (Cost cost : source.getCosts()) {
if (cost instanceof ReturnAttackerToHandTargetCost) {
defendingPlayerId = ((ReturnAttackerToHandTargetCost) cost).getDefendingPlayerId();
}
}
if (defendingPlayerId != null) {
game.getCombat().addAttackerToCombat(permanent.getId(), defendingPlayerId, game);
return true;
}
}
}
return false;
}
}