def init(self): self.name = 'The Meat Caves' self.width = 80 self.height = 40 for (x, y), value in mg.delve_connected(self.width, self.height, 2, 3, 1, False, True, limit_draw = False, draw_once = True, fraction_cleared = 0.5).iteritems(): self.place_feature(x, y, {'wall':features.StoneWall, 'floor':features.StoneFloor, 'door':features.WoodenDoor}[value]() ) for i in range(20): self.place_item_random( items.ReconstructPotion() ) self.place_item_random( items.RagePotion() ) self.place_item_random( items.ScryingScroll() ) self.place_actor_random( actors.Executioner() ) # need a place_feature_random function... x, y = random.choice([(x, y) for (x, y), feature in self.feature_map.iteritems() if not feature.blocks_movement and not self.actor_at(x, y) and not self.item_at(x, y)]) self.place_feature(x, y, features.StoneStairs())
def init(self): self.name = 'Test Map' self.width = 80 self.height = 40 seed = [(x, y) for (x, y), value in mg.roomer(80, 40, 40).iteritems() if value == mg.EMPTY] map = mg.delve_connected(self.width, self.height, 2, 4, 0.1, False, True, limit_draw = False, draw_once = True, fraction_cleared = 0.7, seed = seed) for (x, y), value in map.iteritems(): self.place_feature(x, y, {mg.FILLED:features.StoneWall, mg.EMPTY:features.StoneFloor}[value]() ) for (x, y) in mg.get_door_locations(map): if random.random() > 0.5: self.place_feature(x, y, features.WoodenDoor()) actor_spots = self.get_free_spots_actor() item_spots = self.get_free_spots_item() for x, y in random.sample(actor_spots, 20): self.place_actor( x, y, actors.Executioner() ) map_items = [ #(items.PotionEnergy, 10), #(items.PotionHealing, 10), #(items.ScrollScrying, 5), #(items.WeaponBattleAxe, 1), #(items.WeaponLongsword, 2), #(items.WeaponSpear, 2), (items.WeaponKnife, 5), #(items.WeaponKnuckles, 2), #(items.ArmorHeavyChain, 2), (items.Shield, 5) ] for x, y in random.sample(item_spots, 100): self.place_item( x, y, weighted_choice(map_items)() )