package th; /* FORMAT FOR REGIONS: Put the region at the top, followed by all the nodes * that it uses. */ class WonkaRegion extends Region { public static String name = "Chocolate-encrusted Cavern"; public static String description = "You catch a wiff of chocolate as you enter this room.\n" +"Despite the pleasing aroma, however, you sense great evil\n" +"deep within these catacombs."; public static String color = Ifc.BRIGHT_MAGENTA; public WonkaRegion (Node start, int region) { super(start, region); } // Put your nodes here for performance reasons. private static Class WonkaTunnel = Utl.gclass("WonkaBasicTunnel"); private static Class WonkaEncounterR = Utl.gclass("WonkaEncounter"); private static Class WonkaRoom = Utl.gclass("WonkaSideTunnel"); private static Class WonkaCatacombs = Utl.gclass("WonkaAncientCatacombs"); public void generate (Node origin, int region, int direction) { origin.description = description; origin.name = name; origin.color = color; Node tmp = origin; Node old_tmp; int size = Utl.d(3,6); for (int i = 0; i < size; ++i) { old_tmp = tmp; tmp = (Node)Utl.newInstance(WonkaTunnel); tmp.region = region; Map.makelink(tmp, old_tmp, direction); if (Utl.rn()) { // add clockwise branch Node brn1 = (Node)Utl.newInstance(WonkaRoom); brn1.region = region; Map.makelink(brn1, tmp, Map.rotate(direction, 1)); } if (Utl.rn()){ // add counter-clockwise branch Node brn1 = (Node)Utl.newInstance(WonkaRoom); brn1.region = region; Map.makelink(brn1, tmp, Map.rotate(direction, -1)); } } Node mine_end = (Node)Utl.newInstance(WonkaEncounterR); mine_end.region = region; Node catacombs = (Node)Utl.newInstance(WonkaCatacombs); catacombs.region = region; Map.makelink(mine_end, tmp, direction); Map.makelink(catacombs, mine_end, direction); } } class WonkaSideTunnel extends Node { private static String[] DESCS = { "This warren is home to some oompa-loompa slaves.", "There is an active chocolate mine here.", "This area must be used for storage.", "There is a vein of cocoa ore here.", "This is an oompa-loompa graveyard. Corpses are stacked in piles." }; private static String[] NAMES = { "Slave Quarters", "Chocolate Mine", "Storeroom", "Cocoa Vein", "Oompa-Loompa Catacombs" }; private static Spe[] MONS = { Species.oompa, Species.oompa, Species.chocolate_golem, Species.chocolate_golem, Species.oompa, }; private static Kind[] ITMS = { Items.tattered_rags, Items.chocolate, Items.sack, Items.chocolate, Items.oompa_corpse }; public WonkaSideTunnel() { super(); color = Ifc.BRIGHT_MAGENTA; special_symbol = "#"; int type = Utl.rn(5); description = DESCS[type]; name = NAMES[type]; tunnel = false; spawn = Species.wonka_spawn; spawn_chance = 1; int f = Utl.rn(6); for (int i = 0; i < f; ++i) add(ITMS[type].make()); f = Utl.rn(2); for (int i = 0; i < f; ++i) add(MONS[type].make()); } } class WonkaBasicTunnel extends Node { private static String[] 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." }; public WonkaBasicTunnel() { super(); color = Ifc.BRIGHT_MAGENTA; description = Utl.rn(DESCS); name = "Chocolate Mines"; unique = true; tunnel = true; spawn = Species.wonka_spawn; spawn_chance = 1; int f = Utl.rn(6); for (int i = 0; i < f; ++i) add(Items.chocolate.make()); f = Utl.rn(3); for (int i = 0; i < f; ++i) add(Utl.rn(Species.wonka_spawn).make()); } } class WonkaMonSpecial extends MonSpecial { boolean first = true; int old_oompa_align = -1; public void die(Mon self, Mon killer, Node here) { Ifc.msg("Wonka: 'How can this be happenning? I am invincible! No!'"); if (killer == g.player) { g.bonus += 100; g.special_merits.add("+100 Vanquished the Mad Confectioner Willie Wonka."); } else if (killer.ai == killer.PET) { g.bonus += 50; g.special_merits.add( "+50 Your team Vanquished the Mad Confectioner Willie Wonka" ); } Species.oompa.xenophobic = false; } public void attacked(Mon self, Mon attacker, Node here) { if (first && attacker == g.player) { first = false; Ifc.msg("Wonka: 'Fool! Prepare to meet your terrible doom!'"); if (g.player.resist_polymorph || g.player.species.resist_polymorph) { Ifc.msg( "Wonka: 'You may be protected from my most lethal weapon, but do not think you can defeat me!" ); } else if (g.player.gender == g.player.FEMALE) { Ifc.msg("Wonka: 'I will turn your body into my new blueberry juice factory!'"); } else if (g.player.gender == g.player.MALE) { Ifc.msg("Wonka: 'I will reanimate your exploded corpse and make you my 'personal' slave!'"); } Species.oompa.xenophobic = true; } } } class WonkaEncounter extends Node { public WonkaEncounter() { super(); color = Ifc.MAJOR_MAGENTA; description = "This room is decorated with oompa-loompa skulls, giant\n" + "candy, and a river of chocolate. In the center, there is an\n" + "imperious throne, crafted from rock candy. The whole place reeks\n" + "of oompa-loompa blood, entrails, and candy. It gives you chills.\n"; name = "Eerie Lair"; unique = true; tunnel = false; locked = true; spawn = Species.wonka_spawn; spawn_chance = 1; Mon wonka = Species.wonka.make(); wonka.special = new WonkaMonSpecial(); wonka.inventory.add(Items.cloak.make()); wonka.inventory.add(Items.top_hat.make()); wonka.inventory.add(Items.wonka_whistle.make()); add(wonka); } } class WonkaAncientCatacombs extends Node { public WonkaAncientCatacombs() { super(); name = "Ancient Oompa-Loompa Catacombs"; special_symbol = "%"; color = Ifc.MAJOR_MAGENTA; description = "A chill stinking breeze from a crack in the wall permiates the air.\n" + "Stacks of the oompa-loompa dead line compartments on the walls."; unique = true; tunnel = false; locked = true; for (int i = 0; i < 10; ++i) if (Utl.rn()) add(Items.filth.make()); else add(Items.oompa_corpse.make()); add(Items.tattered_rags.make()); } public void do_special(int which, Itm item, Mon user) { if (which != 0 || item.kind != Items.wonka_whistle) return; if (north == null) { Node tmp = new WonkaSecretLab(); tmp.region = this.region; Map.makelink(tmp, this, 0); Ifc.msg("A secret door appears to the north!"); } else { Node tmp = new WonkaSecretLab(); tmp.region = this.region; Map.makelink(tmp, this, 3); Ifc.msg("A secret door appears to the west!"); } } } class WonkaSecretLab extends Node { public WonkaSecretLab() { super(); special_symbol = "L"; color = Ifc.BRIGHT_MAGENTA; name = "Clandestine Laboratory"; description = "This dark lab is filled with the appaling results of Wonka's " + "depraved\nbiological exiperiments. You shudder to think of the horrors\n" + "these pastel walls have seen...\n" + "You have the eerie feeling that some of the experimental animals are \n" + "observing you."; unique = true; tunnel = false; locked = true; for (int i = 0; i < 3; ++i) { Itm tmp = Items.cage.make(); tmp.name = "Lab Animals"; ((cageSpecial)tmp.special).capacity = 1; Mon critter = Species.hamster.make(); critter.inventory.clear(); critter.inventory.add(Items.carrot.make()); critter.name = "XPC-"+Utl.rn(1000); ((cageSpecial)tmp.special).contents.add(critter); add(tmp); } Itm tmp = Items.flask.make(); ((flaskSpecial)tmp.special).type = 0; tmp.name = "Sulfuric Acid"; add(tmp); tmp = Items.flask.make(); ((flaskSpecial)tmp.special).type = 1; tmp.name = "Red Dye #5"; add(tmp); tmp = Items.flask.make(); ((flaskSpecial)tmp.special).type = 2; tmp.name = "Pikachu Extract"; add(tmp); tmp = Items.flask.make(); ((flaskSpecial)tmp.special).type = 3; ((flaskSpecial)tmp.special).super_charge = true; ((flaskSpecial)tmp.special).uses = 1; tmp.name = "Loompa Leavings"; add(tmp); tmp = Items.flask.make(); ((flaskSpecial)tmp.special).type = 4; tmp.name = "Foobar McGee's Herbal Elixer"; add(tmp); add(Items.lab_coat.make()); add(Items.gum.make()); } }