Refactored a lot of the artifact/enchantment destruction. Using common filter types to reduce code duplication.

This commit is contained in:
Justin Godesky 2015-06-05 12:05:51 -04:00
parent e46439aa47
commit bea1cee395
56 changed files with 130 additions and 550 deletions

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.magic2010;
import java.util.UUID;
@ -34,9 +33,7 @@ import mage.constants.Rarity;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.common.FilterArtifactOrEnchantmentPermanent;
import mage.target.TargetPermanent;
/**
@ -45,19 +42,12 @@ import mage.target.TargetPermanent;
*/
public class SolemnOffering extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public SolemnOffering(UUID ownerId) {
super(ownerId, 33, "Solemn Offering", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{W}");
this.expansionSetCode = "M10";
this.getSpellAbility().addTarget(new TargetPermanent(filter));
// Destroy target artifact or enchantment. You gain 4 life.
this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent()));
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addEffect(new GainLifeEffect(4));
}