def __init__(self, fac=None):
     super(TempleArchitecture,
           self).__init__(biome=context.HAB_BUILDING,
                          desctags=[context.MAP_GOUP, context.MTY_PRIEST],
                          wall_filter=converter.BasicConverter())
     self.sprites[maps.SPRITE_WALL] = random.choice(self.WALL_OPTIONS)
     self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_diamond.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_metal.png"
     self.sprites[maps.SPRITE_INTERIOR] = "terrain_int_temple.png"
 def __init__(self, biome=None, fac=None):
     super(Village,
           self).__init__(biome=context.HAB_BUILDING,
                          desctags=[context.CIVILIZED, context.MAP_GOUP],
                          wall_filter=converter.BasicConverter())
     wall_options = self.DEFAULT_WALL_OPTIONS + self.CUSTOM_WALL_OPTIONS.get(
         biome, [])
     self.sprites[maps.SPRITE_WALL] = random.choice(wall_options)
     self.sprites[maps.SPRITE_FLOOR] = random.choice(self.FLOOR_OPTIONS)
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
class RandomScene(Room):
    """The blueprint for a scene."""
    DEFAULT_ROOM = rooms.FuzzyRoom
    WALL_FILTER = converter.BasicConverter()
    PREPARE = prep.BasicPrep()

    def __init__(self,
                 myscene,
                 default_room=None,
                 wall_filter=None,
                 gapfill=None,
                 mutate=None,
                 decorate=None):
        super(RandomScene, self).__init__(myscene.width, myscene.height)
        self.gb = myscene
        self.area = pygame.Rect(0, 0, myscene.width, myscene.height)
        self.contents = myscene.contents
        if default_room:
            self.DEFAULT_ROOM = default_room
        if wall_filter:
            self.WALL_FILTER = wall_filter
        if gapfill:
            self.GAPFILL = gapfill
        if mutate:
            self.MUTATE = mutate
        if decorate:
            self.DECORATE = decorate

    def make(self):
        """Assemble this stuff into a real map."""
        # Conduct the five steps of building a level.
        self.PREPARE(self)  # Only the scene generator gets to prepare
        self.step_two(self.gb)  # Arrange contents for self, then children
        self.step_three(self.gb)  # Connect contents for self, then children
        self.step_four(self.gb)  # Mutate for self, then children
        self.step_five(self.gb)  # Render for self, then children

        # Convert undefined walls to real walls.
        self.WALL_FILTER(self)
        self.gb.validate_terrain()

        self.step_six(self.gb)  # Deploy for self, then children
        self.step_seven(self.gb)  # Decorate for self, then children

        self.clean_contents()

        return self.gb

    def clean_contents(self):
        # Remove unimportant things from the contents.
        for t in self.gb.contents[:]:
            if not hasattr(t, "pos"):
                if isinstance(t, maps.Scene):
                    t.parent_scene = self.gb
                self.gb.contents.remove(t)
 def __init__(self, fac=None):
     super(CavernDungeon, self).__init__(
         biome=context.HAB_CAVE,
         desctags=[context.MAP_DUNGEON, context.MAP_GODOWN],
         wall_filter=converter.BasicConverter(),
         mutate=mutator.CellMutator())
     self.sprites[maps.SPRITE_WALL] = random.choice(self.WALL_OPTIONS)
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_under.png"
     self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_gravel.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     # Do the custom decorating now.
     if fac:
         if fac.primary in self.CUSTOM_DECOR_TYPES.keys():
             a, b = self.CUSTOM_DECOR_TYPES[fac.primary]
             self.decorate = a(**b)
         elif fac.secondary in self.CUSTOM_DECOR_TYPES.keys():
             a, b = self.CUSTOM_DECOR_TYPES[fac.secondary]
             self.decorate = a(**b)
     self.name = random.choice(self.NAME_PATTERNS).format(
         namegen.random_style_name())
 def __init__(self, fac=None):
     super(BuildingDungeon,
           self).__init__(biome=context.HAB_BUILDING,
                          desctags=[
                              context.MAP_DUNGEON, context.MAP_GOUP,
                              context.MTY_HUMANOID
                          ],
                          wall_filter=converter.BasicConverter())
     self.sprites[maps.SPRITE_WALL] = random.choice(self.WALL_OPTIONS)
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_under.png"
     self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_dungeon.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     if fac:
         if fac.primary in self.CUSTOM_DECOR_TYPES.keys():
             a, b = self.CUSTOM_DECOR_TYPES[fac.primary]
             self.decorate = a(**b)
         elif fac.secondary in self.CUSTOM_DECOR_TYPES.keys():
             a, b = self.CUSTOM_DECOR_TYPES[fac.secondary]
             self.decorate = a(**b)
     self.name = random.choice(self.NAME_PATTERNS).format(
         namegen.random_style_name())