예제 #1
0
	def __init__ (self, level): #input character level
		self.level=level
		self.strength=stellagama.dice(3,6) #ability generation
		self.dexterity=stellagama.dice(3,6)
		self.constitution=stellagama.dice(3,6)
		self.intelligence=stellagama.dice(3,6)
		self.wisdom=stellagama.dice(3,6)
		self.charisma=stellagama.dice(3,6)
		self.strmod=henchgenlib.attribute_modifier(self.strength) #ability modifier calculation
		self.dexmod=henchgenlib.attribute_modifier(self.dexterity)
		self.conmod=henchgenlib.attribute_modifier(self.constitution)
		self.intmod=henchgenlib.attribute_modifier(self.intelligence)
		self.wismod=henchgenlib.attribute_modifier(self.wisdom)
		self.chamod=henchgenlib.attribute_modifier(self.charisma)
		self.attribute_list=[self.strength,self.dexterity, self.constitution, self.intelligence, self.wisdom, self.charisma] #turning abilities into a list
		self.gold=10*stellagama.dice(3,6) #generate starting gold
		self.sex=henchgenlib.sex_gen() #generate sex
		self.race=henchgenlib.race_gen(self.constitution, self.intelligence) #generate race
		self.name=henchgenlib.name_gen(self.sex) #generate name
		self.cclass=henchgenlib.charclass(self.strength, self.dexterity, self.constitution, self.intelligence, self.wisdom, self.charisma, self.sex, self.race, self.level) #choose character class
		self.hp=henchgenlib.hp_gen(self.cclass, self.conmod, self.level) #generate hit points
		self.proficiencies=henchgenlib.profgen(self.intmod, self.level, self.cclass) #generate proficiencies
		self.weapon=henchgenlib.weapon_gen(self.cclass) #generate weapon
		self.armor=henchgenlib.armor_gen(self.cclass) #generate armor
		self.trinket=stellagama.random_line("trinkets.txt") #generates trinket
		self.quirk=stellagama.random_line("quirks.txt") #generates quirk
예제 #2
0
def name_gen(sex):
    name = ""
    if sex == "male":
        return stellagama.random_line("malenames.txt")
    elif sex == "female":
        return stellagama.random_line("femalenames.txt")
    else:
        return 'Tokay'
예제 #3
0
def name_gen(sex):
    name = ""
    if sex == "male":
        return stellagama.random_line(
            "./data/malenames.txt")  # output random male name
    elif sex == "female":
        return stellagama.random_line(
            "./data/femalenames.txt")  # output random female name
    else:
        return "Tokay"
예제 #4
0
def name_gen(sex):  #input character sex
    """
	randomly chooses a character name from a list
	"""
    name = ""
    if sex == "male":
        return stellagama.random_line(
            "malenames.txt")  #output random male name
    elif sex == "female":
        return stellagama.random_line(
            "femalenames.txt")  #output random female name
    else:  #in case of wrong input
        return "Tokay"  #output placeholder
예제 #5
0
 def __init__(self, hex):
     self.name = stellagama.random_line(os.path.join('data', 'worlds.txt'))
     self.hex = hex
     self.uwp_dict = {
         "starport": "X",
         "size": stellagama.dice(2, 6) - 2,
         "atmosphere": 0,
         "hydrographics": 0,
         "population": 0,
         "government": 0,
         "law": 0,
         "tl": 0
     }
     self.uwp_dict["atmosphere"] = atmo_gen(self.uwp_dict["size"])
     self.uwp_dict["hydrographics"] = hydro_gen(self.uwp_dict["size"],
                                                self.uwp_dict["atmosphere"])
     self.uwp_dict["population"] = pop_gen(self.uwp_dict["atmosphere"],
                                           self.uwp_dict["hydrographics"])
     self.uwp_dict["government"] = gov_gen(self.uwp_dict["population"])
     self.uwp_dict["law"] = law_gen(self.uwp_dict["government"])
     self.uwp_dict["starport"] = starport_gen(self.uwp_dict["population"])
     self.uwp_dict["tl"] = tech_gen(self.uwp_dict)
     self.hex_uwp = {
         "starport": self.uwp_dict["starport"],
         "size": stellagama.pseudo_hex(self.uwp_dict["size"]),
         "atmosphere": stellagama.pseudo_hex(self.uwp_dict["atmosphere"]),
         "hydrographics":
         stellagama.pseudo_hex(self.uwp_dict["hydrographics"]),
         "population": stellagama.pseudo_hex(self.uwp_dict["population"]),
         "government": stellagama.pseudo_hex(self.uwp_dict["government"]),
         "law": stellagama.pseudo_hex(self.uwp_dict["law"]),
         "tl": stellagama.pseudo_hex(self.uwp_dict["tl"])
     }
     self.zone = zone_gen(self.uwp_dict)
     self.pbg = pbg_gen(self.uwp_dict["population"])
     self.pbg_list = self.pbg.split()
     if int(self.pbg_list[0]) > 0:
         self.gas_giant = "G"
     self.base = base_gen(self.uwp_dict["starport"])
     self.trade_list = trade_gen(self.uwp_dict)
     self.trade_string = " ".join(self.trade_list)
     self.allegiance = "Na"
     self.ix = ""
     self.ex = ""
     self.cx = ""
     self.noble = ""
     self.w = ""
     self.stellar = ""
예제 #6
0
 def __init__(self):
     self.upp = {
         "STR": stellagama.dice(2, 6),
         "DEX": stellagama.dice(2, 6),
         "END": stellagama.dice(2, 6),
         "INT": stellagama.dice(2, 6),
         "EDU": stellagama.dice(2, 6),
         "SOC": stellagama.dice(2, 6)
     }
     self.upp_dms = upp_dms(self.upp)
     self.skills = {}
     self.possessions = {}
     self.rank = 0
     self.terms = 0
     self.cash = 0
     self.title = ""
     self.status = ""
     self.sex = random.choice(["male", "female"])
     self.name = name_gen(self.sex)
     self.surname = stellagama.random_line("surnames.txt")
     self.career = "Agent"
     #self.career = career_choice(self.upp)
     self.age = 18
     self.homeworld = random.choice([
         "High-Tech World", "Colony", "Inhospitable Outpost",
         "Primitive Backwater"
     ])
     add_skill(self.skills, random.choice(homeworlds[self.homeworld]))
     enlistment = stellagama.dice(2, 6)
     enlistment += self.upp_dms[careers[self.career]["qualification DM"]]
     if enlistment >= careers[self.career]["qualification"]:
         self.career = self.career
     else:
         self.career = random.choice(
             ["Colonist", "Rogue", "Marine", "Merchant", "Navy", "Scout"])
     in_career = True
     while in_career:
         if self.terms == 0:
             if 0 in careers[self.career]["rank skills"]:
                 add_skill(self.skills,
                           careers[self.career]["rank skills"][0])
                 break
예제 #7
0
 def __init__(self, death=True, career=[]):
     self.skill_ranks = 1
     self.upp = {
         "STR": stellagama.dice(2, 6),
         "DEX": stellagama.dice(2, 6),
         "END": stellagama.dice(2, 6),
         "INT": stellagama.dice(2, 6),
         "EDU": stellagama.dice(2, 6),
         "SOC": stellagama.dice(2, 6)
     }
     self.upp_dms = upp_dms(self.upp)
     self.death = death
     self.history = []
     self.skills = []
     self.skill_counter = {}
     self.possessions = []
     self.possession_counter = {}
     self.rank = 0
     self.terms = 0
     self.cash = 0
     self.title = ""
     self.status = ""
     self.cash_counter = 0
     self.sex = random.choice(["male", "female"])
     self.name = name_gen(self.sex)
     self.surname = stellagama.random_line("surnames.txt")
     if career == []:
         self.career = career_choice(self.upp)
     else:
         self.career = career
     self.age = 18
     self.character_string = ""
     self.upp_string = ""
     self.homeworld = random.choice([
         "High-Tech World", "Colony", "Inhospitable Outpost",
         "Primitive Backwater"
     ])
     self.add_skill(random.choice(homeworlds[self.homeworld]))
     # Enlistment
     if career == []:
         enlistment = stellagama.dice(2, 6)
         enlistment += self.upp_dms[careers[self.career]
                                    ["qualification DM"]]
         if enlistment >= careers[self.career]["qualification"]:
             self.career = self.career
             self.history.append(
                 f"Successfully enlisted into the {self.career}")
         else:
             self.career = random.choice([
                 "Colonist", "Rogue", "Marine", "Merchant", "Navy", "Scout"
             ])
             self.history.append(f"Drafted into the {self.career}")
     else:
         self.career = career
     # Career generation loop
     in_career = True
     while in_career:
         # Survival
         survival = stellagama.dice(2, 6)
         survival += self.upp_dms[careers[self.career]["survival DM"]]
         if self.death:
             if survival >= careers[self.career]["survival"]:
                 pass
             else:
                 self.status = "DECEASED"
                 break
         if not self.death:
             if survival >= careers[self.career]["survival"]:
                 pass
             else:
                 break
         else:
             pass
         # Skills
         if self.terms == 1:
             for i in range(0, 2):
                 self.add_random_skill()
         else:
             self.add_random_skill()
         if self.rank in careers[self.career]["rank skills"]:
             self.add_skill(careers[self.career]["rank skills"][self.rank])
         # Advancement
         if self.rank in range(0, 6):
             advancement = stellagama.dice(2, 6)
             advancement += self.upp_dms[careers[self.career]
                                         ["advancement DM"]]
             if advancement >= careers[self.career]["advancement"]:
                 self.rank += 1
                 self.add_random_skill()
             else:
                 pass
         else:
             pass
         # Aging
         if self.age >= 34:
             aging_throw = stellagama.dice(2, 6) - self.terms
             if aging_throw >= 1:
                 pass
             elif aging_throw == 0:
                 self.reduce_physical_characteristic(1)
             elif aging_throw == -1:
                 for i in range(0, 2):
                     self.reduce_physical_characteristic(1)
             elif aging_throw == -2:
                 for i in range(0, 3):
                     self.reduce_physical_characteristic(1)
             elif aging_throw == -3:
                 self.reduce_physical_characteristic(2)
                 for i in range(0, 2):
                     self.reduce_physical_characteristic(1)
             elif aging_throw == -4:
                 self.reduce_physical_characteristic(1)
                 for i in range(0, 2):
                     self.reduce_physical_characteristic(2)
             elif aging_throw == -5:
                 for i in range(0, 3):
                     self.reduce_physical_characteristic(2)
             elif aging_throw == -6:
                 self.reduce_mental_characteristic(1)
                 for i in range(0, 2):
                     self.reduce_physical_characteristic(2)
             else:
                 pass
             for characteristic in [
                     self.upp["STR"], self.upp["DEX"], self.upp["END"]
             ]:
                 if characteristic <= 0:
                     if death:
                         aging_crisis = stellagama.dice(2, 6)
                         if aging_crisis < 6:
                             self.status = "DECEASED"
                             break
                         else:
                             self.upp[characteristic] = 1
                             break
                     if not death:
                         self.upp[characteristic] = 1
                         break
         else:
             pass
         self.terms += 1
         self.age += 4
         # Reenlistment
         reenlistment = stellagama.dice(2, 6)
         if self.terms < 7:
             if reenlistment >= careers[self.career]["reenlistment"]:
                 pass
             else:
                 break
         elif self.terms >= 7:
             if reenlistment == 12:
                 pass
             else:
                 break
     # Mustering Out
     muster_throws = self.terms
     if self.rank in [1, 2]:
         pass
     elif self.rank == 4:
         muster_throws += 1
     elif self.rank == 5:
         muster_throws += 2
     elif self.rank == 6:
         muster_throws += 3
     for i in range(0, muster_throws):
         self.muster()
     if self.status != "DECEASED":
         self.add_skill(random.choice(skills))
     else:
         pass
     # Data Processing
     possessions_iteration = list.copy(self.possessions)
     for item in possessions_iteration:
         if item == "Weapon":
             self.possessions[self.possessions.index(item)] = random.choice(
                 weapons)
         if item == "+1 INT":
             self.possessions.remove(item)
             self.upp["INT"] += 1
         if item == "+1 STR":
             self.possessions.remove(item)
             self.upp["STR"] += 1
         if item == "+1 EDU":
             self.possessions.remove(item)
             self.upp["EDU"] += 1
         if item == "+1 END":
             self.possessions.remove(item)
             self.upp["END"] += 1
         if item == "+1 DEX":
             self.possessions.remove(item)
             self.upp["DEX"] += 1
         if item == "+1 SOC":
             self.possessions.remove(item)
             self.upp["SOC"] += 1
     skill_iteration = list.copy(self.skills)
     for skill in skill_iteration:
         if skill == "+1 INT":
             self.skills.remove(skill)
             self.upp["INT"] += 1
         if skill == "+1 STR":
             self.skills.remove(skill)
             self.upp["STR"] += 1
         if skill == "+1 EDU":
             self.skills.remove(skill)
             self.upp["EDU"] += 1
         if skill == "+1 END":
             self.skills.remove(skill)
             self.upp["END"] += 1
         if skill == "+1 DEX":
             self.skills.remove(skill)
             self.upp["DEX"] += 1
         if skill == "+1 SOC":
             self.skills.remove(skill)
             self.upp["SOC"] += 1
     if self.status == "DECEASED":
         self.possessions = []
         self.cash = 0
     self.skill_counter = collections.Counter(self.skills)
     self.possession_counter = collections.Counter(self.possessions)
     self.title_gen()
     self.rank_name = careers[self.career]['ranks'][self.rank]
     if self.title == "":
         if self.sex == "male":
             self.title = "Mr."
         elif self.sex == "female":
             self.title = random.choice(["Mrs.", "Ms.", "Ms."])
     self.skill_string = skill_stringer(self.skill_counter)
     self.possessions_string = possession_stringer(self.possession_counter)
     self.upp_string = f"{stellagama.pseudo_hex(self.upp['STR'])}{stellagama.pseudo_hex(self.upp['DEX'])}{stellagama.pseudo_hex(self.upp['END'])}{stellagama.pseudo_hex(self.upp['INT'])}{stellagama.pseudo_hex(self.upp['EDU'])}{stellagama.pseudo_hex(self.upp['SOC'])}"
     if self.status == "DECEASED":
         self.skill_string = ""
         self.possessions_string = ""
         self.character_string = f"{self.title} {self.name} {self.surname}\t{self.upp_string}\t Age {self.age}\n{self.terms} terms {self.career} {careers[self.career]['ranks'][self.rank]}\tCr{self.cash}\n{self.status}"
     elif self.possessions:
         self.character_string = f"{self.title} {self.name} {self.surname}\t{self.upp_string}\t Age {self.age}\n{self.terms} terms {self.career} {careers[self.career]['ranks'][self.rank]}\tCr{self.cash}\n{self.skill_string}\n{self.possessions_string}"
     elif not self.possessions:
         self.character_string = f"{self.title} {self.name} {self.surname}\t{self.upp_string}\t Age {self.age}\n{self.terms} terms {self.career} {careers[self.career]['ranks'][self.rank]}\tCr{self.cash}\n{self.skill_string}"
예제 #8
0
 def __init__(self):
     """generate basic stats"""
     self.upp = [
         stellagama.dice(2, 6),
         stellagama.dice(2, 6),
         stellagama.dice(2, 6),
         stellagama.dice(2, 6),
         stellagama.dice(2, 6),
         stellagama.dice(2, 6)
     ]
     self.skills = {}
     self.possessions = {}
     self.rank = 0
     self.terms = 0
     self.cash = 0
     self.title = ""
     self.status = ""
     self.sex = stellagama.random_choice(["male", "female"])
     self.name = name_gen(self.sex)
     self.surname = stellagama.random_line("surnames.txt")
     self.career = career_choice(self.upp)
     self.age = 18
     """enlistment"""
     enlistment = stellagama.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 = stellagama.random_choice(
             [Navy, Marines, Army, Merchants, Scouts, Other])
     """career generation loop"""
     in_career = True
     while in_career == True:
         if self.terms == 0:
             if 0 in self.career["rank skills"]:
                 add_skill(self.skills, self.career["rank skills"][0])
         survival = stellagama.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 [Scouts, Other]:
             for i in range(0, 2):
                 skill_table = stellagama.random_choice(
                     ["personal", "service", "advanced", "advanced 2"])
                 add_skill(
                     self.skills,
                     stellagama.random_choice(self.career[skill_table]))
         else:
             if self.terms == 1:
                 for i in range(0, 2):
                     skill_table = stellagama.random_choice(
                         ["personal", "service", "advanced", "advanced 2"])
                     add_skill(
                         self.skills,
                         stellagama.random_choice(self.career[skill_table]))
             else:
                 skill_table = stellagama.random_choice(
                     ["personal", "service", "advanced", "advanced 2"])
                 add_skill(
                     self.skills,
                     stellagama.random_choice(self.career[skill_table]))
         """commission and promotion"""
         if self.career in [Scouts, Other]:
             self.rank = 0
         elif self.rank == 0:
             commission = stellagama.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 = stellagama.random_choice(
                     ["personal", "service", "advanced", "advanced 2"])
                 add_skill(
                     self.skills,
                     stellagama.random_choice(self.career[skill_table]))
                 if self.rank in self.career["rank skills"]:
                     add_skill(self.skills,
                               self.career["rank skills"][self.rank])
             else:
                 self.rank = self.rank
         if self.rank > 0 and self.rank < 6:
             promotion = stellagama.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 = stellagama.random_choice(
                     ["personal", "service", "advanced", "advanced 2"])
                 add_skill(
                     self.skills,
                     stellagama.random_choice(self.career[skill_table]))
                 if self.rank in self.career["rank skills"]:
                     add_skill(self.skills,
                               self.career["rank skills"][self.rank])
             else:
                 self.rank = self.rank
         """reenlistment"""
         reenlistment = stellagama.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 = {}
     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 = stellagama.random_choice(["muster", "cash"])
             muster_roll = stellagama.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":
                 add_possession(self.possessions,
                                self.career["muster"][muster_roll])
             elif muster_table == "cash":
                 self.cash += self.career["cash"][muster_roll]
     """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 = "Knight"
         elif self.sex == "female":
             self.title = "Dame"
     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 = stellagama.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."
예제 #9
0
def quirk_gen():
    if stellagama.dice(1, 6) >= 5:
        return stellagama.random_line("./data/quirks.txt").lower()
    else:
        pass
예제 #10
0
def trinket_gen():
    if stellagama.dice(1, 6) >= 5:
        return stellagama.random_line("./data/trinkets.txt").lower()
    else:
        pass