Beispiel #1
0
class PersonGenerator(object):
    def __init__(self, surnames, male_names, female_names):
        self.surnames = RandomTable(
            *[line.strip().title() for line in open(surnames)])
        self.male_names = RandomTable(
            *[line.strip().title() for line in open(male_names)])
        self.female_names = RandomTable(
            *[line.strip().title() for line in open(female_names)])

    def person(self, male, born=-17):
        if male is None:
            male = random.choice([True, False])
        return Person(male,
                      self.new_name(male),
                      self.surnames.roll(),
                      None,
                      None,
                      born=born)

    def new_name(self, male):
        return self.male_names.roll() if male else self.female_names.roll()

    def child(self, father, mother, born):
        male = random.choice([True, False])
        return Person(male,
                      self.new_name(male),
                      father.surname,
                      father,
                      mother,
                      born=born)
Beispiel #2
0
class PersonGenerator(object):
    def __init__(self, surnames, male_names, female_names):
        self.surnames = RandomTable(*[line.strip().title() for line in open(surnames)])
        self.male_names = RandomTable(*[line.strip().title() for line in open(male_names)])
        self.female_names = RandomTable(*[line.strip().title() for line in open(female_names)])

    def person(self, male, born=-17):
        if male is None:
            male = random.choice([True, False])
        return Person(male, self.new_name(male), self.surnames.roll(), None, None, born=born)

    def new_name(self, male):
        return self.male_names.roll() if male else self.female_names.roll()

    def child(self, father, mother, born):
        male = random.choice([True, False])
        return Person(male, self.new_name(male), father.surname, father, mother, born=born)
Beispiel #3
0
    def build_random(self, overwrite=False, verbose=False):
        if verbose:
            print("Randomizing the NPC appearance")
        self.appearance = RandomTable.roll(self.build_config_path(propertie=self.APPEARANCE_PATH))
        if verbose:
            print("-> " + self.appearance)
            print("Randomizing the NPC bond")
        self.bonds = RandomTable.roll(self.build_config_path(propertie=self.BONDS_PATH))
        if verbose:
            print("-> " + self.bonds)
            print("Randomizing the NPC flaw")
        self.flaws = RandomTable.roll(self.build_config_path(propertie=self.FLAWS_PATH))
        if verbose:
            print("-> " + self.flaws)
            print("Randomizing what the NPC ideals")
        self.ideals = RandomTable.roll(self.build_config_path(propertie=self.IDEALS_PATH))
        if verbose:
            print("-> " + self.ideals)
            print("Randomizing the NPC mannerisms")
        self.mannerisms = RandomTable.roll(self.build_config_path(propertie=self.MANNERISMS_PATH))
        if verbose:
            print("-> " + self.mannerisms)
            print("Randomizing the NPC talent")
        self.talent = RandomTable.roll(self.build_config_path(propertie=self.TALENT_PATH))
        if verbose:
            print("-> " + self.talent)
            print("Randomizing the NPC interaction")
        self.interaction = RandomTable.roll(self.build_config_path(propertie=self.INTERACTION_PATH))
        if verbose:
            print("-> " + self.interaction)
            print("Randomizing the NPC high ability")
        self.high_ability = RandomTable.roll(self.build_config_path(propertie=self.HIGH_ABILITY_PATH))
        if verbose:
            print("-> " + self.high_ability)
            print("Randomizing the NPC low ability")
        self.low_ability = RandomTable.roll(self.build_config_path(propertie=self.LOW_ABILITY_PATH))
        if verbose:
            print("-> " + self.low_ability)
            print("Saving the NPC to file")

        save_path = self.OUTPUT_PATH + self.name + self.FILE_EXTENSION
        self.save_to_file(save_path, overwrite, verbose)

        if verbose:
            print("NPC saved under: " + save_path)
Beispiel #4
0
 def __init__(self, surnames, male_names, female_names):
     self.surnames = RandomTable(
         *[line.strip().title() for line in open(surnames)])
     self.male_names = RandomTable(
         *[line.strip().title() for line in open(male_names)])
     self.female_names = RandomTable(
         *[line.strip().title() for line in open(female_names)])
Beispiel #5
0
    def build_random(self, overwrite=False, verbose=False, random_name=True):
        if random_name:
            if verbose:
                print("Randomizing the city name")
            self.name = RandomTable.roll(
                                self.build_config_path(
                                            propertie=self.NAME_PATH))
            if verbose:
                print("-> " + self.name)
        
        if verbose:
            print("Randomizing the city race relations")
        self.race_relation = RandomTable.roll(
                                    self.build_config_path(
                                            propertie=self.RACE_RELATION_PATH))
        if verbose:
            print("-> " + self.race_relation)
            print("Randomizing the city ruler status")
        self.ruler_status = RandomTable.roll(
                                    self.build_config_path(
                                            propertie=self.RULER_STATUS_PATH))
        if verbose:
            print("-> " + self.ruler_status)
            print("Randomizing the city notable trait")
        self.notable_trait = RandomTable.roll(
                                    self.build_config_path(
                                                    propertie=self.TRAITS_PATH))
        if verbose:
            print("-> " + self.notable_trait)
            print("Randomizing what the city is known for")
        self.known_for = RandomTable.roll(
                                self.build_config_path(
                                                propertie=self.KNOWN_FOR_PATH))
        if verbose:
            print("-> " + self.known_for)
            print("Randomizing the city impending calamity")
        self.calamity = RandomTable.roll(
                                self.build_config_path(
                                                propertie=self.CALAMITY_PATH))
        if verbose:
            print("-> " + self.calamity)
            print("Randomizing the city population")
        self.population = RandomTable.roll(
                                    self.build_config_path(
                                                propertie=self.POPULATION_PATH))
        if verbose:
            print("-> " + self.population)
            print("Saving the city to file")

        
        self.save_to_file(overwrite, verbose)
Beispiel #6
0
 def __init__(self, surnames, male_names, female_names):
     self.surnames = RandomTable(*[line.strip().title() for line in open(surnames)])
     self.male_names = RandomTable(*[line.strip().title() for line in open(male_names)])
     self.female_names = RandomTable(*[line.strip().title() for line in open(female_names)])