示例#1
0
 def generate_standard_opening(self):
     artifact_name = md_writer.phrase_as_anchor_link(self.ruin.artifact.name)
     return templates.Template("{{line}}").render(
         line="{{metaphor}}|{{people}}|{{artifact}}",
         artifact=artifact_name,
         metaphor="A_or_an {{metone}} is a_or_an {{mettwo}}",
         lament="{{poor_word}} {{poor_verb}} {{object}}",
         object="world|us|you|we|fate|cruelty|suffering|sadness|coldness|stars",
         metone=vocab.get_ogden_basic_noun(),
         mettwo=vocab.get_noun(),
         people="{{peoplephrase}} {{peopleare}}",
         peoplephrase="We are|You are|They are|All of us are",
         peopleare="cursed|dying|corrupted|free|joyful|sorrowful|lost|frozen|damned|hidden|love|maddened|envious",
     )
示例#2
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"))
示例#3
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
def random_word():
    return translate_word(vocab.get_noun())