Merge pull request #4735 from rystan/patch-2

Update LookLibraryAndPickControllerEffect to support random order return
This commit is contained in:
LevelX2 2018-04-10 10:28:44 +02:00 committed by GitHub
commit 7481a3fb25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,22 +60,35 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
protected boolean optional; protected boolean optional;
private boolean upTo; private boolean upTo;
private boolean putOnTopSelected; private boolean putOnTopSelected;
private boolean anyOrder;
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, FilterCard pickFilter, boolean putOnTop) { public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, putOnTop, true); 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) { public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, Zone.LIBRARY, putOnTop, reveal); 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, public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal) { boolean mayShuffleAfter, DynamicValue numberToPick,
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, false); 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) { public LookLibraryAndPickControllerEffect(int numberOfCards,
this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, true, upTo); 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 targetZonePickedCards
* @param optional * @param optional
*/ */
public LookLibraryAndPickControllerEffect(int numberOfCards, int numberToPick, FilterCard pickFilter, boolean reveal, boolean upTo, public LookLibraryAndPickControllerEffect(int numberOfCards,
Zone targetZonePickedCards, boolean optional) { int numberToPick, FilterCard pickFilter, boolean reveal,
this(new StaticValue(numberOfCards), false, new StaticValue(numberToPick), pickFilter, Zone.LIBRARY, false, reveal, upTo, targetZonePickedCards, optional); 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 pickFilter
* @param targetZoneLookedCards * @param targetZoneLookedCards
* @param putOnTop if zone for the rest is library decide if cards go to top * @param putOnTop if zone for the rest is library decide if cards go to top
* or butoom * or bottom
* @param reveal * @param reveal
* @param upTo * @param upTo
*/ */
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo) { boolean mayShuffleAfter, DynamicValue numberToPick,
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, Zone.HAND, false); 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 pickFilter
* @param targetZoneLookedCards * @param targetZoneLookedCards
* @param putOnTop if zone for the rest is library decide if cards go to top * @param putOnTop if zone for the rest is library decide if cards go to top
* or butoom * or bottom
* @param reveal * @param reveal
* @param upTo * @param upTo
* @param targetZonePickedCards * @param targetZonePickedCards
* @param optional * @param optional
*/ */
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional) { boolean mayShuffleAfter, DynamicValue numberToPick,
this(numberOfCards, mayShuffleAfter, numberToPick, pickFilter, targetZoneLookedCards, putOnTop, reveal, upTo, targetZonePickedCards, optional, true); 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 pickFilter
* @param targetZoneLookedCards * @param targetZoneLookedCards
* @param putOnTop if zone for the rest is library decide if cards go to top * @param putOnTop if zone for the rest is library decide if cards go to top
* or butoom * or bottom
* @param reveal * @param reveal
* @param upTo * @param upTo
* @param targetZonePickedCards * @param targetZonePickedCards
* @param optional * @param optional
* @param putOnTopSelected * @param putOnTopSelected
*/ */
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards, boolean mayShuffleAfter, DynamicValue numberToPick, public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
FilterCard pickFilter, Zone targetZoneLookedCards, boolean putOnTop, boolean reveal, boolean upTo, Zone targetZonePickedCards, boolean optional, boolean putOnTopSelected) { boolean mayShuffleAfter, DynamicValue numberToPick,
super(Outcome.DrawCard, numberOfCards, mayShuffleAfter, targetZoneLookedCards, putOnTop); 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.numberToPick = numberToPick;
this.filter = pickFilter; this.filter = pickFilter;
this.revealPickedCards = reveal; this.revealPickedCards = reveal;
@ -155,6 +184,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
this.upTo = upTo; this.upTo = upTo;
this.optional = optional; this.optional = optional;
this.putOnTopSelected = putOnTopSelected; this.putOnTopSelected = putOnTopSelected;
this.anyOrder = anyOrder;
} }
public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) { public LookLibraryAndPickControllerEffect(final LookLibraryAndPickControllerEffect effect) {
@ -166,6 +196,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
this.upTo = effect.upTo; this.upTo = effect.upTo;
this.optional = effect.optional; this.optional = effect.optional;
this.putOnTopSelected = effect.putOnTopSelected; this.putOnTopSelected = effect.putOnTopSelected;
this.anyOrder = effect.anyOrder;
} }
@Override @Override
@ -194,7 +225,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
Cards pickedCards = new CardsImpl(target.getTargets()); Cards pickedCards = new CardsImpl(target.getTargets());
cards.removeAll(pickedCards); cards.removeAll(pickedCards);
if (targetPickedCards == Zone.LIBRARY && !putOnTopSelected) { if (targetPickedCards == Zone.LIBRARY && !putOnTopSelected) {
player.putCardsOnBottomOfLibrary(pickedCards, game, source, true); player.putCardsOnBottomOfLibrary(pickedCards, game, source, anyOrder);
} else { } else {
player.moveCards(pickedCards.getCards(game), targetPickedCards, source, game); player.moveCards(pickedCards.getCards(game), targetPickedCards, source, game);
} }
@ -237,6 +268,11 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
} else { } else {
sb.append("put on the buttom of your library"); sb.append("put on the buttom of your library");
} }
if (anyOrder) {
sb.append(" in any order");
} else {
sb.append(" in random order");
}
break; break;
case HAND: case HAND:
if (revealPickedCards) { if (revealPickedCards) {
@ -301,7 +337,13 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
} else { } else {
sb.append("on the bottom"); 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) { } else if (targetZoneLookedCards == Zone.GRAVEYARD) {
sb.append(" and the other into your graveyard"); sb.append(" and the other into your graveyard");
} }