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