mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08:00
Merge pull request #4078 from agnussmcferguss/bugfix/2421-dubious-challenge-kld-not-sequencing-properly
Bugfix/2421 dubious challenge kld not sequencing properly
This commit is contained in:
commit
1a61b657b7
1 changed files with 40 additions and 3 deletions
|
|
@ -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.
|
// 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().addEffect(new DubiousChallengeEffect());
|
||||||
getSpellAbility().addTarget(new TargetOpponent());
|
getSpellAbility().addTarget(new TargetOpponent());
|
||||||
|
getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect());
|
||||||
|
getSpellAbility().addEffect(new DubiousChallengeMoveToBattlefieldEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
public DubiousChallenge(final DubiousChallenge card) {
|
public DubiousChallenge(final DubiousChallenge card) {
|
||||||
|
|
@ -69,7 +71,7 @@ class DubiousChallengeEffect extends OneShotEffect {
|
||||||
|
|
||||||
public DubiousChallengeEffect() {
|
public DubiousChallengeEffect() {
|
||||||
super(Outcome.Benefit);
|
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) {
|
public DubiousChallengeEffect(final DubiousChallengeEffect effect) {
|
||||||
|
|
@ -98,15 +100,17 @@ class DubiousChallengeEffect extends OneShotEffect {
|
||||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (opponent != null) {
|
if (opponent != null) {
|
||||||
TargetCard targetOpponentCreature = new TargetCard(0, 1, Zone.EXILED, new FilterCreatureCard());
|
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)) {
|
if (opponent.choose(outcome, exiledCards, targetOpponentCreature, game)) {
|
||||||
Card card = game.getCard(targetOpponentCreature.getFirstTarget());
|
Card card = game.getCard(targetOpponentCreature.getFirstTarget());
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
opponent.moveCards(card, Zone.BATTLEFIELD, source, game);
|
opponentEffect.setPlayerAndCards(opponent, new CardsImpl(card));
|
||||||
exiledCards.remove(card);
|
exiledCards.remove(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!exiledCards.isEmpty()) {
|
if (!exiledCards.isEmpty()) {
|
||||||
controller.moveCards(exiledCards, Zone.BATTLEFIELD, source, game);
|
controllerEffect.setPlayerAndCards(controller, exiledCards);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -117,3 +121,36 @@ class DubiousChallengeEffect extends OneShotEffect {
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue