def generate_shop(w, h, shop_items): level = Level(w, h, is_shop=True) for x,y in range2d(w, h): t = level.tiles[x][y] if x == 0 or y == 0 or x == w-1 or y == h-1: t.img = spr.WOOD_WALL t.blocking = True t.transparent = False else: t.img = spr.WOOD_FLOOR t.blocking = False t.transparent = True for a,b in box2d(2, 2, 5, 5): level.add_item((a,b), random.choice(shop_items)) for a,b in box2d(9, 2, 5, 5): level.add_item((a,b), random.choice(shop_items)) for a,b in box2d(2, 9, 5, 5): level.add_item((a,b), random.choice(shop_items)) for a,b in box2d(9, 9, 5, 5): level.add_item((a,b), random.choice(shop_items)) level.illuminated = True return level
import sprites as spr from my_geom import box2d from level import Level from level_generators import generate_dungeon, generate_shop from objects import Item, Portal import default_items import item_actions WELL_DEPTH = 20 town = Level(25, 25, name="town") well = [generate_dungeon(13+min(12,i), 13+min(12,i), i+1) for i in xrange(100)] shop = [] town.illuminated = True town.generate_town() town.add_item((12,12), Item(spr.WELL, name="well of doom", holdable=False)) default_items.general = [ Item(spr.TORCH, name="torch", value=20, luminosity=3), Item(spr.LANTERN, name="lantern", value=800, luminosity=5), Item(spr.POTION_RED, name="lesser health potion", value=15, desc="In[v]oking it will heal 10 HP.", action=item_actions.heal_target(10), ), Item(spr.SCROLL, name="town portal scroll", value=50, desc="In[v]oking it will return the user to town after channeling.", action=item_actions.tp_target_to(town, 12, 12), ), Item(spr.ESSENCE, name="luminescent sphere", value=4000, luminosity=999),