def strength_determine(self, modifier=None, modifier2=None): roll = rollsim(2,20) # Handle the modifier argument if(modifier is not None): if(modifier == 'important'): roll += 2 elif(modifier == 'weak'): roll -= 2 elif(modifier == 'strong'): roll += 2 elif(modifier == 'prime'): roll += 4 if(modifier2 is not None): if(modifier2 == 'important'): roll += 2 elif(modifier2 == 'weak'): roll -= 2 elif(modifier2 == 'strong'): roll += 2 elif(modifier2 == 'prime'): roll += 4 # Iterate over the array then return for i in self.statistic: if(roll <= i.upper): return i.string1 elif(roll >= 26): return self.statistic[-1].string1 return None
def get_goal(self): roll = rollsim(1,100) result = None for i in self.goals: if(roll <= i.upper): result = i.description break return result
def price(self): roll = rollsim(1, 100) result = None for i in self.pay_price: if(roll <= i.upper): result = i.description break return result
def generate(self): location = '' purpose = '' roll = rollsim(1,100) for i in self.dungeon_location: if(roll <= i.upper): location = i.description break roll = rollsim(1,20) for i in self.dungeon_purpose: if(roll <= i.upper): purpose = i.description break return location, purpose
def generate(self): event = '' event_desc = '' roll = rollsim(1,100) for i in self.events_table: if(roll <= i.upper): event = i.name event_desc = i.description break meaning = '' roll = rollsim(1, 100) meaning += self.action[roll - 1] + ' ' roll = rollsim(1, 100) meaning += self.subject[roll - 1] return event, event_desc, meaning
def get_faction(self): roll = rollsim(1, 100) result = None desc = None for i in self.factions: if(roll <= i.upper): result = i.string1 desc = i.string2 break return result, desc
def generate(self): name = MName().New() ruler_status = self.ruler_status[rollsim(0, len(self.ruler_status) - 1)] temp = ruler_status first = list(temp.lower()) if (first[0] == "a" or first[0] == "i" or first[0] == "u" or first[0] == "e" or first[0] == "o"): start = "an" else: start = "a" result = 'The village/town/city named {4} is governed by {5} {0}, known for its {1} and {2}. It is in a state of calamity due to {3}.'.format( colored(ruler_status, 'cyan'), colored(self.traits[rollsim(0, len(self.traits) - 1)], 'green'), colored(self.known_for[rollsim(0, len(self.known_for) - 1)], 'green'), colored(self.calamity[rollsim(0, len(self.calamity) - 1)], 'yellow'), colored(name, 'magenta'), start ) return result
def detail(self, chaos=None): roll = rollsim(2, 20) # Handle the chaos argument if(chaos is not None): if(chaos == '+'): roll += 2 elif(chaos == '-'): roll -= 2 # Iterate over the array then return for i in self.details_table: if(roll <= i.upper): return i.string1, i.string2 elif(roll >= 18): return self.details_table[-1].string1, self.details_table[-1].string2 return None
def plot_twist(self): roll = rollsim(0, len(self.twist) - 1) return self.twist[roll]
def exotic(self): roll = rollsim(0, len(self.dungeon_exotic) - 1) result = self.dungeon_exotic[roll] return result
def description_gen(self): result = '' result += self.description_1[rollsim(0, len(self.description_1) - 1)] result += ' ' result += self.description_2[rollsim(0, len(self.description_2) - 1)] return result
def action_gen(self): result = '' result += self.action_1[rollsim(0, len(self.action_1) - 1)] result += ' ' result += self.action_2[rollsim(0, len(self.action_2) - 1)] return result
def calculate(self, rank, chaos=None): roll1 = rollsim(1, 10) roll2 = rollsim(1, 10) total = roll1 + roll2 # For exceptional results roll1 = rollsim(1, 10) roll2 = rollsim(1, 10) total2 = roll1 + roll2 # For Chaos isChaos = False # Calculate the likelihood if(rank == 1): total -= 8 elif(rank == 2): total -= 6 elif(rank == 3): total -= 4 elif(rank == 4): total -= 2 elif(rank == 6): total += 2 elif(rank == 7): total += 4 elif(rank == 8): total += 6 elif(rank == 9): total += 8 # Add the Chaos Factor if(chaos is not None): if(chaos == '+'): total += 2 elif(chaos == '-'): total -= 2 isChaos = True # For exceptionals and events digits = str(total2) if(len(digits) > 1): digit1 = int(digits[0]) digit2 = int(digits[1]) # Return the answer if(total < 11): if(len(digits) > 1): if(isChaos == True): if(digits[0] == digits[1]): return 'Exceptionally no. Roll for an event or detail.' elif(digit1 % 2 == 1 and digit2 % 2 == 1): return 'Exceptionally no.' elif(digit1 % 2 == 0 and digit2 % 2 == 0): return 'No. Roll for an event or detail.' return 'No.' elif (total >= 11): if(len(digits) > 1): if(isChaos == True): if(digits[0] == digits[1]): return 'Exceptionally yes. Roll for an event or detail.' elif(digit1 % 2 == 1 and digit2 % 2 == 1): return 'Exceptionally yes.' elif(digit1 % 2 == 0 and digit2 % 2 == 0): return 'Yes. Roll for an event or detail.' return 'Yes.'