def test_populator_uses_treasure_source(): layout = MockDungeonLayout() layout.purpose = 'temple' state = Random() manager = MockDungeonManager() template = GuardedTreasureVaultTemplate(1, dungeon_manager=manager) template.alter_dungeon(layout)
def test_dungeon_templates(): layout = MockDungeonLayout() layout.purpose = 'temple' manager = MockDungeonManager() state = Random() template = HauntedTemplate(1, dungeon_manager=manager) template.alter_dungeon(layout)
def test_sewer(): layout = MockDungeonLayout() layout.purpose = 'temple' manager = MockDungeonManager() state = Random() template = InfestedSewerTemplate(1, dungeon_manager=manager) template.alter_dungeon(layout)
def test_taint(): layout = MockDungeonLayout() state = Random(0) manager = MockDungeonManager() layout.node[0]['tags'] = ['populate'] manager = MockDungeonManager() populator = Taint(dungeon_manager=manager, random_state=state) populator.populate(layout, tag='populate')
def test_trap_room_description(): layout = MockDungeonLayout() layout.terrain = 'hills' manager = MockDungeonManager() room = TrapRoom(1, manager) # print(room.room_description()) # def test_lair_chooses_dragon(): # layout = MockDungeonLayout() # with DungeonManager(5, layout) as manager: # event = DragonLair(5, manager) # print(event.choose_dragon())
def test_dungeon_ager_ages_dungeon(): layout = MockDungeonLayout() state = Random(0) furnisher = DungeonFurnisher('stronghold', random_state=state) ager = DungeonAger('age', random_state=state) furnisher.furnish(layout) ager.age(layout)
def test_dungeon_furnisher_adds_descriptions(): layout = MockDungeonLayout() state = Random(0) furnisher = DungeonFurnisher('stronghold', random_state=state) furnished = furnisher.furnish(layout) assert furnished.nodes(data=True)[0][ 'description'] == 'A wide spiralling staircase with many landings and branching corridors.'
def test_dungeon_populator_adds_encounters(): layout = MockDungeonLayout() manager = MockDungeonManager() state = Random(0) populator = OriginalInhabitants(dungeon_manager=manager, random_state=state) populator.populate(layout)
def test_manager_gets_signs(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) manager.add_special_encounter_source('test', source) sign = manager.get_sign('test') assert str(sign) == 'a sign of some scary monsters'
def test_manager_creates_wandering_monsters_table(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) with DungeonManager(1, layout) as manager: template = InfestedCaveTemplate(4, dungeon_manager=manager) template.alter_dungeon(layout)
def test_underground_natives(): layout = MockDungeonLayout() state = Random(0) ager = DungeonAger('age', random_state=state) manager = MockDungeonManager() ager.age(layout) populator = UndergroundNatives(dungeon_manager=manager, random_state=state) populator.populate(layout)
def test_manager_deletes_signs(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) manager.add_special_encounter_source('test', source) sign = manager.get_sign('test') manager.delete_signs('test') assert str(manager.signs['test'][0]) == ''
def test_manager_adds_events(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) with DungeonManager(1, layout) as manager: template = AncientRemnantsTempleTemplate(4, dungeon_manager=manager, random_state=state) template.alter_dungeon(layout)
def test_original_inhabitants(): layout = MockDungeonLayout() state = Random(0) manager = MockDungeonManager() trap_source = MockTrapSource() populator = OriginalInhabitants(dungeon_manager=manager, trap_source=trap_source, random_state=state) populator.populate(layout) dungeon = Dungeon(layout)
def test_manager_only_shows_events_if_there_are_encounters(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) with DungeonManager(1, layout) as manager: template = AncientRemnantsTempleTemplate(4, dungeon_manager=manager) template.alter_dungeon(layout) manager.encounters[template.name] = 0 assert layout.events == []
def test_manager_deletes_encounters(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() manager = DungeonManager(1, layout) manager.add_special_encounter_source('test', source) encounter = manager.get_encounter('test', style='test style') assert manager.encounters['test'] == 1 manager.delete_encounter(encounter) assert manager.encounters['test'] == 0
def test_deleting_encounters_deletes_signs(): state = Random(0) source = MockEncounterSource() layout = MockDungeonLayout() with DungeonManager(1, layout) as manager: manager.add_special_encounter_source('test', source) encounter = manager.get_encounter('test') sign = manager.get_sign('test') # print(sign) manager.delete_encounter(encounter)
def test_integration_from_encounter_manager_to_populator(): layout = MockDungeonLayout() layout.purpose = 'temple' with DungeonManager(1, layout) as manager: template = AncientRemnantsTempleTemplate(4, dungeon_manager=manager) template.alter_dungeon(layout)
def test_libraries(): layout = MockDungeonLayout() state = Random(0) layout.node[0]['tags'].append('library') library = Library() library.add_special_furnishing(layout)
def test_dungeon_entrance_get_url(): layout = MockDungeonLayout() layout.terrain = 'hills' manager = MockDungeonManager() entrance = DungeonEntrance(1, manager)
def test_feywild(): layout = MockDungeonLayout() manager = DungeonManager(2, layout) feywild = FeywildTemplate(2, manager)
def test_lair(): layout = MockDungeonLayout() state = Random(0) manager = MockDungeonManager() populator = Lair(dungeon_manager=manager, random_state=state) populator.populate(layout)
def test_explorers(): layout = MockDungeonLayout() state = Random(0) manager = MockDungeonManager() populator = Explorers(dungeon_manager=manager, random_state=state) populator.populate(layout)
def test_villain_hideout_integration(): layout = MockDungeonLayout() with DungeonManager(5, layout) as manager: event = VillainHideout(5, manager) event.alter_dungeon(layout)
def test_dungeon_ager_adds_tags(): layout = MockDungeonLayout() state = Random(0) furnisher = DungeonFurnisher('stronghold', random_state=state) ager = DungeonAger('shadowfell', random_state=state) ager.age(layout)
def test_villain_hideout_chooses_good_room(): layout = MockDungeonLayout() event = VillainHideout(5, None) assert event.find_best_room(layout) == 4