package th; class HoboRegion extends Region { public static String name = "Gaping Hole"; public static String description = "At the end of the tunnel, you see a rock wall with\na large hole carved into it."; public static String color = Ifc.BRIGHT_CYAN; public HoboRegion (Node start, int region) { super(start, region); } private static Class HoboNode = Utl.gclass("HoboTunnel"); private static Class HoboEncounter = Utl.gclass("HoboThroneRoom"); public void generate (Node origin, int region, int direction) { origin.description = description; origin.name = name; origin.color = color; origin.unique = true; Node newnode = origin; Node oldnode; int size = Utl.d(8, 6); int curdir = direction; int phase = 1; while (size > 0) { oldnode = newnode; newnode = (Node)Utl.newInstance(HoboNode); newnode.region = region; size--; Map.makelink(newnode, oldnode, curdir); if (Utl.rn(2) == 0) { phase = -phase; curdir = Map.rotate(curdir, phase); } } oldnode = newnode; newnode = (Node)Utl.newInstance(HoboEncounter); newnode.region = region; Map.makelink(newnode, oldnode, curdir); } } class HoboTunnel extends Node { private static Spe[] MONS = { Species.hobo, Species.hobo, Species.hobo, Species.hobo, Species.hobo, Species.mole_person, Species.mole_person, Species.hamster, Species.spider, Species.hamster, Species.mole_person }; private static Kind[] ITMS = { Items.tattered_rags, Items.tattered_rags, Items.tattered_rags, Items.stick, Items.stick, Items.filth, Items.filth, Items.overalls, Items.rock, Items.rock, Items.rock, Items.rock, Items.sack, Items.peanut, Items.peanut, Items.carrot, Items.carrot, Items.peanut, Items.chocolate, Items.soda, Items.frying_pan, Items.frying_pan, Items.frying_pan, Items.spork, Items.spork }; private static int[] mons_spawn_chance = {0, 1, 1, 1, 2}; private static int[] item_spawn_chance = {0, 1, 1, 2, 3}; public HoboTunnel() { super(); name = "Cavern"; description = "You're crawling along in a tunnel hollowed out of the rock\nface. Occasionally you have to duck under a stalactite."; color = Ifc.CYAN; tunnel = true; spawn = MONS; spawn_chance = 1; int f = Utl.rn(mons_spawn_chance); for (int i = 0; i < f; ++i) { Mon tmp = Utl.rn(MONS).make(); tmp.ai = 0; add(tmp); } f = Utl.rn(item_spawn_chance); for (int i = 0; i < f; ++i) add(Utl.rn(ITMS).make()); } } class HoboThroneRoom extends Node { public HoboThroneRoom () { super(); color = Ifc.MAJOR_CYAN; name = "Throne Room"; //description to be written unique = true; tunnel = false; locked = true; Mon leader = Species.hobo_leader.make(); add(leader); } }