mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Add Dungeon to EditionSectionWithCollectorNumbers
This commit is contained in:
@@ -138,7 +138,7 @@ public class CardStorageReader {
|
|||||||
final CardRules.Reader rulesReader = new CardRules.Reader();
|
final CardRules.Reader rulesReader = new CardRules.Reader();
|
||||||
|
|
||||||
final List<CardRules> result = new ArrayList<>();
|
final List<CardRules> result = new ArrayList<>();
|
||||||
for(int i = from; i < to; i++) {
|
for (int i = from; i < to; i++) {
|
||||||
final ZipEntry ze = files.get(i);
|
final ZipEntry ze = files.get(i);
|
||||||
// if (ze.getName().endsWith(CardStorageReader.CARD_FILE_DOT_EXTENSION)) // already filtered!
|
// if (ze.getName().endsWith(CardStorageReader.CARD_FILE_DOT_EXTENSION)) // already filtered!
|
||||||
result.add(this.loadCard(rulesReader, ze));
|
result.add(this.loadCard(rulesReader, ze));
|
||||||
@@ -315,11 +315,11 @@ public class CardStorageReader {
|
|||||||
final List<Future<List<CardRules>>> parts = executor.invokeAll(tasks);
|
final List<Future<List<CardRules>>> parts = executor.invokeAll(tasks);
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
cdl.await();
|
cdl.await();
|
||||||
for(final Future<List<CardRules>> pp : parts) {
|
for (final Future<List<CardRules>> pp : parts) {
|
||||||
result.addAll(pp.get());
|
result.addAll(pp.get());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(final Callable<List<CardRules>> c : tasks) {
|
for (final Callable<List<CardRules>> c : tasks) {
|
||||||
result.addAll(c.call());
|
result.addAll(c.call());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ public class StaticData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PaperCard getCardByEditionDate(PaperCard card, Date editionDate) {
|
public PaperCard getCardByEditionDate(PaperCard card, Date editionDate) {
|
||||||
|
|
||||||
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), editionDate, CardDb.SetPreference.LatestCoreExp, card.getArtIndex());
|
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), editionDate, CardDb.SetPreference.LatestCoreExp, card.getArtIndex());
|
||||||
|
|
||||||
if (null != c) {
|
if (null != c) {
|
||||||
@@ -346,7 +345,6 @@ public class StaticData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PaperCard getCardFromLatestorEarliest(PaperCard card) {
|
public PaperCard getCardFromLatestorEarliest(PaperCard card) {
|
||||||
|
|
||||||
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.Latest, card.getArtIndex());
|
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.Latest, card.getArtIndex());
|
||||||
|
|
||||||
if (null != c && c.hasImage()) {
|
if (null != c && c.hasImage()) {
|
||||||
@@ -376,7 +374,6 @@ public class StaticData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PaperCard getCardFromEarliestCoreExp(PaperCard card) {
|
public PaperCard getCardFromEarliestCoreExp(PaperCard card) {
|
||||||
|
|
||||||
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.EarliestCoreExp, card.getArtIndex());
|
PaperCard c = this.getCommonCards().getCardFromEdition(card.getName(), null, CardDb.SetPreference.EarliestCoreExp, card.getArtIndex());
|
||||||
|
|
||||||
if (null != c && c.hasImage()) {
|
if (null != c && c.hasImage()) {
|
||||||
|
|||||||
@@ -212,16 +212,14 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
CardRules cr = rulesByName.get(cis.name);
|
CardRules cr = rulesByName.get(cis.name);
|
||||||
if (cr != null) {
|
if (cr != null) {
|
||||||
addSetCard(e, cis, cr);
|
addSetCard(e, cis, cr);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
missingCards.add(cis.name);
|
missingCards.add(cis.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isCoreExpSet && logMissingPerEdition) {
|
if (isCoreExpSet && logMissingPerEdition) {
|
||||||
if (missingCards.isEmpty()) {
|
if (missingCards.isEmpty()) {
|
||||||
System.out.println(" ... 100% ");
|
System.out.println(" ... 100% ");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int missing = (e.getAllCardsInSet().size() - missingCards.size()) * 10000 / e.getAllCardsInSet().size();
|
int missing = (e.getAllCardsInSet().size() - missingCards.size()) * 10000 / e.getAllCardsInSet().size();
|
||||||
System.out.printf(" ... %.2f%% (%s missing: %s)%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | "));
|
System.out.printf(" ... %.2f%% (%s missing: %s)%n", missing * 0.01f, Lang.nounWithAmount(missingCards.size(), "card"), StringUtils.join(missingCards, " | "));
|
||||||
}
|
}
|
||||||
@@ -245,7 +243,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
if (!contains(cr.getName())) {
|
if (!contains(cr.getName())) {
|
||||||
if (upcomingSet != null) {
|
if (upcomingSet != null) {
|
||||||
addCard(new PaperCard(cr, upcomingSet.getCode(), CardRarity.Unknown, 1));
|
addCard(new PaperCard(cr, upcomingSet.getCode(), CardRarity.Unknown, 1));
|
||||||
} else if(enableUnknownCards) {
|
} else if (enableUnknownCards) {
|
||||||
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/editions/ folder. ");
|
System.err.println("The card " + cr.getName() + " was not assigned to any set. Adding it to UNKNOWN set... to fix see res/editions/ folder. ");
|
||||||
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
addCard(new PaperCard(cr, CardEdition.UNKNOWN.getCode(), CardRarity.Special, 1));
|
||||||
}
|
}
|
||||||
@@ -505,17 +503,16 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
|
|||||||
if (pc.hasImage()) {
|
if (pc.hasImage()) {
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
else {
|
if (firstWithoutImage == null) {
|
||||||
if (firstWithoutImage == null) {
|
firstWithoutImage = pc; //ensure first without image returns if none have image
|
||||||
firstWithoutImage = pc; //ensure first without image returns if none have image
|
|
||||||
}
|
|
||||||
if (cardsListReadOnly) { //ensure we don't modify a cached collection
|
|
||||||
cards = new ArrayList<>(cards);
|
|
||||||
cardsListReadOnly = false;
|
|
||||||
}
|
|
||||||
cards.remove(randomIndex); //remove card from collection and try another random card
|
|
||||||
sz--;
|
|
||||||
}
|
}
|
||||||
|
if (cardsListReadOnly) { //ensure we don't modify a cached collection
|
||||||
|
cards = new ArrayList<>(cards);
|
||||||
|
cardsListReadOnly = false;
|
||||||
|
}
|
||||||
|
cards.remove(randomIndex); //remove card from collection and try another random card
|
||||||
|
sz--;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,8 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
BUY_A_BOX("buy a box"),
|
BUY_A_BOX("buy a box"),
|
||||||
PROMO("promo"),
|
PROMO("promo"),
|
||||||
BUNDLE("bundle"),
|
BUNDLE("bundle"),
|
||||||
BOX_TOPPER("box topper");
|
BOX_TOPPER("box topper"),
|
||||||
|
DUNGEONS("dungeons");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
@@ -216,11 +217,11 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
try {
|
try {
|
||||||
collNr = Integer.parseInt(onlyNumeric);
|
collNr = Integer.parseInt(onlyNumeric);
|
||||||
} catch (NumberFormatException exon) {
|
} catch (NumberFormatException exon) {
|
||||||
collNr = 0; // this is the case of ONLY-letters collector numbers
|
collNr = 0; // this is the case of ONLY-letters collector numbers
|
||||||
}
|
}
|
||||||
if ((collNr > 0) && (sortableCollNr.startsWith(onlyNumeric))) // e.g. 12a, 37+, 2018f,
|
if ((collNr > 0) && (sortableCollNr.startsWith(onlyNumeric))) // e.g. 12a, 37+, 2018f,
|
||||||
sortableCollNr = String.format("%05d", collNr) + nonNumeric;
|
sortableCollNr = String.format("%05d", collNr) + nonNumeric;
|
||||||
else // e.g. WS6, S1
|
else // e.g. WS6, S1
|
||||||
sortableCollNr = nonNumeric + String.format("%05d", collNr);
|
sortableCollNr = nonNumeric + String.format("%05d", collNr);
|
||||||
}
|
}
|
||||||
return sortableCollNr;
|
return sortableCollNr;
|
||||||
@@ -459,11 +460,11 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
Map<String, Integer> cardToIndex = new HashMap<>();
|
Map<String, Integer> cardToIndex = new HashMap<>();
|
||||||
|
|
||||||
List<PrintSheet> sheets = Lists.newArrayList();
|
List<PrintSheet> sheets = Lists.newArrayList();
|
||||||
for(String sectionName : cardMap.keySet()) {
|
for (String sectionName : cardMap.keySet()) {
|
||||||
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sectionName));
|
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sectionName));
|
||||||
|
|
||||||
List<CardInSet> cards = cardMap.get(sectionName);
|
List<CardInSet> cards = cardMap.get(sectionName);
|
||||||
for(CardInSet card : cards) {
|
for (CardInSet card : cards) {
|
||||||
int index = 1;
|
int index = 1;
|
||||||
if (cardToIndex.containsKey(card.name)) {
|
if (cardToIndex.containsKey(card.name)) {
|
||||||
index = cardToIndex.get(card.name);
|
index = cardToIndex.get(card.name);
|
||||||
@@ -478,7 +479,7 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
sheets.add(sheet);
|
sheets.add(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String sheetName : customPrintSheetsToParse.keySet()) {
|
for (String sheetName : customPrintSheetsToParse.keySet()) {
|
||||||
List<String> sheetToParse = customPrintSheetsToParse.get(sheetName);
|
List<String> sheetToParse = customPrintSheetsToParse.get(sheetName);
|
||||||
CardPool sheetPool = CardPool.fromCardList(sheetToParse);
|
CardPool sheetPool = CardPool.fromCardList(sheetToParse);
|
||||||
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sheetName), sheetPool);
|
PrintSheet sheet = new PrintSheet(String.format("%s %s", this.getCode(), sheetName), sheetPool);
|
||||||
@@ -561,7 +562,7 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
|
|
||||||
// parse tokens section
|
// parse tokens section
|
||||||
if (contents.containsKey("tokens")) {
|
if (contents.containsKey("tokens")) {
|
||||||
for(String line : contents.get("tokens")) {
|
for (String line : contents.get("tokens")) {
|
||||||
if (StringUtils.isBlank(line))
|
if (StringUtils.isBlank(line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -589,11 +590,11 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
res.mciCode = res.code2.toLowerCase();
|
res.mciCode = res.code2.toLowerCase();
|
||||||
}
|
}
|
||||||
res.scryfallCode = section.get("ScryfallCode");
|
res.scryfallCode = section.get("ScryfallCode");
|
||||||
if (res.scryfallCode == null){
|
if (res.scryfallCode == null) {
|
||||||
res.scryfallCode = res.code;
|
res.scryfallCode = res.code;
|
||||||
}
|
}
|
||||||
res.cardsLanguage = section.get("CardLang");
|
res.cardsLanguage = section.get("CardLang");
|
||||||
if (res.cardsLanguage == null){
|
if (res.cardsLanguage == null) {
|
||||||
res.cardsLanguage = "en";
|
res.cardsLanguage = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,7 +620,7 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
res.borderColor = BorderColor.valueOf(section.get("border", "Black").toUpperCase(Locale.ENGLISH));
|
res.borderColor = BorderColor.valueOf(section.get("border", "Black").toUpperCase(Locale.ENGLISH));
|
||||||
Type enumType = Type.UNKNOWN;
|
Type enumType = Type.UNKNOWN;
|
||||||
if (this.isCustomEditions){
|
if (this.isCustomEditions){
|
||||||
enumType = Type.CUSTOM_SET; // Forcing ThirdParty Edition Type to avoid inconsistencies
|
enumType = Type.CUSTOM_SET; // Forcing ThirdParty Edition Type to avoid inconsistencies
|
||||||
} else {
|
} else {
|
||||||
String type = section.get("type");
|
String type = section.get("type");
|
||||||
if (null != type && !type.isEmpty()) {
|
if (null != type && !type.isEmpty()) {
|
||||||
@@ -636,7 +637,7 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
res.prerelease = section.get("Prerelease", null);
|
res.prerelease = section.get("Prerelease", null);
|
||||||
res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", enumType.getBoosterBoxDefault()));
|
res.boosterBoxCount = Integer.parseInt(section.get("BoosterBox", enumType.getBoosterBoxDefault()));
|
||||||
|
|
||||||
switch(section.get("foil", "newstyle").toLowerCase()) {
|
switch (section.get("foil", "newstyle").toLowerCase()) {
|
||||||
case "notsupported":
|
case "notsupported":
|
||||||
res.foilType = FoilType.NOT_SUPPORTED;
|
res.foilType = FoilType.NOT_SUPPORTED;
|
||||||
break;
|
break;
|
||||||
@@ -769,7 +770,7 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, SealedProduct.Template> readAll() {
|
public Map<String, SealedProduct.Template> readAll() {
|
||||||
Map<String, SealedProduct.Template> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
Map<String, SealedProduct.Template> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
for(CardEdition ce : Collection.this) {
|
for (CardEdition ce : Collection.this) {
|
||||||
List<String> boosterTypes = Lists.newArrayList(ce.getAvailableBoosterTypes());
|
List<String> boosterTypes = Lists.newArrayList(ce.getAvailableBoosterTypes());
|
||||||
for (String type : boosterTypes) {
|
for (String type : boosterTypes) {
|
||||||
String setAffix = type.equals("Draft") ? "" : type;
|
String setAffix = type.equals("Draft") ? "" : type;
|
||||||
@@ -799,18 +800,18 @@ public final class CardEdition implements Comparable<CardEdition> {
|
|||||||
|
|
||||||
for (Entry<PaperCard, Integer> k : cards) {
|
for (Entry<PaperCard, Integer> k : cards) {
|
||||||
PaperCard cp = StaticData.instance().getCommonCards().getCardFromEdition(k.getKey().getName(), strictness);
|
PaperCard cp = StaticData.instance().getCommonCards().getCardFromEdition(k.getKey().getName(), strictness);
|
||||||
if( cp == null && strictness == SetPreference.EarliestCoreExp) {
|
if (cp == null && strictness == SetPreference.EarliestCoreExp) {
|
||||||
strictness = SetPreference.Earliest; // card is not found in core and expansions only (probably something CMD or C13)
|
strictness = SetPreference.Earliest; // card is not found in core and expansions only (probably something CMD or C13)
|
||||||
cp = StaticData.instance().getCommonCards().getCardFromEdition(k.getKey().getName(), strictness);
|
cp = StaticData.instance().getCommonCards().getCardFromEdition(k.getKey().getName(), strictness);
|
||||||
}
|
}
|
||||||
if ( cp == null )
|
if (cp == null)
|
||||||
cp = k.getKey(); // it's unlikely, this code will ever run
|
cp = k.getKey(); // it's unlikely, this code will ever run
|
||||||
|
|
||||||
minEditions.add(cp.getEdition());
|
minEditions.add(cp.getEdition());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(CardEdition ed : getOrderedEditions()) {
|
for (CardEdition ed : getOrderedEditions()) {
|
||||||
if(minEditions.contains(ed.getCode()))
|
if (minEditions.contains(ed.getCode()))
|
||||||
return ed;
|
return ed;
|
||||||
}
|
}
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
|
|||||||
@@ -513,14 +513,14 @@ public final class CardRules implements ICardCharacteristics {
|
|||||||
case 'S':
|
case 'S':
|
||||||
if ("S".equals(key)) {
|
if ("S".equals(key)) {
|
||||||
this.faces[this.curFace].addStaticAbility(value);
|
this.faces[this.curFace].addStaticAbility(value);
|
||||||
} else if ( "SVar".equals(key) ) {
|
} else if ("SVar".equals(key)) {
|
||||||
if ( null == value ) throw new IllegalArgumentException("SVar has no variable name");
|
if (null == value) throw new IllegalArgumentException("SVar has no variable name");
|
||||||
|
|
||||||
colonPos = value.indexOf(':');
|
colonPos = value.indexOf(':');
|
||||||
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
String variable = colonPos > 0 ? value.substring(0, colonPos) : value;
|
||||||
value = colonPos > 0 ? value.substring(1+colonPos) : null;
|
value = colonPos > 0 ? value.substring(1+colonPos) : null;
|
||||||
|
|
||||||
if ( "Picture".equals(variable) ) {
|
if ("Picture".equals(variable)) {
|
||||||
this.pictureUrl[this.curFace] = value;
|
this.pictureUrl[this.curFace] = value;
|
||||||
} else
|
} else
|
||||||
this.faces[curFace].addSVar(variable, value);
|
this.faces[curFace].addSVar(variable, value);
|
||||||
|
|||||||
@@ -451,8 +451,7 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
if (calculatedType == null) {
|
if (calculatedType == null) {
|
||||||
if (subtypes.isEmpty()) {
|
if (subtypes.isEmpty()) {
|
||||||
calculatedType = StringUtils.join(getTypesBeforeDash(), ' ');
|
calculatedType = StringUtils.join(getTypesBeforeDash(), ' ');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
calculatedType = StringUtils.join(getTypesBeforeDash(), ' ') + " - " + StringUtils.join(subtypes, " ");
|
calculatedType = StringUtils.join(getTypesBeforeDash(), ' ') + " - " + StringUtils.join(subtypes, " ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public final class MagicColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String toShortString(final byte color) {
|
public static String toShortString(final byte color) {
|
||||||
switch (color){
|
switch (color) {
|
||||||
case WHITE: return "W";
|
case WHITE: return "W";
|
||||||
case BLUE: return "U";
|
case BLUE: return "U";
|
||||||
case BLACK: return "B";
|
case BLACK: return "B";
|
||||||
@@ -95,7 +95,7 @@ public final class MagicColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String toLongString(final byte color) {
|
public static String toLongString(final byte color) {
|
||||||
switch (color){
|
switch (color) {
|
||||||
case WHITE: return Constant.WHITE;
|
case WHITE: return Constant.WHITE;
|
||||||
case BLUE: return Constant.BLUE;
|
case BLUE: return Constant.BLUE;
|
||||||
case BLACK: return Constant.BLACK;
|
case BLACK: return Constant.BLACK;
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ public class PrintSheet {
|
|||||||
public static final IStorage<PrintSheet> initializePrintSheets(File sheetsFile, CardEdition.Collection editions) {
|
public static final IStorage<PrintSheet> initializePrintSheets(File sheetsFile, CardEdition.Collection editions) {
|
||||||
IStorage<PrintSheet> sheets = new StorageExtendable<>("Special print runs", new PrintSheet.Reader(sheetsFile));
|
IStorage<PrintSheet> sheets = new StorageExtendable<>("Special print runs", new PrintSheet.Reader(sheetsFile));
|
||||||
|
|
||||||
for(CardEdition edition : editions) {
|
for (CardEdition edition : editions) {
|
||||||
for(PrintSheet ps : edition.getPrintSheetsBySection()) {
|
for (PrintSheet ps : edition.getPrintSheetsBySection()) {
|
||||||
sheets.add(ps.name, ps);
|
sheets.add(ps.name, ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ public class PrintSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addAll(Iterable<PaperCard> cards, int weight) {
|
public void addAll(Iterable<PaperCard> cards, int weight) {
|
||||||
for(PaperCard card : cards)
|
for (PaperCard card : cards)
|
||||||
cardsWithWeights.add(card, weight);
|
cardsWithWeights.add(card, weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,15 +78,15 @@ public class PrintSheet {
|
|||||||
private PaperCard fetchRoulette(int start, int roulette, Collection<PaperCard> toSkip) {
|
private PaperCard fetchRoulette(int start, int roulette, Collection<PaperCard> toSkip) {
|
||||||
int sum = start;
|
int sum = start;
|
||||||
boolean isSecondRun = start > 0;
|
boolean isSecondRun = start > 0;
|
||||||
for(Entry<PaperCard, Integer> cc : cardsWithWeights ) {
|
for (Entry<PaperCard, Integer> cc : cardsWithWeights ) {
|
||||||
sum += cc.getValue();
|
sum += cc.getValue();
|
||||||
if( sum > roulette ) {
|
if (sum > roulette) {
|
||||||
if( toSkip != null && toSkip.contains(cc.getKey()))
|
if (toSkip != null && toSkip.contains(cc.getKey()))
|
||||||
continue;
|
continue;
|
||||||
return cc.getKey();
|
return cc.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( isSecondRun )
|
if (isSecondRun)
|
||||||
throw new IllegalStateException("Print sheet does not have enough unique cards");
|
throw new IllegalStateException("Print sheet does not have enough unique cards");
|
||||||
|
|
||||||
return fetchRoulette(sum + 1, roulette, toSkip); // start over from beginning, in case last cards were to skip
|
return fetchRoulette(sum + 1, roulette, toSkip); // start over from beginning, in case last cards were to skip
|
||||||
@@ -94,8 +94,8 @@ public class PrintSheet {
|
|||||||
|
|
||||||
public List<PaperCard> all() {
|
public List<PaperCard> all() {
|
||||||
List<PaperCard> result = new ArrayList<>();
|
List<PaperCard> result = new ArrayList<>();
|
||||||
for(Entry<PaperCard, Integer> kv : cardsWithWeights) {
|
for (Entry<PaperCard, Integer> kv : cardsWithWeights) {
|
||||||
for(int i = 0; i < kv.getValue(); i++) {
|
for (int i = 0; i < kv.getValue(); i++) {
|
||||||
result.add(kv.getKey());
|
result.add(kv.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,26 +106,26 @@ public class PrintSheet {
|
|||||||
List<PaperCard> result = new ArrayList<>();
|
List<PaperCard> result = new ArrayList<>();
|
||||||
|
|
||||||
int totalWeight = cardsWithWeights.countAll();
|
int totalWeight = cardsWithWeights.countAll();
|
||||||
if( totalWeight == 0) {
|
if (totalWeight == 0) {
|
||||||
System.err.println("No cards were found on sheet " + name);
|
System.err.println("No cards were found on sheet " + name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If they ask for 40 unique basic lands (to make a fatpack) out of 20 distinct possible, add the whole print run N times.
|
// If they ask for 40 unique basic lands (to make a fatpack) out of 20 distinct possible, add the whole print run N times.
|
||||||
int uniqueCards = cardsWithWeights.countDistinct();
|
int uniqueCards = cardsWithWeights.countDistinct();
|
||||||
while ( number >= uniqueCards ) {
|
while (number >= uniqueCards) {
|
||||||
for(Entry<PaperCard, Integer> kv : cardsWithWeights) {
|
for (Entry<PaperCard, Integer> kv : cardsWithWeights) {
|
||||||
result.add(kv.getKey());
|
result.add(kv.getKey());
|
||||||
}
|
}
|
||||||
number -= uniqueCards;
|
number -= uniqueCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PaperCard> uniques = wantUnique ? new ArrayList<>() : null;
|
List<PaperCard> uniques = wantUnique ? new ArrayList<>() : null;
|
||||||
for(int iC = 0; iC < number; iC++) {
|
for (int iC = 0; iC < number; iC++) {
|
||||||
int index = MyRandom.getRandom().nextInt(totalWeight);
|
int index = MyRandom.getRandom().nextInt(totalWeight);
|
||||||
PaperCard toAdd = fetchRoulette(0, index, wantUnique ? uniques : null);
|
PaperCard toAdd = fetchRoulette(0, index, wantUnique ? uniques : null);
|
||||||
result.add(toAdd);
|
result.add(toAdd);
|
||||||
if( wantUnique )
|
if (wantUnique)
|
||||||
uniques.add(toAdd);
|
uniques.add(toAdd);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
CardPool pool = CardPool.fromCardList(cardsInSection);
|
CardPool pool = CardPool.fromCardList(cardsInSection);
|
||||||
// I used to store planes and schemes under sideboard header, so this will assign them to a correct section
|
// I used to store planes and schemes under sideboard header, so this will assign them to a correct section
|
||||||
IPaperCard sample = pool.get(0);
|
IPaperCard sample = pool.get(0);
|
||||||
if (sample != null && ( sample.getRules().getType().isPlane() || sample.getRules().getType().isPhenomenon())) {
|
if (sample != null && (sample.getRules().getType().isPlane() || sample.getRules().getType().isPhenomenon())) {
|
||||||
sec = DeckSection.Planes;
|
sec = DeckSection.Planes;
|
||||||
}
|
}
|
||||||
if (sample != null && sample.getRules().getType().isScheme()) {
|
if (sample != null && sample.getRules().getType().isScheme()) {
|
||||||
@@ -263,13 +263,13 @@ public class Deck extends DeckBase implements Iterable<Entry<DeckSection, CardPo
|
|||||||
Date dateWithAllCards = StaticData.instance().getEditions().getEarliestDateWithAllCards(getAllCardsInASinglePool());
|
Date dateWithAllCards = StaticData.instance().getEditions().getEarliestDateWithAllCards(getAllCardsInASinglePool());
|
||||||
String artOption = StaticData.instance().getPrefferedArtOption();
|
String artOption = StaticData.instance().getPrefferedArtOption();
|
||||||
|
|
||||||
for(Entry<DeckSection, CardPool> p : parts.entrySet()) {
|
for (Entry<DeckSection, CardPool> p : parts.entrySet()) {
|
||||||
if( p.getKey() == DeckSection.Planes || p.getKey() == DeckSection.Schemes || p.getKey() == DeckSection.Avatar)
|
if (p.getKey() == DeckSection.Planes || p.getKey() == DeckSection.Schemes || p.getKey() == DeckSection.Avatar)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CardPool newPool = new CardPool();
|
CardPool newPool = new CardPool();
|
||||||
|
|
||||||
for(Entry<PaperCard, Integer> cp : p.getValue()){
|
for (Entry<PaperCard, Integer> cp : p.getValue()) {
|
||||||
PaperCard card = cp.getKey();
|
PaperCard card = cp.getKey();
|
||||||
int count = cp.getValue();
|
int count = cp.getValue();
|
||||||
|
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ public class GameAction {
|
|||||||
if (fromBattlefield && !zoneFrom.getPlayer().equals(zoneTo.getPlayer())) {
|
if (fromBattlefield && !zoneFrom.getPlayer().equals(zoneTo.getPlayer())) {
|
||||||
final Map<AbilityKey, Object> runParams2 = AbilityKey.mapFromCard(lastKnownInfo);
|
final Map<AbilityKey, Object> runParams2 = AbilityKey.mapFromCard(lastKnownInfo);
|
||||||
runParams2.put(AbilityKey.OriginalController, zoneFrom.getPlayer());
|
runParams2.put(AbilityKey.OriginalController, zoneFrom.getPlayer());
|
||||||
if(params != null) {
|
if (params != null) {
|
||||||
runParams2.putAll(params);
|
runParams2.putAll(params);
|
||||||
}
|
}
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams2, false);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams2, false);
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ public class DamageAllEffect extends DamageBaseEffect {
|
|||||||
CardCollectionView list;
|
CardCollectionView list;
|
||||||
if (sa.hasParam("ValidCards")) {
|
if (sa.hasParam("ValidCards")) {
|
||||||
list = game.getCardsIn(ZoneType.Battlefield);
|
list = game.getCardsIn(ZoneType.Battlefield);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
list = CardCollection.EMPTY;
|
list = CardCollection.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public enum AttackRestrictionType {
|
|||||||
public Predicate<Card> getPredicate(final Card attacker) {
|
public Predicate<Card> getPredicate(final Card attacker) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case NEED_GREATER_POWER:
|
case NEED_GREATER_POWER:
|
||||||
return CardPredicates.hasGreaterPowerThan(attacker.getNetPower());
|
return CardPredicates.hasGreaterPowerThan(attacker.getNetPower());
|
||||||
case NEED_BLACK_OR_GREEN:
|
case NEED_BLACK_OR_GREEN:
|
||||||
return Predicates.and(
|
return Predicates.and(
|
||||||
CardPredicates.isColor((byte) (MagicColor.BLACK | MagicColor.GREEN)),
|
CardPredicates.isColor((byte) (MagicColor.BLACK | MagicColor.GREEN)),
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ public class ManaConversionMatrix {
|
|||||||
rowIdx = rowIdx < 0 ? identityMatrix.length - 1 : rowIdx;
|
rowIdx = rowIdx < 0 ? identityMatrix.length - 1 : rowIdx;
|
||||||
if (additive) {
|
if (additive) {
|
||||||
colorConversionMatrix[rowIdx] |= replacementColor;
|
colorConversionMatrix[rowIdx] |= replacementColor;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
colorRestrictionMatrix[rowIdx] &= replacementColor;
|
colorRestrictionMatrix[rowIdx] &= replacementColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,8 +258,7 @@ public class ManaCostBeingPaid {
|
|||||||
ManaCostShard shard;
|
ManaCostShard shard;
|
||||||
if (StringUtils.isEmpty(xColor)) {
|
if (StringUtils.isEmpty(xColor)) {
|
||||||
shard = ManaCostShard.GENERIC;
|
shard = ManaCostShard.GENERIC;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
shard = ManaCostShard.parseNonGeneric(xColor);
|
shard = ManaCostShard.parseNonGeneric(xColor);
|
||||||
}
|
}
|
||||||
increaseShard(shard, xCost, true);
|
increaseShard(shard, xCost, true);
|
||||||
|
|||||||
@@ -137,18 +137,15 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
if (convertToColorless) {
|
if (convertToColorless) {
|
||||||
convertManaColor(b, (byte)ManaAtom.COLORLESS);
|
convertManaColor(b, (byte)ManaAtom.COLORLESS);
|
||||||
cm.addAll(pMana);
|
cm.addAll(pMana);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cleared.addAll(cm);
|
cleared.addAll(cm);
|
||||||
cm.clear();
|
cm.clear();
|
||||||
floatingMana.putAll(b, pMana);
|
floatingMana.putAll(b, pMana);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (convertToColorless) {
|
if (convertToColorless) {
|
||||||
convertManaColor(b, (byte)ManaAtom.COLORLESS);
|
convertManaColor(b, (byte)ManaAtom.COLORLESS);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cleared.addAll(cm);
|
cleared.addAll(cm);
|
||||||
cm.clear();
|
cm.clear();
|
||||||
}
|
}
|
||||||
@@ -261,8 +258,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
|
|
||||||
if (poolLane != null && poolLane.contains(mana)) {
|
if (poolLane != null && poolLane.contains(mana)) {
|
||||||
removeFloating.add(mana);
|
removeFloating.add(mana);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
manaNotAccountedFor = true;
|
manaNotAccountedFor = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -319,7 +315,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
// TODO Debug this for Paying Gonti,
|
// TODO Debug this for Paying Gonti,
|
||||||
byte line = getPossibleColorUses(color);
|
byte line = getPossibleColorUses(color);
|
||||||
|
|
||||||
for(byte outColor : ManaAtom.MANATYPES) {
|
for (byte outColor : ManaAtom.MANATYPES) {
|
||||||
if ((line & outColor) != 0 && shard.canBePaidWithManaOfColor(outColor)) {
|
if ((line & outColor) != 0 && shard.canBePaidWithManaOfColor(outColor)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class MulliganService {
|
|||||||
boolean allKept;
|
boolean allKept;
|
||||||
do {
|
do {
|
||||||
allKept = true;
|
allKept = true;
|
||||||
for(AbstractMulligan mulligan : mulligans) {
|
for (AbstractMulligan mulligan : mulligans) {
|
||||||
if (mulligan.hasKept()) {
|
if (mulligan.hasKept()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ public class MulliganService {
|
|||||||
}
|
}
|
||||||
} while (!allKept);
|
} while (!allKept);
|
||||||
|
|
||||||
for(AbstractMulligan mulligan : mulligans) {
|
for (AbstractMulligan mulligan : mulligans) {
|
||||||
mulligan.afterMulligan();
|
mulligan.afterMulligan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class RegisteredPlayer {
|
|||||||
}
|
}
|
||||||
if (appliedVariants.contains(GameType.Vanguard) || appliedVariants.contains(GameType.MomirBasic)
|
if (appliedVariants.contains(GameType.Vanguard) || appliedVariants.contains(GameType.MomirBasic)
|
||||||
|| appliedVariants.contains(GameType.MoJhoSto)) { //fix the crash, if somehow the avatar is null, get it directly from the deck
|
|| appliedVariants.contains(GameType.MoJhoSto)) { //fix the crash, if somehow the avatar is null, get it directly from the deck
|
||||||
start.setVanguardAvatars(vanguardAvatar == null ? deck.get(DeckSection.Avatar).toFlatList():vanguardAvatar.toFlatList());
|
start.setVanguardAvatars(vanguardAvatar == null ? deck.get(DeckSection.Avatar).toFlatList() : vanguardAvatar.toFlatList());
|
||||||
}
|
}
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
@@ -167,7 +167,7 @@ public class RegisteredPlayer {
|
|||||||
private void setVanguardAvatars(List<PaperCard> vanguardAvatars0) {
|
private void setVanguardAvatars(List<PaperCard> vanguardAvatars0) {
|
||||||
vanguardAvatars = vanguardAvatars0;
|
vanguardAvatars = vanguardAvatars0;
|
||||||
if (vanguardAvatars == null) { return; }
|
if (vanguardAvatars == null) { return; }
|
||||||
for(PaperCard avatar: vanguardAvatars){
|
for (PaperCard avatar: vanguardAvatars) {
|
||||||
setStartingLife(getStartingLife() + avatar.getRules().getLife());
|
setStartingLife(getStartingLife() + avatar.getRules().getLife());
|
||||||
setStartingHand(getStartingHand() + avatar.getRules().getHand());
|
setStartingHand(getStartingHand() + avatar.getRules().getHand());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,6 @@ public class StaticAbilityCantBeCast {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (stAb.hasParam("AffectedZone") && !card.isInZone(ZoneType.smartValueOf(stAb.getParam("AffectedZone")))) {
|
if (stAb.hasParam("AffectedZone") && !card.isInZone(ZoneType.smartValueOf(stAb.getParam("AffectedZone")))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,11 +48,7 @@ public class StaticAbilityCastWithFlash {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static boolean commonParts(final StaticAbility stAb, final SpellAbility sa, final Card card, final Player activator) {
|
public static boolean commonParts(final StaticAbility stAb, final SpellAbility sa, final Card card, final Player activator) {
|
||||||
|
|
||||||
if (!stAb.matchesValidParam("ValidCard", card)) {
|
if (!stAb.matchesValidParam("ValidCard", card)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -535,14 +535,12 @@ public abstract class Trigger extends TriggerReplacementBase {
|
|||||||
return this.numberTurnActivations;
|
return this.numberTurnActivations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerRun()
|
public void triggerRun() {
|
||||||
{
|
|
||||||
this.numberTurnActivations++;
|
this.numberTurnActivations++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resets the state stored each turn for per-turn and per-instance restriction
|
// Resets the state stored each turn for per-turn and per-instance restriction
|
||||||
public void resetTurnState()
|
public void resetTurnState() {
|
||||||
{
|
|
||||||
this.numberTurnActivations = 0;
|
this.numberTurnActivations = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ public class TriggerHandler {
|
|||||||
waitingTriggers.clear();
|
waitingTriggers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetTurnTriggerState() {
|
public void resetTurnTriggerState() {
|
||||||
for(final Trigger t : activeTriggers) {
|
for(final Trigger t : activeTriggers) {
|
||||||
t.resetTurnState();
|
t.resetTurnState();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -839,7 +839,7 @@ public class VLobby implements ILobbyView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPlayerAI(final int playernum) {
|
private boolean isPlayerAI(final int playernum) {
|
||||||
if(playernum < activePlayersNum){
|
if (playernum < activePlayersNum) {
|
||||||
return playerPanels.get(playernum).isAi();
|
return playerPanels.get(playernum).isAi();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user