from .. import Region, Ifc, Utl, Map, Node, Monster, g from ..data import Species, Items def HoboRegion(origin, region, direction): origin.description = "At the end of the tunnel, you see a rock wall with a large hole carved into it." origin.name = "Gaping Hole" origin.color = Ifc.BRIGHT_CYAN origin.unique = True oldnode, newnode = None, origin size, phase = Utl.d(8, 6), 1 curdir = direction for x in xrange(size): oldnode, newnode = newnode, HoboTunnel(region=region) Region.makelink(newnode, oldnode, curdir) if Utl.rn(2) == 0: phase = -phase curdir = Map.rotate(curdir, phase) oldnode, newnode = newnode, HoboThroneRoom(region=region) Region.makelink(newnode, oldnode, curdir) mons_spawn_chance = 0, 1, 1, 1, 2 item_spawn_chance = 0, 1, 1, 2, 3 class HoboTunnel(Node.Node): def xinit(self): self.color = Ifc.CYAN self.name = "Cavern" self.description = """You're crawling along a tunnel hollowed out of the rock face. Occasionally you have to duck under a stalactite.""" self.tunnel = True self.spawn_chance = 1 self.spawn = Species.cavern_mons for x in xrange(Utl.rn_seq(mons_spawn_chance)): self.add(Utl.rn_seq(Species.cavern_mons).make(ai=Monster.SLEEPING)) for x in xrange(Utl.rn_seq(item_spawn_chance)): self.add(Utl.rn_seq(Items.cavern_items).make()) class HoboThroneRoom(Node.Node): def xinit(self): self.color = Ifc.MAJOR_CYAN self.name = "Throne Room" self.description = """You have entered the infamous dwelling of the the local hobo monarch. Except for a throne carved from rock, this room looks very spartan.""" self.unique = True self.tunnel = False self.locked = True self.add(Species.hobo_leader.make())