def genBelts(self): # Determine the presence of belts if D6Rollx2() >= 4: self.nBelts = D6Roll() - 3 if self.siz == 0 and self.nBelts < 1: self.nBelts = 1 else: self.nBelts = 0
def genGiants(self): # Determine the presence of gas giants if D6Rollx2() >= 5: self.nGiants = D6Roll() - 2 if self.nGiants < 1: self.nGiants = 1 else: self.nGiants = 0
def genSystemNature(): x = D6Rollx2() if x < 8: nStars = 1 elif x < 12: nStars = 2 else: nStars = 3 return nStars
def gen_hyd(self): x = D6Rollx2() + self.siz - 7 if self.siz == 0: x = 0 else: if self.atm in [0, 1, 10, 11, 12]: x -= 4 if self.atm == 14: x -= 2 if x < 0: x = 0 self.hyd = x
def gen_pop(self): x = D6Rollx2() - 2 if self.siz <= 2: x -= 1 if self.atm in [0, 1, 10, 11, 12]: x -= 2 if self.atm == 6: x += 3 if self.atm in [5, 8]: x += 1 if self.hyd == 0 and self.atm < 3: x -= 2 if self.pop < 0: x = 0 if self.pop > 12: x = 12 self.pop = x
def gen_belts(self): # Determine the presence of planetoid belts if D6Rollx2() >= 4: nBelts = D6Roll() - 3 if self.siz == 0 and nBelts < 1: nBelts = 1 else: nBelts = 0 self.nBelts = nBelts
def gen_zones(self): # Determine travel zones aZoneProbTargetA = 11 aZoneProbTargetB = 12 rZoneProbtarget = 17 # First look at worlds wih characteristics indicative of Amber zones tZone = " " if self.atm >= 10 and D6Rollx2() >= aZoneProbTargetA: tZone = "A" elif self.gov in [0, 7, 10] and D6Rollx2() >= aZoneProbTargetA: tZone = "A" elif self.law == 0 or self.law >= 9 and D6Rollx2() >= aZoneProbTargetA: tZone = "A" # Now apply some random Amber and Red zones if D6Rollx2() >= aZoneProbTargetB: tZone = "A" if D6Rollx3() >= rZoneProbtarget: tZone = "R" self.tZone = tZone
def gen_bCode(self): # Check for Naval bases nBase = False if self.starPort == "A" or self.starPort == "B": if D6Rollx2() >= 8: nBase = True else: nBase = False # Scout bases / outposts sBase = False if self.starPort != "E" and self.starPort != "X": roll = D6Rollx2() if self.starPort == "A": roll -= 3 if self.starPort == "B": roll -= 2 if self.starPort == "C": roll -= 1 if roll >= 7: sBase = True else: sBase = False # Pirate bases pBase = False if self.starPort != "A" and not nBase: if D6Rollx2() == 12: pBase = True # Format the base code bCode = " " if nBase and sBase: bCode = "A" if nBase and not sBase: bCode = "N" if sBase and pBase: bCode = "G" if pBase and not sBase: bCode = "P" if sBase and not nBase and not pBase: bCode = "S" self.bCode = bCode
def genStarType(modifier): retlist = [] x = D6Rollx2() + modifier if x < 0: sType = 'O' elif x < 2: sType = 'B' elif x < 3: sType = 'A' elif x < 5: sType = 'F' elif x < 7: sType = 'G' elif x < 9: sType = 'K' else: sType = 'M' retlist.append(sType) retlist.append(x) return retlist
def genStarSize(modifier): retlist = [] x = D6Rollx2() + modifier if x <= 0: sSize = 'Ia' elif x <= 1: sSize = 'Ib' elif x <= 2: sSize = 'II' elif x <= 3: sSize = 'III' elif x <= 4: sSize = 'IV' elif x <= 10: sSize = 'V' elif x <= 11: sSize = 'VI' else: sSize = 'D' retlist.append(sSize) retlist.append(x) return retlist
def genCompanionOrbit(modifier, primaryType, primarySize): x = D6Rollx2() + modifier if x <= 3: returnval = 'Close' elif x == 4: returnval = 1 elif x == 5: returnval = 2 elif x == 6: returnval = 3 elif x == 7: returnval = 4 + D6Roll() elif x == 8: returnval = 5 + D6Roll() elif x == 9: returnval = 6 + D6Roll() elif x == 10: returnval = 7 + D6Roll() elif x == 11: returnval = 8 + D6Roll() else: returnval = 'Far' # Check that the companion is not inside the primary and adjust accordingly if it is # Do some jiggling of the primary type to determine which set of orbital zones to use if primaryType[0] == 'M': if primaryType[-1] in ['7', '8', '9']: a = '9' elif primaryType[-1] in ['3', '4', '5', '6']: a = '5' elif primaryType[-1] in ['0', '1', '2']: a = '0' else: if primaryType[-1] in ['5', '6', '7', '8', '9']: a = '5' elif primaryType[-1] in ['0', '1', '2', '3', '4']: a = '0' thisType = primaryType[0] + a # Get the first available orbit from the orbital zone constant # A bit clunky, may revisit this to make it more elegant but it will do for now if primarySize[0] == 'V': orbits = SIZEVZONES.get(thisType) firstOrbit = orbits[0] if isinstance(returnval, int) and returnval < firstOrbit: returnval = firstOrbit return returnval
def gen_starPort(self): spRoll = D6Rollx2() - 7 + self.pop self.starPort = TR_Constants.STARPORTSTABLE.get(spRoll)
def gen_law(self): x = D6Rollx2() - 7 + self.gov if self.pop == 0: x = 0 self.law = x
def gen_gov(self): x = D6Rollx2() - 7 + self.pop if self.pop == 0: x = 0 self.gov = x
def gen_pMod(self): x = D6Rollx2() - 2 if self.pop > 0 and x < 1: x = 1 if self.pop == 0: x = 0 if x == 10: x = 9 self.pMod = x
def gen_siz(self): x = D6Rollx2() - 2 self.siz = x
def gen_atm(self): x = D6Rollx2() + self.siz - 7 if x < 0: x = 0 elif x > 15: x = 15 if self.siz == 0: x = 0 self.atm = x