- if desc == None or desc == '':
- obj["descriptions"][j] = True
- objects[i] = (obj_name, obj)
- elif desc != True:
- if search(desc, text):
- obj["descriptions"][j] = True
- objects[i] = (obj_name, obj)
-
-def hint_coverage(hints, text):
- for name, hint in hints:
- if hint["question"] != True:
- if search(hint["question"], text):
- hint["question"] = True
- if hint["hint"] != True:
- if search(hint["hint"], text):
- hint["hint"] = True
-
-def special_coverage(specials, text):
- for name, special in specials:
- if special["message"] == None:
- special["message"] = True
- if special["message"] != True:
- if search(special["message"], text):
- special["message"] = True
-
-def threshold_coverage(classes, text):
- for i, msg in enumerate(classes):
- if msg["message"] == None:
- msg["message"] = True
- elif msg["message"] != True:
- if search(msg["message"], text):
- msg["message"] = True
+ name = "{}[{}]".format(obj_name, j)
+ if name not in report["messages"]:
+ report["messages"][name] = {"covered" : False}
+ report["total"] += 1
+ if report["messages"][name]["covered"] != True and search(desc, text):
+ report["messages"][name]["covered"] = True
+ report["covered"] += 1
+
+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:
+ desc = loc["description"]
+ if name not in report["messages"]:
+ report["messages"][name] = {"long" : False, "short": False}
+ report["total"] += 2
+ if report["messages"][name]["long"] != True and search(desc["long"], text):
+ report["messages"][name]["long"] = True
+ report["covered"] += 1
+ if report["messages"][name]["short"] != True and search(desc["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 and 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 and search(message, text):
+ report["messages"][name]["covered"] = True
+ report["covered"] += 1