From 1e1c5fa139f3378f4ce8c206aad1498ae7660740 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 30 Apr 2021 22:20:26 +0800 Subject: [PATCH 1/3] update Filter --- forge-core/src/main/java/forge/card/CardDb.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/forge-core/src/main/java/forge/card/CardDb.java b/forge-core/src/main/java/forge/card/CardDb.java index 72a2d263376..db27bb77b53 100644 --- a/forge-core/src/main/java/forge/card/CardDb.java +++ b/forge-core/src/main/java/forge/card/CardDb.java @@ -635,10 +635,12 @@ public final class CardDb implements ICardDatabase, IDeckGenPool { CardEdition edition = null; try { edition = editions.getEditionByCodeOrThrow(paperCard.getEdition()); + if (edition.getType() == Type.PROMOS||edition.getType() == Type.REPRINT) + return false; } catch (Exception ex) { return false; } - return edition != null && (edition.getType() != Type.PROMOS||edition.getType() != Type.REPRINT); + return true; } })); } From 9fee1fda1eb8a37e44fd80c2018922bf84ae6363 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 30 Apr 2021 22:21:56 +0800 Subject: [PATCH 2/3] update order Message --- .../src/main/java/forge/player/PlayerControllerHuman.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java index d8913de1254..86ee5e8373c 100644 --- a/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java +++ b/forge-gui/src/main/java/forge/player/PlayerControllerHuman.java @@ -997,6 +997,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont @Override public CardCollectionView orderMoveToZoneList(final CardCollectionView cards, final ZoneType destinationZone, final SpellAbility source) { + boolean bottomOfLibrary = false; if (source == null || source.getApi() != ApiType.ReorderZone) { if (destinationZone == ZoneType.Graveyard) { switch (FModel.getPreferences().getPref(FPref.UI_ALLOW_ORDER_GRAVEYARD_WHEN_NEEDED)) { @@ -1019,13 +1020,18 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont } } + if (source != null) { + if (source.hasParam("LibraryPosition")) { + bottomOfLibrary = Integer.parseInt(source.getParam("LibraryPosition")) < 0; + } + } tempShowCards(cards); GameEntityViewMap gameCacheMove = GameEntityView.getMap(cards); List choices = gameCacheMove.getTrackableKeys(); switch (destinationZone) { case Library: - choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoLibrary"), localizer.getMessage("lblClosestToTop"), choices, null); + choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutIntoLibrary"), localizer.getMessage(bottomOfLibrary ? "lblClosestToBottom" : "lblClosestToTop"), choices, null); break; case Battlefield: choices = getGui().order(localizer.getMessage("lblChooseOrderCardsPutOntoBattlefield"), localizer.getMessage("lblPutFirst"), choices, null); From 6d3155dff9127c58e2df2c4f8d425fd43b5f5405 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 30 Apr 2021 22:27:07 +0800 Subject: [PATCH 3/3] prevent NPE --- forge-core/src/main/java/forge/card/CardDb.java | 6 ++++++ forge-core/src/main/java/forge/card/CardEdition.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/forge-core/src/main/java/forge/card/CardDb.java b/forge-core/src/main/java/forge/card/CardDb.java index db27bb77b53..99c8f5e47cc 100644 --- a/forge-core/src/main/java/forge/card/CardDb.java +++ b/forge-core/src/main/java/forge/card/CardDb.java @@ -533,6 +533,8 @@ public final class CardDb implements ICardDatabase, IDeckGenPool { @Override public int getPrintCount(String cardName, String edition) { int cnt = 0; + if (edition == null || cardName == null) + return cnt; for (PaperCard pc : getAllCards(cardName)) { if (pc.getEdition().equals(edition)) { cnt++; @@ -544,6 +546,8 @@ public final class CardDb implements ICardDatabase, IDeckGenPool { @Override public int getMaxPrintCount(String cardName) { int max = -1; + if (cardName == null) + return max; for (PaperCard pc : getAllCards(cardName)) { if (max < pc.getArtIndex()) { max = pc.getArtIndex(); @@ -555,6 +559,8 @@ public final class CardDb implements ICardDatabase, IDeckGenPool { @Override public int getArtCount(String cardName, String setName) { int cnt = 0; + if (cardName == null || setName == null) + return cnt; Collection cards = getAllCards(cardName); if (null == cards) { diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index 04d41cdfb89..75cd6980ec5 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -256,7 +256,7 @@ public final class CardEdition implements Comparable { // immutable date = date + "-01"; try { return formatter.parse(date); - } catch (ParseException e) { + } catch (Exception e) { return new Date(); } }