From c38dacb8798207111d1698161c374697d69d621b Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Sun, 8 Apr 2018 22:09:43 -0400 Subject: [PATCH] Update LookLibraryAndPickControllerEffect to support random order return New Dominaria cards support looking in library and returning to bottom of library in random order. --- .../LookLibraryAndPickControllerEffect.java | 94 ++++++++++++++----- 1 file changed, 68 insertions(+), 26 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java index ebf8ca4eed..c5ce9c2d64 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/LookLibraryAndPickControllerEffect.java @@ -60,22 +60,35 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff protected boolean optional; private boolean upTo; private boolean putOnTopSelected; + private boolean anyOrder; - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, FilterCard pickFilter, boolean putOnTop) { - this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, putOnTop, true); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, boolean putOnTop) { + this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, + putOnTop, true); } - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, FilterCard pickFilter, boolean putOnTop, boolean reveal) { - this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, Zone.LIBRARY, putOnTop, reveal); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, boolean putOnTop, boolean reveal) { + this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, + Zone.LIBRARY, putOnTop, reveal); } - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, - FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal) { - this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, false); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, Zone targetZoneLookedCards, + boolean putOnTop, boolean reveal) { + this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, + targetZoneLookedCards, putOnTop, reveal, false); } - public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick, FilterCard pickFilter, boolean upTo) { - this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, true, upTo); + public LookLibraryAndPickControllerEffect(int numberOfCards, + int numberToPick, FilterCard pickFilter, boolean upTo) { + this(new StaticValue(numberOfCards), false, + new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, + true, upTo); } /** @@ -88,9 +101,12 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff * @param targetZonePickedCards * @param optional */ - public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick, FilterCard pickFilter, boolean reveal, boolean upTo, - Zone targetZonePickedCards, boolean optional) { - this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, reveal, upTo, targetZonePickedCards, optional); + public LookLibraryAndPickControllerEffect(int numberOfCards, + int numberToPick, FilterCard pickFilter, boolean reveal, + boolean upTo, Zone targetZonePickedCards, boolean optional) { + this(new StaticValue(numberOfCards), false, + new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, + reveal, upTo, targetZonePickedCards, optional, true, true); } @@ -102,13 +118,17 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff * @param pickFilter * @param targetZoneLookedCards * @param putOnTop if zone for the rest is library decide if cards go to top - * or butoom + * or bottom * @param reveal * @param upTo */ - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, - FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo) { - this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, Zone.HAND, false); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, Zone targetZoneLookedCards, + boolean putOnTop, boolean reveal, boolean upTo) { + this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, + targetZoneLookedCards, putOnTop, reveal, upTo, Zone.HAND, + false, true, true); } /** @@ -119,15 +139,20 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff * @param pickFilter * @param targetZoneLookedCards * @param putOnTop if zone for the rest is library decide if cards go to top - * or butoom + * or bottom * @param reveal * @param upTo * @param targetZonePickedCards * @param optional */ - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, - FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional) { - this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, targetZonePickedCards, optional, true); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, + boolean reveal, boolean upTo, Zone targetZonePickedCards, + boolean optional) { + this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, + targetZoneLookedCards, putOnTop, reveal, upTo, + targetZonePickedCards, optional, true, true); } /** @@ -138,16 +163,20 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff * @param pickFilter * @param targetZoneLookedCards * @param putOnTop if zone for the rest is library decide if cards go to top - * or butoom + * or bottom * @param reveal * @param upTo * @param targetZonePickedCards * @param optional * @param putOnTopSelected */ - public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, - FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional, boolean putOnTopSelected) { - super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, targetZoneLookedCards, putOnTop); + public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, + boolean mayShuffleAfter, DynamicValue numberToPick, + FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, + boolean reveal, boolean upTo, Zone targetZonePickedCards, + boolean optional, boolean putOnTopSelected, boolean anyOrder) { + super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, + targetZoneLookedCards, putOnTop); this.numberToPick = numberToPick; this.filter = pickFilter; this.revealPickedCards = reveal; @@ -155,6 +184,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff this.upTo = upTo; this.optional = optional; this.putOnTopSelected = putOnTopSelected; + this.anyOrder = anyOrder; } public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) { @@ -166,6 +196,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff this.upTo = effect.upTo; this.optional = effect.optional; this.putOnTopSelected = effect.putOnTopSelected; + this.anyOrder = effect.anyOrder; } @Override @@ -194,7 +225,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff Cards pickedCards = new CardsImpl(target.getTargets()); cards.removeAll(pickedCards); if (targetPickedCards == Zone.LIBRARY && !putOnTopSelected) { - player.putCardsOnBottomOfLibrary(pickedCards, game, source, true); + player.putCardsOnBottomOfLibrary(pickedCards, game, source, anyOrder); } else { player.moveCards(pickedCards.getCards(game), targetPickedCards, source, game); } @@ -237,6 +268,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff } else { sb.append("put on the buttom of your library"); } + if (anyOrder) { + sb.append(" in any order"); + } else { + sb.append(" in random order"); + } break; case HAND: if (revealPickedCards) { @@ -301,7 +337,13 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff } else { sb.append("on the bottom"); } - sb.append(" of your library in any order"); + sb.append(" of your libary in "); + if (anyOrder) { + sb.append("any"); + } else { + sb.append("random"); + } + sb.append(" order"); } else if (targetZoneLookedCards == Zone.GRAVEYARD) { sb.append(" and the other into your graveyard"); }