コード例 #1
0
ファイル: room.py プロジェクト: mattfister/ruindogs
    def render(self):
        md_writer.print_chapter_subheading(md_writer.phrase_with_anchor(self.full_name))

        for sentence in self.details:
            md_writer.print_chapter_sentence(sentence)

        md_writer.end_chapter()

        if self.engraving is not None:
            md_writer.print_chapter_sentence(templates.Template("There is an engraving on {{location}} written in {{language}}.")
                                             .render(location=self.engraving_location,
                                                     language=self.ruin.race + " Script|common"))
            md_writer.end_paragraph()
            self.engraving.render()
        md_writer.end_chapter()

        for prop in self.props:
            md_writer.print_list_item(templates.Template("There is a_or_an {{prop}} here.").render(prop=prop) + "\n")
        if self.artifact is not None:
            md_writer.print_list_item(templates.Template("{{artifact}} is here.").render(artifact=md_writer.phrase_as_anchor_link(self.artifact.name)) + "\n")
        if self.villain is not None:
            md_writer.print_list_item(templates.Template("{{villain}} is here.").render(villain=md_writer.phrase_as_anchor_link(self.villain.__str__())) + "\n")

        for key, val in self.connections.items():
            if val is None:
                pass
            elif val == 'entrance':
                 md_writer.print_list_item(templates.Template("To the {{direction}} is the entrance.").render(direction=key) + "\n")
            else:
                connection = val[0]
                connected_room = val[1]
                md_writer.print_list_item(templates.Template("To the {{direction}} {{connection}} {{leadsto}} {{room}}.\n").render(
                    direction=key, connection=connection.description,
                    leadsto="leads to|connects to|opens to",
                    room="["+connected_room.full_name+"]"+"(#"+connected_room.full_name.replace(" ","-")+")"))
コード例 #2
0
ファイル: artifact.py プロジェクト: mattfister/ruindogs
 def render(self):
     md_writer.print_chapter_subheading(md_writer.phrase_with_anchor(self.name))
     md_writer.end_chapter()
     md_writer.print_chapter_sentence(self.form)
     for sentence in self.description_sentences:
         md_writer.print_chapter_sentence(sentence)
     md_writer.print_chapter_sentence(self.when_sentence)
     md_writer.end_chapter()