def __init__(self): """generate basic stats""" self.starport = game.random_choice([ 'X', 'E', 'E', 'E', 'E', 'E', 'E', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'A', 'A' ]) self.size = game.dice(2, 6) - 2 self.atmosphere = self.atmosphere_calc(self.size) self.hydrographics = self.hydrographics_calc(self.size, self.atmosphere) self.population = game.dice(2, 6) - 2 self.government = self.government_calc(self.population) self.lawlevel = self.law_level_calc(self.government, self.population) self.techlevel = self.techlevel_calc(self.population, self.starport, self.size, self.atmosphere, self.hydrographics, self.government) self.upp = [ self.size, self.atmosphere, self.hydrographics, self.population, self.government, self.lawlevel, self.techlevel ] self.tradelevel = self.trade_classification( self.size, self.atmosphere, self.hydrographics, self.population, self.government, self.lawlevel, self.techlevel)
def atmosphere_calc(self, size): atmo_base = game.dice(2, 6) - 7 + size if atmo_base <= 0: return 0 elif atmo_base >= 15: return 15 else: return atmo_base
def add_skill(self, skill_list, skill): #inputs the skill dictionary and skill """ adds a skill or characteristic bonus to a character """ if skill == "": return skill_list if skill == "Gun Combat": if game.dice(1, 6) >= 3: for item in self.guns: if item in skill_list: skill = item else: skill = game.random_choice(self.guns) else: skill = game.random_choice(self.guns) elif skill in ["Blade Combat", "Blade Cbt"]: if game.dice(1, 6) >= 3: for item in self.melee: if item in skill_list: skill = item else: skill = game.random_choice(self.melee) else: skill = game.random_choice(self.melee) elif skill == "Vehicle": if game.dice(1, 6) >= 3: for item in self.vehicles: if item in skill_list: skill = item else: skill = game.random_choice(self.vehicles) else: skill = game.random_choice(self.vehicles) if skill in skill_list: skill_list[skill] += 1 elif skill not in skill_list: skill_list[skill] = 1 return skill_list #outputs the skill dictionary
def government_calc(self, population): gov_base = game.dice(2, 6) - 7 if population <= 0: return 0 else: gov_base += population if gov_base <= 0: return 0 elif gov_base >= 15: return 15 else: return gov_base
def techlevel_calc(self, population, starport, size, atmosphere, hydrographics, government): tech_base = game.dice(1, 6) if population <= 0: return 0 else: if starport == 'X': tech_base += -6 elif starport == 'C': tech_base += 2 elif starport == 'B': tech_base += 4 elif starport == 'A': tech_base += 6 if size in [1, 2]: tech_base += 2 elif size in [2, 3, 4]: tech_base += 1 if atmosphere in [0, 1, 2, 3, 10, 11, 12, 13, 14, 15]: tech_base += 1 if hydrographics in [0, 9]: tech_base += 1 elif hydrographics == 10: tech_base += 2 if population in [0, 1, 2, 3, 4, 5, 9]: tech_base += 1 elif population == 10: tech_base += 2 elif population == 11: tech_base += 3 elif population == 12: tech_base += 4 if government in [0, 5]: tech_base += 1 elif government == 7: tech_base += 2 elif government in [13, 14]: tech_base += -2 if tech_base <= 0: return 0 elif tech_base >= 15: return 15 else: return tech_base
def law_level_calc(self, government, population): law_base = game.dice(2, 6) - 7 if population < 1: return 0 else: law_base += government if law_base <= 0: return 0 elif law_base >= 15: return 15 else: return law_base
def hydrographics_calc(self, size, atmosphere): hydro_base = game.dice(2, 6) - 7 if size <= 1: return 0 else: if atmosphere <= 1: hydro_base += -4 elif atmosphere >= 10 and atmosphere <= 12: hydro_base += -4 hydro_base += size if hydro_base <= 0: return 0 elif hydro_base >= 15: return 15 else: return hydro_base
def add_psionic_talent(self, psi_rating, terms): talent_list = [ 'Telepathy', 'Clairvoyance', 'Telekinesis', 'Awareness', 'Teleportation' ] psionic_training_attempts = 0 talent_learned = [] while 0 < len(talent_list): telepathy_chance = 4 + psi_rating - psionic_training_attempts - terms clairvoyance_chance = 3 + psi_rating - psionic_training_attempts - terms telekinesis_chance = 2 + psi_rating - psionic_training_attempts - terms awareness_chance = 1 + psi_rating - psionic_training_attempts - terms teleportation_chance = 0 + psi_rating - psionic_training_attempts - terms psi_talent_training = game.random_choice(talent_list) if psi_talent_training == 'Telepathy': if telepathy_chance > 1: if game.dice(2, 6) <= telepathy_chance: talent_list.remove('Telepathy') talent_learned.extend(['Telepathy']) psionic_training_attempts += 1 else: psionic_training_attempts += 1 else: talent_list.remove('Telepathy') if psi_talent_training == 'Clairvoyance': if clairvoyance_chance > 1: if game.dice(2, 6) <= clairvoyance_chance: talent_list.remove('Clairvoyance') talent_learned.extend(['Clairvoyance']) psionic_training_attempts += 1 else: psionic_training_attempts += 1 else: talent_list.remove('Clairvoyance') if psi_talent_training == 'Telekinesis': if telekinesis_chance > 1: if game.dice(2, 6) <= telekinesis_chance: talent_list.remove('Telekinesis') talent_learned.extend(['Telekinesis']) psionic_training_attempts += 1 else: psionic_training_attempts += 1 else: talent_list.remove('Telekinesis') if psi_talent_training == 'Awareness': if awareness_chance > 1: if game.dice(2, 6) <= awareness_chance: talent_list.remove('Awareness') talent_learned.extend(['Awareness']) psionic_training_attempts += 1 else: psionic_training_attempts += 1 else: talent_list.remove('Awareness') if psi_talent_training == 'Teleportation': if teleportation_chance > 1: if game.dice(2, 6) <= teleportation_chance: talent_list.remove('Teleportation') talent_learned.extend(['Teleportation']) psionic_training_attempts += 1 else: psionic_training_attempts += 1 else: talent_list.remove('Teleportation') return talent_learned
def __init__(self, args={}): start_seed = time.time() random.seed(start_seed) """generate basic stats""" self.upp = [ game.dice(2, 6), game.dice(2, 6), game.dice(2, 6), game.dice(2, 6), game.dice(2, 6), game.dice(2, 6) ] self.skills = {} self.possessions = {} self.rank = 0 self.race = game.random_choice(self.Races) self.birth_world = world() self.birth_upp = self.birth_world.upp self.birth_starport = self.birth_world.starport self.discharge_world = world() self.discharge_starport = self.discharge_world.starport self.discharge_upp = self.discharge_world.upp self.psionic_trained = "no" self.psionic_rating = game.dice(2, 6) self.psionic_talents = {} self.tas_member = "" self.terms = 0 self.cash = 0 self.title = "" self.status = "" self.sex = game.random_choice(["male", "female"]) self.birth_world_name = self.phonetic_gen(args) self.discharge_world_name = self.phonetic_gen(args) self.name = self.phonetic_gen(args) self.surname = self.phonetic_gen(args) self.career = self.career_choice(self.upp) self.age = 18 # Test for world values use with -t world self.birth_size = self.birth_world.size, self.birth_atmosphere = self.birth_world.atmosphere, self.birth_hydrographics = self.birth_world.hydrographics, self.birth_population = self.birth_world.population, self.birth_government = self.birth_world.government, self.birth_lawlevel = self.birth_world.lawlevel, self.birth_techlevel = self.birth_world.techlevel, self.birth_tradelevel = self.birth_world.tradelevel """enlistment""" enlistment = game.dice(2, 6) if self.upp[self.career["enlistment DM+1"]] >= self.career[ "enlistment DM+1 level"]: enlistment += 1 if self.upp[self.career["enlistment DM+2"]] >= self.career[ "enlistment DM+2 level"]: enlistment += 2 if enlistment >= self.career["enlistment"]: self.career = self.career else: self.career = game.random_choice([ self.Navy, self.Marines, self.Army, self.Merchants, self.Scouts, self.Other ]) """career generation loop""" in_career = True while in_career == True: if self.terms == 0: if 0 in self.career["rank skills"]: self.add_skill(self.skills, self.career["rank skills"][0]) survival = game.dice(2, 6) if self.upp[self.career["survival DM+1"]] >= self.career[ "survival DM+1 level"]: survival += 1 if survival >= self.career["survival"]: in_career = True self.terms += 1 self.age += 4 else: self.status = "DECEASED" in_career = False break """skill generation""" if self.career in [self.Scouts, self.Other]: for i in range(0, 2): skill_table = game.random_choice( ["personal", "service", "advanced", "advanced 2"]) self.add_skill( self.skills, game.random_choice(self.career[skill_table])) else: if self.terms == 1: for i in range(0, 2): skill_table = game.random_choice( ["personal", "service", "advanced", "advanced 2"]) self.add_skill( self.skills, game.random_choice(self.career[skill_table])) else: skill_table = game.random_choice( ["personal", "service", "advanced", "advanced 2"]) self.add_skill( self.skills, game.random_choice(self.career[skill_table])) """commission and promotion""" if self.career in [self.Scouts, self.Other]: self.rank = 0 elif self.rank == 0: commission = game.dice(2, 6) if self.upp[self.career["commission DM+1"]] >= self.career[ "commission DM+1 level"]: commission += 1 if commission >= self.career["commission"]: self.rank += 1 skill_table = game.random_choice( ["personal", "service", "advanced", "advanced 2"]) self.add_skill( self.skills, game.random_choice(self.career[skill_table])) if self.rank in self.career["rank skills"]: self.add_skill(self.skills, self.career["rank skills"][self.rank]) else: self.rank = self.rank if self.rank > 0 and self.rank < 6: promotion = game.dice(2, 6) if self.upp[self.career["promotion DM+1"]] >= self.career[ "promotion DM+1 level"]: promotion += 1 if promotion >= self.career["promotion"]: self.rank += 1 skill_table = game.random_choice( ["personal", "service", "advanced", "advanced 2"]) self.add_skill( self.skills, game.random_choice(self.career[skill_table])) if self.rank in self.career["rank skills"]: self.add_skill(self.skills, self.career["rank skills"][self.rank]) else: self.rank = self.rank """reenlistment""" reenlistment = game.dice(2, 6) if self.terms < 7 and reenlistment >= self.career["reenlist"]: in_career = True elif self.terms >= 7 and reenlistment == 12: in_career = True else: in_career = False """mustering out""" if self.status == "DECEASED": self.possessions = {} self.add_possession(self.possessions, "Grave marker") else: muster_throws = self.terms if self.rank in [1, 2]: muster_throws += 1 elif self.rank in [3, 4]: muster_throws += 2 elif self.rank in [5, 6]: muster_throws += 3 for i in range(0, muster_throws): muster_table = game.random_choice(["muster", "cash"]) muster_roll = game.dice(1, 6) - 1 if muster_table == "muster" and self.rank >= 5: muster_roll += 1 if muster_table == "cash" and "Gambling" in self.skills: muster_roll += 1 if muster_table == "muster": self.add_possession(self.possessions, self.career["muster"][muster_roll]) elif muster_table == "cash": self.cash += self.career["cash"][muster_roll] if (self.psionic_rating - self.terms) >= 1: if self.cash >= 100000: if game.dice(2, 6) >= 7: self.cash -= 100000 self.psionic_trained = "yes" self.psionic_talents = self.add_psionic_talent( self.psionic_rating, self.terms) """characteristic modifications""" for k in list(self.skills.keys()): if k == "+1 STR": self.upp[0] += 1 del self.skills[k] elif k == "+1 DEX": self.upp[1] += 1 del self.skills[k] elif k == "+1 END": self.upp[2] += 1 del self.skills[k] elif k == "+1 INT": self.upp[3] += 1 del self.skills[k] elif k == "+1 EDU": self.upp[4] += 1 del self.skills[k] elif k == "+2 EDU": self.upp[4] += 2 del self.skills[k] elif k == "+1 SOC": self.upp[5] += 1 del self.skills[k] elif k == "+2 SOC": self.upp[5] += 2 del self.skills[k] elif k == "-1 SOC": self.upp[5] -= 1 for k in list(self.possessions.keys()): if k == "+1 STR": self.upp[0] += 1 del self.possessions[k] elif k == "+1 DEX": self.upp[1] += 1 del self.possessions[k] elif k == "+1 END": self.upp[2] += 1 del self.possessions[k] elif k == "+1 INT": self.upp[3] += 1 del self.possessions[k] elif k == "+1 EDU": self.upp[4] += 1 del self.possessions[k] elif k == "+2 EDU": self.upp[4] += 2 del self.possessions[k] elif k == "+1 SOC": self.upp[5] += 1 del self.possessions[k] elif k == "+2 SOC": self.upp[5] += 2 del self.possessions[k] """titles""" if self.upp[5] == 11: if self.sex == "male": self.title = "Sir" elif self.sex == "female": self.title = "Lady" elif self.upp[5] == 12: if self.sex == "male": self.title = "Baron" elif self.sex == "female": self.title = "Baroness" elif self.upp[5] == 13: if self.sex == "male": self.title = "Marquis" elif self.sex == "female": self.title = "Marquesa" elif self.upp[5] == 14: if self.sex == "male": self.title = "Count" elif self.sex == "female": self.tatile = "Contessa" elif self.upp[5] == 15: if self.sex == "male": self.title = "Duke" elif self.sex == "female": self.title = "Duchess" elif self.rank >= 5: self.title = self.career["ranks"][self.rank] else: if self.sex == "male": self.title = "Mr." elif self.sex == "female": self.title = game.random_choice(["Ms.", "Mrs."]) if self.upp[4] >= 12: self.title = "Dr." #you get PhD at EDU 12+! if "Medical" in self.skills: if self.skills["Medical"] >= 3: self.title = "Dr."