Enable use of per-set PicCount... hopefully.

This commit is contained in:
jendave
2011-08-06 16:01:39 +00:00
parent 73920782f8
commit 73c98b0e33
6 changed files with 133 additions and 84 deletions

View File

@@ -2294,14 +2294,17 @@ public class GameAction {
card.setUniqueNumber(nextUniqueNumber++);
//if(card.isBasicLand()) {
String PC = card.getSVar("PicCount");
int n = 0;
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
card.setRandomPicture(generator.nextInt(n));
//String PC = card.getSVar("PicCount");
//if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
card.setRandomSetCode();
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
if (n > 1)
card.setRandomPicture(generator.nextInt(n));
card.setImageFilename(CardUtil.buildFilename(card));
//System.out.println("human random number:" + card.getRandomPicture());
@@ -2321,16 +2324,21 @@ public class GameAction {
card.setUniqueNumber(nextUniqueNumber++);
//if(card.isBasicLand()) {
String PC = card.getSVar("PicCount");
int n = 0;
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
card.setRandomPicture(generator.nextInt(n));
//String PC = card.getSVar("PicCount");
//int n = 0;
//if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
//if (n > 1)
// card.setRandomPicture(generator.nextInt(n));
//System.out.println("computer random number:" + card.getRandomPicture());
//}
if ((card.getSets().size() > 0) && card.getCurSetCode().equals(""))
card.setRandomSetCode();
int n = SetInfoUtil.getSetInfo_Code(card.getSets(), card.getCurSetCode()).PicCount;
if (n > 1)
card.setRandomPicture(generator.nextInt(n));
card.setImageFilename(CardUtil.buildFilename(card));
AllZone.Computer_Library.add(card);

View File

@@ -507,19 +507,23 @@ public class Gui_BoosterDraft extends JFrame implements CardContainer, NewConsta
c = list.get(i);
c.setRarity(pack.getRarity(c.getName()));
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
//int n = 0;
//if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
//if (n > 1)
// c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
allCardModel.addCard(c);
}

View File

@@ -118,19 +118,22 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
c.setRarity(pack.getRarity(cardName));
}
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
//int n = 0;
//if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
//if (n > 1)
// c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
topModel.addCard(c);
@@ -144,19 +147,23 @@ public class Gui_CardShop extends JFrame implements CardContainer, DeckDisplay,
// add rarity to card if this is a sealed card pool
if(!customMenu.getGameType().equals(Constant.GameType.Constructed)) c.setRarity(pack.getRarity(c.getName()));
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
//int n = 0;
//if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
//if (n > 1)
// c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}// for

View File

@@ -182,21 +182,24 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
filteredOut = filterByType(c);
}
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (!PC.equals("")) {
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
c.setRandomPicture(r.nextInt(n));
}
//int n = 0;
//if (!PC.equals("")) {
// if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
// if (n > 1)
// c.setRandomPicture(r.nextInt(n));
//}
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
c.setImageFilename(CardUtil.buildFilename(c));
}
if(!filteredOut) {
@@ -211,21 +214,25 @@ public class Gui_DeckEditor extends JFrame implements CardContainer, DeckDisplay
// add rarity to card if this is a sealed card pool
if(!customMenu.getGameType().equals(Constant.GameType.Constructed)) c.setRarity(pack.getRarity(c.getName()));
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (!PC.equals("")) {
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
c.setRandomPicture(r.nextInt(n));
}
//int n = 0;
//if (!PC.equals("")) {
// if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
// if (n > 1)
// c.setRandomPicture(r.nextInt(n));
//}
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}// for

View File

@@ -141,21 +141,25 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
if(addedList.contains(cardName)) c.setRarity("new");
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (!PC.equals("")) {
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
c.setRandomPicture(r.nextInt(n));
}
//int n = 0;
//if (!PC.equals("")) {
// if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
// if (n > 1)
// c.setRandomPicture(r.nextInt(n));
//}
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
c.setImageFilename(CardUtil.buildFilename(c));
}
topModel.addCard(c);
@@ -167,21 +171,25 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardContainer, DeckD
c.setRarity(pack.getRarity(c.getName()));;
String PC = c.getSVar("PicCount");
//String PC = c.getSVar("PicCount");
Random r = new Random();
int n = 0;
if (!PC.equals("")){
if (PC.matches("[0-9][0-9]?"))
n = Integer.parseInt(PC);
if (n > 1)
c.setRandomPicture(r.nextInt(n));
}
//int n = 0;
//if (!PC.equals("")){
// if (PC.matches("[0-9][0-9]?"))
// n = Integer.parseInt(PC);
// if (n > 1)
// c.setRandomPicture(r.nextInt(n));
//}
if (c.getCurSetCode().equals(""))
{
c.setCurSetCode(c.getMostRecentSet());
int n = SetInfoUtil.getSetInfo_Code(c.getSets(), c.getCurSetCode()).PicCount;
if (n > 1)
c.setRandomPicture(r.nextInt(n));
c.setImageFilename(CardUtil.buildFilename(c));
}
bottomModel.addCard(c);
}//for

View File

@@ -4,12 +4,14 @@ public class SetInfo{
public String Code;
public String Rarity;
public String URL;
public int PicCount;
public SetInfo()
{
Code = "";
Rarity = "";
URL = "";
PicCount = 0;
}
public SetInfo(String c, String r, String u)
@@ -17,6 +19,15 @@ public class SetInfo{
Code = c;
Rarity = r;
URL = u;
PicCount = 0;
}
public SetInfo(String c, String r, String u, int p)
{
Code = c;
Rarity = r;
URL = u;
PicCount = p;
}
public SetInfo(String parse)
@@ -25,6 +36,10 @@ public class SetInfo{
Code = pp[0];
Rarity = pp[1];
URL = pp[2];
if (pp.length > 3)
PicCount = Integer.parseInt(pp[3]);
else
PicCount = 0;
}
public String toString()