from .. import Region, Node, Ifc, Utl, Map, g from ..data import Species, Items rotation = [1, 1, 1, -1, 1, -1, -1] def ConferenceRegion(origin, region, direction): origin.color = Ifc.BRIGHT_GREEN origin.name = "Manhole" origin.description = """At one end of the tunnel, you see a ladder leading up through a hole into a bright light.""" newnode, oldnode = origin, None size = Utl.d(10, 4) curdir, phase, hold = direction, 0, 3 while size: oldnode, newnode = newnode, ConferenceNode(region=region) if hold > 0: hold -= 1 else: size -= 1 if Utl.rn(3) == 0 and hold < 2: spawn = ConferenceBranch(region=region) Region.makelink(spawn, newnode, Map.rotate(curdir, -rotation[phase])) Region.makelink(newnode, oldnode, curdir) if Utl.rn(4) == 0 and hold <= 0 and phase < 6: hold, curdir = 2, Map.rotate(curdir, rotation[phase]) phase += 1 oldnode, newnode = newnode, ConferenceEncounter(region=region) Region.makelink(newnode, oldnode, curdir) class ConferenceNode(Node.Node): def xinit(self): self.color = Ifc.GREEN self.name = "Corridor" self.description = "You're walking along a corridor in what looks like a building." self.tunnel = True self.spawn = Species.conference_spawn self.spawn_chance = 1 branch_descs = [ "There is a small coffee machine and a table crammed into the room.", "The room is dominated by an array of pipes against the far wall.", "This room is furnished only with a wall mirror and small dresser.", "The only feature in this room is a sink against one wall." ] class ConferenceBranch(Node.Node): def xinit(self): self.color = Ifc.GREEN self.name = "Cramped Side Room" self.description = Utl.rn_seq(branch_descs) self.spawn = Species.conference_spawn self.spawn_chance = 1 for x in xrange(Utl.rn(4)): self.add(Utl.rn_seq(Species.conference_spawn).make()) class ConferenceEncounter(Node.Node): def xinit(self): self.color = Ifc.MAJOR_GREEN self.name = "Dressing Room" self.description = """The pre-press-conference dressing room of an infamous corrupt politician. Walls are lined with pictures of opponents and various legal documents.""" self.tunnel = False self.unique = True self.spawn = Species.conference_spawn self.spawn_chance = 1 senator = Species.senator.make() senator.add(Items.briefcase.make()) self.add(senator)