Effect effect = new CounterUnlessPaysEffect(new RevealTargetFromHandCostCount());
effect.setText("Counter target spell unless its controller pays {X}.");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new GenericManaCost(2));
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0, Integer.MAX_VALUE, filter)));
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetSpell());
this.addAbility(ability);
}