package th; /* FORMAT FOR REGIONS: Put the region at the top, followed by all the nodes * that it uses. */ /* Traps lead up to the Zeius region. * There are four traps, scattered about in zeius' lair. * 1. Teleporter trap. Teleports you to a random node. * 2. Broken glass trap. Does damage. * 3. Clone trap - makes an evil clone of you. * 4. Armor destroying fire trap. * * Also in the leadup, you will face three students subverted by zeius: * Frederick - Liberal Arts Student. * wielded taocp, lots of healing items. * * Olivia - Science student. * Chemicals, wands, other nastyness, lab coat. * * Marcus - PE student. * Heavily armored, glowing sword * * When you first 'defeat' Zeius, she will (video game boss style) actually * be 'okay' and run away, leaving you to face a Dark Lord of Entropy * while she pulls back to regroup. * * * Dark Lord of Waste * Special Attack: Destroys Items * * After the DL has been delt with, the innermost level of the lab * can be reached. Zeius will be stronger and better equipped the second * time around, and basically immortal until the lab's Aether Beacons are * destroyed. UeberZeius chases and does splash damage. * * */ class ZeiusRegion extends Region { public static int remaining_beacons = 6; public static String name = "Eerie Passageway"; public static String description = "This area seems strange. You feel unsettled by it,\n" +"in a difficult to explain, primal way."; public static String color = Ifc.BRIGHT_YELLOW; public ZeiusRegion (Node start, int region) { super(start, region); } // Put your nodes here for performance reasons. private static final Class FillerTunnel = Utl.gclass("FillerTunnel"); private static final Class BadGuyTunnel = Utl.gclass("BadGuyTunnel"); private static final Class KeydTunnel = Utl.gclass("KeydTunnel"); private static final Class MatTunnel = Utl.gclass("MatTunnel"); private static final Class[] FiendishTraps = { Utl.gclass("TeleporterTrapTunnel"), Utl.gclass("GlassTrapTunnel"), Utl.gclass("FireTrapTunnel"), Utl.gclass("CloneTrapTunnel") }; public void generate (Node origin, int region, int direction) { origin.description = description; origin.name = name; origin.color = color; // make intro passage. Node tmp = origin; Node old_tmp; for (int i = 0; i < 3; ++i) { old_tmp = tmp; tmp = (Node)Utl.newInstance(FillerTunnel); tmp.region = region; Map.makelink(tmp, old_tmp, direction); } // now the fiendish traps, hehe for (int i = 0; i < 4; ++i) { Node left, right; old_tmp = tmp; tmp = (Node)Utl.newInstance(FillerTunnel); tmp.region = region; Map.makelink(tmp, old_tmp, direction); // obviously left and right are abstract terms here... left = (Node)Utl.newInstance(FiendishTraps[i]); left.region = region; if (i != 3) { right = (Node)Utl.newInstance(BadGuyTunnel); ((BadGuyTunnel)right).which_enemy = i; } else { right = (Node)Utl.newInstance(FillerTunnel); } right.region = region; Node t2; old_tmp = right; if (Utl.rn()) {t2 = left; left = right; right = t2;} Map.makelink(tmp, right, Map.rotate(direction, 1)); Map.makelink(tmp, left, Map.rotate(direction, -1)); if (i != 3) { tmp = (Node)Utl.newInstance(KeydTunnel); ((KeydTunnel)tmp).key_required = i+1; } else { tmp = (Node)Utl.newInstance(FillerTunnel); } tmp.region = region; Map.makelink(tmp, old_tmp, direction); } for (int i = 0; i < 3; ++i) { old_tmp = tmp; tmp = (Node)Utl.newInstance(FillerTunnel); tmp.region = region; Map.makelink(tmp, old_tmp, direction); } // now we make the matrix. Node[][] mat = new Node[5][5]; int lab_x = Utl.rn(3)+1, lab_y = Utl.rn(3)+1; for (int x = 0; x < 5; ++x ) for (int y = 0; y < 5; ++y) { if (lab_x==x&&lab_y==y) mat[x][y] = (Node)Utl.newInstance(Utl.gclass( "Evil_Lab")); else mat[x][y] = (Node)Utl.newInstance(MatTunnel); mat[x][y].region = region; } // fixate the matrix. for (int x = 0; x < 5; ++x) for (int y = 0; y < 5; ++y) { if (x != 0) mat[x][y].west = mat[x-1][y]; if (x != 4) mat[x][y].east = mat[x+1][y]; if (y != 0) mat[x][y].north = mat[x][y-1]; if (y != 4) mat[x][y].south = mat[x][y+1]; } if (direction == Map.NORTH) Map.makelink(mat[Utl.rn(5)][0], tmp, Map.NORTH); else if (direction == Map.SOUTH) Map.makelink(mat[Utl.rn(5)][4], tmp, Map.SOUTH); else if (direction == Map.WEST) Map.makelink(mat[0][Utl.rn(5)], tmp, Map.WEST); else // EAST Map.makelink(mat[4][Utl.rn(5)], tmp, Map.EAST); } } // For the intro and exits from the trap mazes. class FillerTunnel extends Node { public final static String[] DESCS = { "A chill breeze runs down this forboding tunnel.", "It's quiet. Too quiet.", "This tunnel is disturbingly unusual.", "There is something vaugely unsettling here.", "You have a bad feeling about this.", "This tunnel seems to radiate malenvonence.", "You feel unhappy and disquieted by this place." }; public FillerTunnel() { super(); description = Utl.rn(DESCS); color = Ifc.BRIGHT_YELLOW; name = "Ominous Tunnel"; } } // Horrible Fire-trap of pain +2 class FireTrapTunnel extends Node { boolean tripped; // only goes once. public FireTrapTunnel() { super(); tripped = false; description = "There are unusual holes in the ceiling overhead."; name = "Ominous Tunnel"; color = Ifc.BRIGHT_YELLOW; } public int check_trap(Mon m, Node origin) { if (tripped || g.turns == 0) return 1; if (m == g.player && Utl.rn(20) < g.player.in && !Ifc.yn("You sense danger. Proceed?")) return 0; return 2; } public void do_trap(Mon m) { Ifc.you("|is| enveloped in a torrent of flaming chemicals!",m); tripped = true; m.hp -= Utl.d(8,20); m.last_damage = "Flaming Death from Above"; Itm y = (Itm)Utl.rn(m.inventory); if (y != null && !y.kind.pc_only && !y.wielded && !y.worn) { Ifc.your(y.kind.name+" is destroyed by fire!",m); m.drop(y); this.items.remove(y); } } } // Mildy irritating pain-trap of pain // NoteL add pyrex golem class GlassTrapTunnel extends Node { public GlassTrapTunnel() { super(); description = "This room is full of broken glassware."; name = "Ominous Tunnel"; color = Ifc.BRIGHT_YELLOW; } public int check_trap(Mon m, Node previous) { return 2; } public void do_trap(Mon m) { if (Utl.rn(20) < m.dx) { Ifc.you("almost trip|s| and fall on some broken glass.", m); } else { Ifc.you("trip|s| and fall|s| on some broken glass.",m); m.hp -= Utl.d(4,10); m.last_damage = "broken glass"; } } } // Henious clone-trap of doom class CloneTrapTunnel extends Node { boolean tripped; // only goes once. public CloneTrapTunnel() { super(); tripped = false; description = "An arcane device, devoid of power, rests " +"against the far wall."; name = "Ominous Tunnel"; color = Ifc.BRIGHT_YELLOW; } public int check_trap(Mon m, Node previous) { if (tripped || g.turns == 0) return 1; return 2; } public void do_trap(Mon m) { tripped = true; Mon evil_clone = m.species.make(); evil_clone.xenophobic = true; evil_clone.hp = evil_clone.mhp = m.mhp; evil_clone.st = evil_clone.mst = m.mst; evil_clone.dx = evil_clone.mdx = m.mdx; evil_clone.in = evil_clone.min = m.min; if (m.name != null) evil_clone.name = m.name+"'s Evil Clone"; evil_clone.gender = m.gender; if (m.wielded != null) { Itm clone_weapon = m.wielded.kind.make(); evil_clone.inventory.add(clone_weapon); evil_clone.wielded = clone_weapon; } evil_clone.setupInventory(); Ifc.you("feel a strange sensation, as if you're being scanned.", m); Ifc.you("|is| very suprised to see a duplicate of yourself!",m); this.add(evil_clone); } } // The teleporter trap class TeleporterTrapTunnel extends Node { int tripped; // turn it was last tripped. public TeleporterTrapTunnel() { super(); tripped = 0; description = "There is a strange machine here, apparently a" +" teleporter."; name = "Ominous Tunnel"; color = Ifc.BRIGHT_YELLOW; } // gate in the baddest possible non-boss monster, tehe public int check_trap(Mon m, Node previous) { if (g.turns == tripped) return 1; return 2; } public void do_trap(Mon m) { tripped = g.turns; Ifc.you("proceed|s| down the tunnel, and suddenly there is" +" a flash!", m); Mon toughest = (Mon)g.monsters.get(g.monsters.size()-1); if (toughest == m) toughest = (Mon)g.monsters.get(0); // just in case for (Object x: g.monsters) { Mon themon = (Mon)x; if (themon.level >toughest.level && !themon.species.boss && themon != m && themon != g.player ) { toughest = themon; } } Ifc.you("disappear|s| in a flash!", toughest); toughest.here.mons.remove(toughest); this.add(toughest); Ifc.you("appear|s| in a flash!", toughest); } } // This is the bad-guy "trap" room. // Note that you can proceed only once the bad guy is dead as they each // produce a key on dying. class BadGuyTunnel extends Node { boolean tripped; // only goes once. public int which_enemy = 2; // 0 Fred, 1 Olivia, 2 Marcus private static final String[] DESCS = { "see|s| a sharply-dressed young man with an air of confidance.", "see|s| a determined-looking young woman wearing a lab-coat", "see|s| a young man with a crazed expression on his face" }; private static final String[] NAMES = { "Frederick", "Olivia", "Marcus" }; private static final int[] GENDERS = { 1,2,1 }; private static final Spe[] SPECIES = { Species.artsie, Species.nerd, Species.jock }; private void inventory_olivia(Mon olivia) { olivia.inventory.add(Items.lab_coat.make()); olivia.inventory.add(Items.t_shirt.make()); Itm wand = Items.wand.make(); wand.blessed = true; ((wandSpecial)wand.special).charges = 5; // she walks on the wild side ^^ olivia.inventory.add(wand); olivia.inventory.add(Items.fur_scrap.make()); if (g.major != 0) olivia.inventory.add(Items.zaurus.make()); Itm taocp = Items.textbook.make(); ((textbookSpecial)taocp.special).topic = 2; olivia.inventory.add(taocp); Itm poly = Items.flask.make(); ((flaskSpecial)poly.special).type = 3; ((flaskSpecial)poly.special).uses = 5; olivia.inventory.add(poly); Itm fruit = Items.flask.make(); ((flaskSpecial)fruit.special).type = 4; ((flaskSpecial)fruit.special).uses = 20; olivia.inventory.add(fruit); Itm acid = Items.flask.make(); ((flaskSpecial)acid.special).type = 0; ((flaskSpecial)acid.special).uses = 10; olivia.inventory.add(acid); Itm key = Items.key.make(); key.name = "Olivia's key"; ((keySpecial)key.special).type = 2; olivia.inventory.add(key); } private void inventory_fred(Mon fred) { fred.inventory.add(Items.top_hat.make()); fred.inventory.add(Items.vest.make()); fred.inventory.add(Items.cloak.make()); fred.inventory.add(Items.bulletproof_vest.make()); if (g.major != 1) fred.inventory.add(Items.pen.make()); Itm fruit = Items.flask.make(); ((flaskSpecial)fruit.special).type = 4; ((flaskSpecial)fruit.special).uses = 20; fred.inventory.add(fruit); Itm fang = Items.dragon_fang.make(); fang.blessed = true; fred.inventory.add(fang); Itm key = Items.key.make(); ((keySpecial)key.special).type = 1; key.name = "Frederick's key"; fred.inventory.add(key); } private void inventory_marcus(Mon marcus) { marcus.inventory.add(Items.jacket.make()); marcus.inventory.add(Items.metal_slab.make()); marcus.inventory.add(Items.metal_slab.make()); marcus.inventory.add(Items.pikachu_egg.make()); if (g.major == 2) marcus.inventory.add(Items.lightsaber.make()); else marcus.inventory.add(Items.nerf_sword.make()); marcus.inventory.add(Items.flask.make()); Itm key = Items.key.make(); ((keySpecial)key.special).type = 3; key.name = "Marcus' key"; marcus.inventory.add(key); } public BadGuyTunnel() { super(); tripped = false; description = "This is a side-room in this strange complex."; name = "Ominous Tunnel"; color = Ifc.BRIGHT_YELLOW; } public int check_trap(Mon m, Node previous) { if (tripped) return 1; if (m != g.player) return 0; tripped = true; return 2; } public void do_trap(Mon m) { Ifc.msg("You see someone ahead of you!"); Ifc.you(DESCS[which_enemy]); Mon baddie = SPECIES[which_enemy].make(); baddie.inventory.clear(); switch (which_enemy) { case 0: inventory_fred(baddie); break; case 1: inventory_olivia(baddie); break; case 2: inventory_marcus(baddie); break; } baddie.name = NAMES[which_enemy]; baddie.gender = GENDERS[which_enemy]; baddie.xenophobic = true; int leveltarget = (g.player.level > 10? g.player.level+5*which_enemy : 15+5*which_enemy); for (int i = 0; i < leveltarget; ++i) baddie.species.level.level_up(baddie); baddie.level = leveltarget; baddie.setupInventory(); this.add(baddie); } } class MatTunnel extends Node { public ZeiusRegion parent; public MatTunnel() { super(); description = "This is a large laboratory, populated with " + "strange instruments."; name = "Evil Lab"; color = Ifc.MAJOR_YELLOW; for (int i = 0; i < Utl.rn(5); ++i) add(Utl.rn(Species.zeius_spawn).make()); } } // Only permits entry with proper key from killing a bad guy. class KeydTunnel extends Node { public int key_required; boolean locked; public KeydTunnel() { super(); locked = true; key_required = 0; description = "This room has a large, solid door."; name = "Security Room"; color = Ifc.BRIGHT_YELLOW; } public int check_trap(Mon m, Node previous) { if (!locked) return 1; if (m != g.player) return 0; Ifc.you( "come to a solid door. There is a keyhole.", m); Itm key = Ifc.choice_itm("Try which item as a key?",m.inventory); if (key == null) { Ifc.you("leave.",m); return 0; } if (key.kind != Items.key) { Ifc.msg("Right... because sometimes a key looks like a " +key.kind.name+". Brilliant."); return 0; } if (((keySpecial)key.special).type != key_required) { Ifc.msg("That key doesn't seem to work."); return 0; } Ifc.msg("The door unlocks, and you pass by."); locked = false; return 1; } }