FilterControlledCreaturePermanent filter = ((OfferingAbility) source).getFilter();
Card spellToCast = game.getCard(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player != null && !CardUtil.isCheckPlayableMode(affectedAbility) &&
player.chooseUse(Outcome.Benefit, "Offer a " + filter.getMessage() + " to cast " + spellToCast.getName() + "?", game)) {
Target target = new TargetControlledCreaturePermanent(1,1,filter,true);
player.chooseTarget(Outcome.Sacrifice, target, source, game);
if (!target.isChosen()) {
return false;
}
game.getState().setValue("offering_" + card.getId(), true);
Permanent offer = game.getPermanent(target.getFirstTarget());
if (offer != null) {
UUID activationId = UUID.randomUUID();
OfferingCostReductionEffect effect = new OfferingCostReductionEffect(spellToCast.getSpellAbility().getId(), offer.getSpellAbility().getManaCosts(), activationId);
game.addEffect(effect, source);
offer.sacrifice(source.getSourceId(), game);