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
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
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
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
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
def custom_init(self, nart): prev = self.elements["PREV"] next = self.elements["NEXT"] self.move_element(next, prev) myzone1 = self.register_element( "_P_ROOM", nart.get_map_generator(prev).DEFAULT_ROOM(tags=(context.GOAL, )), "PREV") myzone2 = self.seek_element(nart, "_N_ROOM", self.seek_entrance_room, scope=next, check_subscenes=False, must_find=False) if not myzone2: myzone2 = self.register_element( "_N_ROOM", randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, )), "NEXT") stairs_1 = waypoints.TreeStump() stairs_1.mini_map_label = "Tree Stump" stairs_1.plot_locked = True stairs_2 = waypoints.GateDoor() stairs_2.mini_map_label = "Exit" self.stump_destination = next self.stump_otherside = stairs_2 stairs_2.destination = prev stairs_2.otherside = stairs_1 self.register_element("TARGET", stairs_1, "_P_ROOM") self.register_element("_EXIT", stairs_2, "_N_ROOM") self._stump_unlocked = False self.add_sub_plot(nart, "PB_OPEN", PlotState().based_on(self)) return True
def custom_init(self, nart): prev = self.elements["PREV"] next = self.elements["NEXT"] self.move_element(next, prev) myzone1 = self.register_element( "_P_ROOM", randmaps.rooms.MountainRoom(tags=( context.GOAL, context.CIVILIZED, )), "PREV") myzone2 = self.register_element( "_N_ROOM", randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, )), "NEXT") stairs_1 = waypoints.MineEntrance() stairs_2 = waypoints.GateDoor() stairs_1.destination = next stairs_1.otherside = stairs_2 stairs_2.destination = prev stairs_2.otherside = stairs_1 if hasattr(next, "dname"): stairs_1.mini_map_label = next.dname else: stairs_1.mini_map_label = next.name stairs_2.mini_map_label = "Exit" myzone1.special_c["door"] = stairs_1 myzone2.contents.append(stairs_2) return True
def custom_init(self, nart): exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, )) exterior.special_c["window"] = maps.DARK_WINDOW self.register_element("_EXTERIOR", exterior, dident="LOCALE") locale = self.elements.get("LOCALE") interior = maps.Scene(50, 50, sprites={ maps.SPRITE_WALL: "terrain_wall_dungeon.png", maps.SPRITE_FLOOR: "terrain_floor_dungeon.png", maps.SPRITE_CHEST: "terrain_chest_metal.png", maps.SPRITE_INTERIOR: "terrain_int_temple.png" }, biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.MAP_DUNGEON, context.GEN_UNDEAD, context.DES_LUNAR, context.MTY_UNDEAD)) igen = randmaps.SubtleMonkeyTunnelScene(interior) interior.name = "{0} Manor".format(namegen.ELDRITCH.gen_word()) gate_1 = waypoints.OpenGateDoor() gate_2 = waypoints.GateDoor() gate_1.destination = interior gate_1.otherside = gate_2 gate_1.mini_map_label = "Haunted House" 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.ENTRANCE, ), anchor=randmaps.anchors.south, parent=interior) int_mainroom.contents.append(gate_2) int_mainroom.contents.append(maps.SKULL_ALTAR) gate_2.anchor = randmaps.anchors.south # Add the goal room, move the target there. int_goalroom = randmaps.rooms.SharpRoom(tags=(context.GOAL, ), parent=interior) target = self.elements["TARGET"] if isinstance(target, items.Item): dest = waypoints.SmallChest() dest.stock(self.rank) int_goalroom.contents.append(dest) else: dest = int_goalroom self.move_element(ele=target, dest=dest) # Add some encounters. Mostly for the treasure chests. pstate = PlotState(elements={"LOCALE": interior}).based_on(self) for t in range(random.randint(1, 3)): self.add_sub_plot(nart, "ENCOUNTER", pstate) return True
def custom_init(self, nart): exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, )) exterior.special_c["window"] = maps.SMALL_WINDOW exterior.special_c["sign1"] = maps.TOWER_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.sprites[maps.SPRITE_FLOOR] = "terrain_floor_diamond.png" 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) gate_2.anchor = randmaps.anchors.south int_mainroom.DECORATE = randmaps.decor.GeneralStoreDec() interior.name = random.choice(self.NAME_PATTERNS) gate_1.mini_map_label = "Adventurer's Guild" boh = waypoints.BookOfHeroes(anchor=randmaps.anchors.middle) int_mainroom.contents.append(boh) int_mainroom.contents.append(waypoints.LargeChest()) nart.camp.mru_advguild = (interior, boh) return True
def custom_init(self, nart): prev = self.elements["PREV"] next = self.elements["NEXT"] well = self.seek_element(nart, "_WELL", self.seek_well, scope=prev, check_subscenes=False) well.plot_locked = True myzone2 = self.seek_element(nart, "_N_ROOM", self.seek_entrance_room, scope=next, check_subscenes=False, must_find=False) if not myzone2: myzone2 = self.register_element( "_N_ROOM", randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, )), "NEXT") stairs_2 = waypoints.GateDoor() self.register_element("_EXIT", stairs_2, "_N_ROOM") self._the_well_has_been_used = False if next.rank > prev.rank: # We're gonna add a dungeon. self.levels = list() pstate = PlotState(elements={ "DUNGEON_TYPE": (context.HAB_TUNNELS, context.DES_WATER) }).based_on(self) for l in range(prev.rank + 1, next.rank + 1): pstate.rank = l sp = self.add_sub_plot(nart, "DUNGEON_LEVEL", pstate) if sp: self.levels.append(sp.elements["LOCALE"]) # Decide on a good name. dname = random.choice(self.NAME_PATTERNS).format( prev, namegen.random_style_name()) # Connect all the levels, and name them. prv = self.levels[0] prv.name = "{0}, Lvl{1}".format(dname, 1) if len(self.levels) > 1: n = 2 for nxt in self.levels[1:]: nxt.name = "{0}, Lvl{1}".format(dname, n) n += 1 pstate = PlotState(rank=nxt.rank, elements={ "PREV": prv, "NEXT": nxt }).based_on(self) sp = self.add_sub_plot(nart, "CONNECT", pstate) prv = nxt # Connect to well and black market. stairs_3 = waypoints.StairsUp() stairs_4 = waypoints.StairsDown() myzone_3 = randmaps.rooms.SharpRoom(tags=(context.ENTRANCE, ), parent=self.levels[0]) myzone_4 = randmaps.rooms.SharpRoom(tags=(context.GOAL, ), parent=self.levels[-1]) myzone_3.contents.append(stairs_3) myzone_4.contents.append(stairs_4) self.well_destination = self.levels[0] self.well_otherside = stairs_3 stairs_3.destination = prev stairs_3.otherside = well stairs_2.destination = self.levels[-1] stairs_2.otherside = stairs_4 stairs_4.destination = next stairs_4.otherside = stairs_2 self.move_element(next, self.levels[-1]) self.move_element(self.levels[0], prev) else: self.well_destination = next self.well_otherside = stairs_2 stairs_2.destination = prev stairs_2.otherside = well self.move_element(next, prev) return True
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
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
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
def custom_init(self, nart): scene = self.elements.get("LOCALE") mygen = nart.get_map_generator(scene) entryroom = mygen.DEFAULT_ROOM() myhabitat = scene.get_encounter_request() myhabitat[context.MTY_HUMANOID] = True myfaction = teams.AntagonistFaction(primary=context.MTY_THIEF, dungeon_type=("Cave", "Guild")) myteam = teams.Team(default_reaction=-999, rank=self.rank, strength=120, habitat=myhabitat, fac=myfaction) entryroom.contents.append(myteam) self.register_element("_ROOM", entryroom, dident="LOCALE") # Create the cave with the treasure. interior = maps.Scene(50, 50, 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_CAVE, setting=self.setting, fac=myfaction, desctags=(context.MAP_DUNGEON, context.MAP_GODOWN, context.MTY_THIEF)) interior.name = myfaction.name mymapgen = randmaps.CaveScene(interior) gate_1 = waypoints.Pit() gate_2 = waypoints.GateDoor() gate_1.destination = interior gate_1.otherside = gate_2 gate_2.destination = scene gate_2.otherside = gate_1 self.register_scene(nart, interior, mymapgen, ident="_THIEFCAVE", dident="LOCALE") gate_1.anchor = randmaps.anchors.middle entryroom.contents.append(gate_1) int_mainroom = randmaps.rooms.FuzzyRoom(anchor=randmaps.anchors.south, parent=interior) int_mainroom.contents.append(gate_2) gate_2.anchor = randmaps.anchors.south int_otherroom = randmaps.rooms.FuzzyRoom(random.randint(10, 16), random.randint(10, 16), parent=interior) bteam = teams.Team(default_reaction=-999, rank=self.rank, strength=200, habitat=myhabitat, fac=myfaction) int_otherroom.contents.append(bteam) # Create the chests and place them. for t in range(random.randint(3, 5)): mychest = random.choice( (waypoints.SmallChest, waypoints.MediumChest, waypoints.LargeChest))() mychest.stock(self.rank) int_otherroom.contents.append(mychest) # Add an extra encounter, just because. self.add_sub_plot( nart, "ENCOUNTER", PlotState(elements={ "LOCALE": interior, "ANTAGONIST": myfaction }).based_on(self)) return True
def custom_init(self, nart): scene = self.elements.get("LOCALE") mygen = nart.get_map_generator(scene) fortress = 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_LEADER)] = context.MAYBE myteam = teams.Team(default_reaction=-999, rank=self.rank, strength=200, habitat=myhabitat, fac=scene.fac) fortress.contents.append(myteam) self.register_element("_ROOM", fortress, dident="LOCALE") # Create the buildings. buildings = list() for t in range(random.randint(1, 3)): exterior = randmaps.rooms.BuildingRoom(tags=(context.CIVILIZED, )) exterior.special_c["window"] = maps.SMALL_WINDOW self.register_element("_EXTERIOR{0}".format(t), exterior, dident="_ROOM") interior = maps.Scene(40, 40, sprites={ maps.SPRITE_WALL: "terrain_wall_wood.png", maps.SPRITE_FLOOR: "terrain_floor_wood.png" }, biome=context.HAB_BUILDING, setting=self.setting, desctags=(context.MTY_HUMANOID, )) interior.name = "Building {}".format(t + 1) igen = randmaps.BuildingScene(interior) gate_1 = waypoints.GateDoor() gate_2 = waypoints.GateDoor() gate_1.destination = interior gate_1.otherside = gate_2 gate_2.destination = scene gate_2.otherside = gate_1 self.register_scene(nart, interior, igen, ident="_BUILDING_{}".format(t), dident="LOCALE") exterior.special_c["door"] = gate_1 int_mainroom = randmaps.rooms.SharpRoom( anchor=randmaps.anchors.south, parent=interior) int_mainroom.contents.append(gate_2) gate_2.anchor = randmaps.anchors.south # Have a second room with guards. Probably. If you want. if random.randint(1, 4) != 1: int_otherroom = randmaps.rooms.SharpRoom(parent=interior) bteam = teams.Team(default_reaction=-999, rank=self.rank, strength=130, habitat=myhabitat, fac=scene.fac) int_otherroom.contents.append(bteam) int_otherroom.DECORATE = randmaps.decor.BuildingDec() buildings.append(int_otherroom) else: buildings.append(int_mainroom) # Create the chests and place them. for t in range(random.randint(4, 6)): mychest = random.choice( (waypoints.SmallChest, waypoints.MediumChest, waypoints.LargeChest))() mychest.stock(self.rank) random.choice(buildings).contents.append(mychest) return True