package th; // Special attack interface SpecialAttack { public void doSpecial(Mon user, Mon target); public boolean usep(Mon user, Mon target); } class insultSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 57; } public void doSpecial (Mon user, Mon target) { Ifc.you("compare|s| the " +target.species.name + " to rodentia.", user); } } class mind_flayerSpecialAttack implements SpecialAttack { private static String[] NTH = { "first", "second", "third", "last" }; public boolean usep (Mon user, Mon target) { if (target.in*3 + 40 > 80) Ifc.you("|is| attracted to "+Ifc.the_mon(target)+"'s great brain!", user); return !target.dead; // Smart brains are tastier } public void doSpecial (Mon user, Mon target) { int i = 0; while (i < 4) { if (Utl.rn(target.dx) < Utl.rn(user.dx)) { Ifc.you("grab|s| " + Ifc.the_mon(target) + "'s head with " +Ifc.his(user)+" "+NTH[i]+" tentacle!", user); if (target.stunned == 0) { target.stunned = 1; target.stunner = "being grabbed by a mind flayer"; } } else { Ifc.you("evade|s| the mind flayer's tentacles.", target); return; } ++i; } Ifc.you("has all four of " + Ifc.his(user) + " tentacles around " + Ifc.the_mon(target) + "'s head!", user); Ifc.you("eat|s| " + Ifc.his(target) + " brain!", user); target.in = 0; target.last_damage = "having " + Ifc.his(target) + " brain eaten by a mind flayer"; target.hp = 0; } } class pyrex_elfSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 60; } public void doSpecial (Mon user, Mon target) { Ifc.you("spit|s| iron compounds on " + Ifc.the_mon(target) + "!", user); if (target.resist_chemical) { Ifc.you("|is| not affected.", target); } else { target.last_damage = "ferric elf spit"; target.hp -= Utl.d(12); // ignore armor if (Utl.rn(target.dx) == 0) { Ifc.you("|is| weakened by the poisonous chemicals!", target); target.st -= Utl.d(3); } } } } class nemesisSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(200) < 250-user.hp; } public void doSpecial (Mon user, Mon target) { user.do_talk(false); Ifc.you("throw|s| hot acid on " + Ifc.the_mon(target) + "!", user); if (target.resist_chemical && target.species != Species.pyrex_elf) { Ifc.your("lab coat partially protects "+Ifc.the_mon(target) + ".", target); target.damage(Utl.d(20), user); target.last_damage = "not having good enough safety equipment"; } else if (target.species.resist_chemical) { Ifc.you("|is| not harmed by the sulfuric acid.", target); } else { target.last_damage = "a flagrant safety code violation"; target.hp -= Utl.d(2,20); // ignore armor target.stunned = Utl.d(4); target.st -= 1; Ifc.you("|is| crippled by pain!", target); target.stunner = "painful acid burns"; } } } class enemesisSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(); } public void doSpecial (Mon user, Mon target) { user.do_talk(false); if (Utl.rn()) { // bureaucratic attack Ifc.you("recite|s| crippling and ineffectual safety regulations!",user); Ifc.your("incantation summons dark forces of entropy and waste...",user); for (Object x: user.here.mons) { Mon y = (Mon)x; if (y != g.player && y.ai == y.PET && y.in < Utl.rn(30)) { Ifc.you("|is| too disillusioned to carry on.", y); y.ai = y.WANDERING; } if (y == g.player) { Ifc.you("feel|s| oppressed.", y); } } } else { // poison gases Ifc.you("throw|s| a flask of volatile chemicals!", user); for (Object x: user.here.mons) { Mon y = (Mon)x; //duck typing is much nicer if (!y.resist_gas) { Ifc.you("cough|s| and spasm|s|!", y); y.stunned = Utl.rn(2); y.stunner = "a coughing fit"; y.hp -= Utl.rn(y.mhp/3); y.last_damage = "poison gases"; } else { Ifc.you("|is| not harmed.",y); } } } } } class securitySpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) > 80 && target.hp >= target.mhp / 2; } public void doSpecial(Mon user, Mon target) { Ifc.you("draw|s| out a handgun and shoot|s| at " + Ifc.the_mon(target) + "!", user); if (target.species.resist_bullets) Ifc.your("skin protect|s| " + Ifc.him(target) + " from the bullets.", target); else if (target.resist_bullets) Ifc.your("bulletproof vest protect|s| " + Ifc.him(target) + " from the bullets.", target); else { Ifc.you("|is| severely wounded by the bullets!", target); target.hp -= (target.mhp / 3) + Utl.rn(target.mhp / 4); target.last_damage = "a handgun"; } } } class spiderSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 10; } public void doSpecial (Mon user, Mon target) { Ifc.you("jumps on and bites " + Ifc.the_mon(target) + "!", user); target.last_damage = "a spider bite"; target.hp -= Utl.d(6); // ignore armor if (Utl.rn(target.dx) < 5) { Ifc.you("|is| weakened by the poisonous bite!", target); target.st -= Utl.d(2); } if (Utl.rn(target.dx) < 5) { Ifc.you("|is| crippled by pain!", target); target.dx -= Utl.d(2); g.update.addElement(target); target.stunned = 3; target.stunner = "the poisonous bite of a " + user.species.name; } } } class gcSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 15; } public void doSpecial (Mon user, Mon target) { if (target == g.player || target.species.gc_immune) { Ifc.you("touch|es| " + Ifc.the_mon(target) + "!", user); if (g.player.murders < Utl.rn(20) || target.species.gc_immune) { Ifc.you("feel|s| a benevolent aura shielding "+Ifc.him(target)+".", target); return; } else if (target == g.player) { Ifc.you("feel like a murderer."); } } Ifc.you("touch|es| " + Ifc.the_mon(target) + "!", user); Ifc.you("|is| feeling rather unreferenced!", target); Ifc.you("|is| cast alive into the celestial bit bucket!", target); target.hp = 0; target.here.mons.remove(target); target.last_damage = "automatic memory management"; } } class programmerSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(); } public void doSpecial (Mon user, Mon target) { Ifc.you("say|s|, \"free(target); target = NULL;\"", user); Ifc.your("fundimental particles feel rather liberated.", target); target.hp = -1; target.here.mons.remove(target); target.last_damage = "manual memory management"; } } class pikachuSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 40; } public void doSpecial (Mon user, Mon target) { if (Utl.rn(30) < target.dx) { Ifc.you("fire|s| an electric blast at " + Ifc.the_mon(target) +", but it misses.", user); } else { Ifc.you("zap|s| " + Ifc.the_mon(target) + " with an electric blast!", user); target.hp -= Utl.d(10)+10; target.last_damage = "a "+user.species.name+"'s electric blast"; if (target.hp < 0) target.die(user); } } } class tribbleSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return (Utl.rn(100) < 40) && user.species.created - user.species.dead < 100; } public void doSpecial (Mon user, Mon target) { Ifc.you("see|s| more "+user.species.name+"s!", target); user.here.add(user.species.make()); user.here.add(user.species.make()); user.here.add(user.species.make()); user.here.add(user.species.make()); } } class wonkaSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return (target == g.player && Utl.rn()); } public void doSpecial (Mon user, Mon target) { Ifc.you("call|s| in some of "+Ifc.his(user)+" minions!", user); user.here.add(Species.oompa.make()); if (Utl.rn()) user.here.add(Species.oompa.make()); } } class zerglingSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(15) > user.here.mons.size() && Utl.rn(100) < 15 && user.species.created - user.species.dead < 150; } public void doSpecial (Mon user, Mon target) { Ifc.you("hear|s| a distant voice say, \"Zerg rush! kekeke\"", target); Mon z; int f = Utl.d(4); for (int i = 0; i < f; ++i) { z = Species.zergling.make(); z.rabid = false; z.ai = user.ai; user.here.add(z); } } } class tohyaSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(100) < 40; } public void doSpecial (Mon user, Mon target) { Ifc.you("disappear|s|.", user); user.here.mons.remove(user); g.monsters.remove(user); } } class gelatinous_cubeSpecialAttack implements SpecialAttack { public boolean usep (Mon user, Mon target) { return Utl.rn(); } public void doSpecial (Mon user, Mon target) { Itm what; if (Utl.rn() && target != user) { // paralyze Ifc.you("squirt|s| paralyzing slime on " + Ifc.the_mon(target) + ".", user); target.stunned = Utl.d(3,6); target.stunner = "gelatinous cube juices"; if (Utl.rn(6) == 0 && target != g.player && target.species != Species.nemesis) { Ifc.you("engulf|s| and digest|s| " + Ifc.the_mon(target) + "!", user); target.hp = 0; target.last_damage = "being engulfed by a gelatinous cube"; } } else { // digest if (!user.inventory.isEmpty()) { what = (Itm)Utl.rn(user.inventory); if (what.kind == Items.zaurus || what.kind == Items.nerf_sword || what.kind == Items.pen) return; Ifc.you("digest|s| a " + what.kind.name + ".", user); user.inventory.remove(what); what.worn = false; if (what.wielded) { what.wielded = false; user.wielded = null; } } if (!user.here.items.isEmpty()) { what = (Itm)Utl.rn(user.here.items); Ifc.you("engulf|s| and then digest|s| a " + what.kind.name + ".", user); user.here.items.remove(what); } } } } class code_monkeySpecialAttack implements SpecialAttack { SpecialAttack stolen = null; public boolean usep (Mon user, Mon target) { return (Utl.rn(100) < 50) || stolen == null; } public void doSpecial (Mon user, Mon target) { if (target.species.special == null || Utl.rn()) { Ifc.you("speak|s| in l33t, draining " + Ifc.the_mon(target) + "'s intelligence!\n", user); target.hp -= Utl.d(3); target.in -= Utl.rn(2); target.last_damage = "obnoxious gamer slang"; if (stolen != null && stolen.usep(user, target)) stolen.doSpecial(user, target); return; } Ifc.you("take|s| some code from " + Ifc.the_mon(target) + " into itself!", user); target.last_damage = "cut and paste"; target.hp -= Utl.d(6); target.in -= Utl.rn(2); Ifc.you("learn|s| a special attack!", user); stolen = target.species.special; } } class jediSpecialAttack implements SpecialAttack { public boolean usep(Mon user, Mon target) { return Utl.rn(100) < 15; } public void doSpecial (Mon user, Mon target) { Ifc.you("see|s| the " + user.species.name + " concentrate.", target); if (target.inventory.isEmpty()) { Ifc.you("trip|s| " + Ifc.the_mon(target) + " using the Force!", user); target.stunned = 1; target.stunner = "tripped by a " + user.species.name; return; } Itm what = (Itm)Utl.rn(target.inventory); int index = target.st - Utl.rn(12); if (index < 0) { Ifc.your(what.kind.name + " is pulled away by " + Ifc.the_mon(user) + "!", target); target.drop(what); user.pick_up(what); } else if (index < 3 && (what.wielded || what.worn)) { Ifc.your(what.kind.name + " is yanked off!", target); target.drop(what); } else { Ifc.you("|is| thrown back!", target); target.here.mons.remove(target); Utl.rn(target.here).add(target); if (target == g.player) g.here = g.player.here; } } }