Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent());
if (cost.canPay(source, source.getSourceId(), defendingPlayerId, game) &&
defender.chooseUse(Outcome.LoseAbility, "Sacrifice a creature to prevent " + sourceObject.getLogName() + " from getting unblockable?", game)) {
if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false)) {
// cost was not payed - so source gets unblockable
ContinuousEffect effect = new UnblockableSourceEffect(Duration.EndOfTurn);
game.addEffect(effect, source);
}
}
return true;
}