public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
ability.getTargets().clear();
FilterSpell filter = new FilterSpell("spell with converted mana cost X");
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.Equal, ability.getManaCostsToPay().getX()));
ability.addTarget(new TargetSpell(filter));
}
}