mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Kill all gui
This commit is contained in:
@@ -11,8 +11,6 @@ import forge.game.spellability.SpellAbility;
|
|||||||
import forge.game.spellability.TargetRestrictions;
|
import forge.game.spellability.TargetRestrictions;
|
||||||
import forge.game.zone.PlayerZone;
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
|
||||||
import forge.gui.GuiDialog;
|
|
||||||
|
|
||||||
public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
||||||
|
|
||||||
@@ -73,19 +71,18 @@ public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
|||||||
Card host = sa.getSourceCard();
|
Card host = sa.getSourceCard();
|
||||||
boolean shuffle = false;
|
boolean shuffle = false;
|
||||||
|
|
||||||
if (sa.getActivatingPlayer().isHuman()) {
|
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
||||||
final TargetRestrictions tgt = sa.getTargetRestrictions();
|
|
||||||
|
|
||||||
|
|
||||||
numCards = AbilityUtils.calculateAmount(host, sa.getParam("NumCards"), sa);
|
numCards = AbilityUtils.calculateAmount(host, sa.getParam("NumCards"), sa);
|
||||||
shuffle = sa.hasParam("MayShuffle");
|
shuffle = sa.hasParam("MayShuffle");
|
||||||
|
|
||||||
for (final Player p : getTargetPlayers(sa)) {
|
for (final Player p : getTargetPlayers(sa)) {
|
||||||
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
if ((tgt == null) || p.canBeTargetedBy(sa)) {
|
||||||
rearrangeTopOfLibrary(host, p, numCards, shuffle, sa);
|
rearrangeTopOfLibrary(host, p, numCards, shuffle, sa);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,8 +98,7 @@ public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
|||||||
* @param mayshuffle
|
* @param mayshuffle
|
||||||
* a boolean.
|
* a boolean.
|
||||||
*/
|
*/
|
||||||
private void rearrangeTopOfLibrary(final Card src, final Player player, final int numCards,
|
private void rearrangeTopOfLibrary(final Card src, final Player player, final int numCards, final boolean mayshuffle, final SpellAbility sa) {
|
||||||
final boolean mayshuffle, final SpellAbility sa) {
|
|
||||||
final PlayerZone lib = player.getZone(ZoneType.Library);
|
final PlayerZone lib = player.getZone(ZoneType.Library);
|
||||||
int maxCards = lib.size();
|
int maxCards = lib.size();
|
||||||
// If library is smaller than N, only show that many cards
|
// If library is smaller than N, only show that many cards
|
||||||
@@ -116,15 +112,13 @@ public class RearrangeTopOfLibraryEffect extends SpellAbilityEffect {
|
|||||||
topCards.add(lib.get(j));
|
topCards.add(lib.get(j));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Card> orderedCards = GuiChoose.order("Select order to Rearrange", "Top of Library", topCards, src);
|
List<Card> orderedCards = player.getController().orderMoveToZoneList(topCards, ZoneType.Library);
|
||||||
for (int i = maxCards - 1; i >= 0; i--) {
|
for (int i = maxCards - 1; i >= 0; i--) {
|
||||||
Card next = orderedCards.get(i);
|
Card next = orderedCards.get(i);
|
||||||
player.getGame().getAction().moveToLibrary(next, 0);
|
player.getGame().getAction().moveToLibrary(next, 0);
|
||||||
}
|
}
|
||||||
if (mayshuffle) {
|
if (mayshuffle && player.getController().confirmAction(sa, null, "Do you want to shuffle the library?")) {
|
||||||
if (GuiDialog.confirm(src, "Do you want to shuffle the library?")) {
|
player.shuffle(sa);
|
||||||
player.shuffle(sa);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user