public boolean apply(Game game, Ability source) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game);
MageObject sourceObject = game.getObject(source.getSourceId());
Player defender = game.getPlayer(defendingPlayerId);
if (defender != null && sourceObject != null) {
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);
}
}