[ZEN] reworked implementation of Bold Defense (fixes
-
package mage.cards.b;
-import java.util.UUID;
-import mage.abilities.condition.LockedInCondition;
+import mage.abilities.Ability;
import mage.abilities.condition.common.KickedCondition;
-import mage.abilities.decorator.ConditionalContinuousEffect;
+import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
-import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.KickerAbility;
@@ -14,7 +11,11 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
+import mage.constants.Outcome;
import mage.filter.StaticFilters;
+import mage.game.Game;
+
+import java.util.UUID;
/**
* @author nantuko, Loki
@@ -28,12 +29,7 @@ public final class BoldDefense extends CardImpl {
this.addAbility(new KickerAbility("{3}{W}"));
// Creatures you control get +1/+1 until end of turn. If Bold Defense was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn.
- this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn),
- new BoostTargetEffect(1, 1, Duration.EndOfTurn), new LockedInCondition(KickedCondition.instance),
- "Creatures you control get +1/+1 until end of turn. If this spell was kicked, instead creatures you control get +2/+2"));
- this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE, false),
- null, new LockedInCondition(KickedCondition.instance),
- "and gain first strike until end of turn"));
+ this.getSpellAbility().addEffect(new BoldDefenseEffect());
}
private BoldDefense(final BoldDefense card) {
@@ -45,3 +41,35 @@ public final class BoldDefense extends CardImpl {
return new BoldDefense(this);
}
}
+
+class BoldDefenseEffect extends OneShotEffect {
+
+ BoldDefenseEffect() {
+ super(Outcome.Benefit);
+ staticText = "Creatures you control get +1/+1 until end of turn. If this spell was kicked, " +
+ "instead creatures you control get +2/+2 and gain first strike until end of turn.";
+ }
+
+ private BoldDefenseEffect(final BoldDefenseEffect effect) {
+ super(effect);
+ }
+
+ @Override
+ public BoldDefenseEffect copy() {
+ return new BoldDefenseEffect(this);
+ }
+
+ @Override
+ public boolean apply(Game game, Ability source) {
+ if (KickedCondition.instance.apply(game, source)) {
+ game.addEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn), source);
+ game.addEffect(new GainAbilityControlledEffect(
+ FirstStrikeAbility.getInstance(), Duration.EndOfTurn,
+ StaticFilters.FILTER_PERMANENT_CREATURE
+ ), source);
+ } else {
+ game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
+ }
+ return true;
+ }
+}
