Exemple #1
0
    def __init__( self, primary=None, dungeon_type=None ):
        # Set dungeon_type to a list of dungeon descriptors to make this faction
        #  name a passable dungeon name.
        super(PolisFaction, self).__init__(reaction=0)
        self.primary = primary or random.choice( self.FRIENDLY_PRIMARY )
        if self.primary in self.FRIENDLY_SECONDARY.keys():
            self.secondary = random.choice( self.FRIENDLY_SECONDARY[ self.primary ] )
        else:
            self.secondary = random.choice( self.RANDOM_SECONDARY )
        orgs = ["Land",] + self.FRIENDLY_ORG.get( self.primary, [] ) * 5 + self.FRIENDLY_ORG.get( self.secondary, [] ) * 2
        adjectives = ["Nice",] + self.FRIENDLY_ADJECTIVE.get( self.primary, [] ) * 2 + self.FRIENDLY_ADJECTIVE.get( self.secondary, [] ) * 2
        icons = ["Peace",] + self.FRIENDLY_ICON.get( self.primary, [] ) * 3 + self.FRIENDLY_ICON.get( self.secondary, [] ) * 2

        if self.primary in self.FRIENDLY_VOICE.keys():
            propername = self.FRIENDLY_VOICE[ self.primary ].gen_word()
        elif self.secondary in self.FRIENDLY_VOICE.keys():
            propername = self.FRIENDLY_VOICE[ self.secondary ].gen_word()
        else:
            propername = namegen.random_style_name()

        # Make a portmanteau name based on the two attributes.
        atts = [self.primary,self.secondary]
        random.shuffle( atts )
        if atts[0] in self.PREFIXES and atts[1] in self.SUFFIXES:
            psname = random.choice(self.PREFIXES[atts[0]])+random.choice(self.SUFFIXES[atts[1]])
        else:
            psname = propername

        if dungeon_type:
            dtype = ["City",] + list( dungeon_type ) * 5
            pattern = random.choice( self.DUNGEON_PATTERN )
        else:
            dtype = orgs
            pattern = random.choice( self.NAME_PATTERN )
        self.name = pattern.format( propername=propername, adjective=random.choice(adjectives), org=random.choice(orgs), icon=random.choice(icons), dungeon=random.choice(dtype), psname=psname )
Exemple #2
0
    def __init__( self, primary=None, dungeon_type=None ):
        # Set dungeon_type to a list of dungeon descriptors to make this faction
        #  name a passable dungeon name.
        super(PolisFaction, self).__init__(reaction=0)
        self.primary = primary or random.choice( self.FRIENDLY_PRIMARY )
        if self.primary in self.FRIENDLY_SECONDARY.keys():
            self.secondary = random.choice( self.FRIENDLY_SECONDARY[ self.primary ] )
        else:
            self.secondary = random.choice( self.RANDOM_SECONDARY )
        orgs = ["Land",] + self.FRIENDLY_ORG.get( self.primary, [] ) * 5 + self.FRIENDLY_ORG.get( self.secondary, [] ) * 2
        adjectives = ["Nice",] + self.FRIENDLY_ADJECTIVE.get( self.primary, [] ) * 2 + self.FRIENDLY_ADJECTIVE.get( self.secondary, [] ) * 2
        icons = ["Peace",] + self.FRIENDLY_ICON.get( self.primary, [] ) * 3 + self.FRIENDLY_ICON.get( self.secondary, [] ) * 2

        if self.primary in self.FRIENDLY_VOICE.keys():
            propername = self.FRIENDLY_VOICE[ self.primary ].gen_word()
        elif self.secondary in self.FRIENDLY_VOICE.keys():
            propername = self.FRIENDLY_VOICE[ self.secondary ].gen_word()
        else:
            propername = namegen.random_style_name()

        # Make a portmanteau name based on the two attributes.
        atts = [self.primary,self.secondary]
        random.shuffle( atts )
        if atts[0] in self.PREFIXES and atts[1] in self.SUFFIXES:
            psname = random.choice(self.PREFIXES[atts[0]])+random.choice(self.SUFFIXES[atts[1]])
        else:
            psname = propername

        if dungeon_type:
            dtype = ["City",] + list( dungeon_type ) * 5
            pattern = random.choice( self.DUNGEON_PATTERN )
        else:
            dtype = orgs
            pattern = random.choice( self.NAME_PATTERN )
        self.name = pattern.format( propername=propername, adjective=random.choice(adjectives), org=random.choice(orgs), icon=random.choice(icons), dungeon=random.choice(dtype), psname=psname )
Exemple #3
0
 def __init__( self, primary=None, dungeon_type=None ):
     # Set dungeon_type to a list of dungeon descriptors to make this faction
     #  name a passable dungeon name.
     super(AntagonistFaction, self).__init__(reaction=-50)
     self.primary = primary or random.choice( self.ANTAGONIST_PRIMARY )
     if self.primary in self.ANTAGONIST_SECONDARY.keys():
         self.secondary = random.choice( self.ANTAGONIST_SECONDARY[ self.primary ] )
     else:
         self.secondary = random.choice( self.RANDOM_SECONDARY )
     orgs = ["League",] + self.ANTAGONIST_ORG.get( self.primary, [] ) * 5 + self.ANTAGONIST_ORG.get( self.secondary, [] ) * 2
     adjectives = ["Evil",] + self.ANTAGONIST_ADJECTIVE.get( self.primary, [] ) * 2 + self.ANTAGONIST_ADJECTIVE.get( self.secondary, [] ) * 2
     icons = ["Doom",] + self.ANTAGONIST_ICON.get( self.primary, [] ) * 3 + self.ANTAGONIST_ICON.get( self.secondary, [] ) * 2
     if self.primary in self.ANTAGONIST_VOICE.keys():
         propername = self.ANTAGONIST_VOICE[ self.primary ].gen_word()
     elif self.secondary in self.ANTAGONIST_VOICE.keys():
         propername = self.ANTAGONIST_VOICE[ self.secondary ].gen_word()
     else:
         propername = namegen.random_style_name()
     if dungeon_type:
         dtype = ["Dungeon",] + list( dungeon_type ) * 5
         pattern = random.choice( self.DUNGEON_PATTERN )
     else:
         dtype = orgs
         pattern = random.choice( self.NAME_PATTERN )
     self.name = pattern.format( propername=propername, adjective=random.choice(adjectives), org=random.choice(orgs), icon=random.choice(icons), dungeon=random.choice(dtype) )
Exemple #4
0
 def __init__( self, primary=None, dungeon_type=None ):
     # Set dungeon_type to a list of dungeon descriptors to make this faction
     #  name a passable dungeon name.
     super(AntagonistFaction, self).__init__(reaction=-50)
     self.primary = primary or random.choice( self.ANTAGONIST_PRIMARY )
     if self.primary in self.ANTAGONIST_SECONDARY.keys():
         self.secondary = random.choice( self.ANTAGONIST_SECONDARY[ self.primary ] )
     else:
         self.secondary = random.choice( self.RANDOM_SECONDARY )
     orgs = ["League",] + self.ANTAGONIST_ORG.get( self.primary, [] ) * 5 + self.ANTAGONIST_ORG.get( self.secondary, [] ) * 2
     adjectives = ["Evil",] + self.ANTAGONIST_ADJECTIVE.get( self.primary, [] ) * 2 + self.ANTAGONIST_ADJECTIVE.get( self.secondary, [] ) * 2
     icons = ["Doom",] + self.ANTAGONIST_ICON.get( self.primary, [] ) * 3 + self.ANTAGONIST_ICON.get( self.secondary, [] ) * 2
     if self.primary in self.ANTAGONIST_VOICE.keys():
         propername = self.ANTAGONIST_VOICE[ self.primary ].gen_word()
     elif self.secondary in self.ANTAGONIST_VOICE.keys():
         propername = self.ANTAGONIST_VOICE[ self.secondary ].gen_word()
     else:
         propername = namegen.random_style_name()
     if dungeon_type:
         dtype = ["Dungeon",] + list( dungeon_type ) * 5
         pattern = random.choice( self.DUNGEON_PATTERN )
     else:
         dtype = orgs
         pattern = random.choice( self.NAME_PATTERN )
     self.name = pattern.format( propername=propername, adjective=random.choice(adjectives), org=random.choice(orgs), icon=random.choice(icons), dungeon=random.choice(dtype) )
Exemple #5
0
 def __init__( self ):
     super(Desert, self).__init__(biome=context.HAB_DESERT,
       desctags=(context.MAP_WILDERNESS,),wall_filter=converter.DesertConverter(),
       mutate=mutator.CellMutator(),prepare=prep.HeightfieldPrep( loground=0.05, higround=0.15 ))
     #self.sprites[maps.SPRITE_WALL] = "terrain_wall_woodfort.png"
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_desert.png"
     #self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_gravel.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     self.name = random.choice( self.NAME_PATTERNS ).format( namegen.random_style_name() )
Exemple #6
0
 def __init__( self ):
     super(Forest, self).__init__(biome=context.HAB_FOREST,
       desctags=(context.MAP_WILDERNESS,),wall_filter=converter.ForestConverter(),
       mutate=mutator.CellMutator())
     #self.sprites[maps.SPRITE_WALL] = "terrain_wall_woodfort.png"
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_forest.png"
     #self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_gravel.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     self.name = random.choice( self.NAME_PATTERNS ).format( namegen.random_style_name() )
 def __init__(self):
     super(Forest, self).__init__(biome=context.HAB_FOREST,
                                  desctags=(context.MAP_WILDERNESS, ),
                                  wall_filter=converter.ForestConverter(),
                                  mutate=mutator.CellMutator())
     #self.sprites[maps.SPRITE_WALL] = "terrain_wall_woodfort.png"
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_forest.png"
     #self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_gravel.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     self.name = random.choice(self.NAME_PATTERNS).format(
         namegen.random_style_name())
    def custom_init( self, nart ):
        """Load dungeon levels, dungeon entrance, CONCLUSION."""
        # Generate the levels
        self.levels = self.get_dungeon_levels( nart, (context.HAB_CAVE,), self.chapter.start_rank, self.chapter.end_rank )
        # Decide on a good name.
        self.dname = random.choice( self.NAME_PATTERNS ).format( namegen.random_style_name() )
        # Connect all the levels, and name them.
        self.install_dungeon( nart, self.levels, self.elements[ "LOCALE" ], self.dname )

        # Load the conclusion.
        self.add_sub_plot( nart, "CONCLUSION", PlotState(rank=self.chapter.end_rank,elements={"FINAL_DUNGEON":self.levels[-1]}).based_on( self ) )

        return True
 def __init__(self):
     super(Desert,
           self).__init__(biome=context.HAB_DESERT,
                          desctags=(context.MAP_WILDERNESS, ),
                          wall_filter=converter.DesertConverter(),
                          mutate=mutator.CellMutator(),
                          prepare=prep.HeightfieldPrep(loground=0.05,
                                                       higround=0.15))
     #self.sprites[maps.SPRITE_WALL] = "terrain_wall_woodfort.png"
     self.sprites[maps.SPRITE_GROUND] = "terrain_ground_desert.png"
     #self.sprites[maps.SPRITE_FLOOR] = "terrain_floor_gravel.png"
     self.sprites[maps.SPRITE_CHEST] = "terrain_chest_wood.png"
     self.name = random.choice(self.NAME_PATTERNS).format(
         namegen.random_style_name())
Exemple #10
0
 def __init__( self, fac=None ):
     super(TunnelDungeon, self).__init__(biome=context.HAB_TUNNELS,
       desctags=[context.MAP_DUNGEON,context.MAP_GODOWN,],
       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() )
 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())
Exemple #13
0
    def custom_init(self, nart):
        """Load dungeon levels, dungeon entrance, CONCLUSION."""
        # Generate the levels
        self.levels = self.get_dungeon_levels(nart, (context.HAB_CAVE, ),
                                              self.chapter.start_rank,
                                              self.chapter.end_rank)
        # Decide on a good name.
        self.dname = random.choice(self.NAME_PATTERNS).format(
            namegen.random_style_name())
        # Connect all the levels, and name them.
        self.install_dungeon(nart, self.levels, self.elements["LOCALE"],
                             self.dname)

        # Load the conclusion.
        self.add_sub_plot(
            nart, "CONCLUSION",
            PlotState(rank=self.chapter.end_rank,
                      elements={
                          "FINAL_DUNGEON": self.levels[-1]
                      }).based_on(self))

        return True
    def custom_init(self, nart):
        prev = self.elements["PREV"]
        next = self.elements["NEXT"]
        well = self.seek_element(nart,
                                 "_WELL",
                                 self.seek_well,
                                 scope=prev,
                                 check_subscenes=False)
        well.plot_locked = True
        myzone2 = self.seek_element(nart,
                                    "_N_ROOM",
                                    self.seek_entrance_room,
                                    scope=next,
                                    check_subscenes=False,
                                    must_find=False)
        if not myzone2:
            myzone2 = self.register_element(
                "_N_ROOM", randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, )),
                "NEXT")
        stairs_2 = waypoints.GateDoor()
        self.register_element("_EXIT", stairs_2, "_N_ROOM")
        self._the_well_has_been_used = False
        if next.rank > prev.rank:
            # We're gonna add a dungeon.
            self.levels = list()
            pstate = PlotState(elements={
                "DUNGEON_TYPE": (context.HAB_TUNNELS, context.DES_WATER)
            }).based_on(self)
            for l in range(prev.rank + 1, next.rank + 1):
                pstate.rank = l
                sp = self.add_sub_plot(nart, "DUNGEON_LEVEL", pstate)
                if sp:
                    self.levels.append(sp.elements["LOCALE"])

            # Decide on a good name.
            dname = random.choice(self.NAME_PATTERNS).format(
                prev, namegen.random_style_name())

            # Connect all the levels, and name them.
            prv = self.levels[0]
            prv.name = "{0}, Lvl{1}".format(dname, 1)
            if len(self.levels) > 1:
                n = 2
                for nxt in self.levels[1:]:
                    nxt.name = "{0}, Lvl{1}".format(dname, n)
                    n += 1
                    pstate = PlotState(rank=nxt.rank,
                                       elements={
                                           "PREV": prv,
                                           "NEXT": nxt
                                       }).based_on(self)
                    sp = self.add_sub_plot(nart, "CONNECT", pstate)
                    prv = nxt

            # Connect to well and black market.
            stairs_3 = waypoints.StairsUp()
            stairs_4 = waypoints.StairsDown()
            myzone_3 = randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, ),
                                                parent=self.levels[0])
            myzone_4 = randmaps.rooms.SharpRoom(tags=(context.GOAL, ),
                                                parent=self.levels[-1])
            myzone_3.contents.append(stairs_3)
            myzone_4.contents.append(stairs_4)

            self.well_destination = self.levels[0]
            self.well_otherside = stairs_3
            stairs_3.destination = prev
            stairs_3.otherside = well

            stairs_2.destination = self.levels[-1]
            stairs_2.otherside = stairs_4
            stairs_4.destination = next
            stairs_4.otherside = stairs_2
            self.move_element(next, self.levels[-1])
            self.move_element(self.levels[0], prev)
        else:
            self.well_destination = next
            self.well_otherside = stairs_2
            stairs_2.destination = prev
            stairs_2.otherside = well
            self.move_element(next, prev)
        return True
Exemple #15
0
    def custom_init( self, nart ):
        prev = self.elements[ "PREV" ]
        next = self.elements[ "NEXT" ]
        well = self.seek_element( nart, "_WELL", self.seek_well, scope=prev, check_subscenes=False )
        well.plot_locked = True
        myzone2 = self.seek_element( nart, "_N_ROOM", self.seek_entrance_room, scope=next, check_subscenes=False, must_find=False )
        if not myzone2:
            myzone2 = self.register_element( "_N_ROOM", randmaps.rooms.SharpRoom(tags=(context.ENTRANCE,)), "NEXT" )
        stairs_2 = waypoints.GateDoor()
        self.register_element( "_EXIT", stairs_2, "_N_ROOM" )
        self._the_well_has_been_used = False
        if next.rank > prev.rank:
            # We're gonna add a dungeon.
            self.levels = list()
            pstate = PlotState( elements={"DUNGEON_TYPE":(context.HAB_TUNNELS,context.DES_WATER)} ).based_on( self )
            for l in range( prev.rank+1, next.rank+1 ):
                pstate.rank = l
                sp = self.add_sub_plot( nart, "DUNGEON_LEVEL", pstate )
                if sp:
                    self.levels.append( sp.elements[ "LOCALE" ] )

            # Decide on a good name.
            dname = random.choice( self.NAME_PATTERNS ).format( prev, namegen.random_style_name() )

            # Connect all the levels, and name them.
            prv = self.levels[0]
            prv.name = "{0}, Lvl{1}".format( dname, 1 )
            if len( self.levels ) > 1:
                n = 2
                for nxt in self.levels[1:]:
                    nxt.name = "{0}, Lvl{1}".format( dname, n )
                    n += 1
                    pstate = PlotState( rank = nxt.rank, elements={"PREV":prv,"NEXT":nxt} ).based_on( self )
                    sp = self.add_sub_plot( nart, "CONNECT", pstate )
                    prv = nxt

            # Connect to well and black market.
            stairs_3 = waypoints.StairsUp()
            stairs_4 = waypoints.StairsDown()
            myzone_3 = randmaps.rooms.SharpRoom(tags=(context.ENTRANCE,),parent=self.levels[0])
            myzone_4 = randmaps.rooms.SharpRoom(tags=(context.GOAL,),parent=self.levels[-1])
            myzone_3.contents.append( stairs_3 )
            myzone_4.contents.append( stairs_4 )

            self.well_destination = self.levels[0]
            self.well_otherside = stairs_3
            stairs_3.destination = prev
            stairs_3.otherside = well

            stairs_2.destination = self.levels[-1]
            stairs_2.otherside = stairs_4
            stairs_4.destination = next
            stairs_4.otherside = stairs_2
            self.move_element( next, self.levels[-1] )
            self.move_element( self.levels[0], prev )
        else:
            self.well_destination = next
            self.well_otherside = stairs_2
            stairs_2.destination = prev
            stairs_2.otherside = well
            self.move_element( next, prev )
        return True
Exemple #16
0
 def gen_name( self ):
     return random.choice( self.NAME_PATTERNS ).format( namegen.random_style_name() )