| beg = ["a","e","i","o","u","ba","be","bi","bo","bu","by","y","da","de","di","do","du","dy","fa","fi","fo","fe","fu","ga","ge","gi","go","gu","ka","ke","ki","ko","ku","ky","ma","me","mi","mo","mu","na","ne","ni","no","nu","pa","pe","pi","po","pu","ra","re","ri","ro","ru","ry","sa","se","si","so","su","ta","te","ti","to","tu","ty","wa","we","wi","wo","wy","za","ze","zi","zo","zu","zy"] | beg = ["a","e","i","o","u","ba","be","bi","bo","bu","by","y","da","de","di","do","du","dy","fa","fi","fo","fe","fu","ga","ge","gi","go","gu","ka","ke","ki","ko","ku","ky","ma","me","mi","mo","mu","na","ne","ni","no","nu","pa","pe","pi","po","pu","ra","re","ri","ro","ru","ry","sa","se","si","so","su","ta","te","ti","to","tu","ty","wa","we","wi","wo","wy","za","ze","zi","zo","zu","zy"] | ||||
| mid = beg + ["l","x","n","r"] | mid = beg + ["l","x","n","r"] | ||||
| def gen_name(length=None, minimum=None, maximum=None): | |||||
| def gen_name(length=None, minimum=3, maximum=9): | |||||
| if length == None: | if length == None: | ||||
| minimum = 3 if minimum == None else minimum | |||||
| maximum = 9 if maximum == None else maximum | |||||
| lgt = r.randint(minimum,maximum) | lgt = r.randint(minimum,maximum) | ||||
| else: | else: | ||||
| lgt = length | lgt = length | ||||
| def print_name(self): | def print_name(self): | ||||
| print(f"Name: {self.name} (Kobold {self.career})") | print(f"Name: {self.name} (Kobold {self.career})") | ||||
| def print(self): | |||||
| def print(self, html=False): | |||||
| self.print_name() | self.print_name() | ||||
| print(f"Order: {self.stats[0]}") | print(f"Order: {self.stats[0]}") | ||||
| print(f"Chaos: {self.stats[1]}") | print(f"Chaos: {self.stats[1]}") | ||||
| self.bqual = r.choice(["has an annoying AI","has inconveniently crossed circuits","has an unpredictable power source","drifts to the right","is haunted","was recently 'found' so the kobolds are unused to it","is too cold","has a constant odd smell","its interior design... changes","its water pressure shifts between slow drip and power wash","it leaves a visible smoke trail"]) | self.bqual = r.choice(["has an annoying AI","has inconveniently crossed circuits","has an unpredictable power source","drifts to the right","is haunted","was recently 'found' so the kobolds are unused to it","is too cold","has a constant odd smell","its interior design... changes","its water pressure shifts between slow drip and power wash","it leaves a visible smoke trail"]) | ||||
| self.fullname = f"{self.name1} {self.name2}" | self.fullname = f"{self.name1} {self.name2}" | ||||
| def print(self): | |||||
| def print(self, html=False): | |||||
| print(f"The {self.fullname} {self.gqual}, but {self.bqual}.") | print(f"The {self.fullname} {self.gqual}, but {self.bqual}.") | ||||
| print() | print() | ||||
| self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a" | self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a" | ||||
| def print_params(self, endc=""): | |||||
| def print_params(self, endc="", html=False): | |||||
| st = ["Order:", "Chaos:", "Brains:", "Body:"] | st = ["Order:", "Chaos:", "Brains:", "Body:"] | ||||
| print(f"The Kobolds of the {self.ship.fullname} ", end=endc) | print(f"The Kobolds of the {self.ship.fullname} ", end=endc) | ||||
| print(f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location} ", end=endc) | print(f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location} ", end=endc) | ||||
| pst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.thirdProblem["stats"]]))]) | pst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.thirdProblem["stats"]]))]) | ||||
| print(f"- - The stats of the {self.params.thirdProblem['shortname']}: {pst}") | print(f"- - The stats of the {self.params.thirdProblem['shortname']}: {pst}") | ||||
| print() | print() | ||||
| self.ship.print() | |||||
| self.ship.print(html=html) | |||||
| def print_chars(self): | |||||
| def print_chars(self, html=False): | |||||
| print("The kobolds:") | print("The kobolds:") | ||||
| for k in self.characters: | for k in self.characters: | ||||
| k.print() | |||||
| k.print(html=html) | |||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||
| parser = argparse.ArgumentParser() | parser = argparse.ArgumentParser() | ||||
| group.add_argument("-n", "--names", help="print N kobolds without stat blocks", nargs="?", const=1, type=int, metavar="N") | group.add_argument("-n", "--names", help="print N kobolds without stat blocks", nargs="?", const=1, type=int, metavar="N") | ||||
| group.add_argument("-p", "--params", help="print only the parameters of a campaign", action="store_true") | group.add_argument("-p", "--params", help="print only the parameters of a campaign", action="store_true") | ||||
| group.add_argument("-s", "--ship", help="print only the ship name and description", action="store_true") | group.add_argument("-s", "--ship", help="print only the ship name and description", action="store_true") | ||||
| parser.add_argument("--html", help="print in HTML instead of plain text", action="store_true") | |||||
| args = parser.parse_args() | args = parser.parse_args() | ||||
| # print(args) | # print(args) | ||||
| html = True if args.html else False | |||||
| if args.campaign: | if args.campaign: | ||||
| cmp = Campaign(args.campaign) | cmp = Campaign(args.campaign) | ||||
| cmp.print_params() | |||||
| cmp.print_chars() | |||||
| cmp.print_params(html=html) | |||||
| cmp.print_chars(html=html) | |||||
| elif args.params: | elif args.params: | ||||
| cmp = Campaign(makeChars=False) | cmp = Campaign(makeChars=False) | ||||
| cmp.print_params() | |||||
| cmp.print_params(html=html) | |||||
| elif args.ship: | elif args.ship: | ||||
| ship = Ship() | ship = Ship() | ||||
| ship.print() | |||||
| ship.print(html=html) | |||||
| elif args.names: | elif args.names: | ||||
| for _ in range(args.names): | for _ in range(args.names): | ||||
| c = Character() | c = Character() | ||||
| c.generate() | c.generate() | ||||
| c.print_name() | |||||
| c.print_name(html=html) | |||||
| else: | else: | ||||
| for _ in range(args.kobolds): | for _ in range(args.kobolds): | ||||
| c = Character() | c = Character() | ||||
| c.generate() | c.generate() | ||||
| c.print() | |||||
| c.print(html=html) |