forked from External/mage
Refactor LookLibraryAndPickControllerEffect (#8841)
This commit is contained in:
parent
7db8dd11b4
commit
dc7dcec39a
195 changed files with 1463 additions and 3526 deletions
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -14,13 +12,21 @@ import mage.players.Player;
|
|||
*/
|
||||
public class ShuffleLibrarySourceEffect extends OneShotEffect {
|
||||
|
||||
private boolean optional;
|
||||
|
||||
public ShuffleLibrarySourceEffect() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public ShuffleLibrarySourceEffect(boolean optional) {
|
||||
super(Outcome.Neutral);
|
||||
this.staticText = "Shuffle your library";
|
||||
this.optional = optional;
|
||||
this.staticText = optional ? "you may shuffle" : "shuffle your library";
|
||||
}
|
||||
|
||||
public ShuffleLibrarySourceEffect(final ShuffleLibrarySourceEffect effect) {
|
||||
super(effect);
|
||||
this.optional = effect.optional;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -32,7 +38,9 @@ public class ShuffleLibrarySourceEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.shuffleLibrary(source, game);
|
||||
if (!optional || player.chooseUse(Outcome.Benefit, "Shuffle your library?", source, game)) {
|
||||
player.shuffleLibrary(source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue