mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Minor cleanup of earlier commit; made variables final or unmodifiable where applicable.
This commit is contained in:
@@ -298,7 +298,7 @@ public final class BoosterUtils {
|
|||||||
// Type 2: a duplicate card of the players choice
|
// Type 2: a duplicate card of the players choice
|
||||||
rewards.add(new QuestRewardCardChooser(QuestRewardCardChooser.poolType.playerCards, temp));
|
rewards.add(new QuestRewardCardChooser(QuestRewardCardChooser.poolType.playerCards, temp));
|
||||||
} else if (temp.length >= 2 && temp[0].equalsIgnoreCase("chosen") && temp[1].equalsIgnoreCase("card")) {
|
} else if (temp.length >= 2 && temp[0].equalsIgnoreCase("chosen") && temp[1].equalsIgnoreCase("card")) {
|
||||||
// Type 2: a duplicate card of the players choice
|
// Type 3: a duplicate card of the players choice
|
||||||
rewards.add(new QuestRewardCardChooser(QuestRewardCardChooser.poolType.predicateFilter, temp));
|
rewards.add(new QuestRewardCardChooser(QuestRewardCardChooser.poolType.predicateFilter, temp));
|
||||||
} else if (temp.length > 0) {
|
} else if (temp.length > 0) {
|
||||||
// Type 4: assume we are asking for a single copy of a specific card
|
// Type 4: assume we are asking for a single copy of a specific card
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
|
|
||||||
for (String s : input) {
|
for (String s : input) {
|
||||||
if (s.startsWith("sets:") || s.startsWith("Sets:")) {
|
if (s.startsWith("sets:") || s.startsWith("Sets:")) {
|
||||||
String[] tmp = s.split(":");
|
final String[] tmp = s.split(":");
|
||||||
if (tmp.length > 1) {
|
if (tmp.length > 1) {
|
||||||
String [] setcodes = tmp[1].split(",");
|
String [] setcodes = tmp[1].split(",");
|
||||||
if (setcodes.length > 0) {
|
if (setcodes.length > 0) {
|
||||||
@@ -113,12 +113,12 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s.startsWith("rules:") || s.startsWith("Rules:")) {
|
} else if (s.startsWith("rules:") || s.startsWith("Rules:")) {
|
||||||
String[] tmp = s.split(":");
|
final String[] tmp = s.split(":");
|
||||||
if (tmp.length > 1) {
|
if (tmp.length > 1) {
|
||||||
String [] ruleCodes = tmp[1].split(",");
|
String [] ruleCodes = tmp[1].split(",");
|
||||||
if (ruleCodes.length > 0) {
|
if (ruleCodes.length > 0) {
|
||||||
for (String rule : ruleCodes) {
|
for (String rule : ruleCodes) {
|
||||||
Predicate<CardRules> newRule = BoosterUtils.parseRulesLimitation(rule);
|
final Predicate<CardRules> newRule = BoosterUtils.parseRulesLimitation(rule);
|
||||||
if (newRule != null) {
|
if (newRule != null) {
|
||||||
filterRules = (filterRules == null ? newRule : Predicates.or(filterRules, newRule));
|
filterRules = (filterRules == null ? newRule : Predicates.or(filterRules, newRule));
|
||||||
}
|
}
|
||||||
@@ -126,12 +126,11 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (s.startsWith("rarity:") || s.startsWith("Rarity:")) {
|
} else if (s.startsWith("rarity:") || s.startsWith("Rarity:")) {
|
||||||
String[] tmp = s.split(":");
|
final String[] tmp = s.split(":");
|
||||||
if (tmp.length > 1) {
|
if (tmp.length > 1) {
|
||||||
String [] rarityCodes = tmp[1].split(",");
|
String [] rarityCodes = tmp[1].split(",");
|
||||||
if (rarityCodes.length > 0) {
|
if (rarityCodes.length > 0) {
|
||||||
for (String rarity : rarityCodes) {
|
for (String rarity : rarityCodes) {
|
||||||
Predicate<CardPrinted> rarityRule = null;
|
|
||||||
if (rarity.startsWith("C") || rarity.startsWith("c")) {
|
if (rarity.startsWith("C") || rarity.startsWith("c")) {
|
||||||
filterRarity = (filterRarity == null ? CardPrinted.Predicates.Presets.IS_COMMON : Predicates.or(filterRarity, CardPrinted.Predicates.Presets.IS_COMMON));
|
filterRarity = (filterRarity == null ? CardPrinted.Predicates.Presets.IS_COMMON : Predicates.or(filterRarity, CardPrinted.Predicates.Presets.IS_COMMON));
|
||||||
} else if (rarity.startsWith("U") || rarity.startsWith("u")) {
|
} else if (rarity.startsWith("U") || rarity.startsWith("u")) {
|
||||||
@@ -148,7 +147,7 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (filterRules != null) {
|
if (filterRules != null) {
|
||||||
Predicate<CardPrinted> rulesPrinted = Predicates.compose(filterRules, CardPrinted.FN_GET_RULES);
|
final Predicate<CardPrinted> rulesPrinted = Predicates.compose(filterRules, CardPrinted.FN_GET_RULES);
|
||||||
filters = Predicates.and(filters, rulesPrinted);
|
filters = Predicates.and(filters, rulesPrinted);
|
||||||
}
|
}
|
||||||
if (filterRarity != null) {
|
if (filterRarity != null) {
|
||||||
@@ -216,7 +215,7 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
}
|
}
|
||||||
Collections.sort(cardChoices);
|
Collections.sort(cardChoices);
|
||||||
|
|
||||||
return cardChoices;
|
return Collections.unmodifiableList(cardChoices);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (type == poolType.predicateFilter) {
|
} else if (type == poolType.predicateFilter) {
|
||||||
@@ -227,7 +226,7 @@ public class QuestRewardCardChooser implements InventoryItem {
|
|||||||
}
|
}
|
||||||
Collections.sort(cardChoices);
|
Collections.sort(cardChoices);
|
||||||
|
|
||||||
return cardChoices;
|
return Collections.unmodifiableList(cardChoices);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Unknown QuestRewardCardType: " + type);
|
throw new RuntimeException("Unknown QuestRewardCardType: " + type);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user