mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge branch 'master' of https://git.cardforge.org/core-developers/forge
This commit is contained in:
@@ -96,7 +96,7 @@ public class CustomLimited extends DeckBase {
|
||||
* @return the custom limited
|
||||
*/
|
||||
public static CustomLimited parse(final List<String> dfData, final IStorage<Deck> cubes) {
|
||||
final FileSection data = FileSection.parse(dfData, ":");
|
||||
final FileSection data = FileSection.parse(dfData, FileSection.COLON_KV_SEPARATOR);
|
||||
|
||||
List<Pair<String, Integer>> slots = new ArrayList<>();
|
||||
String boosterData = data.get("Booster");
|
||||
|
||||
@@ -57,6 +57,7 @@ import forge.util.storage.StorageBase;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* The default Model implementation for Forge.
|
||||
@@ -259,31 +260,31 @@ public final class FModel {
|
||||
if (!CardType.Constant.LOADED.isSet()) {
|
||||
final List<String> typeListFile = FileUtil.readFile(ForgeConstants.TYPE_LIST_FILE);
|
||||
|
||||
List<String> tList = null;
|
||||
Set<String> addTo = null;
|
||||
|
||||
for (final String s : typeListFile) {
|
||||
if (s.equals("[BasicTypes]")) {
|
||||
tList = CardType.Constant.BASIC_TYPES;
|
||||
addTo = CardType.Constant.BASIC_TYPES;
|
||||
} else if (s.equals("[LandTypes]")) {
|
||||
tList = CardType.Constant.LAND_TYPES;
|
||||
addTo = CardType.Constant.LAND_TYPES;
|
||||
} else if (s.equals("[CreatureTypes]")) {
|
||||
tList = CardType.Constant.CREATURE_TYPES;
|
||||
addTo = CardType.Constant.CREATURE_TYPES;
|
||||
} else if (s.equals("[SpellTypes]")) {
|
||||
tList = CardType.Constant.SPELL_TYPES;
|
||||
addTo = CardType.Constant.SPELL_TYPES;
|
||||
} else if (s.equals("[EnchantmentTypes]")) {
|
||||
tList = CardType.Constant.ENCHANTMENT_TYPES;
|
||||
addTo = CardType.Constant.ENCHANTMENT_TYPES;
|
||||
} else if (s.equals("[ArtifactTypes]")) {
|
||||
tList = CardType.Constant.ARTIFACT_TYPES;
|
||||
addTo = CardType.Constant.ARTIFACT_TYPES;
|
||||
} else if (s.equals("[WalkerTypes]")) {
|
||||
tList = CardType.Constant.WALKER_TYPES;
|
||||
addTo = CardType.Constant.WALKER_TYPES;
|
||||
} else if (s.length() > 1) {
|
||||
if (tList != null) {
|
||||
if (addTo != null) {
|
||||
if (s.contains(":")) {
|
||||
String[] k = s.split(":");
|
||||
tList.add(k[0]);
|
||||
addTo.add(k[0]);
|
||||
CardType.Constant.pluralTypes.put(k[0], k[1]);
|
||||
} else {
|
||||
tList.add(s);
|
||||
addTo.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1034,7 +1034,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
* java.lang.String, java.util.List, java.util.List, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String chooseSomeType(final String kindOfType, final SpellAbility sa, final List<String> validTypes,
|
||||
public String chooseSomeType(final String kindOfType, final SpellAbility sa, final Collection<String> validTypes,
|
||||
final List<String> invalidTypes, final boolean isOptional) {
|
||||
final List<String> types = Lists.newArrayList(validTypes);
|
||||
if (invalidTypes != null && !invalidTypes.isEmpty()) {
|
||||
@@ -1409,11 +1409,16 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
final boolean call) {
|
||||
final String[] labelsSrc = call ? new String[] { "heads", "tails" }
|
||||
: new String[] { "win the flip", "lose the flip" };
|
||||
final ImmutableList.Builder<String> strResults = ImmutableList.builder();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
strResults.add(labelsSrc[results[i] ? 0 : 1]);
|
||||
final List<String> sortedResults = new ArrayList<String>();
|
||||
for (boolean result : results) {
|
||||
sortedResults.add(labelsSrc[result ? 0 : 1]);
|
||||
}
|
||||
return getGui().one(sa.getHostCard().getName() + " - Choose a result", strResults.build()).equals(labelsSrc[0]);
|
||||
|
||||
Collections.sort(sortedResults);
|
||||
if (!call) {
|
||||
Collections.reverse(sortedResults);
|
||||
}
|
||||
return getGui().one(sa.getHostCard().getName() + " - Choose a result", sortedResults).equals(labelsSrc[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ForgeProfileProperties {
|
||||
|
||||
private static Map<String, String> getMap(final Properties props, final String propertyKey) {
|
||||
final String strMap = props.getProperty(propertyKey, "").trim();
|
||||
return FileSection.parseToMap(strMap, "->", "|");
|
||||
return FileSection.parseToMap(strMap, FileSection.ARROW_KV_SEPARATOR);
|
||||
}
|
||||
|
||||
private static int getInt(final Properties props, final String propertyKey, final int defaultValue) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SellRules {
|
||||
return;
|
||||
}
|
||||
|
||||
FileSection section = FileSection.parse(questShop, "=");
|
||||
FileSection section = FileSection.parse(questShop, FileSection.EQUALS_KV_SEPARATOR);
|
||||
minWins = section.getInt("WinsToUnlock");
|
||||
cost = section.getInt("Credits", 250);
|
||||
maxDifficulty = section.getInt("MaxDifficulty", 5);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class QuestChallengeReader extends StorageReaderFolder<QuestEventChalleng
|
||||
final QuestEventChallenge qc = new QuestEventChallenge();
|
||||
|
||||
// Unique properties
|
||||
FileSection sectionQuest = FileSection.parse(contents.get("quest"), "=");
|
||||
FileSection sectionQuest = FileSection.parse(contents.get("quest"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setId(sectionQuest.get("ID", "-1"));
|
||||
qc.setOpponentName(sectionQuest.get("OpponentName"));
|
||||
qc.setRepeatable(sectionQuest.getBoolean("Repeat", false));
|
||||
@@ -60,7 +60,7 @@ public class QuestChallengeReader extends StorageReaderFolder<QuestEventChalleng
|
||||
}
|
||||
|
||||
// Common properties
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), "=");
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setTitle(sectionMeta.get("Title"));
|
||||
qc.setName(qc.getTitle()); // Challenges have unique titles
|
||||
qc.setDifficulty(QuestEventDifficulty.fromString(sectionMeta.get("Difficulty")));
|
||||
|
||||
@@ -27,7 +27,7 @@ public class QuestDuelReader extends StorageReaderFolder<QuestEventDuel> {
|
||||
final QuestEventDuel qc = new QuestEventDuel();
|
||||
|
||||
// Common properties
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), "=");
|
||||
FileSection sectionMeta = FileSection.parse(contents.get("metadata"), FileSection.EQUALS_KV_SEPARATOR);
|
||||
qc.setTitle(sectionMeta.get("Title"));
|
||||
qc.setName(sectionMeta.get("Name")); // Challenges have unique titles
|
||||
qc.setDifficulty(QuestEventDifficulty.fromString(sectionMeta.get("Difficulty")));
|
||||
|
||||
Reference in New Issue
Block a user