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(" ","-")+")"))
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()
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