mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
update advance filter
support alternate parts limited to card names, keywords, rules text, types and subtypes
This commit is contained in:
@@ -81,6 +81,13 @@ public class AdvancedSearch {
|
|||||||
Set<String> names = new HashSet<>();
|
Set<String> names = new HashSet<>();
|
||||||
names.add(input.getRules().getOracleText());
|
names.add(input.getRules().getOracleText());
|
||||||
names.add(CardTranslation.getTranslatedOracle(input.getName()));
|
names.add(CardTranslation.getTranslatedOracle(input.getName()));
|
||||||
|
CardSplitType cardSplitType = input.getRules().getSplitType();
|
||||||
|
if (cardSplitType != CardSplitType.None && cardSplitType != CardSplitType.Split) {
|
||||||
|
if (input.getRules().getOtherPart() != null) {
|
||||||
|
names.add(input.getRules().getOtherPart().getOracleText());
|
||||||
|
names.add(CardTranslation.getTranslatedOracle(input.getRules().getOtherPart().getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -91,6 +98,18 @@ public class AdvancedSearch {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected Set<Keyword> getItemValues(PaperCard input) {
|
protected Set<Keyword> getItemValues(PaperCard input) {
|
||||||
|
CardSplitType cardSplitType = input.getRules().getSplitType();
|
||||||
|
if (cardSplitType != CardSplitType.None && cardSplitType != CardSplitType.Split) {
|
||||||
|
Set<Keyword> keywords = new HashSet<>();
|
||||||
|
if (input.getRules().getOtherPart() != null) {
|
||||||
|
PaperCard otherPart = FModel.getMagicDb().getCommonCards().getCard(input.getRules().getOtherPart().getName());
|
||||||
|
if (otherPart != null) {
|
||||||
|
keywords.addAll(Keyword.getKeywordSet(otherPart));
|
||||||
|
keywords.addAll(Keyword.getKeywordSet(input));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return keywords;
|
||||||
|
}
|
||||||
return Keyword.getKeywordSet(input);
|
return Keyword.getKeywordSet(input);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -175,6 +194,24 @@ public class AdvancedSearch {
|
|||||||
protected Set<String> getItemValues(PaperCard input) {
|
protected Set<String> getItemValues(PaperCard input) {
|
||||||
final CardType type = input.getRules().getType();
|
final CardType type = input.getRules().getType();
|
||||||
final Set<String> types = new HashSet<>();
|
final Set<String> types = new HashSet<>();
|
||||||
|
CardSplitType cardSplitType = input.getRules().getSplitType();
|
||||||
|
if (cardSplitType != CardSplitType.None && cardSplitType != CardSplitType.Split) {
|
||||||
|
if (input.getRules().getOtherPart() != null) {
|
||||||
|
for (Supertype supertype : input.getRules().getOtherPart().getType().getSupertypes()) {
|
||||||
|
types.add(supertype.name());
|
||||||
|
}
|
||||||
|
for (CoreType coreType : input.getRules().getOtherPart().getType().getCoreTypes()) {
|
||||||
|
types.add(coreType.name());
|
||||||
|
}
|
||||||
|
for (Supertype supertype : input.getRules().getMainPart().getType().getSupertypes()) {
|
||||||
|
types.add(supertype.name());
|
||||||
|
}
|
||||||
|
for (CoreType coreType : input.getRules().getMainPart().getType().getCoreTypes()) {
|
||||||
|
types.add(coreType.name());
|
||||||
|
}
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (Supertype t : type.getSupertypes()) {
|
for (Supertype t : type.getSupertypes()) {
|
||||||
types.add(t.name());
|
types.add(t.name());
|
||||||
}
|
}
|
||||||
@@ -196,10 +233,9 @@ public class AdvancedSearch {
|
|||||||
if (input.getRules().getOtherPart() != null) {
|
if (input.getRules().getOtherPart() != null) {
|
||||||
Set<String> subtypes = new HashSet<>();
|
Set<String> subtypes = new HashSet<>();
|
||||||
for (String subs : input.getRules().getOtherPart().getType().getSubtypes()) {
|
for (String subs : input.getRules().getOtherPart().getType().getSubtypes()) {
|
||||||
if (!subtypes.contains(subs))
|
|
||||||
subtypes.add(subs);
|
subtypes.add(subs);
|
||||||
}for (String subs : input.getRules().getMainPart().getType().getSubtypes()) {
|
}
|
||||||
if (!subtypes.contains(subs))
|
for (String subs : input.getRules().getMainPart().getType().getSubtypes()) {
|
||||||
subtypes.add(subs);
|
subtypes.add(subs);
|
||||||
}
|
}
|
||||||
return subtypes;
|
return subtypes;
|
||||||
|
|||||||
Reference in New Issue
Block a user