From e9b18b561867d5509625457a0fb7fb5f66a2130b Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 1 Oct 2017 19:07:13 +1030 Subject: [PATCH 1/2] 2421: Fixed Dubious Challenge to make cards enter the battlefield in correct order. --- .../src/mage/cards/d/DubiousChallenge.java | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DubiousChallenge.java b/Mage.Sets/src/mage/cards/d/DubiousChallenge.java index ed2b4c02e2d..3adb0f36838 100644 --- a/Mage.Sets/src/mage/cards/d/DubiousChallenge.java +++ b/Mage.Sets/src/mage/cards/d/DubiousChallenge.java @@ -53,6 +53,8 @@ public class DubiousChallenge extends CardImpl { // Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control. getSpellAbility().addEffect(new DubiousChallengeEffect()); getSpellAbility().addTarget(new TargetOpponent()); + getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect()); + getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect()); } public DubiousChallenge(final DubiousChallenge card) { @@ -69,7 +71,7 @@ class DubiousChallengeEffect extends OneShotEffect { public DubiousChallengeEffect() { super(Outcome.Benefit); - this.staticText = "Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control"; + this.staticText = "Look at the top ten cards of your library, exile up to two creature cards from among them, then shuffle your library. Target opponent may choose one of the exiled cards and put it onto the battlefield under his or her control. Put the rest onto the battlefield under your control."; } public DubiousChallengeEffect(final DubiousChallengeEffect effect) { @@ -98,15 +100,17 @@ class DubiousChallengeEffect extends OneShotEffect { Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); if (opponent != null) { TargetCard targetOpponentCreature = new TargetCard(0, 1, Zone.EXILED, new FilterCreatureCard()); + DubiousChallengeMoveToBattlefieldEffect opponentEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(1); + DubiousChallengeMoveToBattlefieldEffect controllerEffect = (DubiousChallengeMoveToBattlefieldEffect) source.getEffects().get(2); if (opponent.choose(outcome, exiledCards, targetOpponentCreature, game)) { Card card = game.getCard(targetOpponentCreature.getFirstTarget()); if (card != null) { - opponent.moveCards(card, Zone.BATTLEFIELD, source, game); + opponentEffect.setPlayerAndCards(opponent, new CardsImpl(card)); exiledCards.remove(card); } } if (!exiledCards.isEmpty()) { - controller.moveCards(exiledCards, Zone.BATTLEFIELD, source, game); + controllerEffect.setPlayerAndCards(controller, exiledCards); } } } else { @@ -117,3 +121,36 @@ class DubiousChallengeEffect extends OneShotEffect { return false; } } + +class DubiousChallengeMoveToBattlefieldEffect extends OneShotEffect { + + public DubiousChallengeMoveToBattlefieldEffect() { + super(Outcome.Benefit); + } + + public DubiousChallengeMoveToBattlefieldEffect(final DubiousChallengeMoveToBattlefieldEffect effect) { + super(effect); + } + + @Override + public DubiousChallengeMoveToBattlefieldEffect copy() { + return new DubiousChallengeMoveToBattlefieldEffect(this); + } + + public void setPlayerAndCards(Player targetPlayer, Cards targetCards) + { + this.player = targetPlayer; + this.cards = targetCards; + } + + @Override + public boolean apply(Game game, Ability source) { + if (cards != null && player != null) { + return player.moveCards(cards, Zone.BATTLEFIELD, source, game); + } + return false; + } + + private Cards cards; + private Player player; +} \ No newline at end of file From 3e208af490303efab129299c77bb9d9d69b1542e Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 1 Oct 2017 19:10:16 +1030 Subject: [PATCH 2/2] 2421: added newline --- Mage.Sets/src/mage/cards/d/DubiousChallenge.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/d/DubiousChallenge.java b/Mage.Sets/src/mage/cards/d/DubiousChallenge.java index 3adb0f36838..cd973d7619a 100644 --- a/Mage.Sets/src/mage/cards/d/DubiousChallenge.java +++ b/Mage.Sets/src/mage/cards/d/DubiousChallenge.java @@ -153,4 +153,4 @@ class DubiousChallengeMoveToBattlefieldEffect extends OneShotEffect { private Cards cards; private Player player; -} \ No newline at end of file +}