from .. import Region, Ifc, Utl, Map, Node, g from ..data import Species, Items def WonkaRegion(origin, region, direction): origin.color = Ifc.BRIGHT_MAGENTA origin.name = "Chocolate-encrusted Cavern" origin.description = """You catch a wiff of chocolate as you enter this room. Despite the pleasing aroma, however, you sense great evil deep within these catacombs.""" newnode, oldnode = origin, None for x in xrange(Utl.d(3, 6)): oldnode, newnode = newnode, WonkaTunnel(region = region) Region.makelink(newnode, oldnode, direction) if Utl.rn(): Region.makelink(WonkaRoom(region = region), newnode, Map.rotate(direction, 1)) if Utl.rn(): Region.makelink(WonkaRoom(region = region), newnode, Map.rotate(direction, -1)) oldnode, newnode = newnode, WonkaEncounter(region = region) Region.makelink(newnode, oldnode, direction) oldnode, newnode = newnode, WonkaCatacombs(region = region) Region.makelink(newnode, oldnode, direction) oldnode, newnode = newnode, WonkaSecretLab(region = region) Region.makelink(newnode, oldnode, direction) tunnel_descs = [ "Splatters of chocolate adorn the walls.", "Entering this area, you catch a whiff of fruit juice.", "The smell of cocoa is strong here.", "This tunnel is like many others, but more sugary.", "Strange confectionary statues adorn this hall." ] class WonkaTunnel(Node.Node): def xinit(self): self.color = Ifc.BRIGHT_MAGENTA self.name = "Chocolate Mines" self.description = Utl.rn_seq(tunnel_descs) self.unique = True self.tunnel = True self.spawn = Species.wonka_spawn self.spawn_chance = 1 for x in xrange(Utl.rn(6)): self.add(Items.chocolate.make()) for x in xrange(Utl.rn(3)): self.add(Utl.rn_seq(Species.wonka_spawn).make()) side_tunnels = [ ("Slave Quarters", "This warren is home to some oompa-loompa slaves.", Species.oompa, Items.tattered_rags), ("Chocolate Mine", "There is an active chocolate mine here.", Species.oompa, Items.chocolate), ("Storeroom", "This area must be used for storage.", Species.chocolate_golem, Items.sack), ("Cocoa Vein", "There is a vein of cocoa ore here.", Species.chocolate_golem, Items.chocolate), ("Oompa-Loompa Catacombs", "This is an oompa-loompa graveyard. Corpses are stacked in piles.", Species.oompa, Items.oompa_corpse), ] class WonkaRoom(Node.Node): def xinit(self): self.special_symbol = '#' self.color = Ifc.BRIGHT_MAGENTA self.name, self.description, spe, itm = Utl.rn_seq(side_tunnels) self.tunnel = False self.spawn = Species.wonka_spawn self.spawn_chance = 1 for x in xrange(Utl.rn(6)): self.add(itm.make()) for x in range(Utl.rn(2)): self.add(spe.make()) class WonkaEncounter(Node.Node): def xinit(self): self.color = Ifc.MAJOR_MAGENTA self.name = "Eerie Lair" self.description = """This room is decorated with oompa-loompa skulls, giant candy, and a river of chocolate. In the center, there is an imperious throne, crafted from rock candy. The whole place reeks of oompa-loompa blood, entrails, and candy. It gives you chills.""" self.unique = True self.tunnel = False self.locked = True self.spawn = Species.wonka_spawn self.spawn_chance = 1 wonka = Species.wonka.make() wonka.add(Items.cloak.make()) wonka.add(Items.top_hat.make()) wonka.add(Items.wonka_whistle.make()) wonka.setup_inventory() self.add(wonka) class WonkaCatacombs(Node.Node): def xinit(self): self.special_symbol = '%' self.color = Ifc.MAJOR_MAGENTA self.name = "Ancient Oompa-Loompa Catacombs" self.description = """A chill stinking breeze from a crack in the wall permiates the air. Stacks of the oompa-loompa dead line compartments on the walls.""" self.unique = True self.tunnel = False self.locked = True for x in xrange(10): if Utl.rn(): self.add(Items.filth.make()) else: self.add(Items.oompa_corpse.make()) self.add(Items.tattered_rags.make()) class WonkaSecretLab(Node.Node): def xinit(self): self.special_symbol = 'L' self.color = Ifc.BRIGHT_MAGENTA self.name = "Tiny Passageway" self.description = """This dark lab is filled with the appaling results of Wonka's depraved biological exiperiments. You shudder to think of the horrors these pastel walls have seen... You have the eerie feeling that some of the experimental animals are observing you.""" self.tunnel = False self.locked = True for x in xrange(3): cage = Items.cage.make(name = "Lab Animals", capacity = 1) critter = Species.hamster.make(name = "XPC-%03d" % (Utl.rn(1000)), inventory = [Items.carrot.make()]) cage.contents.append(critter) self.add(cage) self.add(Items.flask.make(type = 0, name = "Sulfuric Acid")) self.add(Items.flask.make(type = 1, name = "Red Dye #5")) self.add(Items.flask.make(type = 2, name = "Pikachu Extract")) self.add(Items.flask.make(type = 3, uses = 1, blessed = True, name = "Loompa Leavings")) self.add(Items.flask.make(type = 4, name = "Foobar McGee's Herbal Elixir")) self.add(Items.lab_coat.make()) self.add(Items.gum.make()) def check_trap(self, mon, origin): if not g.freed_oompas: Ifc.you("attempt|s| to fit through the passageway, but |you| do|es|n't get very far before turning back because of a lack of crawlspace.", mon) return 0 if self.locked and mon is g.player: self.locked = False self.name = "Clandestine Laboratory" Ifc.you('find the rock Doompel Empa mentioned and press it, the passage widening as you walk through.') elif self.locked: return 0 return 1