package th; // Species class import java.util.Vector; public class Spe { public String name = "Missingno"; // :) // Name for the species. public String description = "Missing description."; // Describe it thusly. public static int TINY = 0, SMALL = 1, NORMAL = 2, LARGE = 3, GIANT = 4; public int size = NORMAL; // Monster size. public boolean boss = false; // Boss monsters have special behavior // such as fighting to the death more readily. // Behaviors for item use public boolean uses = false, wears = false, wields = false; public boolean special_talk = false; // Don't put speech in quotes. public boolean resist_chemical = false; public boolean resist_polymorph = false; public boolean resist_bullets = false; public boolean resist_gas = false; /* public boolean no_leveling = false; // Can't level up. superseeded by Level field - null means no leveling. */ // If this is true, the player will use the special attack // if polymorphed into the creature. public boolean usable_special = false; public String die_verb = "kill"; // You kill the foo! // // How many have been made? int created = 0, dead = 0; // say something when killed. public String last_words = null; boolean eats = true; public String attack_verb = null; // What it does when it attacks you without a weapon. // ------- VARIOUS parameters ------------------- // Individual parameters are marked, others do not varry // among individuals. boolean human = false; // If true, this species counts as a human. Main gameplay implication // is that it is considered murder to kill it. // The game tracks the number of murders you commit and there is a // chance that you will go to jail if you do this. It is desirable, // then, to avoid murdering. The villan is considered to have // renonced his/her humanity and thus isn't human for murder purposes. boolean chase = true; // These creatures will pursue if they think they are // winning the battle. (In ai state 3) // Also, they will flee if in ai state 2, and move around in // ai state 1. boolean gc_immune = false; // Immune to garbage collector's insta-kill attack. boolean no_wander = false; // Supress wandering behavior (useful for special nasties that // could otherwise get lost or killed - or drop in on player :) ) int gender = 0; // The creature's gender. 0: neuter, call it "it", // 1: male, call it "him", // 2: female, call it "her", // 3: male or female, pick one for each instance. String [] names = null; String [] male_names = null; String [] female_names = null; // Specific names for various instances of the creature. // If null, then this species doesn't have individual names, // otherwise, each instance gets a random name from the list. //' // // String[] photos = null; // Pictures you will get by photographing this creature // Leveling mode Level level = null; // Regen HP 1 in N turns. int regeneration = 100; // Use special attack on self. boolean auto_special = false; int alignment = 0; // Positive alignment means that the creature is Nerd-aligned, // Negative alignment means it is Jock-aligned. // 0 is of course neutral. boolean peaceful = false; // This creature is peaceful by default even if it would ordinarily // hate the player because of alignment difference. // Note that peaceful creatures can become hostile if provoked. boolean flees = false; // creature will run away and avoid combat in preference to // fighting the player. If it is fast and the player is not, // this also means that it will always get away. // (All mons will flee if weak.) boolean smart = false; // If true, the creature will pick up items and use them. // (Not very smartly; it will pick up anything until it can't // carry any more, and just wield the best weapon it has.) String[] talk = null; // If the player talks to the creature, give one of these replies. // (chosen at random). // If null, you will get a message ("The Foo doesn't share your penchant // for conversation".) boolean chatty = false; // Chatty monsters say things without the player talking to them. // If chatty is true but talk is null, a generic message results. // (The Foo speaks incomprehensibly.) The chance of a chatty monster // saying something is one in 10 per turn, although of course it will // always talk if spoken too. boolean xenophobic = false; int default_ai = 0; // you can set its default AI mode here. // 0 means sleeping, which is to say that it does nothing until // woken up by the player's entrance into the room. // 1 means it is started roving about, possibly picking up items and // fighting other monsters as per the normal behavior of creatures // after the player has awoken them. // // These are really the only two states you should set it in by // default, but for completeness: // 2 means that it is fleeing. It will move randomly like in 1, but // it will run away if the player or a cross-aligned monster is in // the room it enters. Other than that, they will behave like roving // monsters, above, picking stuff up and whatnot. // 3 means that it is hostile. Monsters that are hostile will chase // after the player if they can do so, in addition to normal roving // behavior. Hostile monsters will start fleeing if they are weak. // int sleep_timeout = 20; // How many turns before it goes back to sleep after being awoken? // Useful so that the game doesn't waste time tracking monsters that // the player woke up and left after a while. (Sleeping monsters // don't move, pick up items, fight, etc. They wait for the player // to come into the room.) Kind inventory[] = null; // If this creature starts with items, choose them from this list. int nitems = 0; // How many items does the creature get? // Note that this is a very primitive system. It needs improvement. Kind corpse = null; // Leave a corpse? // String wake_text = null; // Text to say when waking up boolean scavenger = false; // Eat corpses off the ground boolean teleports = false; // Can it teleport? // int rabid_chance = 10; // Chance to be rabid. int cyborg_chance = 10; // Chance to be a cyborg. int in = 1, st = 1, dx = 1, hp = 1; // The primary stats: intelligence, strength, and hit points. int vin = 0, vst = 0, vdx = 0, vhp = 0; // varriation in these stats. If you use negative numbers, then // (somewhat quirkily) the primary stats are minimums, and up to // the varriation less one may be added to them. Otherwise, the stats // varry by +/- the varriation. int difficulty = 0; // How difficult is this creature? Used to decide where it // can be placed. int number = -1; // The number of this type that can be created. Use -1 for // essentially unlimited creatures of this type; 1 for a unique // creature that may be randomly placed, 0 for a creature that must // be placed explicitly in special rooms, and any other positive // number for "this many". // SpecialAttack special = null; int ap = 2; // Create a creature of this type, randomly. public Mon make() { Mon m = new Mon(); m.species = this; ++created; if (gender == 3) m.gender = Utl.d(2); else m.gender = gender; if (m.gender == 1 && male_names != null) m.name = Utl.rn(male_names); else if (m.gender == 2 && female_names != null) m.name = Utl.rn(female_names); else if (names != null) m.name = Utl.rn(names); else m.name = null; // roll its stats. m.in = m.min = in + Utl.rn(-vin); m.st = m.mst = st + Utl.rn(-vst); m.hp = m.mhp = hp + Utl.rn(-vhp); m.dx = m.mdx = dx + Utl.rn(-vdx); m.resist_chemical = resist_chemical; m.resist_bullets = resist_bullets; m.resist_polymorph = resist_polymorph; m.alignment = alignment; m.ai = default_ai; m.ap = ap; m.xenophobic = xenophobic; m.inventory = new Vector(); if (inventory != null) { for (int i = 0; i < nitems; ++i) { m.inventory.add(Utl.rn(inventory).make()); } m.setupInventory(); } if (rabid_chance > Utl.rn(100)) { m.rabid = true; m.hp = (m.hp * 2)/3 + 1; } if (cyborg_chance > Utl.rn(100)) { m.mhp *= 2; m.mst += 5; m.hp = m.mhp; m.st = m.mst; m.cyborg = true; } g.addInPlace(m); return m; } }