forked from External/mage
* Game: fixed that Snow-Covered lands can be added to auto-generated or submitted/timeout decks (#7222);
This commit is contained in:
parent
10cf9c4a4e
commit
dd7c1939d3
6 changed files with 71 additions and 51 deletions
|
|
@ -20,6 +20,7 @@ public class CardCriteria {
|
|||
private String nameExact;
|
||||
private String rules;
|
||||
private final List<String> setCodes;
|
||||
private final List<String> ignoreSetCodes; // sets to ignore, use with little amount of sets (example: ignore sets with snow lands)
|
||||
private final List<CardType> types;
|
||||
private final List<CardType> notTypes;
|
||||
private final List<String> supertypes;
|
||||
|
|
@ -42,6 +43,7 @@ public class CardCriteria {
|
|||
|
||||
public CardCriteria() {
|
||||
this.setCodes = new ArrayList<>();
|
||||
this.ignoreSetCodes = new ArrayList<>();
|
||||
this.rarities = new ArrayList<>();
|
||||
this.types = new ArrayList<>();
|
||||
this.notTypes = new ArrayList<>();
|
||||
|
|
@ -130,6 +132,16 @@ public class CardCriteria {
|
|||
return this;
|
||||
}
|
||||
|
||||
public CardCriteria ignoreSetCodes(String... ignoreSetCodes) {
|
||||
this.ignoreSetCodes.addAll(Arrays.asList(ignoreSetCodes));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CardCriteria ignoreSetsWithSnowLands() {
|
||||
this.ignoreSetCodes.addAll(CardRepository.snowLandSetCodes);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CardCriteria types(CardType... types) {
|
||||
this.types.addAll(Arrays.asList(types));
|
||||
return this;
|
||||
|
|
@ -216,6 +228,14 @@ public class CardCriteria {
|
|||
clausesCount++;
|
||||
}
|
||||
|
||||
for (String ignoreSetCode : ignoreSetCodes) {
|
||||
where.ne("setCode", ignoreSetCode);
|
||||
}
|
||||
if (!ignoreSetCodes.isEmpty()) {
|
||||
where.or(ignoreSetCodes.size());
|
||||
clausesCount++;
|
||||
}
|
||||
|
||||
if (types.size() != 7) { //if all types selected - no selection needed (Tribal and Conspiracy not selectable yet)
|
||||
for (CardType type : types) {
|
||||
where.like("types", new SelectArg('%' + type.name() + '%'));
|
||||
|
|
@ -357,6 +377,10 @@ public class CardCriteria {
|
|||
return setCodes;
|
||||
}
|
||||
|
||||
public List<String> getIgnoreSetCodes() {
|
||||
return ignoreSetCodes;
|
||||
}
|
||||
|
||||
public List<CardType> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,14 @@ public enum CardRepository {
|
|||
private Set<String> classNames;
|
||||
private final RepositoryEventSource eventSource = new RepositoryEventSource();
|
||||
|
||||
public static final Set<String> snowLandSetCodes = new HashSet<>(Arrays.asList(
|
||||
"CSP",
|
||||
"MH1",
|
||||
"SLD",
|
||||
"ME2",
|
||||
"ICE"
|
||||
));
|
||||
|
||||
CardRepository() {
|
||||
File file = new File("db");
|
||||
if (!file.exists()) {
|
||||
|
|
@ -188,12 +196,8 @@ public enum CardRepository {
|
|||
return names;
|
||||
}
|
||||
|
||||
public Boolean haveSnowLands(String setCode) {
|
||||
return setCode.equals("CSP")
|
||||
|| setCode.equals("MH1")
|
||||
|| setCode.equals("SLD")
|
||||
|| setCode.equals("ME2")
|
||||
|| setCode.equals("ICE");
|
||||
public static Boolean haveSnowLands(String setCode) {
|
||||
return snowLandSetCodes.contains(setCode);
|
||||
}
|
||||
|
||||
public Set<String> getNonbasicLandNames() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue