summaryrefslogtreecommitdiff
path: root/src/main/java/tlIItools
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2019-01-05 11:35:25 -0400
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2019-01-05 11:35:25 -0400
commit07bd5208c4bd366836d5179a26c139acbde8daac (patch)
tree84b647a25fc97b0eaf3dc98890c62f0b2de7eb9b /src/main/java/tlIItools
parent11bcfd3632668d57d4df07760121fc6ebda044f3 (diff)
Minor tweaks
Diffstat (limited to 'src/main/java/tlIItools')
-rw-r--r--src/main/java/tlIItools/Effect.java32
-rw-r--r--src/main/java/tlIItools/ReplPair.java4
2 files changed, 32 insertions, 4 deletions
diff --git a/src/main/java/tlIItools/Effect.java b/src/main/java/tlIItools/Effect.java
index c4f3cfe7..1c0af9af 100644
--- a/src/main/java/tlIItools/Effect.java
+++ b/src/main/java/tlIItools/Effect.java
@@ -12,13 +12,27 @@ import java.util.Scanner;
/**
* Represents an effect attached to an affix.
+ *
+ * @author Ben Culkin
*/
public class Effect {
+ /**
+ * The list of detail strings for skills.
+ */
private static Map<String, String> detals;
+ /**
+ * The list of detail strings for timed skills.
+ */
private static Map<String, String> timeDetals;
+ /**
+ * The list of replacements for detail strings.
+ */
private static List<ReplPair> replList;
+ /*
+ * Init. lists from files.
+ */
static {
try (FileReader detalReader = new FileReader("data/affix-detals.txt")) {
detals = readDetails(new Scanner(detalReader));
@@ -81,7 +95,10 @@ public class Effect {
return detals;
}
- private static void sanityCheckFormats() {
+ /**
+ * Sanity check the loaded format strings.
+ */
+ public static void sanityCheckFormats() {
for (Entry<String, String> detal : detals.entrySet()) {
String fmt = detal.getValue();
@@ -90,12 +107,16 @@ public class Effect {
String tmp = fmt;
fmt = fmt.replaceAll(repl.find, repl.replace);
if (!fmt.equals(tmp)) {
- AffixLister.errOut.printf("\t\tTRACE: Replaced %s with %s: \n\t\t%s\n\t\t%s\n", repl.find, repl.replace, tmp, fmt);
+ String outFmt = "\t\tTRACE: Replaced %s with %s: \n\t\t%s\n\t\t%s\n";
+
+ AffixLister.errOut.printf(outFmt, repl.find, repl.replace, tmp, fmt);
}
}
if (fmt.contains("<") || fmt.contains(">")) {
- AffixLister.errOut.printf("WARN: Details for effect %s are malformated (contains < or >):\n\t%s\n", detal.getKey(), fmt);
+ String warnFmt = "WARN: Details for effect %s are malformated (contains < or >):\n\t%s\n";
+
+ AffixLister.errOut.printf(warnFmt, detal.getKey(), fmt);
}
}
@@ -107,10 +128,12 @@ public class Effect {
}
if (fmt.contains("<") || fmt.contains(">")) {
- AffixLister.errOut.printf("WARN: Details for effect %s are malformated (contains < or >):\n\t%s\n", detal.getKey(), fmt);
+ String warnFmt = "WARN: Details for timed effect %s are malformatted (contains < or >):\n\t%s\n";
+ AffixLister.errOut.printf(warnFmt, detal.getKey(), fmt);
}
}
}
+
/**
* The file name this effect came from.
*/
@@ -230,6 +253,7 @@ public class Effect {
* The rate at which the effect fires.
*/
public double pulse;
+
/**
* Create a new blank effect.
*/
diff --git a/src/main/java/tlIItools/ReplPair.java b/src/main/java/tlIItools/ReplPair.java
index 41d483b3..3d4a82fb 100644
--- a/src/main/java/tlIItools/ReplPair.java
+++ b/src/main/java/tlIItools/ReplPair.java
@@ -44,6 +44,8 @@ public class ReplPair {
*
* @param scn
* The source to read the replacements from.
+ * @return
+ * The list of replacements.
*/
public static List<ReplPair> readList(Scanner scn) {
return ReplPair.readList(new ArrayList<>(), scn);
@@ -57,6 +59,8 @@ public class ReplPair {
* The list to add the replacements to.
* @param scn
* The source to read the replacements from.
+ * @return
+ * The list of replacements.
*/
public static List<ReplPair> readList(List<ReplPair> detals, Scanner scn) {
while (scn.hasNextLine()) {