class LockableDoor( Waypoint ): TILE = maps.Tile( None, maps.CLOSED_DOOR, None ) ATTACH_TO_WALL = True desc = "You stand before a door." def unlocked_use( self, explo ): self.scene.map[self.pos[0]][self.pos[1]].wall = maps.OPEN_DOOR explo.alert( "You open the door." )
class SmallChest( Waypoint ): TILE = maps.Tile( None, None, maps.SMALL_CHEST ) gold = 0 ALT_DECOR = maps.SMALL_CHEST_OPEN trap = None HOARD_AMOUNT = 50 desc = "You stand before a chest." def unlocked_use( self, explo ): if self.trap: disarm = self.trap.trigger( explo, self.pos ) if disarm: self.trap = None self.get_the_stuff( explo ) else: self.get_the_stuff( explo ) def get_the_stuff( self, explo ): if self.ALT_DECOR: self.scene.map[self.pos[0]][self.pos[1]].decor = self.ALT_DECOR if self.gold: explo.alert( "You find {0} gold pieces.".format( self.gold ) ) explo.camp.gold += self.gold self.gold = 0 ix = exploration.InvExchange( explo.camp.party, self.contents, explo.view ) ix( explo.screen ) def stock( self, hoard_rank=3, item_types=items.PREMIUM_TYPES ): self.gold,hoard = items.generate_hoard(hoard_rank,self.HOARD_AMOUNT,item_types) self.contents += hoard if random.randint(1,500) < self.HOARD_AMOUNT: self.trap = traps.choose_trap( hoard_rank )
class SpiritJar( Waypoint ): TILE = maps.Tile( None, None, maps.SPIRIT_JAR ) desc = "You stand before a spirit jar." mini_map_label = "Spirit Jar" desctags = (context.DES_LUNAR,) def release_spirit( self ): self.scene.map[self.pos[0]][self.pos[1]].decor = maps.EMPTY_SPIRIT_JAR
class Cart( SmallChest ): TILE = maps.Tile( None, None, maps.CART ) ALT_DECOR = None HOARD_AMOUNT = 100 def stock( self, hoard_rank=3, item_types=items.PREMIUM_TYPES ): self.gold,hoard = items.generate_hoard(hoard_rank,self.HOARD_AMOUNT,item_types) self.contents += hoard
class Forge( Waypoint ): TILE = maps.Tile( None, None, maps.FORGE ) desc = "You stand before a forge." mini_map_label = "Forge" desctags = (context.DES_FIRE,) def cool_down( self ): self.scene.map[self.pos[0]][self.pos[1]].decor = maps.COLDFORGE
def custom_init(self, nart): scene = self.elements.get("LOCALE") mygen = nart.get_map_generator(scene) room = mygen.DEFAULT_ROOM() room.DECORATE = randmaps.decor.MonsterDec() mychest = waypoints.LargeChest() mychest.TILE = maps.Tile(None, None, maps.LARGE_CHEST_OPEN) mychest.gold = 1 room.contents.append(mychest) self.register_element("_ROOM", room, dident="LOCALE") return True
class PuzzleDoor( Waypoint ): TILE = maps.Tile( None, maps.CLOSED_DOOR, None ) ATTACH_TO_WALL = True desc = "You stand before a door." def unlocked_use( self, explo ): explo.alert( "This door is impassable." ) def activate( self, explo ): self.scene.map[self.pos[0]][self.pos[1]].wall = maps.OPEN_DOOR if explo.scene is self.scene: explo.alert( "You hear a rumbling noise in the distance..." ) else: explo.alert( "You get the feeling that new possibilities have been opened up." )
class SpiralStairsUp( Waypoint ): TILE = maps.Tile( None, maps.SPIRAL_STAIRS_UP, None ) destination = None otherside = None desc = "You stand before a staircase." mini_map_label = "Stairs Up" def unlocked_use( self, explo ): if self.destination and self.otherside: explo.camp.destination = self.destination explo.camp.entrance = self.otherside else: explo.alert( "You have just bumped the stairs. Woohoo!" )
class PowerCrystal( Waypoint ): TILE = maps.Tile( None, None, maps.CRYSTAL_ORB ) desc = "You stand before a large crystal." mini_map_label = "Power Crystal" HEAL_FX = effects.ManaRestore( dice=(1,6,9999), stat_bonus=None ) def unlocked_use( self, explo ): # Perform this waypoint's special action. targets = list() for pc in explo.camp.party: if pc.is_alright(): targets.append( pc.pos ) explo.invoke_effect( self.HEAL_FX, None, targets )
class RoadSignForward( Waypoint ): TILE = maps.Tile( None, None, maps.SIGN_FORWARD ) ATTACH_TO_WALL = False destination = None otherside = None desc = "You stand before a road sign." mini_map_label = "Way Forward" def unlocked_use( self, explo ): if self.destination and self.otherside: explo.camp.destination = self.destination explo.camp.entrance = self.otherside else: explo.alert( self.desc )
class OpenGateDoor( Waypoint ): TILE = maps.Tile( None, maps.FAKE_OPEN_DOOR, None ) ATTACH_TO_WALL = True destination = None otherside = None desc = "You stand before a door." mini_map_label = "Door" def unlocked_use( self, explo ): if self.destination and self.otherside: explo.camp.destination = self.destination explo.camp.entrance = self.otherside else: explo.alert( "This door doesn't seem to go anywhere." )
class Pit( Waypoint ): TILE = maps.Tile( None, None, maps.PIT ) ATTACH_TO_WALL = False destination = None otherside = None desc = "You stand before a pit." mini_map_label = "Pit" def unlocked_use( self, explo ): if self.destination and self.otherside: explo.camp.destination = self.destination explo.camp.entrance = self.otherside else: explo.alert( self.desc )
class PuzzleSwitch( Waypoint ): TILE = maps.Tile( None, None, maps.SWITCH_UP ) ATTACH_TO_WALL = True UP = True desc = "You stand before a lever." mini_map_label = "Lever" def unlocked_use( self, explo ): if self.UP: self.scene.map[self.pos[0]][self.pos[1]].decor = maps.SWITCH_DOWN self.UP = False else: self.scene.map[self.pos[0]][self.pos[1]].decor = maps.SWITCH_UP self.UP = True explo.check_trigger( "USE", self )
class RoadSignToAdventure( Waypoint ): # This road sign will generate and start a new shortie adventure. TILE = maps.Tile( None, None, maps.SIGN_FORWARD ) ATTACH_TO_WALL = False destination = None otherside = None desc = "You stand before a road sign which points the way to adventure." mini_map_label = "Way Forward" def unlocked_use( self, explo ): #print explo.camp.scripts ynmenu = PuzzleMenu( explo, self ) ynmenu.add_item( "Go on an adventure.", True ) ynmenu.add_item( "Stay here for now.", False ) if ynmenu.query(): adv = explo.camp.add_story( "SHORTIE" ) if adv: adv.begin_adventure( explo, self.scene, self )
class DownEntrance( SpiralStairsUp ): TILE = maps.Tile( None, None, maps.DOWN_ENTRANCE ) desc = "You stand before a dark passageway."
class Anvil( Waypoint ): TILE = maps.Tile( None, None, maps.ANVIL ) desc = "You stand before an anvil." desctags = (context.DES_EARTH,)
class BookOfHeroes( Waypoint ): TILE = maps.Tile( None, None, maps.SIGNPOST ) desc = "You stand before a book." caption = "Book of Heroes" def add_members( self, camp, screen, predraw ): charloader.load_characters( camp.party, screen, predraw ) if camp.party: camp.remove_party_from_scene() camp.entrance = self camp.place_party() camp.update_library() def remove_members( self, camp, screen, predraw ): charsheets = dict() for pc in camp.party: charsheets[ pc ] = charsheet.CharacterSheet( pc , screen=screen ) psr = charsheet.PartySelectRedrawer( charsheets=charsheets, predraw=predraw, screen=screen, caption="Remove Party Members" ) while camp.party: rpm = charsheet.RightMenu( screen, predraw=psr, add_desc=False ) psr.menu = rpm for pc in camp.party: rpm.add_item( str( pc ), pc ) rpm.sort() rpm.add_alpha_keys() pc = rpm.query() if pc: camp.party.remove( pc ) camp.scene.contents.remove( pc ) if pc.is_alright(): pc.save() else: camp.graveyard.append( pc ) else: break def open_menu( self, camp, screen, predraw=None ): # Save the most recently used adventurer's guild. If all characters die, # this is where the game restarts. camp.mru_advguild = (self.scene,self) mypartysheet = charsheet.PartySheet( camp.party , screen=screen, camp=camp ) myredraw = charsheet.CharacterViewRedrawer( csheet=mypartysheet, screen=screen, predraw=predraw, caption=self.caption ) while True: rpm = charsheet.RightMenu( screen, predraw=myredraw ) rpm.add_item( "Add Members", self.add_members ) rpm.add_item( "Remove Members", self.remove_members ) rpm.add_item( "Exit {0}".format(self.caption), False, self.desc ) rpm.add_alpha_keys() it = rpm.query() if it: it( camp, screen, predraw ) mypartysheet.regenerate_avatars() else: break camp.save( screen ) def no_explo_use( self, camp, screen ): self.open_menu( camp, screen ) def unlocked_use( self, explo ): self.open_menu( explo.camp, explo.screen, explo.view )
class TreeStump( Waypoint ): TILE = maps.Tile( None, None, maps.TREE_STUMP ) desc = "You stand before a tree stump."
class Signpost( Waypoint ): TILE = maps.Tile( None, None, maps.SIGNPOST ) desc = "You stand before a sign."
class Well( Waypoint ): TILE = maps.Tile( None, None, maps.WELL ) desc = "You stand before a well." mini_map_label = "Well"
class Bookshelf( Waypoint ): TILE = maps.Tile( None, None, maps.BOOKSHELF ) ATTACH_TO_WALL = True desc = "You stand before a bookshelf." mini_map_label = "Bookshelf"
class LargeChest( SmallChest ): TILE = maps.Tile( None, None, maps.LARGE_CHEST ) ALT_DECOR = maps.LARGE_CHEST_OPEN HOARD_AMOUNT = 200
class MediumChest( SmallChest ): TILE = maps.Tile( None, None, maps.MEDIUM_CHEST ) ALT_DECOR = maps.MEDIUM_CHEST_OPEN HOARD_AMOUNT = 100
class Campsite( Waypoint ): TILE = maps.Tile( None, None, maps.CAULDRON ) desc = "You stand before a fire." mini_map_label = "Campsite" desctags = (context.DES_FIRE,context.DES_WATER)
class StairsDown( SpiralStairsUp ): TILE = maps.Tile( None, maps.STAIRS_DOWN, None ) ATTACH_TO_WALL = True desc = "You stand before a staircase." mini_map_label = "Stairs Down"
class Fountain( Waypoint ): TILE = maps.Tile( None, None, maps.FOUNTAIN ) desc = "You stand before a fountain." mini_map_label = "Fountain" desctags = (context.DES_WATER,)
class SpiralStairsDown( SpiralStairsUp ): TILE = maps.Tile( None, maps.SPIRAL_STAIRS_DOWN, None ) desc = "You stand before a staircase." mini_map_label = "Stairs Down"
class MineEntrance( SpiralStairsUp ): TILE = maps.Tile( None, None, maps.MINE_ENTRANCE ) desc = "You stand before a mine entrance."