Exemplo n.º 1
0
    def custom_init( self, nart ):
        """Create map, fill with city + services."""
        myscene = maps.Scene( 129, 129, sprites={maps.SPRITE_GROUND: "terrain_ground_forest.png", maps.SPRITE_WALL: "terrain_wall_lightbrick.png"},
            biome=context.HAB_FOREST, setting=self.setting,
            desctags=(context.MAP_WILDERNESS,context.DES_CIVILIZED,) )
        mymapgen = mapgen.EdgeOfCivilization( myscene )
        self.register_scene( nart, myscene, mymapgen, ident="LOCALE" )

        castle = self.register_element( "CITY", mapgen.CastleRoom( width=35,height=35,tags=(context.CIVILIZED,context.ROOM_PUBLIC), parent=myscene ) )
        myroom = mapgen.FuzzyRoom( tags=(context.ENTRANCE,), parent=castle )
        myteam = teams.Team( strength=0, default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append( myteam )
        myent = waypoints.Well()
        myroom.contents.append( myent )
        myroom.contents.append( monsters.generate_npc(team=myteam) )
        myroom.contents.append( monsters.generate_npc(team=myteam) )

        self.register_element( "ENTRANCE", myent )

        self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_CITY, myent, True )

        self.add_sub_plot( nart, "CITY_GENERALSTORE" )
        self.add_sub_plot( nart, "CITY_LIBRARY" )
        self.add_sub_plot( nart, "CITY_INN" )
        self.add_sub_plot( nart, "CITY_TEMPLE" )
        self.add_sub_plot( nart, "CITY_EXTRASHOP" )
        for t in range( random.randint(1,4) ):
            self.add_sub_plot( nart, "ENCOUNTER" )

        self.add_sub_plot( nart, "CITY_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )


        return True
Exemplo n.º 2
0
    def custom_init(self, nart):
        """Create map, fill with city + services."""
        biome = self.elements.setdefault("BIOME",
                                         randmaps.architect.make_wilderness())
        archi = self.register_element("ARCHITECTURE",
                                      randmaps.architect.Village(biome.biome))
        culture = self.elements.setdefault("CULTURE", teams.PolisFaction())
        myscene, mymapgen = randmaps.architect.design_scene(
            90,
            90,
            randmaps.EdgeOfCivilization,
            biome,
            secondary=archi,
            setting=self.setting)
        myscene.desctags.append(context.DES_CIVILIZED)
        self.register_scene(nart, myscene, mymapgen, ident="LOCALE")

        castle = self.register_element(
            "CITY",
            randmaps.rooms.CastleRoom(width=35,
                                      height=35,
                                      tags=(context.CIVILIZED,
                                            context.ROOM_PUBLIC),
                                      parent=myscene))
        myroom = randmaps.rooms.FuzzyRoom(tags=(context.ENTRANCE, ),
                                          parent=castle)
        myteam = teams.Team(strength=0,
                            default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append(myteam)
        myent = waypoints.Well()
        myroom.contents.append(myent)
        myroom.contents.append(monsters.generate_npc(team=myteam, fac=culture))
        myroom.contents.append(monsters.generate_npc(team=myteam, fac=culture))

        self.register_element("ENTRANCE", myent)

        self.chapter.world.add_entrance(myscene, myscene.name, worlds.W_CITY,
                                        myent, True)

        self.add_sub_plot(nart, "CITY_GENERALSTORE")
        self.add_sub_plot(nart, "CITY_LIBRARY")
        self.add_sub_plot(nart, "CITY_INN")
        self.add_sub_plot(nart, "CITY_TEMPLE")
        self.add_sub_plot(nart, "CITY_EXTRASHOP")
        for t in range(random.randint(1, 4)):
            self.add_sub_plot(nart, "ENCOUNTER")
        self.add_sub_plot(nart, "SPECIAL_FEATURE")
        self.add_sub_plot(nart, "TEST_FEATURE", necessary=False)

        self.add_sub_plot(
            nart, "CITY_STORY",
            PlotState(rank=self.random_rank_in_chapter()).based_on(self))

        return True
Exemplo n.º 3
0
 def custom_init( self, nart ):
     # Add a group of humanoids, hostile reaction score.
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator( scene )
     room = mygen.DEFAULT_ROOM()
     myteam = self.register_element( "TEAM", teams.Team( default_reaction=-50, strength=0 ) )
     room.contents.append( myteam )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     p1 = self.register_element( "NPC1", monsters.generate_npc(team=myteam,job=random.choice( self.FIGHTERS ),upgrade=True,rank=self.rank,fac=scene.fac), dident="_ROOM")
     p2 = self.register_element( "NPC2", monsters.generate_npc(team=myteam,job=random.choice( self.THIEVES ),upgrade=True,rank=self.rank,fac=scene.fac), dident="_ROOM")
     p3 = self.register_element( "NPC3", monsters.generate_npc(team=myteam,job=random.choice( self.PRIESTS ),upgrade=True,rank=self.rank,fac=scene.fac), dident="_ROOM")
     p4 = self.register_element( "NPC4", monsters.generate_npc(team=myteam,job=random.choice( self.MAGES ),upgrade=True,rank=self.rank,fac=scene.fac), dident="_ROOM")
     self.add_sub_plot( nart, "RESOURCE_NPCCONVO", PlotState( elements={"NPC":random.choice((p1,p2,p3,p4))} ).based_on( self ) )
     return True
Exemplo n.º 4
0
    def custom_init( self, nart ):
        scene = self.elements.get("LOCALE")
        mygen = nart.get_map_generator( scene )

        # Bridge room
        bridge_room = randmaps.rooms.BottleneckRoom()
        bridge_room.special_c[ "door" ] = self.register_element("_DOOR",waypoints.LockableDoor(plot_locked=True))
        mygen.special_c[ "bridge" ] = bridge_room
        self.register_element( "_BRIDGE_ROOM", bridge_room, dident="LOCALE" )

        # Key room
        key_room = mygen.DEFAULT_ROOM( tags = (context.ENTRANCE,) )
        myteam = self.register_element("TEAM",teams.Team(default_reaction=-999,
         rank=self.rank, strength=150, habitat=scene.get_encounter_request() ))
        key_room.contents.append( myteam )
        self.register_element( "_KEY_ROOM", key_room, dident="LOCALE" )
        self._ready = True
        npc = self.register_element( "NPC",monsters.generate_npc(team=myteam,
          fac=scene.fac,rank=self.rank,upgrade=True),dident="_KEY_ROOM" )
        myteam.boss = npc


        # Post-bridge encounter
        room = mygen.DEFAULT_ROOM()
        mygen.special_c[ "after_bridge" ] = room
        myhabitat=scene.get_encounter_request()
        myhabitat[ context.MTY_HUMANOID ] = context.PRESENT
        myhabitat[ context.MTY_FIGHTER ] = context.MAYBE
        room.contents.append( teams.Team(default_reaction=-999, rank=self.rank, 
          strength=150, habitat=myhabitat ) )
        self.register_element( "_ROOM", room, dident="LOCALE" )

        return True
Exemplo n.º 5
0
 def custom_init( self, nart ):
     # Find a public room. Stick the generated NPC there.
     if not self.seek_element( nart, "_PREMADE", self.seek_npc, must_find=False ):
         room = self.seek_element( nart, "_ROOM", self.seek_room )
         npc = monsters.generate_npc( job=self.elements[ "JOB" ] )
         self.register_element( "_NPC", npc, dident="_ROOM" )
     return True
Exemplo n.º 6
0
 def custom_init( self, nart ):
     scene = self.elements.get("LOCALE")
     room = randmaps.rooms.SharpRoom()
     room.DECORATE = randmaps.decor.LibraryDec(win=None)
     # Create a chest, and stock it with magical goodies.
     mychest = waypoints.LargeChest()
     mychest.stock(self.rank,item_types=(items.SCROLL,items.POTION))
     room.contents.append( mychest )
     room.contents.append( waypoints.Bookshelf() )
     for t in range( random.randint(2,3) ):
         myitem = items.generate_scroll( self.rank + 1 )
         if myitem:
             myitem.identified = True
             mychest.contents.append( myitem )
     # Create a team for our spellcasters.
     myhabitat = scene.get_encounter_request()
     myhabitat[(context.MTY_MAGE,context.MTY_PRIEST)] = True
     myteam = self.register_element( "TEAM", teams.Team(default_reaction=-999, rank=self.rank, 
       strength=120, habitat=myhabitat, hodgepodge = True ) )
     room.contents.append( myteam )
     boss = monsters.generate_npc(team=myteam,upgrade=True,rank=self.rank+1,job=random.choice(self.JOBS),fac=scene.fac)
     myitem = items.generate_special_item( self.rank )
     if myitem:
         boss.contents.append( myitem )
     room.contents.append( boss )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     return True
Exemplo n.º 7
0
    def custom_init( self, nart ):
        """Install the dungeon."""
        # Create the intermediary level.
        interior = maps.Scene( 65,65, sprites={maps.SPRITE_WALL: "terrain_wall_darkbrick.png", maps.SPRITE_GROUND: "terrain_ground_under.png", maps.SPRITE_FLOOR: "terrain_floor_tile.png" },
            fac=self.elements["ANTAGONIST"],
            biome=context.HAB_TUNNELS, setting=self.setting, desctags=(context.MAP_DUNGEON,) )
        igen = randmaps.SubtleMonkeyTunnelScene( interior )
        self.register_scene( nart, interior, igen, ident="LOCALE" )

        # Create the goal room.
        team = teams.Team(default_reaction=-999, rank=self.rank, strength=50, habitat=interior.get_encounter_request(),
         fac=self.elements["ANTAGONIST"], respawn=False )
        int_goalroom = randmaps.rooms.SharpRoom( tags=(context.GOAL,), parent=interior )
        int_goalroom.contents.append( team )

        # Create the guardian.
        boss = self.register_element( "_BOSS", monsters.generate_npc(team=team,upgrade=True,rank=self.rank+3) )
        self.enemy_defeated = False
        interior.name = "{}'s Chamber".format( boss )
        int_goalroom.contents.append( boss )

        for t in range( random.randint(2,4) ):
            self.add_sub_plot( nart, "ENCOUNTER" )

        # Connect to previous level.
        self.add_sub_plot( nart, "CONNECT", PlotState( elements={"PREV":self.elements["LAST_DUNGEON"],"NEXT":interior} ).based_on( self ) )

        # Add a BARDIC_FRESHSTART to install the dungeon somewhere else.
        sp = self.add_sub_plot( nart, "BARDIC_FRESHSTART" )
        self.register_element( "DESTINATION", sp.elements.get( "LOCALE" ) )
        return True
    def custom_init(self, nart):
        """Create the crypt and add a person saying where."""
        myscene = maps.Scene(129,
                             129,
                             sprites={
                                 maps.SPRITE_GROUND:
                                 "terrain_ground_forest.png",
                                 maps.SPRITE_WALL: "terrain_wall_darkbrick.png"
                             },
                             biome=context.HAB_FOREST,
                             setting=self.setting,
                             desctags=(
                                 context.MAP_WILDERNESS,
                                 context.DES_CIVILIZED,
                             ))
        myscene.name = "Crypt Thing"
        mymapgen = randmaps.ForestScene(myscene)
        self.register_scene(nart, myscene, mymapgen, ident="WILDERNESS")

        myroom = randmaps.rooms.FuzzyRoom(tags=(context.ENTRANCE, ),
                                          parent=myscene,
                                          anchor=randmaps.anchors.northwest)
        myent = waypoints.Well()
        myroom.contents.append(myent)

        wme = self.chapter.world.add_entrance(myscene, myscene.name,
                                              worlds.W_DUNGEON, myent, False)
        self.wme = wme

        room = self.seek_element(nart, "_ROOM", self.seek_room)
        npc = monsters.generate_npc(job=characters.Necromancer)
        self.register_element("_NPC", npc, dident="_ROOM")

        return True
Exemplo n.º 9
0
    def custom_init( self, nart ):
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.SWORD_SIGN
        exterior.special_c[ "sign2" ] = maps.SHIELD_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        archi = self.elements.setdefault( "ARCHITECTURE", randmaps.architect.Village() )
        culture = self.elements.get("CULTURE")
        interior,igen = randmaps.architect.design_scene( 50, 50, randmaps.BuildingScene,
            archi, setting=self.setting,fac=culture )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1
        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( maps.PILED_GOODS )
        int_mainroom.contents.append( maps.PILED_GOODS )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec()
        npc = monsters.generate_npc( job=monsters.base.Merchant,fac=culture )
        npc.tags.append( context.CHAR_SHOPKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
        gate_1.mini_map_label = "General Store"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )
        self.shop = self.register_element( "SHOPSERVICE", services.Shop( rank=self.rank, turnover=3, npc=npc ) )
        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
        return True
Exemplo n.º 10
0
 def custom_init( self, nart ):
     exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
     exterior.special_c[ "window" ] = maps.SMALL_WINDOW
     exterior.special_c[ "sign1" ] = maps.SWORD_SIGN
     exterior.special_c[ "sign2" ] = maps.SHIELD_SIGN
     self.register_element( "_EXTERIOR", exterior, dident="CITY" )
     interior = maps.Scene( 50,50, sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
         biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
     igen = mapgen.BuildingScene( interior )
     gate_1 = waypoints.GateDoor()
     gate_2 = waypoints.GateDoor()
     gate_1.destination = interior
     gate_1.otherside = gate_2
     gate_2.destination = self.elements.get( "LOCALE" )
     gate_2.otherside = gate_1
     self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
     exterior.special_c[ "door" ] = gate_1
     int_mainroom = mapgen.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
     int_mainroom.contents.append( gate_2 )
     int_mainroom.contents.append( maps.PILED_GOODS )
     int_mainroom.contents.append( maps.PILED_GOODS )
     gate_2.anchor = mapgen.south
     int_mainroom.decorate = mapgen.GeneralStoreDec()
     npc = monsters.generate_npc( job=monsters.base.Merchant )
     npc.tags.append( context.CHAR_SHOPKEEPER )
     interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
     gate_1.mini_map_label = "General Store"
     int_mainroom.contents.append( npc )
     self.register_element( "SHOPKEEPER", npc )
     self.shop = self.register_element( "SHOPSERVICE", services.Shop( rank=self.rank+3 ) )
     self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
     return True
Exemplo n.º 11
0
    def custom_init(self, nart):
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.STAINED_GLASS
        exterior.special_c["sign1"] = maps.ANKH_SIGN
        self.register_element("_EXTERIOR", exterior, dident="CITY")

        locale = self.elements.get("LOCALE")

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault("ARCHITECTURE",
                                         randmaps.architect.Village())
        interior, igen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.BuildingScene,
            archi,
            setting=self.setting,
            fac=culture)
        interior.sprites[maps.SPRITE_FLOOR] = "terrain_floor_bigtile.png"
        interior.sprites[maps.SPRITE_INTERIOR] = "terrain_int_temple.png"
        interior.name = "{0} Temple".format(locale)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_1.mini_map_label = "Temple"
        gate_2.destination = locale
        gate_2.otherside = gate_1

        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")

        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        int_mainroom.contents.append(maps.ANKH_ALTAR)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TempleDec(
            win=maps.STAINED_GLASS)

        npc = monsters.generate_npc(job=random.choice(
            (characters.Priest, characters.Priest, characters.Priest,
             characters.Priest, characters.Priest, characters.Priest,
             characters.Priest, characters.Druid, characters.Druid,
             characters.Priest, characters.Monk, characters.Knight)),
                                    fac=culture)
        npc.tags.append(context.CHAR_HEALER)
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)

        self.shop = services.Temple()

        return True
Exemplo n.º 12
0
 def custom_init( self, nart ):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator( scene )
     room = randmaps.rooms.CastleRoom( width=21,height=21,tags=(context.GOAL,))
     myhabitat = scene.get_encounter_request()
     myhabitat[ context.MTY_HUMANOID ] = True
     myhabitat[ (context.MTY_FIGHTER,context.MTY_THIEF) ] = context.MAYBE
     myteam = teams.Team(default_reaction=-999, rank=self.rank, 
       strength=150, habitat=myhabitat, fac=scene.fac )
     room.contents.append( myteam )
     room2 = randmaps.rooms.FuzzyRoom(parent=room)
     for t in range( random.randint( 3, 5 ) ):
         mychest = random.choice(( waypoints.SmallChest, waypoints.MediumChest, waypoints.LargeChest, waypoints.Cart ))()
         mychest.stock( self.rank )
         room2.contents.append( mychest )
     room3 = randmaps.rooms.FuzzyRoom(parent=room)
     mychest = waypoints.Cart()
     mychest.stock(self.rank)
     room3.contents.append( mychest )
     room3.contents.append( maps.CAULDRON )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     boss = self.register_element( "NPC1",
      monsters.generate_npc(team=myteam,upgrade=True,fac=scene.fac,rank=self.rank+random.randint(0,1)),
      dident="_ROOM")
     for t in range( 2 ):
         myitem = items.generate_special_item( self.rank )
         if myitem:
             boss.contents.append( myitem )
     return True
Exemplo n.º 13
0
 def custom_init( self, nart ):
     locale = self.seek_element( nart, "_LOCALE", self.seek_scene )
     exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
     exterior.special_c[ "window" ] = maps.CASTLE_WINDOW
     exterior.special_c[ "sign1" ] = maps.SWORD_SIGN
     exterior.special_c[ "sign2" ] = maps.SHIELD_SIGN
     self.register_element( "_EXTERIOR", exterior, dident="_LOCALE" )
     interior = maps.Scene( 50,50, sprites={maps.SPRITE_WALL: "terrain_wall_darkbrick.png", maps.SPRITE_FLOOR: "terrain_floor_stone.png" },
         biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
     igen = mapgen.BuildingScene( interior )
     gate_1 = waypoints.GateDoor()
     gate_2 = waypoints.GateDoor()
     gate_1.destination = interior
     gate_1.otherside = gate_2
     gate_2.destination = self.elements.get( "_LOCALE" )
     gate_2.otherside = gate_1
     self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="_LOCALE" )
     exterior.special_c[ "door" ] = gate_1
     int_mainroom = mapgen.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
     int_mainroom.contents.append( gate_2 )
     int_mainroom.contents.append( maps.PILED_GOODS )
     int_mainroom.contents.append( maps.PILED_GOODS )
     gate_2.anchor = mapgen.south
     int_mainroom.decorate = mapgen.GeneralStoreDec(win=maps.CASTLE_WINDOW)
     npc = monsters.generate_npc( job=self.elements["JOB"] )
     npc.tags.append( context.CHAR_SHOPKEEPER )
     interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
     gate_1.mini_map_label = "Dungeon Shop"
     int_mainroom.contents.append( npc )
     self.register_element( "SHOPKEEPER", npc )
     self.shop = self.register_element( "SHOPSERVICE", services.Shop( rank=locale.rank+3, allow_magic=True ) )
     self.first_time = True
     return True
Exemplo n.º 14
0
 def custom_init(self, nart):
     # Add a group of humanoids, hostile reaction score.
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator(scene)
     room = mygen.DEFAULT_ROOM()
     myteam = self.register_element(
         "TEAM", teams.Team(default_reaction=-50, strength=0))
     room.contents.append(myteam)
     self.register_element("_ROOM", room, dident="LOCALE")
     p1 = self.register_element("NPC1",
                                monsters.generate_npc(team=myteam,
                                                      job=random.choice(
                                                          self.FIGHTERS),
                                                      upgrade=True,
                                                      rank=self.rank,
                                                      fac=scene.fac),
                                dident="_ROOM")
     p2 = self.register_element("NPC2",
                                monsters.generate_npc(team=myteam,
                                                      job=random.choice(
                                                          self.THIEVES),
                                                      upgrade=True,
                                                      rank=self.rank,
                                                      fac=scene.fac),
                                dident="_ROOM")
     p3 = self.register_element("NPC3",
                                monsters.generate_npc(team=myteam,
                                                      job=random.choice(
                                                          self.PRIESTS),
                                                      upgrade=True,
                                                      rank=self.rank,
                                                      fac=scene.fac),
                                dident="_ROOM")
     p4 = self.register_element("NPC4",
                                monsters.generate_npc(team=myteam,
                                                      job=random.choice(
                                                          self.MAGES),
                                                      upgrade=True,
                                                      rank=self.rank,
                                                      fac=scene.fac),
                                dident="_ROOM")
     self.add_sub_plot(
         nart, "RESOURCE_NPCCONVO",
         PlotState(elements={
             "NPC": random.choice((p1, p2, p3, p4))
         }).based_on(self))
     return True
Exemplo n.º 15
0
    def custom_init(self, nart):
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        exterior.special_c["sign1"] = maps.WEAPONS_SIGN
        self.register_element("_EXTERIOR", exterior, dident="CITY")

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault("ARCHITECTURE",
                                         randmaps.architect.Village())
        interior, igen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.BuildingScene,
            archi,
            setting=self.setting,
            fac=culture)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1

        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")

        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        #        int_mainroom.contents.append( waypoints.Anvil() )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.WeaponShopDec()

        npc = monsters.generate_npc(job=monsters.base.Merchant, fac=culture)
        npc.tags.append(context.CHAR_SHOPKEEPER)
        interior.name = random.choice(self.NAME_PATTERNS).format(npc)
        gate_1.mini_map_label = "Weapon Shop"
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)

        self.shop = self.register_element(
            "SHOPSERVICE",
            services.Shop(ware_types=services.WEAPON_STORE,
                          rank=self.rank + 1,
                          allow_misc=False,
                          num_items=25,
                          npc=npc))

        return True
Exemplo n.º 16
0
 def custom_init(self, nart):
     # Find a public room. Stick the generated NPC there.
     if not self.seek_element(nart, "_PREMADE", self.seek_npc, must_find=False):
         room = self.seek_element(nart, "_ROOM", self.seek_room)
         npc = monsters.generate_npc(job=self.elements["JOB"])
         self.register_element("NPC", npc, dident="_ROOM")
         # Maybe give this NPC something extra to do.
         if random.randint(1, 6) == 2:
             self.add_sub_plot(nart, "RESOURCE_NPCCONVO")
     return True
Exemplo n.º 17
0
    def custom_init( self, nart ):
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.DRINK_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="LOCALE" )
        interior = maps.Scene( 50,50, sprites={maps.SPRITE_WALL: "terrain_wall_wood.png",maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
            biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
        igen = randmaps.BuildingScene( interior )
        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1
        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( random.randint(12,20), random.randint(12,20),
         tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( waypoints.Bookshelf() )
        int_mainroom.contents.append( maps.FIREPLACE )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TavernDec(win=maps.SMALL_WINDOW)
        npc = monsters.generate_npc(job=monsters.base.Innkeeper)
        npc.tags.append( context.CHAR_INNKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc, random.choice(monsters.MONSTER_LIST).name, random.choice(monsters.MONSTER_LIST).name )
        gate_1.mini_map_label = "Traveler's Inn"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )
        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )
        # Add at least one visitor.
        npc = self.register_element( "NPC", monsters.generate_npc( rank=self.rank+2,upgrade=True ) )
        self.add_sub_plot( nart, "RESOURCE_NPCCONVO" )
        int_mainroom.contents.append( npc )

        int_bedroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,), parent=interior )
        int_bedroom.contents.append( maps.LIGHT_STAND )
        int_bedroom.DECORATE = randmaps.decor.BedroomDec()
        self.shop = services.Inn()
        return True
Exemplo n.º 18
0
 def custom_init( self, nart ):
     """Create the cousin, add puzzle subplot."""
     npc = self.elements["SHOPKEEPER"]
     the_room = self.seek_element( nart, "_THE_ROOM", self.room_seeker, scope=self.elements.get("BUILDING_INT") )
     the_cousin = monsters.generate_npc(species=npc.species.__class__)
     self.register_element( "TARGET", the_cousin )
     self.started = False
     self.dated = False
     self.add_sub_plot( nart, "SB_DATE", PlotState().based_on( self ) )
     self.add_sub_plot( nart, "REWARD", PlotState(elements={"ORIGIN":npc}).based_on( self ), ident="next" )
     return True
Exemplo n.º 19
0
 def custom_init(self, nart):
     # Find a public room. Stick the generated NPC there.
     if not self.seek_element(
             nart, "_PREMADE", self.seek_npc, must_find=False):
         room = self.seek_element(nart, "_ROOM", self.seek_room)
         npc = monsters.generate_npc(job=self.elements["JOB"])
         self.register_element("NPC", npc, dident="_ROOM")
         # Maybe give this NPC something extra to do.
         if random.randint(1, 6) == 2:
             self.add_sub_plot(nart, "RESOURCE_NPCCONVO")
     return True
Exemplo n.º 20
0
    def custom_init( self, nart ):
        locale = self.elements.get( "LOCALE" )
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.DARK_WINDOW
        exterior.special_c[ "sign1" ] = maps.BOOK_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault( "ARCHITECTURE", randmaps.architect.Village() )
        interior,igen = randmaps.architect.design_scene( 50, 50, randmaps.BuildingScene,
            archi, setting=self.setting,fac=culture )

        interior.name = "{0} Library".format( locale )
        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_1.mini_map_label = "Library"
        gate_2.destination = locale
        gate_2.otherside = gate_1
        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( waypoints.Bookshelf() )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.LibraryDec(win=maps.BRIGHT_WINDOW)
        if random.randint(1,100) == 23:
            npc = monsters.generate_npc( job=characters.Ninja,fac=culture )
        else:
            npc = monsters.generate_npc( job=random.choice((characters.Mage,characters.Mage,characters.Necromancer,
                characters.Mage,characters.Mage,characters.Necromancer,characters.Bard) ),fac=culture)
        npc.tags.append( context.CHAR_SHOPKEEPER )
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )
        int_mainroom.contents.append( maps.DESK )
        int_mainroom.contents.append( maps.TABLE )
        self.shop = self.register_element( "SHOPSERVICE", services.Shop( services.MAGIC_STORE,
          rank=self.rank+1, allow_misc=False, enhance_at=10, num_items=25, turnover=5, npc=npc ) )
        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
        return True
Exemplo n.º 21
0
    def custom_init(self, nart):
        w = random.randint(7, 10)
        exterior = randmaps.rooms.BuildingRoom(w,
                                               17 - w,
                                               tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        self.register_element("_EXTERIOR", exterior, dident="LOCALE")

        interior = maps.Scene(
            50,
            50,
            sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png"},
            biome=context.HAB_BUILDING,
            setting=self.setting,
            desctags=(context.DES_CIVILIZED, ))
        igen = randmaps.BuildingScene(interior)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1

        self.register_scene(nart,
                            interior,
                            igen,
                            ident="_INTERIOR",
                            dident="LOCALE")
        exterior.special_c["door"] = gate_1

        int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED, ),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.BedroomDec()

        npc = monsters.generate_npc(fac=pstate.elements["LOCALE"].fac)
        interior.name = "{0}'s Home".format(npc)
        gate_1.mini_map_label = interior.name
        suitor = self.elements.get("TARGET")
        # Assume a heteronormativity rate of 50%.
        if random.randint(1, 2) == 1:
            if suitor.gender == stats.MALE:
                npc.gender = stats.FEMALE
            elif suitor.gender == stats.FEMALE:
                npc.gender = stats.MALE
        int_mainroom.contents.append(npc)
        self.register_element("RESOURCE", npc)

        return True
Exemplo n.º 22
0
    def custom_init( self, nart ):
        """Create map, fill with city + services."""
        biome = self.elements.setdefault( "BIOME", randmaps.architect.make_wilderness() )
        archi = self.register_element( "ARCHITECTURE", randmaps.architect.Village(biome.biome))
        culture = self.register_element( "CULTURE",
          teams.PolisFaction(dungeon_type=("Village","Hamlet","Town")) )
        myscene,mymapgen = randmaps.architect.design_scene( 50, 50,
          randmaps.ForestScene, biome,fac=culture,secondary=archi,
          setting=self.setting)
        myscene.desctags.append( context.DES_CIVILIZED )
        myscene.name = culture.name
        self.register_scene( nart, myscene, mymapgen, ident="LOCALE" )

        castle = self.register_element( "CITY",
         randmaps.rooms.VillageRoom( width=35,height=35,anchor=randmaps.anchors.middle,
         tags=(context.CIVILIZED,context.ROOM_PUBLIC), parent=myscene ) )
        myroom = randmaps.rooms.FuzzyRoom( tags=(context.ENTRANCE,), parent=castle )
        myteam = teams.Team( strength=0, default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append( myteam )
        myent = waypoints.RoadSignToAdventure()
        myroom.contents.append( myent )
        myroom.contents.append( monsters.generate_npc(team=myteam,fac=culture) )
        myroom.contents.append( monsters.generate_npc(team=myteam,fac=culture) )

        self.register_element( "ENTRANCE", myent )

        #self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_CITY, myent, True )

        self.add_sub_plot( nart, "CITY_GENERALSTORE",spstate=PlotState(rank=random.randint(3,5)).based_on(self))
        self.add_sub_plot( nart, "CITY_LIBRARY",spstate=PlotState(rank=random.randint(3,5)).based_on(self))
        self.add_sub_plot( nart, "CITY_INN" )
        self.add_sub_plot( nart, "CITY_TEMPLE" )
        self.add_sub_plot( nart, "CITY_WEAPONSHOP",spstate=PlotState(rank=random.randint(3,5)).based_on(self))
        self.add_sub_plot( nart, "CITY_ARMORSHOP",spstate=PlotState(rank=random.randint(3,5)).based_on(self))
        self.add_sub_plot( nart, "CITY_ADVGUILD" )

        self.add_sub_plot( nart, "TEST_FEATURE",spstate=PlotState(elements={"LOCALE":castle}).based_on(self), necessary=False )
        return True
Exemplo n.º 23
0
 def custom_init(self, nart):
     locale = self.seek_element(nart, "_LOCALE", self.seek_scene)
     exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
     exterior.special_c["window"] = maps.CASTLE_WINDOW
     exterior.special_c["sign1"] = maps.SWORD_SIGN
     exterior.special_c["sign2"] = maps.SHIELD_SIGN
     self.register_element("_EXTERIOR", exterior, dident="_LOCALE")
     interior = maps.Scene(50,
                           50,
                           sprites={
                               maps.SPRITE_WALL:
                               "terrain_wall_darkbrick.png",
                               maps.SPRITE_FLOOR: "terrain_floor_stone.png"
                           },
                           biome=context.HAB_BUILDING,
                           setting=self.setting,
                           desctags=(context.DES_CIVILIZED, ))
     igen = randmaps.BuildingScene(interior)
     gate_1 = waypoints.GateDoor()
     gate_2 = waypoints.GateDoor()
     gate_1.destination = interior
     gate_1.otherside = gate_2
     gate_2.destination = self.elements.get("_LOCALE")
     gate_2.otherside = gate_1
     self.register_scene(nart,
                         interior,
                         igen,
                         ident="BUILDING_INT",
                         dident="_LOCALE")
     exterior.special_c["door"] = gate_1
     int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED,
                                                   context.ROOM_PUBLIC),
                                             anchor=randmaps.anchors.south,
                                             parent=interior)
     int_mainroom.contents.append(gate_2)
     int_mainroom.contents.append(maps.PILED_GOODS)
     int_mainroom.contents.append(maps.PILED_GOODS)
     gate_2.anchor = randmaps.anchors.south
     int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec(
         win=maps.CASTLE_WINDOW)
     npc = monsters.generate_npc(job=self.elements["JOB"])
     npc.tags.append(context.CHAR_SHOPKEEPER)
     interior.name = random.choice(self.NAME_PATTERNS).format(npc)
     gate_1.mini_map_label = "Dungeon Shop"
     int_mainroom.contents.append(npc)
     self.register_element("SHOPKEEPER", npc)
     self.shop = self.register_element(
         "SHOPSERVICE", services.Shop(rank=locale.rank + 3, npc=npc))
     self.first_time = True
     return True
Exemplo n.º 24
0
 def custom_init( self, nart ):
     locale = self.elements.get( "LOCALE" )
     exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
     exterior.special_c[ "window" ] = maps.DARK_WINDOW
     exterior.special_c[ "sign1" ] = maps.BOOK_SIGN
     self.register_element( "_EXTERIOR", exterior, dident="CITY" )
     interior = maps.Scene( 50,50, sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
         biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
     igen = mapgen.BuildingScene( interior )
     interior.name = "{0} Library".format( locale )
     gate_1 = waypoints.GateDoor()
     gate_2 = waypoints.GateDoor()
     gate_1.destination = interior
     gate_1.otherside = gate_2
     gate_1.mini_map_label = "Library"
     gate_2.destination = locale
     gate_2.otherside = gate_1
     self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
     exterior.special_c[ "door" ] = gate_1
     int_mainroom = mapgen.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
     int_mainroom.contents.append( gate_2 )
     int_mainroom.contents.append( waypoints.Bookshelf() )
     gate_2.anchor = mapgen.south
     int_mainroom.decorate = mapgen.LibraryDec(win=maps.BRIGHT_WINDOW)
     if random.randint(1,100) == 23:
         npc = monsters.generate_npc( job=characters.Ninja )
     else:
         npc = monsters.generate_npc( job=random.choice((characters.Mage,characters.Mage,characters.Necromancer,
             characters.Mage,characters.Mage,characters.Necromancer,characters.Bard) ))
     npc.tags.append( context.CHAR_SHOPKEEPER )
     int_mainroom.contents.append( npc )
     self.register_element( "SHOPKEEPER", npc )
     int_mainroom.contents.append( maps.DESK )
     int_mainroom.contents.append( maps.TABLE )
     self.shop = self.register_element( "SHOPSERVICE", services.Shop( services.MAGIC_STORE, rank=self.rank+5, allow_misc=False, allow_magic=True, num_items=25 ) )
     self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
     return True
Exemplo n.º 25
0
    def custom_init( self, nart ):
        """Create map, fill with city + services."""
        biome = self.elements.setdefault( "BIOME", randmaps.architect.make_wilderness() )
        archi = self.register_element( "ARCHITECTURE", randmaps.architect.Village(biome.biome))
        culture = self.elements.setdefault( "CULTURE", teams.PolisFaction() )
        myscene,mymapgen = randmaps.architect.design_scene( 90, 90,
          randmaps.EdgeOfCivilization, biome,secondary=archi,setting=self.setting)
        myscene.desctags.append( context.DES_CIVILIZED )
        self.register_scene( nart, myscene, mymapgen, ident="LOCALE" )

        castle = self.register_element( "CITY", randmaps.rooms.CastleRoom( width=35,height=35,tags=(context.CIVILIZED,context.ROOM_PUBLIC), parent=myscene ) )
        myroom = randmaps.rooms.FuzzyRoom( tags=(context.ENTRANCE,), parent=castle )
        myteam = teams.Team( strength=0, default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append( myteam )
        myent = waypoints.Well()
        myroom.contents.append( myent )
        myroom.contents.append( monsters.generate_npc(team=myteam,fac=culture) )
        myroom.contents.append( monsters.generate_npc(team=myteam,fac=culture) )

        self.register_element( "ENTRANCE", myent )

        self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_CITY, myent, True )

        self.add_sub_plot( nart, "CITY_GENERALSTORE" )
        self.add_sub_plot( nart, "CITY_LIBRARY" )
        self.add_sub_plot( nart, "CITY_INN" )
        self.add_sub_plot( nart, "CITY_TEMPLE" )
        self.add_sub_plot( nart, "CITY_EXTRASHOP" )
        for t in range( random.randint(1,4) ):
            self.add_sub_plot( nart, "ENCOUNTER" )
        self.add_sub_plot( nart, "SPECIAL_FEATURE" )
        self.add_sub_plot( nart, "TEST_FEATURE", necessary=False )

        self.add_sub_plot( nart, "CITY_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )


        return True
Exemplo n.º 26
0
    def custom_init( self, nart ):
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.DRINK_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault( "ARCHITECTURE", randmaps.architect.Village() )
        interior,igen = randmaps.architect.design_scene( 50, 50, randmaps.BuildingScene,
            archi, setting=self.setting,fac=culture )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( random.randint(12,20), random.randint(12,20),
         tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( waypoints.Bookshelf() )
        int_mainroom.contents.append( maps.FIREPLACE )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TavernDec(win=maps.SMALL_WINDOW)

        npc = monsters.generate_npc(job=monsters.base.Innkeeper,fac=culture)
        npc.tags.append( context.CHAR_INNKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc, random.choice(monsters.MONSTER_LIST).name, random.choice(monsters.MONSTER_LIST).name )
        gate_1.mini_map_label = "Inn"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )

        int_bedroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,), parent=interior )
        int_bedroom.contents.append( maps.LIGHT_STAND )
        int_bedroom.DECORATE = randmaps.decor.BedroomDec()

        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )

        self.shop = services.Inn()

        return True
Exemplo n.º 27
0
    def custom_init(self, nart):
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        exterior.special_c["sign1"] = maps.SWORD_SIGN
        exterior.special_c["sign2"] = maps.SHIELD_SIGN
        self.register_element("_EXTERIOR", exterior, dident="CITY")

        archi = self.elements.setdefault("ARCHITECTURE",
                                         randmaps.architect.Village())
        culture = self.elements.get("CULTURE")
        interior, igen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.BuildingScene,
            archi,
            setting=self.setting,
            fac=culture)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1
        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")
        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        int_mainroom.contents.append(maps.PILED_GOODS)
        int_mainroom.contents.append(maps.PILED_GOODS)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec()
        npc = monsters.generate_npc(job=monsters.base.Merchant, fac=culture)
        npc.tags.append(context.CHAR_SHOPKEEPER)
        interior.name = random.choice(self.NAME_PATTERNS).format(npc)
        gate_1.mini_map_label = "General Store"
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)
        self.shop = self.register_element(
            "SHOPSERVICE", services.Shop(rank=self.rank, turnover=3, npc=npc))
        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
        return True
Exemplo n.º 28
0
    def custom_init( self, nart ):
        # Add the forest itself.
        myscene = maps.Scene( min( 95 + self.rank * 3, 129 ), min( 95 + self.rank * 3, 129 ), 
            sprites={maps.SPRITE_WALL: "terrain_wall_woodfort.png", maps.SPRITE_GROUND: "terrain_ground_forest.png",
             maps.SPRITE_FLOOR: "terrain_floor_gravel.png" },
            biome=context.HAB_FOREST, setting=self.setting, fac=None,
            desctags=(context.MAP_WILDERNESS,) )
        mymapgen = randmaps.ForestScene( myscene )
        self.register_scene( nart, myscene, mymapgen, ident="LOCALE" )

        # Add a village.
        castle = self.register_element( "CITY", randmaps.rooms.VillageRoom( width=35,
            height=35,tags=(context.CIVILIZED,context.ROOM_PUBLIC,context.MAP_ON_EDGE), parent=myscene ) )
        myroom = randmaps.rooms.FuzzyRoom( tags=(context.ENTRANCE,), parent=castle )
        myteam = teams.Team( strength=0, default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append( myteam )
        myent = waypoints.Well()
        myroom.contents.append( myent )
        myroom.contents.append( monsters.generate_npc(species=characters.Elf, team=myteam) )
        myroom.contents.append( monsters.generate_npc(species=characters.Elf, team=myteam) )
        self.add_sub_plot( nart, "CITY_GENERALSTORE" )
        self.add_sub_plot( nart, "CITY_LIBRARY" )
        self.add_sub_plot( nart, "CITY_INN" )
        self.add_sub_plot( nart, "CITY_EXTRASHOP" )

        # Add world map entrance.
        self._entrance = self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_VILLAGE, myent, False )

        for t in range( random.randint(2+min(self.rank//3,6),4+min(self.rank//2,6)) ):
            self.add_sub_plot( nart, "ENCOUNTER" )
        self.add_sub_plot( nart, "SPECIAL_FEATURE" )

        # Install the dungeon here.
        self.install_dungeon( nart, self.elements[ "LEVELS" ], myscene, self.elements["DNAME"] )
        self._ready = True
        return True
Exemplo n.º 29
0
    def custom_init( self, nart ):
        exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.DRINK_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        interior = maps.Scene( 50,50, sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
            biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
        igen = mapgen.BuildingScene( interior )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = mapgen.SharpRoom( random.randint(12,20), random.randint(12,20),
         tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( waypoints.Bookshelf() )
        int_mainroom.contents.append( maps.FIREPLACE )
        gate_2.anchor = mapgen.south
        int_mainroom.decorate = mapgen.TavernDec(win=maps.SMALL_WINDOW)

        npc = monsters.generate_npc()
        npc.tags.append( context.CHAR_INNKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc, random.choice(monsters.MONSTER_LIST).name, random.choice(monsters.MONSTER_LIST).name )
        gate_1.mini_map_label = "Inn"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )
        int_mainroom.contents.append( maps.TABLE )

        int_bedroom = mapgen.SharpRoom( tags=(context.CIVILIZED,), parent=interior )
        int_bedroom.contents.append( maps.LIGHT_STAND )
        int_bedroom.decorate = mapgen.BedroomDec()

        self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )

        self.shop = services.Inn()

        return True
Exemplo n.º 30
0
 def custom_init( self, nart ):
     sk = self.elements["SHOPKEEPER"]
     the_room = self.seek_element( nart, "_THE_ROOM", self.room_seeker, scope=self.elements.get("BUILDING_INT") )
     npc = monsters.generate_npc(species=sk.species.__class__)
     # Assume a heteronormativity rate of 50%.
     if random.randint(1,2) == 1:
         if sk.gender == stats.MALE:
             npc.gender = stats.FEMALE
         elif sk.gender == stats.FEMALE:
             npc.gender = stats.MALE
     self.register_element( "_NPC", npc, dident="_THE_ROOM" )
     self.add_sub_plot( nart, "REWARD", PlotState(elements={"ORIGIN":npc}).based_on( self ), ident="next" )
     self.quest_started = False
     self.employees = [sk,npc]
     self.needed_stat = random.choice( stats.PRIMARY_STATS )
     return True
Exemplo n.º 31
0
    def custom_init(self, nart):
        w = random.randint(7, 10)
        exterior = randmaps.rooms.BuildingRoom(w, 17 - w, tags=(context.CIVILIZED,))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        self.register_element("_EXTERIOR", exterior, dident="LOCALE")

        interior = maps.Scene(
            50,
            50,
            sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png"},
            biome=context.HAB_BUILDING,
            setting=self.setting,
            desctags=(context.DES_CIVILIZED,),
        )
        igen = randmaps.BuildingScene(interior)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1

        self.register_scene(nart, interior, igen, ident="_INTERIOR", dident="LOCALE")
        exterior.special_c["door"] = gate_1

        int_mainroom = randmaps.rooms.SharpRoom(
            tags=(context.CIVILIZED,), anchor=randmaps.anchors.south, parent=interior
        )
        int_mainroom.contents.append(gate_2)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.BedroomDec()

        npc = monsters.generate_npc(fac=pstate.elements["LOCALE"].fac)
        interior.name = "{0}'s Home".format(npc)
        gate_1.mini_map_label = interior.name
        suitor = self.elements.get("TARGET")
        # Assume a heteronormativity rate of 50%.
        if random.randint(1, 2) == 1:
            if suitor.gender == stats.MALE:
                npc.gender = stats.FEMALE
            elif suitor.gender == stats.FEMALE:
                npc.gender = stats.MALE
        int_mainroom.contents.append(npc)
        self.register_element("RESOURCE", npc)

        return True
Exemplo n.º 32
0
    def custom_init( self, nart ):
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.STAINED_GLASS
        exterior.special_c[ "sign1" ] = maps.ANKH_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        locale = self.elements.get( "LOCALE" )

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault( "ARCHITECTURE", randmaps.architect.Village() )
        interior,igen = randmaps.architect.design_scene( 50, 50, randmaps.BuildingScene,
            archi, setting=self.setting,fac=culture )
        interior.sprites[maps.SPRITE_FLOOR] = "terrain_floor_bigtile.png"
        interior.sprites[maps.SPRITE_INTERIOR] = "terrain_int_temple.png"
        interior.name = "{0} Temple".format( locale )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_1.mini_map_label = "Temple"
        gate_2.destination = locale
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( maps.ANKH_ALTAR )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TempleDec(win=maps.STAINED_GLASS)

        npc = monsters.generate_npc( job=random.choice((characters.Priest, characters.Priest,
            characters.Priest, characters.Priest, characters.Priest, characters.Priest, characters.Priest,
            characters.Druid, characters.Druid, characters.Priest, characters.Monk, characters.Knight) ),
            fac=culture)
        npc.tags.append( context.CHAR_HEALER )
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        self.shop = services.Temple()

        return True
Exemplo n.º 33
0
    def custom_init(self, nart):
        scene = self.elements.get("LOCALE")
        mygen = nart.get_map_generator(scene)

        # Bridge room
        bridge_room = randmaps.rooms.BottleneckRoom()
        bridge_room.special_c["door"] = self.register_element(
            "_DOOR", waypoints.LockableDoor(plot_locked=True))
        mygen.special_c["bridge"] = bridge_room
        self.register_element("_BRIDGE_ROOM", bridge_room, dident="LOCALE")

        # Key room
        key_room = mygen.DEFAULT_ROOM(tags=(context.ENTRANCE, ))
        myteam = self.register_element(
            "TEAM",
            teams.Team(default_reaction=-999,
                       rank=self.rank,
                       strength=150,
                       habitat=scene.get_encounter_request()))
        key_room.contents.append(myteam)
        self.register_element("_KEY_ROOM", key_room, dident="LOCALE")
        self._ready = True
        npc = self.register_element("NPC",
                                    monsters.generate_npc(team=myteam,
                                                          fac=scene.fac,
                                                          rank=self.rank,
                                                          upgrade=True),
                                    dident="_KEY_ROOM")
        myteam.boss = npc

        # Post-bridge encounter
        room = mygen.DEFAULT_ROOM()
        mygen.special_c["after_bridge"] = room
        myhabitat = scene.get_encounter_request()
        myhabitat[context.MTY_HUMANOID] = context.PRESENT
        myhabitat[context.MTY_FIGHTER] = context.MAYBE
        room.contents.append(
            teams.Team(default_reaction=-999,
                       rank=self.rank,
                       strength=150,
                       habitat=myhabitat))
        self.register_element("_ROOM", room, dident="LOCALE")

        return True
Exemplo n.º 34
0
 def custom_init(self, nart):
     """Create the cousin, add puzzle subplot."""
     npc = self.elements["SHOPKEEPER"]
     the_room = self.seek_element(nart,
                                  "_THE_ROOM",
                                  self.room_seeker,
                                  scope=self.elements.get("BUILDING_INT"))
     the_cousin = monsters.generate_npc(species=npc.species.__class__)
     self.register_element("TARGET", the_cousin)
     self.started = False
     self.dated = False
     self.add_sub_plot(nart, "SB_DATE", PlotState().based_on(self))
     self.add_sub_plot(nart,
                       "REWARD",
                       PlotState(elements={
                           "ORIGIN": npc
                       }).based_on(self),
                       ident="next")
     return True
Exemplo n.º 35
0
 def custom_init( self, nart ):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator( scene )
     room = mygen.DEFAULT_ROOM()
     myhabitat = scene.get_encounter_request()
     myhabitat[ context.MTY_HUMANOID ] = True
     myteam = teams.Team(default_reaction=-999, rank=self.rank, 
       strength=150, habitat=myhabitat )
     room.contents.append( myteam )
     mh2 = myhabitat.copy()
     mh2[(context.MTY_LEADER,context.MTY_BOSS)] = True
     boss = monsters.generate_npc(team=myteam,upgrade=True,rank=self.rank+1,fac=scene.fac)
     myteam.boss = boss
     myitem = items.generate_special_item( self.rank + 1 )
     if myitem:
         boss.contents.append( myitem )
     self.register_element( "_ROOM", room, dident="LOCALE" )
     self.register_element( "BOSS", boss, "_ROOM" )
     return True
Exemplo n.º 36
0
 def custom_init( self, nart ):
     """Create the black market, add secret connection."""
     locale = self.elements["LOCALE"]
     interior = maps.Scene( 50,50, sprites={maps.SPRITE_WALL: "terrain_wall_darkbrick.png", maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
         biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
     igen = randmaps.BuildingScene( interior )
     self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )
     int_mainroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,context.ENTRANCE), anchor=randmaps.anchors.northwest, parent=interior )
     int_mainroom.contents.append( maps.PILED_GOODS )
     int_mainroom.contents.append( maps.PILED_GOODS )
     int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec()
     npc = monsters.generate_npc( job=monsters.base.Merchant )
     npc.tags.append( context.CHAR_SHOPKEEPER )
     interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
     int_mainroom.contents.append( npc )
     self.register_element( "BMKEEPER", npc )
     self.shop = services.Shop( rank=self.rank+3, turnover=2, npc=npc )
     self.add_sub_plot( nart, "SECRET_CONNECT", PlotState( elements={"PREV":locale,"NEXT":interior} ).based_on( self ) )
     self._still_looking = True
     return True
Exemplo n.º 37
0
    def custom_init( self, nart ):
        """Create the crypt and add a person saying where."""
        myscene = maps.Scene( 129, 129, sprites={maps.SPRITE_GROUND: "terrain_ground_forest.png", maps.SPRITE_WALL: "terrain_wall_darkbrick.png"},
            biome=context.HAB_FOREST, setting=self.setting,
            desctags=(context.MAP_WILDERNESS,context.DES_CIVILIZED,) )
        myscene.name = "Crypt Thing"
        mymapgen = randmaps.ForestScene( myscene )
        self.register_scene( nart, myscene, mymapgen, ident="WILDERNESS" )

        myroom = randmaps.rooms.FuzzyRoom( tags=(context.ENTRANCE,), parent=myscene, anchor=randmaps.anchors.northwest )
        myent = waypoints.Well()
        myroom.contents.append( myent )

        wme = self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_DUNGEON, myent, False )
        self.wme = wme

        room = self.seek_element( nart, "_ROOM", self.seek_room )
        npc = monsters.generate_npc( job=characters.Necromancer )
        self.register_element( "_NPC", npc, dident="_ROOM" )

        return True
Exemplo n.º 38
0
    def custom_init( self, nart ):
        exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.STAINED_GLASS
        exterior.special_c[ "sign1" ] = maps.ANKH_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        locale = self.elements.get( "LOCALE" )
        interior = maps.Scene( 50,50, sprites={maps.SPRITE_FLOOR: "terrain_floor_bigtile.png",
            maps.SPRITE_INTERIOR: "terrain_int_temple.png" },
            biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
        igen = mapgen.BuildingScene( interior )
        interior.name = "{0} Temple".format( locale )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_1.mini_map_label = "Temple"
        gate_2.destination = locale
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = mapgen.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
        int_mainroom.contents.append( maps.ANKH_ALTAR )
        gate_2.anchor = mapgen.south
        int_mainroom.decorate = mapgen.TempleDec(win=maps.STAINED_GLASS)

        npc = monsters.generate_npc( job=random.choice((characters.Priest, characters.Priest,
            characters.Priest, characters.Priest, characters.Priest, characters.Priest, characters.Priest,
            characters.Druid, characters.Druid, characters.Priest, characters.Monk, characters.Knight) ))
        npc.tags.append( context.CHAR_HEALER )
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        self.shop = services.Temple()

        return True
Exemplo n.º 39
0
 def custom_init(self, nart):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator(scene)
     room = randmaps.rooms.CastleRoom(width=21,
                                      height=21,
                                      tags=(context.GOAL, ))
     myhabitat = scene.get_encounter_request()
     myhabitat[context.MTY_HUMANOID] = True
     myhabitat[(context.MTY_FIGHTER, context.MTY_THIEF)] = context.MAYBE
     myteam = teams.Team(default_reaction=-999,
                         rank=self.rank,
                         strength=150,
                         habitat=myhabitat,
                         fac=scene.fac)
     room.contents.append(myteam)
     room2 = randmaps.rooms.FuzzyRoom(parent=room)
     for t in range(random.randint(3, 5)):
         mychest = random.choice(
             (waypoints.SmallChest, waypoints.MediumChest,
              waypoints.LargeChest, waypoints.Cart))()
         mychest.stock(self.rank)
         room2.contents.append(mychest)
     room3 = randmaps.rooms.FuzzyRoom(parent=room)
     mychest = waypoints.Cart()
     mychest.stock(self.rank)
     room3.contents.append(mychest)
     room3.contents.append(maps.CAULDRON)
     self.register_element("_ROOM", room, dident="LOCALE")
     boss = self.register_element(
         "NPC1",
         monsters.generate_npc(team=myteam,
                               upgrade=True,
                               fac=scene.fac,
                               rank=self.rank + random.randint(0, 1)),
         dident="_ROOM")
     for t in range(2):
         myitem = items.generate_special_item(self.rank)
         if myitem:
             boss.contents.append(myitem)
     return True
Exemplo n.º 40
0
 def custom_init(self, nart):
     """Create the black market, add secret connection."""
     locale = self.elements["LOCALE"]
     interior = maps.Scene(50,
                           50,
                           sprites={
                               maps.SPRITE_WALL:
                               "terrain_wall_darkbrick.png",
                               maps.SPRITE_FLOOR: "terrain_floor_wood.png"
                           },
                           biome=context.HAB_BUILDING,
                           setting=self.setting,
                           desctags=(context.DES_CIVILIZED, ))
     igen = randmaps.BuildingScene(interior)
     self.register_scene(nart,
                         interior,
                         igen,
                         ident="BUILDING_INT",
                         dident="LOCALE")
     int_mainroom = randmaps.rooms.SharpRoom(
         tags=(context.CIVILIZED, context.ENTRANCE),
         anchor=randmaps.anchors.northwest,
         parent=interior)
     int_mainroom.contents.append(maps.PILED_GOODS)
     int_mainroom.contents.append(maps.PILED_GOODS)
     int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec()
     npc = monsters.generate_npc(job=monsters.base.Merchant)
     npc.tags.append(context.CHAR_SHOPKEEPER)
     interior.name = random.choice(self.NAME_PATTERNS).format(npc)
     int_mainroom.contents.append(npc)
     self.register_element("BMKEEPER", npc)
     self.shop = services.Shop(rank=self.rank + 3, turnover=2, npc=npc)
     self.add_sub_plot(
         nart, "SECRET_CONNECT",
         PlotState(elements={
             "PREV": locale,
             "NEXT": interior
         }).based_on(self))
     self._still_looking = True
     return True
Exemplo n.º 41
0
    def custom_init( self, nart ):
        exterior = randmaps.rooms.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.WEAPONS_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault( "ARCHITECTURE", randmaps.architect.Village() )
        interior,igen = randmaps.architect.design_scene( 50, 50, randmaps.BuildingScene,
            archi, setting=self.setting,fac=culture )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=randmaps.anchors.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
#        int_mainroom.contents.append( waypoints.Anvil() )
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.WeaponShopDec()

        npc = monsters.generate_npc( job=monsters.base.Merchant,fac=culture )
        npc.tags.append( context.CHAR_SHOPKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
        gate_1.mini_map_label = "Weapon Shop"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        self.shop = self.register_element( "SHOPSERVICE", services.Shop( ware_types=services.WEAPON_STORE, rank=self.rank+1,
         allow_misc=False, num_items=25, npc=npc ) )

        return True
Exemplo n.º 42
0
    def custom_init( self, nart ):
        exterior = mapgen.BuildingRoom( tags=(context.CIVILIZED,) )
        exterior.special_c[ "window" ] = maps.SMALL_WINDOW
        exterior.special_c[ "sign1" ] = maps.WEAPONS_SIGN
        self.register_element( "_EXTERIOR", exterior, dident="CITY" )

        interior = maps.Scene( 50,50, sprites={maps.SPRITE_FLOOR: "terrain_floor_wood.png" },
            biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.DES_CIVILIZED,) )
        igen = mapgen.BuildingScene( interior )

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get( "LOCALE" )
        gate_2.otherside = gate_1

        self.register_scene( nart, interior, igen, ident="BUILDING_INT", dident="LOCALE" )

        exterior.special_c[ "door" ] = gate_1
        int_mainroom = mapgen.SharpRoom( tags=(context.CIVILIZED,context.ROOM_PUBLIC), anchor=mapgen.south, parent=interior )
        int_mainroom.contents.append( gate_2 )
#        int_mainroom.contents.append( waypoints.Anvil() )
        gate_2.anchor = mapgen.south
        int_mainroom.decorate = mapgen.WeaponShopDec()

        npc = monsters.generate_npc( job=monsters.base.Merchant )
        npc.tags.append( context.CHAR_SHOPKEEPER )
        interior.name = random.choice( self.NAME_PATTERNS ).format( npc )
        gate_1.mini_map_label = "Weapon Shop"
        int_mainroom.contents.append( npc )
        self.register_element( "SHOPKEEPER", npc )

        self.shop = self.register_element( "SHOPSERVICE", services.Shop( ware_types=services.WEAPON_STORE, rank=self.rank+2,
         allow_misc=False, allow_magic=True, num_items=14 ) )

        return True
Exemplo n.º 43
0
 def custom_init(self, nart):
     scene = self.elements.get("LOCALE")
     mygen = nart.get_map_generator(scene)
     room = mygen.DEFAULT_ROOM()
     myhabitat = scene.get_encounter_request()
     myhabitat[context.MTY_HUMANOID] = True
     myteam = teams.Team(default_reaction=-999,
                         rank=self.rank,
                         strength=150,
                         habitat=myhabitat)
     room.contents.append(myteam)
     mh2 = myhabitat.copy()
     mh2[(context.MTY_LEADER, context.MTY_BOSS)] = True
     boss = monsters.generate_npc(team=myteam,
                                  upgrade=True,
                                  rank=self.rank + 1,
                                  fac=scene.fac)
     myteam.boss = boss
     myitem = items.generate_special_item(self.rank + 1)
     if myitem:
         boss.contents.append(myitem)
     self.register_element("_ROOM", room, dident="LOCALE")
     self.register_element("BOSS", boss, "_ROOM")
     return True
Exemplo n.º 44
0
 def custom_init(self, nart):
     sk = self.elements["SHOPKEEPER"]
     the_room = self.seek_element(nart,
                                  "_THE_ROOM",
                                  self.room_seeker,
                                  scope=self.elements.get("BUILDING_INT"))
     npc = monsters.generate_npc(species=sk.species.__class__)
     # Assume a heteronormativity rate of 50%.
     if random.randint(1, 2) == 1:
         if sk.gender == stats.MALE:
             npc.gender = stats.FEMALE
         elif sk.gender == stats.FEMALE:
             npc.gender = stats.MALE
     self.register_element("_NPC", npc, dident="_THE_ROOM")
     self.add_sub_plot(nart,
                       "REWARD",
                       PlotState(elements={
                           "ORIGIN": npc
                       }).based_on(self),
                       ident="next")
     self.quest_started = False
     self.employees = [sk, npc]
     self.needed_stat = random.choice(stats.PRIMARY_STATS)
     return True
Exemplo n.º 45
0
 def custom_init(self, nart):
     scene = self.elements.get("LOCALE")
     room = randmaps.rooms.SharpRoom()
     room.DECORATE = randmaps.decor.LibraryDec(win=None)
     # Create a chest, and stock it with magical goodies.
     mychest = waypoints.LargeChest()
     mychest.stock(self.rank, item_types=(items.SCROLL, items.POTION))
     room.contents.append(mychest)
     room.contents.append(waypoints.Bookshelf())
     for t in range(random.randint(2, 3)):
         myitem = items.generate_scroll(self.rank + 1)
         if myitem:
             myitem.identified = True
             mychest.contents.append(myitem)
     # Create a team for our spellcasters.
     myhabitat = scene.get_encounter_request()
     myhabitat[(context.MTY_MAGE, context.MTY_PRIEST)] = True
     myteam = self.register_element(
         "TEAM",
         teams.Team(default_reaction=-999,
                    rank=self.rank,
                    strength=120,
                    habitat=myhabitat,
                    hodgepodge=True))
     room.contents.append(myteam)
     boss = monsters.generate_npc(team=myteam,
                                  upgrade=True,
                                  rank=self.rank + 1,
                                  job=random.choice(self.JOBS),
                                  fac=scene.fac)
     myitem = items.generate_special_item(self.rank)
     if myitem:
         boss.contents.append(myitem)
     room.contents.append(boss)
     self.register_element("_ROOM", room, dident="LOCALE")
     return True
Exemplo n.º 46
0
    def custom_init( self, nart ):
        """Install the dungeon."""
        # Create the intermediary level.
        interior = maps.Scene( 65,65, sprites={maps.SPRITE_WALL: "terrain_wall_cave.png", maps.SPRITE_GROUND: "terrain_ground_under.png", maps.SPRITE_FLOOR: "terrain_floor_gravel.png" },
            biome=context.HAB_TUNNELS, setting=self.setting, desctags=(context.MAP_DUNGEON,context.MAP_GODOWN) )
        igen = randmaps.SubtleMonkeyTunnelScene( interior )
        self.register_scene( nart, interior, igen, ident="_LAIR" )

        # Create the guardian.
        btype = monsters.choose_monster_type(self.rank,self.rank+2,{(context.DES_EARTH,context.MTY_FIGHTER,context.MTY_CONSTRUCT):True,context.DES_EARTH:context.MAYBE})
        boss = self.register_element( "_BOSS", monsters.generate_boss( btype, self.rank+3 ) )
        interior.name = "{0}'s Lair".format( boss )

        # Connect to previous level.
        self.add_sub_plot( nart, "CONNECT", PlotState( elements={"PREV":self.elements["LAST_DUNGEON"],"NEXT":interior} ).based_on( self ) )

        # Create the goal room.
        team = teams.Team(default_reaction=-999, rank=self.rank, strength=150,
         habitat=interior.get_encounter_request(), respawn=False, boss=boss )
        int_goalroom = randmaps.rooms.SharpRoom( tags=(context.GOAL,), parent=interior )
        int_goalroom.contents.append( team )
        int_goalroom.contents.append( boss )
        boss.team = team
        stairs_1 = waypoints.SpiralStairsDown()
        int_goalroom.contents.append( stairs_1 )

        # Create the Dwarven City.
        myscene = maps.Scene( 65, 65, 
            sprites={maps.SPRITE_WALL: "terrain_wall_cave.png", maps.SPRITE_GROUND: "terrain_ground_under.png", maps.SPRITE_FLOOR: "terrain_floor_gravel.png"},
            biome=context.HAB_BUILDING, setting=self.setting,
            name=random.choice( self.NAME_PATTERNS ).format( namegen.DWARF.gen_word() ),
            desctags=(context.MAP_DUNGEON,context.DES_CIVILIZED,context.MAP_GODOWN) )
        mymapgen = randmaps.CaveScene( myscene )
        self.register_scene( nart, myscene, mymapgen, ident="LOCALE" )

        castle = self.register_element( "CITY", randmaps.rooms.VillageRoom( width=35,height=35,tags=(context.CIVILIZED,context.ROOM_PUBLIC), parent=myscene ) )
        myroom = randmaps.rooms.FuzzyRoom( tags=(context.ENTRANCE,), parent=castle )
        myteam = teams.Team( strength=0, default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append( myteam )
        stairs_2 = waypoints.SpiralStairsUp()
        myroom.contents.append( stairs_2 )
        myroom.contents.append( monsters.generate_npc(species=characters.Dwarf, team=myteam) )
        myroom.contents.append( monsters.generate_npc(species=characters.Dwarf, team=myteam) )

        # Connect the stairs.
        self.move_element( myscene, interior )
        stairs_1.destination = myscene
        stairs_1.otherside = stairs_2
        stairs_2.destination = interior
        stairs_2.otherside = stairs_1

        # Add some city services.
        self.add_sub_plot( nart, "CITY_GENERALSTORE" )
        self.add_sub_plot( nart, "CITY_LIBRARY" )
        self.add_sub_plot( nart, "CITY_INN" )
        self.add_sub_plot( nart, "CITY_TEMPLE" )
        self.add_sub_plot( nart, "CITY_EXTRASHOP" )

        # Install the dungeon in the city.
        self.install_dungeon( nart, self.elements[ "LEVELS" ], self.elements[ "LOCALE" ], self.elements["DNAME"] )
        return True
Exemplo n.º 47
0
    def custom_init(self, nart):
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        exterior.special_c["sign1"] = maps.DRINK_SIGN
        self.register_element("_EXTERIOR", exterior, dident="LOCALE")
        interior = maps.Scene(50,
                              50,
                              sprites={
                                  maps.SPRITE_WALL: "terrain_wall_wood.png",
                                  maps.SPRITE_FLOOR: "terrain_floor_wood.png"
                              },
                              biome=context.HAB_BUILDING,
                              setting=self.setting,
                              desctags=(context.DES_CIVILIZED, ))
        igen = randmaps.BuildingScene(interior)
        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1
        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")
        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(random.randint(12, 20),
                                                random.randint(12, 20),
                                                tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        int_mainroom.contents.append(waypoints.Bookshelf())
        int_mainroom.contents.append(maps.FIREPLACE)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TavernDec(win=maps.SMALL_WINDOW)
        npc = monsters.generate_npc(job=monsters.base.Innkeeper)
        npc.tags.append(context.CHAR_INNKEEPER)
        interior.name = random.choice(self.NAME_PATTERNS).format(
            npc,
            random.choice(monsters.MONSTER_LIST).name,
            random.choice(monsters.MONSTER_LIST).name)
        gate_1.mini_map_label = "Traveler's Inn"
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)
        int_mainroom.contents.append(maps.TABLE)
        int_mainroom.contents.append(maps.TABLE)
        int_mainroom.contents.append(maps.TABLE)
        # Add at least one visitor.
        npc = self.register_element(
            "NPC", monsters.generate_npc(rank=self.rank + 2, upgrade=True))
        self.add_sub_plot(nart, "RESOURCE_NPCCONVO")
        int_mainroom.contents.append(npc)

        int_bedroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED, ),
                                               parent=interior)
        int_bedroom.contents.append(maps.LIGHT_STAND)
        int_bedroom.DECORATE = randmaps.decor.BedroomDec()
        self.shop = services.Inn()
        return True
Exemplo n.º 48
0
    def custom_init(self, nart):
        locale = self.elements.get("LOCALE")
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.DARK_WINDOW
        exterior.special_c["sign1"] = maps.BOOK_SIGN
        self.register_element("_EXTERIOR", exterior, dident="CITY")

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault("ARCHITECTURE",
                                         randmaps.architect.Village())
        interior, igen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.BuildingScene,
            archi,
            setting=self.setting,
            fac=culture)

        interior.name = "{0} Library".format(locale)
        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_1.mini_map_label = "Library"
        gate_2.destination = locale
        gate_2.otherside = gate_1
        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")
        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        int_mainroom.contents.append(waypoints.Bookshelf())
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.LibraryDec(
            win=maps.BRIGHT_WINDOW)
        if random.randint(1, 100) == 23:
            npc = monsters.generate_npc(job=characters.Ninja, fac=culture)
        else:
            npc = monsters.generate_npc(job=random.choice(
                (characters.Mage, characters.Mage, characters.Necromancer,
                 characters.Mage, characters.Mage, characters.Necromancer,
                 characters.Bard)),
                                        fac=culture)
        npc.tags.append(context.CHAR_SHOPKEEPER)
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)
        int_mainroom.contents.append(maps.DESK)
        int_mainroom.contents.append(maps.TABLE)
        self.shop = self.register_element(
            "SHOPSERVICE",
            services.Shop(services.MAGIC_STORE,
                          rank=self.rank + 1,
                          allow_misc=False,
                          enhance_at=10,
                          num_items=25,
                          turnover=5,
                          npc=npc))
        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )
        return True
Exemplo n.º 49
0
    def custom_init(self, nart):
        exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, ))
        exterior.special_c["window"] = maps.SMALL_WINDOW
        exterior.special_c["sign1"] = maps.DRINK_SIGN
        self.register_element("_EXTERIOR", exterior, dident="CITY")

        culture = self.elements.get("CULTURE")
        archi = self.elements.setdefault("ARCHITECTURE",
                                         randmaps.architect.Village())
        interior, igen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.BuildingScene,
            archi,
            setting=self.setting,
            fac=culture)

        gate_1 = waypoints.GateDoor()
        gate_2 = waypoints.GateDoor()
        gate_1.destination = interior
        gate_1.otherside = gate_2
        gate_2.destination = self.elements.get("LOCALE")
        gate_2.otherside = gate_1

        self.register_scene(nart,
                            interior,
                            igen,
                            ident="BUILDING_INT",
                            dident="LOCALE")

        exterior.special_c["door"] = gate_1
        int_mainroom = randmaps.rooms.SharpRoom(random.randint(12, 20),
                                                random.randint(12, 20),
                                                tags=(context.CIVILIZED,
                                                      context.ROOM_PUBLIC),
                                                anchor=randmaps.anchors.south,
                                                parent=interior)
        int_mainroom.contents.append(gate_2)
        int_mainroom.contents.append(waypoints.Bookshelf())
        int_mainroom.contents.append(maps.FIREPLACE)
        gate_2.anchor = randmaps.anchors.south
        int_mainroom.DECORATE = randmaps.decor.TavernDec(win=maps.SMALL_WINDOW)

        npc = monsters.generate_npc(job=monsters.base.Innkeeper, fac=culture)
        npc.tags.append(context.CHAR_INNKEEPER)
        interior.name = random.choice(self.NAME_PATTERNS).format(
            npc,
            random.choice(monsters.MONSTER_LIST).name,
            random.choice(monsters.MONSTER_LIST).name)
        gate_1.mini_map_label = "Inn"
        int_mainroom.contents.append(npc)
        self.register_element("SHOPKEEPER", npc)

        int_mainroom.contents.append(maps.TABLE)
        int_mainroom.contents.append(maps.TABLE)
        int_mainroom.contents.append(maps.TABLE)

        int_bedroom = randmaps.rooms.SharpRoom(tags=(context.CIVILIZED, ),
                                               parent=interior)
        int_bedroom.contents.append(maps.LIGHT_STAND)
        int_bedroom.DECORATE = randmaps.decor.BedroomDec()

        #self.add_sub_plot( nart, "SIDE_STORY", PlotState(rank=self.random_rank_in_chapter()).based_on( self ) )

        self.shop = services.Inn()

        return True
Exemplo n.º 50
0
    def custom_init(self, nart):
        """Create map, fill with city + services."""
        biome = self.elements.setdefault("BIOME",
                                         randmaps.architect.make_wilderness())
        archi = self.register_element("ARCHITECTURE",
                                      randmaps.architect.Village(biome.biome))
        culture = self.register_element(
            "CULTURE",
            teams.PolisFaction(dungeon_type=("Village", "Hamlet", "Town")))
        myscene, mymapgen = randmaps.architect.design_scene(
            50,
            50,
            randmaps.ForestScene,
            biome,
            fac=culture,
            secondary=archi,
            setting=self.setting)
        myscene.desctags.append(context.DES_CIVILIZED)
        myscene.name = culture.name
        self.register_scene(nart, myscene, mymapgen, ident="LOCALE")

        castle = self.register_element(
            "CITY",
            randmaps.rooms.VillageRoom(width=35,
                                       height=35,
                                       anchor=randmaps.anchors.middle,
                                       tags=(context.CIVILIZED,
                                             context.ROOM_PUBLIC),
                                       parent=myscene))
        myroom = randmaps.rooms.FuzzyRoom(tags=(context.ENTRANCE, ),
                                          parent=castle)
        myteam = teams.Team(strength=0,
                            default_reaction=characters.SAFELY_FRIENDLY)
        castle.contents.append(myteam)
        myent = waypoints.RoadSignToAdventure()
        myroom.contents.append(myent)
        myroom.contents.append(monsters.generate_npc(team=myteam, fac=culture))
        myroom.contents.append(monsters.generate_npc(team=myteam, fac=culture))

        self.register_element("ENTRANCE", myent)

        #self.chapter.world.add_entrance( myscene, myscene.name, worlds.W_CITY, myent, True )

        self.add_sub_plot(
            nart,
            "CITY_GENERALSTORE",
            spstate=PlotState(rank=random.randint(3, 5)).based_on(self))
        self.add_sub_plot(
            nart,
            "CITY_LIBRARY",
            spstate=PlotState(rank=random.randint(3, 5)).based_on(self))
        self.add_sub_plot(nart, "CITY_INN")
        self.add_sub_plot(nart, "CITY_TEMPLE")
        self.add_sub_plot(
            nart,
            "CITY_WEAPONSHOP",
            spstate=PlotState(rank=random.randint(3, 5)).based_on(self))
        self.add_sub_plot(
            nart,
            "CITY_ARMORSHOP",
            spstate=PlotState(rank=random.randint(3, 5)).based_on(self))
        self.add_sub_plot(nart, "CITY_ADVGUILD")

        self.add_sub_plot(nart,
                          "TEST_FEATURE",
                          spstate=PlotState(elements={
                              "LOCALE": castle
                          }).based_on(self),
                          necessary=False)
        return True