mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Sure enough, the code didn't work with brand new cards lacking SetInfo.
This commit is contained in:
@@ -2301,11 +2301,13 @@ public class GameAction {
|
|||||||
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
|
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
|
||||||
card.setRandomSetCode();
|
card.setRandomSetCode();
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
|
if (!card.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
|
||||||
card.setRandomPicture(generator.nextInt(n));
|
if (n > 1)
|
||||||
|
card.setRandomPicture(generator.nextInt(n));
|
||||||
|
|
||||||
card.setImageFilename(CardUtil.buildFilename(card));
|
card.setImageFilename(CardUtil.buildFilename(card));
|
||||||
|
}
|
||||||
|
|
||||||
//System.out.println("human random number:" + card.getRandomPicture());
|
//System.out.println("human random number:" + card.getRandomPicture());
|
||||||
//}
|
//}
|
||||||
@@ -2335,11 +2337,13 @@ public class GameAction {
|
|||||||
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
|
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
|
||||||
card.setRandomSetCode();
|
card.setRandomSetCode();
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
|
if (!card.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
|
||||||
card.setRandomPicture(generator.nextInt(n));
|
if (n > 1)
|
||||||
|
card.setRandomPicture(generator.nextInt(n));
|
||||||
|
|
||||||
card.setImageFilename(CardUtil.buildFilename(card));
|
card.setImageFilename(CardUtil.buildFilename(card));
|
||||||
|
}
|
||||||
|
|
||||||
AllZone.Computer_Library.add(card);
|
AllZone.Computer_Library.add(card);
|
||||||
|
|
||||||
|
|||||||
@@ -518,12 +518,13 @@ public class Gui_BoosterDraft extends JFrame implements CardContainer, NewConsta
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
allCardModel.addCard(c);
|
allCardModel.addCard(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,12 +129,13 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
topModel.addCard(c);
|
topModel.addCard(c);
|
||||||
|
|
||||||
@@ -158,12 +159,13 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
bottomModel.addCard(c);
|
bottomModel.addCard(c);
|
||||||
}// for
|
}// for
|
||||||
|
|||||||
@@ -195,12 +195,13 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
if(!filteredOut) {
|
if(!filteredOut) {
|
||||||
topModel.addCard(c);
|
topModel.addCard(c);
|
||||||
@@ -227,12 +228,13 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
bottomModel.addCard(c);
|
bottomModel.addCard(c);
|
||||||
}// for
|
}// for
|
||||||
|
|||||||
@@ -154,12 +154,13 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
topModel.addCard(c);
|
topModel.addCard(c);
|
||||||
@@ -184,12 +185,13 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
|
|||||||
if (c.getCurSetCode().equals(""))
|
if (c.getCurSetCode().equals(""))
|
||||||
c.setCurSetCode(c.getMostRecentSet());
|
c.setCurSetCode(c.getMostRecentSet());
|
||||||
|
|
||||||
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
if (!c.getCurSetCode().equals("")) {
|
||||||
if (n > 1)
|
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
|
||||||
c.setRandomPicture(r.nextInt(n));
|
if (n > 1)
|
||||||
|
c.setRandomPicture(r.nextInt(n));
|
||||||
c.setImageFilename(CardUtil.buildFilename(c));
|
|
||||||
|
|
||||||
|
c.setImageFilename(CardUtil.buildFilename(c));
|
||||||
|
}
|
||||||
|
|
||||||
bottomModel.addCard(c);
|
bottomModel.addCard(c);
|
||||||
}//for
|
}//for
|
||||||
|
|||||||
Reference in New Issue
Block a user