From 9280a84ecfe53b0350a3ea1dad08dfd6d969b221 Mon Sep 17 00:00:00 2001 From: Loki Date: Wed, 6 Jun 2012 17:09:55 +0300 Subject: [PATCH] ApostlesBlessingEffect becomes stateless --- .../sets/newphyrexia/ApostlesBlessing.java | 66 +++++++++---------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java b/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java index 713ed081beb..ff64431e416 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/ApostlesBlessing.java @@ -47,7 +47,6 @@ import mage.game.permanent.Permanent; import mage.target.common.TargetControlledPermanent; /** - * * @author Loki */ public class ApostlesBlessing extends CardImpl { @@ -59,16 +58,16 @@ public class ApostlesBlessing extends CardImpl { filter.setScopeCardType(mage.filter.Filter.ComparisonScope.Any); } - public ApostlesBlessing (UUID ownerId) { + public ApostlesBlessing(UUID ownerId) { super(ownerId, 2, "Apostle's Blessing", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{WP}"); this.expansionSetCode = "NPH"; - this.color.setWhite(true); + this.color.setWhite(true); this.getSpellAbility().addEffect(new ApostlesBlessingEffect(Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetControlledPermanent(filter)); this.getSpellAbility().addChoice(new ChoiceColorOrArtifact()); } - public ApostlesBlessing (final ApostlesBlessing card) { + public ApostlesBlessing(final ApostlesBlessing card) { super(card); } @@ -81,46 +80,41 @@ public class ApostlesBlessing extends CardImpl { class ApostlesBlessingEffect extends GainAbilityTargetEffect { - FilterCard protectionFilter; + public ApostlesBlessingEffect(Duration duration) { + super(new ProtectionAbility(new FilterCard()), duration); + staticText = "Target artifact or creature gains protection from artifacts or from the color of your choice until end of turn"; + } - public ApostlesBlessingEffect(Duration duration) { - super(new ProtectionAbility(new FilterCard()), duration); - protectionFilter = (FilterCard)((ProtectionAbility)ability).getFilter(); - staticText = "Target artifact or creature gains protection from artifacts or from the color of your choice until end of turn"; - } + public ApostlesBlessingEffect(final ApostlesBlessingEffect effect) { + super(effect); + } - public ApostlesBlessingEffect(final ApostlesBlessingEffect effect) { - super(effect); - this.protectionFilter = effect.protectionFilter.copy(); - } + @Override + public ApostlesBlessingEffect copy() { + return new ApostlesBlessingEffect(this); + } - @Override - public ApostlesBlessingEffect copy() { - return new ApostlesBlessingEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - ChoiceColorOrArtifact choice = (ChoiceColorOrArtifact) source.getChoices().get(0); + @Override + public boolean apply(Game game, Ability source) { + FilterCard protectionFilter = new FilterCard(); + ChoiceColorOrArtifact choice = (ChoiceColorOrArtifact) source.getChoices().get(0); if (choice.isArtifactSelected()) { - if (!protectionFilter.getCardType().contains(CardType.ARTIFACT)) { - protectionFilter.getCardType().add(Constants.CardType.ARTIFACT); - protectionFilter.setScopeCardType(ComparisonScope.Any); - } + protectionFilter.getCardType().add(Constants.CardType.ARTIFACT); + protectionFilter.setScopeCardType(ComparisonScope.Any); } else { protectionFilter.setColor(choice.getColor()); protectionFilter.setUseColor(true); - protectionFilter.setScopeColor(ComparisonScope.Any); + protectionFilter.setScopeColor(ComparisonScope.Any); } - protectionFilter.setMessage(choice.getChoice()); - ((ProtectionAbility)ability).setFilter(protectionFilter); - Permanent creature = game.getPermanent(source.getFirstTarget()); - if (creature != null) { - creature.addAbility(ability, game); - return true; - } - return false; - } + protectionFilter.setMessage(choice.getChoice()); + ((ProtectionAbility) ability).setFilter(protectionFilter); + Permanent creature = game.getPermanent(source.getFirstTarget()); + if (creature != null) { + creature.addAbility(ability, game); + return true; + } + return false; + } }