From c2c04e6a562be6cbf05c3e5a14cc651577347967 Mon Sep 17 00:00:00 2001 From: North Date: Mon, 23 Jul 2012 20:45:08 +0300 Subject: [PATCH] Refactored Spelltwine --- .../src/mage/sets/magic2013/Spelltwine.java | 50 +++++++++---------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java b/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java index 938623b2822..13fd1692c1a 100644 --- a/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java +++ b/Mage.Sets/src/mage/sets/magic2013/Spelltwine.java @@ -28,8 +28,8 @@ package mage.sets.magic2013; import java.util.UUID; -import mage.Constants; import mage.Constants.CardType; +import mage.Constants.Outcome; import mage.Constants.Rarity; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -57,9 +57,7 @@ public class Spelltwine extends CardImpl { filter.add(Predicates.or( new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY))); - } - static { filter2.add(Predicates.or( new CardTypePredicate(CardType.INSTANT), new CardTypePredicate(CardType.SORCERY))); @@ -92,8 +90,8 @@ public class Spelltwine extends CardImpl { class SpelltwineEffect extends OneShotEffect { public SpelltwineEffect() { - super(Constants.Outcome.PlayForFree); - staticText = "Exile target instant or sorcery card from your graveyard and target instant or sorcery card from an opponent's graveyard. Copy those cards. Cast the copies if able without paying their mana costs. Exile {this}"; + super(Outcome.PlayForFree); + staticText = "Exile target instant or sorcery card from your graveyard and target instant or sorcery card from an opponent's graveyard. Copy those cards. Cast the copies if able without paying their mana costs"; } public SpelltwineEffect(final SpelltwineEffect effect) { @@ -107,27 +105,25 @@ class SpelltwineEffect extends OneShotEffect { Card cardTwo = game.getCard(source.getTargets().get(1).getFirstTarget()); if (you != null) { if (cardOne != null) { - if (you.chooseUse(Constants.Outcome.PlayForFree, "Cast the copy of " + cardOne.getName() + " first?", game)) { - cardOne.moveToExile(null, null, source.getId(), game); - Card copyOne = game.copyCard(cardOne, source, you.getId()); - you.cast(copyOne.getSpellAbility(), game, true); - if (cardTwo != null) { - cardTwo.moveToExile(null, null, source.getId(), game); - Card copyTwo = game.copyCard(cardTwo, source, you.getId()); - you.cast(copyTwo.getSpellAbility(), game, true); - } - } else { - if (cardTwo != null) { - cardTwo.moveToExile(null, null, source.getId(), game); - Card copyTwo = game.copyCard(cardTwo, source, you.getId()); - you.cast(copyTwo.getSpellAbility(), game, true); - } - if (cardOne != null) { - cardOne.moveToExile(null, null, source.getId(), game); - Card copyOne = game.copyCard(cardOne, source, you.getId()); - you.cast(copyOne.getSpellAbility(), game, true); - } - } + cardOne.moveToExile(null, null, source.getId(), game); + } + if (cardTwo != null) { + cardTwo.moveToExile(null, null, source.getId(), game); + } + + boolean castCardOne = true; + if (cardOne != null && you.chooseUse(Outcome.Neutral, "Cast the copy of " + cardOne.getName() + " first?", game)) { + Card copyOne = game.copyCard(cardOne, source, you.getId()); + you.cast(copyOne.getSpellAbility(), game, true); + castCardOne = false; + } + if (cardTwo != null) { + Card copyTwo = game.copyCard(cardTwo, source, you.getId()); + you.cast(copyTwo.getSpellAbility(), game, true); + } + if (cardOne != null && castCardOne) { + Card copyOne = game.copyCard(cardOne, source, you.getId()); + you.cast(copyOne.getSpellAbility(), game, true); } return true; } @@ -138,4 +134,4 @@ class SpelltwineEffect extends OneShotEffect { public SpelltwineEffect copy() { return new SpelltwineEffect(this); } -} \ No newline at end of file +}