Browse Source

Minor changes

master
Noëlle 3 years ago
parent
commit
6f591c06e4
1 changed files with 24 additions and 11 deletions
  1. 24
    11
      koboldgen.py

+ 24
- 11
koboldgen.py View File

@@ -138,14 +138,20 @@ class Plot:
self.problem = Plot.prob[self.probIndex]
if type(self.problem["name"]) != str:
self.problem["name"] = self.problem["name"]()
if type(self.problem["note"]) != str:
self.problem["note"] = self.problem["note"]()
if self.problem["hasMinion"]:
if secProblem != None:
try:
self.secProblem = Plot.prob[self.secProblem]
self.secProblem = Plot.prob[secProblem]
except:
self.secProblem = r.choice(self.problem["potentialMinions"])
self.secProblem = Plot.prob[r.choice(self.problem["potentialMinions"])]
else:
self.secProblem = r.choice(self.problem["potentialMinions"])
self.secProblem = Plot.prob[r.choice(self.problem["potentialMinions"])]
if type(self.secProblem["name"]) != str:
self.secProblem["name"] = self.secProblem["name"]()
if type(self.secProblem["note"]) != str:
self.secProblem["note"] = self.secProblem["note"]()
self.fullProblem = ""
if self.problem["needsName"]:
self.problem["givenname"] = probName if probName != None else gen_name()
@@ -462,7 +468,7 @@ class Campaign:
ms = bin(self.params.missIndex)[2:]
pb1 = bin(self.params.probIndex)[2:]
if self.params.problem["hasMinion"]:
pb2 = bin(self.params.secProbIndex)[2:]
pb2 = bin(self.params.secProblem["id"])[2:]
else:
pb2 = bin(127)[2:]
if self.params.problem["needsName"]:
@@ -768,23 +774,29 @@ class Campaign:
else:
oops = ""
mission = oops + self.params.mission
pl = "s" if self.params.problem["isPlural"] else ""
# pl = "s" if self.params.problem["isPlural"] else ""
note = self.params.problem["note"]
secnote = ""
if self.params.problem["hasMinion"]:
secnote = "Their minion: " + self.params.secProblem["note"]
lines = [
f"The Kobolds of the {self.ship.fullname}",
f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location}!",
f"in order to {mission}",
f"but they're challenged by {self.params.fullProblem}!",
f"{note}",
f"The stats of the {self.params.problem['shortname']}{pl}",
f"{note} {secnote}",
f"The stats of the {self.params.problem['shortname']}",
f"{cst}"
]
if self.params.problem["hasMinion"]:
mst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.secProblem["stats"]]))])
spl = "s" if self.params.secProblem["isPlural"] else ""
lines.append(f"The stats of the {self.params.secProblem['shortname']}{spl}")
# spl = "s" if self.params.secProblem["isPlural"] else ""
lines.append(f"The stats of the {self.params.secProblem['shortname']}")
lines.append(f"{mst}")
if html:
secnote = ""
if self.params.problem["hasMinion"]:
secnote = "Their minion: " + self.params.secProblem["note"] + "<br>\n"
out = (
f"<div id='theship' class='firstrow'>\n"
f" <span class='head'>The Ship</span>\n"
@@ -813,8 +825,9 @@ class Campaign:
f" They're challenged by <span id='advname'>{self.params.fullProblem}</span>!\n"
f" <br>\n"
f" <span id='problemnote'>\n"
f" {self.params.problem['note']}"
f" </span>"
f" {self.params.problem['note']}<br>\n"
f" {secnote}"
f" </span>\n"
f" <span id='problemstats'>\n"
f" The stats of the {self.params.problem['shortname']}:<br>\n"
f" {cst}\n"

Loading…
Cancel
Save