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;
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");
}