+def loc_coverage(locations, text, report):
+ # locations have a long and a short description, that each have to
+ # be checked seperately
+ for name, loc in locations:
+ if name not in report["messages"]:
+ report["messages"][name] = {"long" : False, "short": False}
+ report["total"] += 2
+ if report["messages"][name]["long"] != True:
+ if loc["description"]["long"] == None or loc["description"]["long"] == '' or search(loc["description"]["long"], text):
+ report["messages"][name]["long"] = True
+ report["covered"] += 1
+ if report["messages"][name]["short"] != True:
+ if loc["description"]["short"] == None or loc["description"]["short"] == '' or search(loc["description"]["short"], text):
+ report["messages"][name]["short"] = True
+ report["covered"] += 1
+
+def hint_coverage(obituaries, text, report):
+ # hints have a "question" where the hint is offered, followed
+ # by the actual hint if the player requests it
+ for i, hintouter in enumerate(obituaries):
+ hint = hintouter["hint"]
+ name = hint["name"]
+ if name not in report["messages"]:
+ report["messages"][name] = {"question" : False, "hint": False}
+ report["total"] += 2
+ if report["messages"][name]["question"] != True and search(hint["question"], text):
+ report["messages"][name]["question"] = True
+ report["covered"] += 1
+ if report["messages"][name]["hint"] != True and search(hint["hint"], text):
+ report["messages"][name]["hint"] = True
+ report["covered"] += 1
+
+def obit_coverage(obituaries, text, report):
+ # obituaries have a "query" where it asks the player for a resurrection,
+ # followed by a snarky comment if the player says yes
+ for name, obit in enumerate(obituaries):
+ if name not in report["messages"]:
+ report["messages"][name] = {"query" : False, "yes_response": False}
+ report["total"] += 2
+ if report["messages"][name]["query"] != True and search(obit["query"], text):
+ report["messages"][name]["query"] = True
+ report["covered"] += 1
+ if report["messages"][name]["yes_response"] != True and search(obit["yes_response"], text):
+ report["messages"][name]["yes_response"] = True
+ report["covered"] += 1
+
+def threshold_coverage(classes, text, report):
+ # works for class thresholds and turn threshold, which have a "message"
+ # property
+ for name, item in enumerate(classes):
+ if name not in report["messages"]:
+ report["messages"][name] = {"covered" : "False"}
+ report["total"] += 1
+ if report["messages"][name]["covered"] != True:
+ if item["message"] == None or item["message"] == "NO_MESSAGE" or search(item["message"], text):
+ report["messages"][name]["covered"] = True
+ report["covered"] += 1
+
+def arb_coverage(arb_msgs, text, report):
+ for name, message in arb_msgs:
+ if name not in report["messages"]:
+ report["messages"][name] = {"covered" : False}
+ report["total"] += 1
+ if report["messages"][name]["covered"] != True:
+ if message == None or search(message, text):
+ report["messages"][name]["covered"] = True
+ report["covered"] += 1
+
+def specials_actions_coverage(items, text, report):
+ # works for actions or specials
+ for name, item in items:
+ if name not in report["messages"]:
+ report["messages"][name] = {"covered" : False}
+ report["total"] += 1
+ if report["messages"][name]["covered"] != True:
+ if item["message"] == None or item["message"] == "NO_MESSAGE" or search(item["message"], text):
+ report["messages"][name]["covered"] = True
+ report["covered"] += 1