- Dev mode: added a way to add a card to top of the library instead of the bottom.

- Fixed a bug that caused the zone index not to be accounted for during changeZone (not sure how many things were affected by this, but it prevented putting a card on top of the library via moveToLibrary).
This commit is contained in:
Agetian
2018-11-17 10:08:11 +03:00
parent d277ba0420
commit 8b566c0bbb
2 changed files with 15 additions and 4 deletions

View File

@@ -77,7 +77,7 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
} }
public final void add(final Card c, final Integer index) { public final void add(final Card c, final Integer index) {
add(c, null, null); add(c, index, null);
} }
public void add(final Card c, final Integer index, final Card latestState) { public void add(final Card c, final Integer index, final Card latestState) {

View File

@@ -1937,6 +1937,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
private SpellAbility lastAddedSA; private SpellAbility lastAddedSA;
private boolean lastTrigs; private boolean lastTrigs;
private boolean lastSummoningSickness; private boolean lastSummoningSickness;
private boolean lastTopOfTheLibrary;
private DevModeCheats() { private DevModeCheats() {
} }
@@ -2347,9 +2348,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
game.getAction().invoke(new Runnable() { game.getAction().invoke(new Runnable() {
@Override @Override
public void run() { public void run() {
if (targetZone != ZoneType.Battlefield) { if (targetZone == ZoneType.Battlefield) {
game.getAction().moveTo(targetZone, forgeCard, null);
} else {
if (noTriggers) { if (noTriggers) {
if (forgeCard.isPermanent() && !forgeCard.isAura()) { if (forgeCard.isPermanent() && !forgeCard.isAura()) {
if (forgeCard.isCreature()) { if (forgeCard.isCreature()) {
@@ -2405,6 +2404,18 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
// playSa could fire some triggers // playSa could fire some triggers
game.getStack().addAllTriggeredAbilitiesToStack(); game.getStack().addAllTriggeredAbilitiesToStack();
} }
} else if (targetZone == ZoneType.Library) {
if (!repeatLast) {
lastTopOfTheLibrary = getGui().confirm(forgeCard.getView(),
TextUtil.concatWithSpace("Should", forgeCard.toString(), "be added to the top or to the bottom of the library?"), true, Arrays.asList("Top", "Bottom"));
}
if (lastTopOfTheLibrary) {
game.getAction().moveToLibrary(forgeCard, null, null);
} else {
game.getAction().moveToBottomOfLibrary(forgeCard, null, null);
}
} else {
game.getAction().moveTo(targetZone, forgeCard, null);
} }
lastAdded = f; lastAdded = f;