Example #1
0
 def generate_standard_middle_line(self):
     return templates.Template("{{line}}").render(
         line="{{list}}|{{list2}}|{{butphrase}}",
         list="{{adj1}}, {{adj2}}, {{adj3}}",
         list2="{{adj1}} and {{adj2}}",
         adj1=vocab.get_adj(),
         adj2=vocab.get_adj(),
         adj3=vocab.get_adj(),
         butphrase="{{butword}} {{adj1}}",
         butword="yet|but|yet never|but never|ever|always",
     )
Example #2
0
    def generate_middle_line(self, rhyme):
        last_word = vocab.get_adj()
        if rhyme is not None:
            last_word_choices = vocab.rhyming_adjs(rhyme)
            if len(last_word_choices) == 0:
                raise ValueError
            last_word = random.choice(last_word_choices)


        return (templates.Template("{{line}}")
                .render(line="{{list}}|{{list2}}|{{butphrase}}|{{it_phrase}}",
                        it_phrase="it is {{always_never}} {{last_adj}}",
                        always_never = "always|never",
                        list="{{adj1}}, {{adj2}}, {{last_adj}}",
                        list2="{{adj1}} and {{last_adj}}",
                        adj1=vocab.get_adj(), adj2=vocab.get_adj(), last_adj=last_word,
                        butphrase="{{butword}} {{last_adj}}",
                        butword="yet|but|yet never|but never|ever|always"))
Example #3
0
 def generate_end_line(self, rhyme):
     last_word = vocab.get_adj()
     if rhyme is not None:
         last_word_choices = vocab.rhyming_adjs(rhyme)
         if len(last_word_choices) == 0:
             raise ValueError
         last_word = random.choice(last_word_choices)
     return (templates.Template("{{line}}")
             .render(line="{{statement}}",
                     statement="{{subject}} is {{adj}}",
                     subject="all|sadness|cruelty|fate|the world|life|death|hope|nothing|everything",
                     adj=last_word))
Example #4
0
    def __init__(self):
        self.name = (templates.Template("{{output}}")
                     .render(output="{{old1}}|{{old1}} {{old2}}|The {{adj}} {{noun}}",
                             old1=old_language_generator.random_word(),
                             old2=old_language_generator.random_word(),
                             adj=vocab.get_adj(),
                             noun=vocab.get_noun()).title())

        self.form = (templates.Template("{{name}} {{shapephrase}} a_or_an {{adj}} {{shape}}.")
                     .render(name=self.name,
                             shapephrase="has the form of|is a powerful artifact in the shape of|looks like",
                             adj="broken|smooth|warm|cold|sharp|wet|soft|hard|mushy|transparent|glassy|opaque",
                             shape="rock|doll|figurine|amulet|orb|gem|crystal|sphere|cube|prism|blade|spear|monument|meteorite"))

        self.description_sentences = []
        if random.random() < 0.5:
            self.description_sentences.append(templates.Template("{{thing}} {{verbs}} {{direction}} it.")
                                              .render(thing="light|water|gravity|air|psychic energy|magic|cacophony|power|fire",
                                                      verbs="bends|shifts|flows|pours|incinerates|glows|slides|slips",
                                                      direction="towards|from|away from|around|near").capitalize())

        if random.random() < 0.5:
            self.description_sentences.append(templates.Template("It is a {{adj}} {{color}} color.")
                                              .render(adj="sickly|pale|bright|dark|medium|light|shifting",
                                                      color=vocab.basic_colors))

        if random.random() < 0.5:
            self.description_sentences.append(templates.Template("It smells like {{scent}}.")
                                              .render(scent=vocab.scents))

        random.shuffle(self.description_sentences)

        self.when_sentence = (templates.Template("When {{action}} {{transition}} {{ending}}.")
                              .render(action="worshipped|gazed upon|touched|picked up|smelled|eaten|worn|carried|held|cradled|rubbed|thrown",
                                      transition="it",
                                      ending="becomes hot|become energized with a powerful vibration|liquifies|glows with an eerie light|dissappears|"
                                             "shows an image of the future|becomes a shielding force|aids memory|becomes a deadly projectile|projects energy|tunnels into the earth|"
                                             "repels insects|frightens children|becomes a force of destiny|becomes lost|burns the mind|sings the hymn of the damned|"
                                             "curses all nearby|illuminates its surroundings|destroys itself|destroys others|flies into the air|floats in the air|floats above the ground|"
                                             "levitates surrounding objects|levitates those nearby|grants power to its owner|makes its owner invisible|grants a wish|"
                                             "emits dust|turns surrounding objects to ashes|ignites its surrroundings|grants psychic powers|changes the past|changes probabilities"))
Example #5
0
    def __init__(self):

        self.challenge_rating = random.randint(2, 10)

        self.name = (templates.Template("{{output}}")
                     .render(output="{{old1}}|{{old1}} {{old2}}|The {{adj}} {{noun}}",
                             old1=old_language_generator.random_word(),
                             old2=old_language_generator.random_word(),
                             adj=vocab.get_adj(),
                             noun=vocab.get_noun()).title())

        self.location_description = templates.Template('{{sentence}}').render(sentence="{{name}} is {{locationphrase}} {{placement}}.",
                                                         name=self.name.title(),
                                                         locationphrase="located in|located on|constructed on|located under",
                                                         placement="a_or_an {{adj}} tree|a_or_an {{adj}} plain|a_or_an {{adj}} city|a_or_an {{adj}} rift|a_or_an {{adj}} mountain",
                                                         adj="alien|obsidion|crystal|spikey|giant|flooded|ruined|volcanic|cursed|poisoned|haunted|broken")

        self.parts_description = (templates.Template('{{sentence}}')
                                  .render(sentence="{{segment}} of {{name}} are {{state}}.",
                                          segment="Parts|Some areas|Regions|Some rooms",
                                          name=self.name.title()+"|it",
                                          state="cursed|corrupted|flooded|{{adj}} hot|{{adj}} cold|frozen|foggy|inaccessible|flooded",
                                          adj="incredibly|somewhat|unbearably"))

        self.circumstances_description = (templates.Template('{{sentence}}')
                                          .render(sentence="A_or_an {{outside_thing}} is happening outside.|The ruin is {{ruin_becoming}}.",
                                                  outside_thing="massive storm|battle between raiders|solar eclipse|massive flood|windstorm|blizzard|lunar eclipse",
                                                  ruin_becoming="flooding|coming to life|sinking into the earth|collapsing slowly|burning|larger on the inside than the outside"))

        self.artifact = Artifact()

        self.race = monsters.get_race(self.challenge_rating)
        self.race_description = (templates.Template('{{sentence}}')
                                 .render(sentence="It is occupied by {{plural_race}}.",
                                         plural_race=self.race))

        self.villain = Villain(self)

        self.villain_sentence = (templates.Template('{{sentence}}')
                                 .render(sentence="{{villain}}, a_or_an {{villain_type}} is here.",
                                         villain=md_writer.phrase_with_anchor(self.villain.__str__()),
                                         villain_type=self.villain.monster.name))

        self.race_villain_relation_sentence = (templates.Template("{{sentence}}")
                                               .render(sentence="The {{race_name}} {{relation}} {{villain}}.",
                                                       race_name=self.race,
                                                       relation="are the slaves of|have been charmed by|are ruled by|worship|are the minions of|are the soldiers of|are battling",
                                                       villain=self.villain.__str__()))

        self.entrance = Room(self)
        self.entrance.set_connection('south', 'entrance')

        self.rooms = [self.entrance]

        rooms_to_build = random.randint(5, 15)
        while len(self.rooms) < rooms_to_build:
            random_room = choice(self.rooms)
            new_room = random_room.add_connected_room()
            if new_room is not None:
                self.rooms.append(new_room)

        random_room.artifact = self.artifact
        random_room = choice(self.rooms)
        random_room.villain = self.villain