| @@ -1,5 +1,6 @@ | |||
| import random as r | |||
| import argparse | |||
| import sys | |||
| 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"] | |||
| @@ -186,19 +187,17 @@ class Character: | |||
| self.career = "" | |||
| elif isinstance(career, str): | |||
| self.career = career | |||
| elif isinstance(career, int) and career < len(Campaign.CAREERS): | |||
| elif isinstance(career, int) and career < len(Character.CAREERS): | |||
| self.career = [x for x in Character.CAREERS if x["id"] == career][0]["name"] | |||
| else: | |||
| self.career = "" | |||
| self.stats = stats if stats != None else [] | |||
| if gadget == None: | |||
| self.gadget = "" | |||
| elif isinstance(gadget, str) or isinstance(gadget, object): | |||
| elif isinstance(gadget, str) or isinstance(gadget, dict): | |||
| self.gadget = gadget | |||
| elif isinstance(gadget, int) and gadget < len(Campaign.GADGETS): | |||
| self.gadget = [x for x in Character.GADGETS if x["id"] == gadget][0] | |||
| else: | |||
| self.gadget = "" | |||
| self.gadget = next((x for x in Character.GADGETS if x["id"] == gadget), "") | |||
| self.generate() | |||
| def generate(self): | |||
| @@ -513,7 +512,10 @@ class Campaign: | |||
| def decode_key(self, pw): | |||
| densePwd = pw.replace(" ", "") | |||
| if densePwd == "PACKTACTICS!------------------------------------------------------------------------------------": | |||
| if len(densePwd) != 84: | |||
| print("This password is not valid. If this is a password that this generator created, please email noelle@noelle.codes and let me know.") | |||
| sys.exit(0) | |||
| if densePwd[:12] == "PACKTACTICS!": | |||
| # Create a campaign featuring the Season 3 Pack Tactics crew. | |||
| self.ship = Ship("Red", "Star", "is maneuverable & unarmored", "has a politician who thinks they're in charge of it") | |||
| self.params = Plot() | |||
| @@ -527,7 +529,7 @@ class Campaign: | |||
| # self.print_params() | |||
| # self.print_chars() | |||
| return | |||
| elif densePwd == "JUSTINBAILEY------------------------------------------------------------------------------------": | |||
| elif densePwd[:12] == "JUSTINBAILEY": | |||
| # Create a random campaign, but everyone's Gadget is a leotard that somehow is also an environment suit | |||
| self.create_campaign(n=6, makeChars=True) | |||
| for c in self.characters: | |||
| @@ -535,7 +537,7 @@ class Campaign: | |||
| # self.print_params() | |||
| # self.print_chars() | |||
| return | |||
| elif densePwd == "NARPASSWORD------------------------------------------------------------------------------------": | |||
| elif densePwd[:12] == "NARPASSWORD": | |||
| # Create a random campaign, but all the kobolds' stats are set to 6 | |||
| self.create_campaign(n=6, makeChars=True) | |||
| for c in self.characters: | |||
| @@ -717,8 +719,8 @@ class Campaign: | |||
| # Character 6 gadget: 7 bits | |||
| i,j = j,j+7 | |||
| outkey["char6gad"] = int(self.newBitfield[i:j], 2) | |||
| print(self.newBitfield) | |||
| print(outkey) | |||
| #print(self.newBitfield) | |||
| #print(outkey) | |||
| self.ship = Ship(Ship.NAME1[outkey["sname1"]], Ship.NAME2[outkey["sname2"]], Ship.GQUAL[outkey["gqual"]], Ship.BQUAL[outkey["bqual"]]) | |||
| self.params = Plot(loc_desc=Plot.loc1[outkey["loc1"]], locIndex=outkey["loc2"], battlefield=outkey["battlefield"], location=None, missIndex=outkey["miss"], oops=outkey["oops"], mission=None, probIndex=outkey["prob1"], problem=None, probName=self.decode_name(outkey["prob1name"]), secProblem=outkey["prob2"], thirdProblem=None) | |||
| self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a" | |||