Merge branch 'master' into 'master'

minor fixes

See merge request core-developers/forge!4629
This commit is contained in:
Anthony Calosa
2021-04-30 14:37:18 +00:00
3 changed files with 17 additions and 3 deletions

View File

@@ -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<PaperCard> cards = getAllCards(cardName);
if (null == cards) {
@@ -635,10 +641,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;
}
}));
}

View File

@@ -256,7 +256,7 @@ public final class CardEdition implements Comparable<CardEdition> { // immutable
date = date + "-01";
try {
return formatter.parse(date);
} catch (ParseException e) {
} catch (Exception e) {
return new Date();
}
}

View File

@@ -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<Card, CardView> gameCacheMove = GameEntityView.getMap(cards);
List<CardView> 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);