v07i001: ularn - ultra-larn, an enhancement of the larn adventure game, Part01/08

40 views
Skip to first unread message

Bill Randle

unread,
Jul 6, 1989, 9:58:43 AM7/6/89
to
Submitted-by: "Philip A. Cordier" <ph...@sco.COM>
Posting-number: Volume 7, Issue 1
Archive-name: ularn/Part01

[The original larn has been around for a long time and is generally
quite popular. Here's an updated version with additional features.
-br]

[from the author...]
[[This is Ularn, "Ultra-Larn". Ularn is based on the game Larn, as
written by Noah Morgan, and distributed to the net a couple years ago.
Much of the code is unchanged, and thus the similarities between
the two games is strong. Ularn, however, requires an entirely new
strategy to win. Some things I've added are:

* More levels to the dungeon and volcano
* More and tougher monsters
* Several new magic items that are essentially required to
win the game
* Characters (you can start off as a dwarf, elf, etc).
* Some new options for the .Ularnopts file
* New spells

It's basically a lot harder to win. If you're not familiar with
larn, well, it's basically another 'hack/rogue/omega' style
bash and slash dungeon game. I like it better than any of the
above, though. Use the standard 'rogue keys' to move around the
screen.]]

#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 8)."
# Contents: README MANIFEST bill.c nap.c object.c
# Wrapped by billr@saab on Thu Jun 29 08:10:15 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(8284 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
X U L T R A L A R N
X
X This is Ularn, "Ultra-Larn". Ularn is based on the game Larn, as
X written by Noah Morgan, and distributed to the net a couple years ago.
X Much of the code is unchanged, and thus the similarities between
X the two games is strong. Ularn, however, requires an entirely new
X strategy to win. Some things I've added are:
X
X * More levels to the dungeon and volcano
X * More and tougher monsters
X * Several new magic items that are essentially required to
X win the game
X * Characters (you can start off as a dwarf, elf, etc).
X * Some new options for the .Ularnopts file
X * New spells
X
X It's basically a lot harder to win. If you're not familiar with
X larn, well, it's basically another 'hack/rogue/omega' style
X bash and slash dungeon game. I like it better than any of the
X above, though. Use the standard 'rogue keys' to move around the
X screen.
X
XINSTALLATION:
X
X Configure the Makefile as required. It's pretty self explanatory.
X
X You'll need to set HOME in the Makefile to a directory to contain the
X Ufortune, Umaps, and Uhelp files. The following permissions are
X minimally required:
X HOME 111
X Ufortune 444
X Umaps 444
X Uhelp 444
X Uscore 666
X
X Set UNIX in the Makefile to either SYSV or BSD. This code has
X compiled and run with no problems on:
X
X SYSV:
X SCO Xenix 2.2 386
X SCO System V/386 3.2 (beta version)
X BSD:
X BSD UNIX 4.2
X BSD UNIX 4.3
X
X 'config.c' contains the defines for the wizard password, and default
X diagnostic and checkpoint file names.
X
X *THEN*
X run 'make install' and (as wizard) "Ularn -c" - this
X will create the scoreboard - you need to create it as
X wizard before other users can score on it
X
XNOTES:
X - NEVER NEVER cast 'vpr' when you are next to an altar.
X
X - Interesting things may happen when you sit on a dead throne.
X
XEXAMPLE ".Ularnopts" file:
X
X/* begin example .Ularnopts file */
Xno-introduction
Xname: "Satyr"
Xenable-checkpointing
Xno-beep
Xbold-off
Xcharacter:klingon
Xsavefile: /u/philc/SAVEFILE
Xmonster: "annoying thing"
Xmonster: "barfhead"
Xmonster: "egghead"
Xmonster: "freak"
Xmonster: "geek"
Xmonster: "heartburn"
Xmonster: "icky"
Xmonster: "jerk"
Xmonster: "klutz"
Xmonster: "lush"
Xmonster: "moron"
Xmonster: "nerd"
Xmonster: "old fart"
Xmonster: "rugrat"
Xmonster: "tweak case"
Xmonster: "ugghh"
Xmonster: "vermin"
Xmonster: "whitey"
Xmonster: "xenoid"
Xmonster: "yuchh"
Xmonster: "zetoid"
Xmonster: "Ack!"
Xmonster: "Hippy"
Xmonster: "Jackass"
Xmonster: "Kop"
Xmonster: "Dipshit"
X/* end example .Ularnopts file */
X
XBUGS:
X They are always there somewhere. Send bug reports to:
X
X ph...@sco.com
X or
X ...!uunet!sco!philc
X
X-Phil Cordier
X
X=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
X
X Specific spoilers on new stuff are below:
X
XDONT READ BELOW HERE UNLESS YOU REALLY WANT TO SPOIL THE GAME FOR YOURSELF!!!!
X
X
X
X
X* Lance of death & strategy
X
X In Larn, the basic strategy was to get enough money
X to buy a Lance of Death, usually by getting to
X dungeon level 10, killing or getting around the demon
X lord, and getting and then selling the Eye of Larn.
X This would usually get you enough money to buy the Lance
X from the dnd store. You could then go into the volcano and
X kill everything in sight with one hit from the Lance.
X
X Well, the Lance is still deadly to all monsters. Demons,
X on the other hand, are merely tickled. And there are a LOT
X more demons (and relatives) in Ularn than in Larn.
X
X* Dungeon and Volcano levels
X
X There are now 15 levels to the Dungeon, and 5 to the
X Volcano. Larn had 10 and 3.
X
X Levels 11 - 15 of the dungeon contain, in addition to
X all the other nasty monsters that show up at low levels:
X
X level 11: 1 demonlord
X level 12: 2 demonlords
X level 13: 3 demonlords
X level 14: 4 demonlords
X level 15: 5 demonlords + 1 demonprince guarding the Eye of Larn.
X
X Levels 1 - 5 of the Volcano contain:
X
X level 1: 1 demonprince
X level 2: 2 demonprinces
X level 3: 3 demonprinces
X level 4: 4 demonprinces
X level 5: 5 demonprinces + 1 God of Hellfire
X guarding the potion of cure dianthroritis.
X
X In addition, there are no stairs from level 3 to 4, or from
X 4 to 5. The only way to go down is via a pit or trap door.
X There is guanteed at least 1 bottomless pit and bottomless
X trap door on level 5. The rock on levels 3, 4, and 5 cannot
X be destroyed via a vaporize rock spell, or in any other way.
X
X* Magic Items
X
X There is 1 of each of the following magic items in the game:
X
X - Eye of Larn: The Eye now has a very benificial magic property.
X If you are carrying the Eye, demonlords, demon
X princes, and the God of Hellfire are visible to
X you. Otherwise, they are invisible. They will show
X as follows:
X
X monster character on screen
X
X Type I DemonLord 1
X Type II DemonLord 2
X Type III DemonLord 3
X Type IV DemonLord 4
X Type V DemonLord 5
X Type VI DemonLord 6
X Type VII DemonLord 7
X Demon Prince 9
X God of Hellfire 0
X
X - Sword of Slashing
X
X The sword of slashing is quite strong and light, and
X is impervious to rust.
X
X - Bessman's Flailing Hammer
X
X The Hammer is the strongest weapon in the game (excluding
X the lance of death). It lowers your intelligence by 10, but
X raises your dexterity and strength by 10.
X
X - Orb of Enlightenment
X
X Carrying the Orb gives permanent expanded awareness.
X
X - Orb of Dragon Slaying
X
X Causes attacks against dragons to be much more effective.
X
X - Scarab of Negate Spirit
X
X Spirit Nagas and Poltergiests damage is halved if you have
X the scarab of negate spirit.
X
X - Amulet of Invisibility
X
X Causes the 'inv' spell to last much longer.
X
X - Cube of Undead Control
X
X Vampires, Wraiths, and Zombies damage is halved you have
X the cube of undead control. In addition, they can perform
X no special attacks upon you, like draining your experience
X level.
X
X - Device of Theft Prevention
X
X If you have this, Nymphs and Disenchantresses cannot steal
X anything from you.
X
X - Brass Lamp
X
X A genie lives in the brass lamp. If you are lucky, by rubbing
X the lamp, the genie will grant you a spell. Be warned though,
X the genie does not usually like to be disturbed, and may react
X unpleasantly. If the genie disappears (along with the lamp)
X without granting you a wish, it is still possible to find him
X again. But if you are granted a wish, the genie will not wish
X to be disturbed again (you only get one wish).
X
X - Hand of Fear
X
X Causes the scare monster spell to last much longer.
X
X - Talisman of the Sphere
X
X Normally, demons can dispel spheres of annihilation,
X disenchantresses can cancel them, and if you have the
X spell 'cancel' cast, that may cancel the sphere too.
X You can also die by touching the sphere.
X
X Carrying the talisman revokes all of the above
X
X - Wand of Wonder
X
X You will not fall down any pits or trap doors if you are
X carrying the wand of wonder.
X
X - Staff of Power
X
X Carrying the staff of power will cancel any attack by a
X demonlord, demonprince, wraith, or vampire 75% of the time.
X
X - Slayer
X
X Demonlords and demonprinces attacks are halved if you are
X carrying the sword Slayer. Slayer essentially acts as a
X lance of death, but only against demons. It is otherwise
X a good strong weapon against other monsters. You will only
X find Slayer somewere below dungeon level 10, or in the volcano.
X
X - Elven Chain
X
X Strong and light, impervious to rust.
X
X* New spell
X
X I've added a 'make wall' spell, that creates a wall in the
X place you specify. The code is 'mkw'.
X
X* Elevators
X
X Watch out for express elevators. They can be good or bad, depending on
X which direction they go (up or down).
X
X* Time limit
X
X The time limit for solving the game has been increased from
X 300 mobuls to 400 mobuls.
X
X* Dealer McDope's
X
X On request from several unsavory types here at UC Santa Cruz, I
X added Dealer McDope's Pad. He will show up usually somewhere in the
X lower level of the dungeon. Visiting Dealer McDope's will offer you
X the chance to buy such interesting and stimulating items as:
X
X Killer Speed
X Groovy Acid
X Monster Hash
X Trippy Shrooms
X Cool Coke
X
X You "use" a drug by dropping it, and then moving on top of it.
X
X Drugs have varied effects. They can be fun, but are generally not worth
X the trouble.
X
END_OF_FILE
if test 8284 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1044 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X File Name Archive # Description
X-----------------------------------------------------------
X MANIFEST 1 This shipping list
X Makefile 4
X README 1
X Ufortune 7
X Uhelp.no_control 8
X Umaps 5
X bill.c 1
X config.c 8
X create.c 6
X data.c 3
X diag.c 7
X display.c 7
X fortune.c 7
X global.c 6
X header.h 6
X help.c 5
X io.c 3
X main.c 5
X monster.c 2
X moreobj.c 7
X movem.c 7
X nap.c 1
X object.c 1
X regen.c 6
X savelev.c 7
X scores.c 4
X signal.c 2
X store.c 4
X to_ansi.c 3
X tok.c 8
END_OF_FILE
if test 1044 -ne `wc -c <'MANIFEST'`; then
echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'bill.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bill.c'\"
else
echo shar: Extracting \"'bill.c'\" \(6129 characters\)
sed "s/^X//" >'bill.c' <<'END_OF_FILE'
X/* bill.c */
X
X#include "header.h"
X
Xstatic char mail600[32];
X/*
X * function to create the tax bill for the user
X */
Xstatic int pid;
Xletter1()
X{
X sprintf(mail600, "/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 600 letter\n",23);
X return(0);
X }
Xlprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
Xlprcat("From:");
Xlprcat(" the URS (Ularn Revenue Service)\n");
Xlprcat("\nSubject:");
Xlprcat(" undeclared income\n");
Xlprcat("\n We heard you survived the caverns of Ularn. Let me be the");
Xlprcat("\nfirst to congratulate you on your success. It is quite a feat.");
Xlprcat("\nIt must also have been very profitable for you.");
Xlprcat("\n\n The Dungeon Master has informed us that you brought");
Xlprintf("\n%d gold pieces back with you from your journey. As the",
X (long)c[GOLD]);
Xlprcat("\ncounty of Ularn is in dire need of funds, we have spared no time");
Xlprintf("\nin preparing your tax bill. You owe %d gold pieces as",
X (long)c[GOLD]*TAXRATE);
Xlprcat("\nof this notice, and is due within 5 days. Failure to pay will");
Xlprcat("\nmean penalties. Once again, congratulations, We look forward");
Xlprcat("\nto your future successful expeditions.\n");
X lwclose();
X return(1);
X}
X
Xletter2()
X{
X sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 601 letter\n",23);
X return(0);
X }
Xlprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
Xlprcat("From:");
Xlprcat(" His Majesty King Wilfred of Ularndom\n");
Xlprcat("\nSubject:");
Xlprcat(" a noble deed\n");
Xlprcat("\n I have heard of your magnificent feat, and I, King Wilfred,");
Xlprcat("\nforthwith declare today to be a national holiday. Furthermore,");
Xlprcat("\nhence three days, Ye be invited to the castle to receive the");
Xif (sex)
Xlprcat("\nhonour of Knight of the realm. Upon thy name shall it be written. . .");
Xelse
Xlprcat("\nhonour of Knightess of the realm. Upon thy name shall it be written. . .");
Xlprcat("\nBravery and courage be yours.");
Xlprcat("\nMay you live in happiness forevermore . . .\n");
Xlwclose();
Xreturn(1);
X}
X
Xletter3()
X{
X sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 602 letter\n",23);
X return(0);
X }
X lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
X lprcat("From:");
X lprcat(" Count Endelford\n");
X lprcat("\nSubject:");
X if (sex)
X lprcat(" You Bastard!\n");
X else
X lprcat(" You Bitch!\n");
Xlprcat("\n I heard (from sources) of your journey. Congratulations!");
X if (sex)
X lprcat("\nYou Bastard! ");
X else
X lprcat("\nYou Bitch! ");
Xlprcat("With several attempts I have yet to endure the");
Xlprcat(" caves,\nand you, a nobody, makes the journey! From this time");
Xlprcat(" onward, bewarned\nupon our meeting you shall pay the price!\n");
X lwclose();
X return(1);
X}
X
Xletter4()
X{
X sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 603 letter\n",23);
X return(0);
X }
X lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
X lprcat("From:");
X lprcat(" Mainair, Duke of Ularnty\n");
X lprcat("\nSubject:");
X lprcat(" High Praise\n");
Xlprcat("\n With a certainty a hero I declare to be amongst us! A nod of");
Xlprcat("\nfavour I send to thee. Me thinks Count Endelford this day of");
Xlprcat("\nright breath'eth fire as of dragon of whom ye are slayer. I");
Xlprcat("\nyearn to behold his anger and jealously. Should ye choose to");
Xlprcat("\nunleash some of thy wealth upon those who be unfortunate, I,");
X lprcat("\nDuke Mainair, Shall equal thy gift also.\n");
X lwclose();
X return(1);
X}
X
Xletter5()
X{
X sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 604 letter\n",23);
X return(0);
X }
X lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
X lprcat("From:");
X lprcat(" St. Mary's Children's Home\n");
X lprcat("\nSubject:");
X lprcat(" these poor children\n");
Xlprcat("\n News of your great conquests has spread to all of Ularndom.");
Xlprcat("\nMight I have a moment of a great ");
X if (!sex)
X lprcat("woman's");
X else
X lprcat("man's");
Xlprcat(" time. We here at St.");
X lprcat("\nMary's Children's Home are very poor, and many children are");
Xlprcat("\nstarving. Disease is widespread and very often fatal without");
Xlprcat("\ngood food. Could you possibly find it in your heart to help us");
X lprcat("\nin our plight? Whatever you could give will help much.");
X lprcat("\n(your gift is tax deductible)\n");
X lwclose();
X return(1);
X}
X
Xletter6()
X{
X sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
X if (lcreat(mail600) < 0) {
X write(1,"can't write 605 letter\n",23);
X return(0);
X }
X lprcat("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
X lprcat("From:");
X lprcat(" The National Dianthroritis Society of Ularn\n");
X lprcat("\nSubject:");
X lprcat(" hope\n");
Xlprcat("\nCongratulations on your successful expedition. We are sure much");
Xlprcat("\ncourage and determination were needed on your quest. There are");
Xlprcat("\nmany though, that could never hope to undertake such a journey");
Xlprcat("\ndue to an enfeebling disease -- dianthroritis. We at the National");
Xlprcat("\nDianthroritis Society of Ularn wish to appeal to your philanthropy in");
Xlprcat("\norder to save many good people -- possibly even yourself or a loved one a few");
Xlprcat("\nyears from now. Much work needs to be done in researching this");
Xlprcat("\ndreaded disease, and you can help today. Could you please see it");
Xlprcat("\nin your heart to give generously? Your continued good health");
X lprcat("\ncan be your everlasting reward.\n");
X lwclose();
X return(1);
X}
X
X/*
X * function to mail the letters to the player if a winner
X */
Xstatic int (*pfn[])()= {
X letter1, letter2, letter3, letter4, letter5, letter6
X};
X
Xmailbill()
X{
X register int i;
X char buf[128];
X
X wait(0);
X pid=getpid();
X if (fork() == 0) {
X resetscroll();
X for (i=0; i<sizeof(pfn)/sizeof(int (*)()); i++)
X if ((*pfn[i])()) {
X sleep(20);
X sprintf(buf,"mail %s < %s",loginname,mail600);
X system(buf);
X unlink(mail600);
X }
X exit(0);
X }
X}
END_OF_FILE
if test 6129 -ne `wc -c <'bill.c'`; then
echo shar: \"'bill.c'\" unpacked with wrong size!
fi
# end of 'bill.c'
fi
if test -f 'nap.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'nap.c'\"
else
echo shar: Extracting \"'nap.c'\" \(2248 characters\)
sed "s/^X//" >'nap.c' <<'END_OF_FILE'
X/* nap.c */
X
X#include "header.h"
X
X/*
X * routine to take a nap for n milliseconds
X */
Xnap(x)
Xregister int x;
X{
X if (x<=0) return; /* eliminate chance for infinite loop */
X lflush();
X if (x > 999)
X sleep(x/1000);
X#ifndef M_XENIX /* Xenix does not have times() */
X else napms(x);
X#endif /* M_XENIX */
X}
X
X#ifdef SYSV
X#ifndef M_XENIX
X/* napms - sleep for time milliseconds - uses times() */
X/* this assumes that times returns a relative time in 60ths of a second */
X/* this will do horrible things if your times() returns seconds! */
Xnapms(time)
Xint time;
X{
X long matchclock, times();
X struct tms stats;
X
X if (time<=0) time=1; /* eliminate chance for infinite loop */
X if ((matchclock = times(&stats)) == -1 || matchclock == 0)
X return; /* error, or BSD style times() */
X matchclock += (time / 17); /*17 ms/tic is 1000 ms/sec / 60 tics/sec */
X while(matchclock > times(&stats))
X ;
X}
X#endif /* M_XENIX */
X
X#else /* not SYSV */
X# ifdef BSD
X# ifdef SIGVTALRM
X /* This must be BSD 4.2! */
X# define bit(_a) (1<<((_a)-1))
Xnullf()
X{ }
X
X/* napms - sleep for time milliseconds - uses setitimer() */
Xnapms(time)
Xint time;
X{
X struct itimerval timeout;
X int (*oldhandler) ();
X int oldsig;
X
X if (time <= 0) return;
X
X timerclear(&timeout.it_interval);
X timeout.it_value.tv_sec = time / 1000;
X timeout.it_value.tv_usec = (time % 1000) * 1000;
X
X oldsig = sigblock(bit(SIGALRM));
X setitimer(ITIMER_REAL, &timeout, (struct itimerval *)0);
X oldhandler = signal(SIGALRM, nullf);
X sigpause(oldsig);
X signal(SIGALRM, oldhandler);
X sigsetmask(oldsig);
X}
X
X# else /* SIGVTALARM */
X/* napms - sleep for time milliseconds - uses ftime() */
X
Xnapms(time)
Xint time;
X{
X /* assumed to be BSD UNIX */
X struct timeb _gtime;
X time_t matchtime;
X unsigned short matchmilli;
X register struct timeb *tp = & _gtime;
X
X if (time <= 0) return;
X ftime(tp);
X matchmilli = tp->millitm + time;
X matchtime = tp->time;
X while (matchmilli >= 1000) {
X ++matchtime;
X matchmilli -= 1000;
X }
X
X while(1) {
X ftime(tp);
X if ((tp->time > matchtime) ||
X ((tp->time == matchtime) && (tp->millitm >= matchmilli)))
X break;
X }
X}
X# endif /* SIGVTALARAM */
X# else not BSD
Xnapms(time)
Xint time;
X{
X} /* do nothing, forget it */
X# endif /* BSD */
X#endif /* SYSV */
END_OF_FILE
if test 2248 -ne `wc -c <'nap.c'`; then
echo shar: \"'nap.c'\" unpacked with wrong size!
fi
# end of 'nap.c'
fi
if test -f 'object.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'object.c'\"
else
echo shar: Extracting \"'object.c'\" \(32476 characters\)
sed "s/^X//" >'object.c' <<'END_OF_FILE'
X/* object.c */
X
X
X#include "header.h"
X
X/*
X ***************
X LOOK_FOR_OBJECT
X ***************
X
X subroutine to look for an object and give the player his options
X if an object was found.
X */
Xlookforobject()
X{
X register int i,j;
X
X /* can't find objects is time is stopped*/
X if (c[TIMESTOP]) return;
X
X i=item[playerx][playery];
X if (i==0) return;
X
X showcell(playerx,playery);
X cursors();
X yrepcount=0;
X
X switch(i) {
X case OGOLDPILE:
X case OMAXGOLD:
X case OKGOLD:
X case ODGOLD:
X lprcat("\n\nYou have found some gold!");
X ogold(i);
X break;
X
X case OPOTION:
X lprcat("\n\nYou have found a magic potion");
X i = iarg[playerx][playery];
X if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]);
X opotion(i);
X break;
X
X case OSCROLL:
X lprcat("\n\nYou have found a magic scroll");
X i = iarg[playerx][playery];
X if (scrollname[i][0]) lprintf(" of %s",&scrollname[i][1]);
X oscroll(i);
X break;
X
X case OALTAR:
X if (nearbymonst()) return;
X lprcat("\n\nThere is a Holy Altar here!");
X oaltar();
X break;
X
X case OBOOK:
X lprcat("\n\nYou have found a book.");
X obook();
X break;
X
X case OCOOKIE:
X lprcat("\n\nYou have found a fortune cookie.");
X ocookie();
X break;
X
X case OTHRONE:
X if (nearbymonst()) return;
X lprintf("\n\nThere is %s here!",objectname[i]);
X othrone(0);
X break;
X
X case OTHRONE2:
X if (nearbymonst()) return;
X lprintf("\n\nThere is %s here!",objectname[i]);
X othrone(1);
X break;
X
X case ODEADTHRONE:
X lprintf("\n\nThere is %s here!",objectname[i]);
X odeadthrone();
X break;
X
X case OORB:
X if (nearbymonst()) return;
X finditem(i);
X break;
X
X case OBRASSLAMP:
X lprcat("\nYou have found a brass lamp ");
X lprcat("\nDo you want to (r) rub it, (t) take it, or (i) ignore it? ");
X i=0;
X while ((i!='r') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='r') {
X i=rnd(100);
X if (i>90) {
X lprcat("\nThe magic genie was very upset at being disturbed!");
X losehp((int)c[HP]/2+1);
X beep();
X }
X /* higher level, better chance of spell */
X else if ( (rnd(100)+c[LEVEL]/2) > 80) {
X register int a,b,d;
X lprcat("\nA magic genie appears!");
X cursors();
X lprcat("\n What spell would you like? : ");
X while ((a=getcharacter())=='D') {
X seemagic(99);
X cursors();
X lprcat("\n What spell would you like? : ");
X }
X /* to escape casting a spell */
X if (a=='\33') goto over;
X if ((b=getcharacter())=='\33')
X goto over;
X if ((d=getcharacter())=='\33') {
Xover:
X lprcat("aborted");
X return;
X }
X for (lprc('\n'),i=0; i<SPNUM+1; i++)
X if ((spelcode[i][0]==a)
X && (spelcode[i][1]==b)
X && (spelcode[i][2]==d)) {
X spelknow[i]=1;
X lprintf("\nSpell \"%s\": %s\n%s",spelcode[i],
X spelname[i],speldescript[i]);
X lprcat("\nThe genie prefers not to be disturbed again");
X forget();
X bottomline();
X return;
X }
X lprcat("\nThe genie has never heard of such a spell!");
X lprcat("\nThe genie prefers not to be disturbed again");
X forget();
X bottomline();
X return;
X }
X else lprcat("\nnothing happened");
X if (rnd(100) < 15) {
X lprcat("\nThe genie prefers not to be disturbed again!");
X forget();
X c[LAMP]=0; /* chance of finding lamp again */
X }
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OBRASSLAMP,0)==0) forget();
X }
X else lprcat("ignore");
X return;
X
X case OWWAND:
X if (nearbymonst()) return;
X finditem(i);
X break;
X
X case OHANDofFEAR:
X if (nearbymonst()) return;
X finditem(i);
X break;
X
X case OPIT:
X lprcat("\n\nYou're standing at the top of a pit.");
X opit();
X break;
X
X case OSTAIRSUP:
X lprcat("\n\nThere is a circular staircase here");
X ostairs(1); /* up */
X break;
X
X case OELEVATORUP:
X lprcat("\n\nYou have found an express elevator going up");
X nap(2000);
X oelevator(1); /* up */
X
X break;
X
X case OELEVATORDOWN:
X lprcat("\n\nYou have found an express elevator going down");
X nap(2000);
X oelevator(-1); /* down */
X break;
X
X case OFOUNTAIN:
X if (nearbymonst()) return;
X lprcat("\n\nThere is a fountain here");
X ofountain();
X break;
X
X case OSTATUE:
X if (nearbymonst()) return;
X lprcat("\n\nYou are standing in front of a statue");
X ostatue();
X break;
X
X case OCHEST:
X lprcat("\n\nThere is a chest here");
X ochest();
X break;
X
X case OIVTELETRAP:
X if (rnd(11)<6) return;
X item[playerx][playery] = OTELEPORTER;
X know[playerx][playery] = 1;
X
X case OTELEPORTER:
X lprcat("\nZaaaappp! You've been teleported!\n");
X beep();
X nap(3000);
X oteleport(0);
X break;
X
X case OSCHOOL:
X if (nearbymonst()) return;
X lprcat("\n\nYou have found the College of Ularn.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33')) i=getcharacter();
X if (i == 'g') {
X oschool(); /* the college of larn */
X }
X else lprcat(" stay here");
X break;
X
X case OMIRROR:
X if (nearbymonst()) return;
X lprcat("\n\nThere is a mirror here");
X omirror();
X break;
X
X case OBANK2:
X case OBANK:
X if (nearbymonst()) return;
X if (i==OBANK)
X lprcat("\n\nYou have found the bank of Ularn.");
X else
X lprcat("\n\nYou have found a branch office of the bank of Ularn.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X j=0;
X while ((j!='g') && (j!='i') && (j!='\33'))
X j=getcharacter();
X if (j == 'g') {
X if (i==OBANK)
X obank();
X else
X obank2(); /* the bank of larn */
X
X }
X else lprcat(" stay here");
X break;
X
X case ODEADFOUNTAIN:
X if (nearbymonst()) return;
X lprcat("\n\nThere is a dead fountain here");
X break;
X
X case ODNDSTORE:
X if (nearbymonst()) return;
X lprcat("\n\nThere is a DND store here.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33')) i=getcharacter();
X if (i == 'g')
X dndstore(); /* the dnd adventurers store */
X else lprcat(" stay here");
X break;
X
X case OSTAIRSDOWN:
X lprcat("\n\nThere is a circular staircase here");
X ostairs(-1); /* down */
X break;
X
X case OOPENDOOR:
X lprintf("\n\nYou have found %s",objectname[i]);
X lprcat("\nDo you (c) close it");
X iopts();
X i=0;
X while ((i!='c') && (i!='i') && (i!='\33')) i=getcharacter();
X if ((i=='\33') || (i=='i')) {
X ignore();
X break;
X }
X lprcat("close");
X forget();
X item[playerx][playery]=OCLOSEDDOOR;
X iarg[playerx][playery]=0;
X playerx = lastpx;
X playery = lastpy;
X break;
X
X case OCLOSEDDOOR:
X lprintf("\n\nYou have found %s",objectname[i]);
X lprcat("\nDo you (o) try to open it");
X iopts();
X i=0;
X while ((i!='o') && (i!='i') && (i!='\33')) i=getcharacter();
X if ((i=='\33') || (i=='i'))
X {
X ignore();
X playerx = lastpx;
X playery = lastpy;
X break;
X }
X else
X {
X lprcat("open");
X if (rnd(11)<7)
X {
X switch(iarg[playerx][playery])
X {
X case 6:
X c[AGGRAVATE] += rnd(400);
X break;
X
X case 7:
X lprcat("\nYou are jolted by an electric shock ");
X lastnum=274;
X losehp(rnd(20));
X bottomline();
X break;
X
X case 8:
X loselevel();
X break;
X
X case 9:
X lprcat("\nYou suddenly feel weaker ");
X if (c[STRENGTH]>3) c[STRENGTH]--;
X bottomline();
X break;
X
X default:
X break;
X }
X playerx = lastpx;
X playery = lastpy;
X }
X else
X {
X forget();
X item[playerx][playery]=OOPENDOOR;
X }
X }
X break;
X
X case OENTRANCE:
X lprcat("\nYou have found ");
X lprcat(objectname[OENTRANCE]);
X lprcat("\nDo you (g) go inside");
X iopts();
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33')) i=getcharacter();
X if (i == 'g')
X {
X newcavelevel(1);
X playerx=33;
X playery=MAXY-2;
X item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0;
X draws(0,MAXX,0,MAXY);
X bot_linex();
X return;
X }
X else ignore();
X break;
X
X case OVOLDOWN:
X lprcat("\nYou have found ");
X lprcat(objectname[OVOLDOWN]);
X lprcat("\nDo you (c) climb down");
X iopts();
X i=0;
X while ((i!='c') && (i!='i') && (i!='\33'))
X i=getcharacter();
X if ((i=='\33') || (i=='i')) {
X ignore();
X break;
X }
X if (level!=0)
X {
X lprcat("\nThe shaft only extends 5 feet downward!");
X return;
X }
X if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA]))
X {
X lprcat("\nYou slip and fall down the shaft");
X beep();
X lastnum=275;
X losehp(30+rnd(20));
X bottomhp();
X }
X else lprcat("climb down");
X nap(3000);
X newcavelevel(MAXLEVEL);
X playerx = rnd(MAXX-2);
X playery = rnd(MAXY-2);
X positionplayer();
X draws(0,MAXX,0,MAXY);
X bot_linex();
X return;
X
X case OVOLUP:
X lprcat("\nYou have found ");
X lprcat(objectname[OVOLUP]);
X lprcat("\nDo you (c) climb up");
X iopts();
X i=0;
X while ((i!='c') && (i!='i') && (i!='\33')) i=getcharacter();
X if ((i=='\33') || (i=='i')) {
X ignore();
X break;
X }
X if (packweight() > 40+5*(c[DEXTERITY]+c[STRENGTH]+c[STREXTRA])) {
X lprcat("\nYou slip and fall down the shaft");
X beep();
X lastnum=275;
X losehp(15+rnd(20));
X bottomhp();
X return;
X }
X lprcat("climb up");
X lflush();
X nap(3000);
X newcavelevel(0);
X for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */
X if (item[j][i]==OVOLDOWN) {
X playerx=j;
X playery=i;
X j=MAXX;
X i=MAXY;
X positionplayer();
X }
X draws(0,MAXX,0,MAXY);
X bot_linex();
X return;
X
X case OTRAPARROWIV:
X if (rnd(17)<13) return; /* for an arrow trap */
X item[playerx][playery] = OTRAPARROW;
X know[playerx][playery] = 0;
X case OTRAPARROW:
X lprcat("\nYou are hit by an arrow");
X beep(); /* for an arrow trap */
X lastnum=259;
X losehp(rnd(10)+level);
X bottomhp();
X return;
X
X case OIVDARTRAP:
X if (rnd(17)<13)
X return; /* for a dart trap */
X item[playerx][playery] = ODARTRAP;
X know[playerx][playery] = 0;
X case ODARTRAP:
X lprcat("\nYou are hit by a dart");
X beep(); /* for a dart trap */
X lastnum=260;
X losehp(rnd(5));
X if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3;
X bottomline();
X return;
X
X case OIVTRAPDOOR:
X if (rnd(17)<13)
X return; /* for a trap door */
X item[playerx][playery] = OTRAPDOOR;
X know[playerx][playery] = 1;
X case OTRAPDOOR:
X lastnum = 272; /* a trap door */
X for (i=0;i<26;i++)
X if (iven[i]==OWWAND) {
X lprcat("\nYou escape a trap door");
X return;
X }
X if ((level==MAXLEVEL-1)||(level==MAXLEVEL+MAXVLEVEL-1))
X {
X lprcat("\nYou fell through a trap door leading straight to HELL!");
X beep();
X nap(3000);
X died(271);
X }
X lprcat("\nYou fall through a trap door!");
X beep();
X losehp(rnd(5+level));
X nap(2000);
X newcavelevel(level+1);
X draws(0,MAXX,0,MAXY);
X bot_linex();
X return;
X
X case OTRADEPOST:
X if (nearbymonst()) return;
X lprcat("\nYou have found the Ularn trading Post.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33')) i=getcharacter();
X if (i == 'g') otradepost();
X else lprcat("stay here");
X return;
X
X case OHOME:
X if (nearbymonst()) return;
X lprcat("\nYou have found your way home.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33'))
X i=getcharacter();
X if (i == 'g')
X ohome();
X else lprcat("stay here");
X return;
X case OPAD:
X if (nearbymonst()) return;
X lprcat("\nYou have found Dealer McDope's Hideout!!");
X lprcat("\nDo you (c) check it out, or (i) ignore it? ");
X i=0;
X while ((i!='c') && (i!='i') && (i!='\33'))
X i=getcharacter();
X if (i == 'c')
X opad();
X else lprcat("forget it");
X return;
X
X case OSPEED:
X lprcat("\nYou have found some speed");
X lprcat("\nDo you (s) snort it, (t) take it, or (i) ignore it? ");
X i=0;
X while ((i!='s') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='s') {
X lprcat("snort!");
X lprcat("\nOhwowmanlikethingstotallyseemtoslowdown!");
X c[HASTESELF] += 200 + c[LEVEL];
X c[HALFDAM] += 300 + rnd(200);
X if ((c[INTELLIGENCE]-=2) < 3)
X c[INTELLIGENCE]=3;
X if ((c[WISDOM]-=2) < 3)
X c[WISDOM]=3;
X if ((c[CONSTITUTION]-=2) <3)
X c[CONSTITUTION]=3;
X if ((c[DEXTERITY]-=2) <3)
X c[DEXTERITY]=3;
X if ((c[STRENGTH]-=2) <3)
X c[STRENGTH]=3;
X forget();
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OSPEED,0)==0) forget();
X }
X else
X lprcat("ignore");
X break;
X
X case OSHROOMS:
X lprcat("\nYou have found some magic mushrooms");
X lprcat("\nDo you (e) eat them, (t) take them, or (i) ignore them? ");
X i=0;
X while ((i!='e') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='e') {
X lprcat("eat!");
X lprcat("\nThings start to get real spacey...");
X c[HASTEMONST] += rnd(75) + 25;
X c[CONFUSE] += 30+rnd(10);
X c[WISDOM]+=2;
X c[CHARISMA]+=2;
X forget();
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OSHROOMS,0)==0) forget();
X }
X else
X lprcat("ignore");
X break;
X
X case OACID:
X lprcat("\nYou have found some LSD");
X lprcat("\nDo you (e) eat it, (t) take it, or (i) ignore it? ");
X i=0;
X while ((i!='e') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='e') {
X lprcat("eat!");
X lprcat("\nYou are now frying your ass off");
X c[CONFUSE]+=30+rnd(10);
X c[WISDOM]+=2;
X c[INTELLIGENCE]+=2;
X c[AWARENESS]+=1500;
X c[AGGRAVATE]+=1500;
X {
X int j,k; /* heal monsters */
X for(j=0;j<MAXY;j++)
X for(k=0;k<MAXX;k++)
X if (mitem[k][j])
X hitp[k][j]=monster[mitem[k][j]].hitpoints;
X }
X forget();
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OACID,0)==0) forget();
X }
X else lprcat("ignore");
X break;
X
X case OHASH:
X lprcat("\nYou have found some hashish");
X lprcat("\nDo you (s) smoke it, (t) take it, or (i) ignore it? ");
X i=0;
X while ((i!='s') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='s') {
X lprcat("smoke!");
X lprcat("\nWOW! You feel stooooooned...");
X c[HASTEMONST]+=rnd(75)+25;
X c[INTELLIGENCE]+=2;
X c[WISDOM]+=2;
X if( (c[CONSTITUTION]-=2) < 3)
X c[CONSTITUTION]=3;
X if( (c[DEXTERITY]-=2) < 3)
X c[DEXTERITY]=3;
X c[HALFDAM]+=300+rnd(200);
X c[CLUMSINESS]+=rnd(1800)+200;
X forget();
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OHASH,0)==0) forget();
X }
X else lprcat("ignore");
X break;
X
X case OCOKE:
X lprcat("\nYou have found some cocaine");
X lprcat("\nDo you want to (s) snort it, (t) take it, or (i) ignore it? ");
X i=0;
X while ((i!='s') && (i!='i') && (i!='t') && (i!='\33'))
X i=getcharacter();
X if (i=='s') {
X lprcat("snort!");
X lprcat("\nYour nose begins to bleed");
X if ((c[DEXTERITY]-=2) <3)
X c[DEXTERITY]=3;
X if ((c[CONSTITUTION]-=2) <3)
X c[CONSTITUTION]=3;
X c[CHARISMA]+=3;
X for(i=0;i<6;i++)
X c[i]+=33;
X c[COKED]+=10;
X forget();
X bottomline();
X }
X else if (i=='t') {
X lprcat("take");
X if (take(OCOKE,0)==0) forget();
X }
X else lprcat("ignore");
X break;
X
X case OWALL:
X break;
X
X case OANNIHILATION:
X for (i=0;i<26;i++)
X if (iven[i]==OSPHTALISMAN) {
X lprcat("\nThe Talisman of the Sphere protects you from annihilation!");
X return;
X }
X /* annihilated by sphere of annihilation */
X died(283);
X return;
X
X case OLRS:
X if (nearbymonst()) return;
X lprcat("\n\nThere is an LRS office here.");
X lprcat("\nDo you (g) go inside, or (i) stay here? ");
X i=0;
X while ((i!='g') && (i!='i') && (i!='\33')) i=getcharacter();
X if (i == 'g')
X olrs(); /* the larn revenue service */
X else lprcat(" stay here");
X break;
X default:
X finditem(i);
X break;
X };
X}
X
X/*
X function to say what object we found and ask if player wants to take it
X */
Xfinditem(itm)
Xint itm;
X{
X int tmp,i;
X lprintf("\n\nYou have found %s ",objectname[itm]);
X tmp=iarg[playerx][playery];
X switch(itm)
X {
X case ODIAMOND:
X case ORUBY:
X case OEMERALD:
X case OSAPPHIRE:
X case OSPIRITSCARAB:
X case OORBOFDRAGON:
X case OORB:
X case OHANDofFEAR:
X case OWWAND:
X case OCUBEofUNDEAD:
X case ONOTHEFT:
X break;
X
X default:
X if (tmp>0)
X lprintf("+ %d",(long)tmp);
X else if (tmp<0) lprintf(" %d",(long)tmp);
X }
X lprcat("\nDo you want to (t) take it");
X iopts();
X i=0;
X while (i!='t' && i!='i' && i!='\33') i=getcharacter();
X if (i == 't')
X {
X lprcat("take");
X if (take(itm,tmp)==0)
X forget();
X return;
X }
X ignore();
X}
X
X
X/*
X *******
X OSTAIRS
X *******
X
X subroutine to process the stair cases
X if dir > 0 then up else down
X */
Xostairs(dir)
Xint dir;
X{
X register int k, x, y;
X
X lprcat("\nDo you (s) stay here or ");
X if (dir > 0)
X lprcat("(u) go up? ");
X else
X lprcat("(d) go down? ");
X
X while (1)
X switch(getcharacter()) {
X case '\33':
X case 's':
X case 'i':
X lprcat("stay here");
X return;
X
X case 'u':
X lprcat("go up");
X if (dir < 0)
X lprcat("\nThe stairs don't go up!");
X else
X if (level>=2 && level!=MAXLEVEL) {
X newcavelevel(level-1);
X for (x=0;x<MAXX;x++)
X for (y=0;y<MAXY;y++)
X if (item[x][y] == OSTAIRSDOWN) {
X playerx=x;
X playery=y;
X x=MAXX;
X y=MAXY;
X }
X draws(0,MAXX,0,MAXY);
X bot_linex();
X }
X else lprcat("\nThe stairs lead to a dead end!");
X return;
X
X case 'd':
X lprcat("go down");
X if (dir > 0)
X lprcat("\nThe stairs don't go down!");
X else
X if ((level!=0) && (level!= (MAXLEVEL-1)) &&
X (level!=(MAXLEVEL-1 + MAXVLEVEL))) {
X newcavelevel(level+1);
X for (x=0;x<MAXX;x++)
X for (y=0;y<MAXY;y++)
X if (item[x][y] == OSTAIRSUP) {
X playerx=x;
X playery=y;
X x=MAXX;
X y=MAXY;
X }
X draws(0,MAXX,0,MAXY);
X bot_linex();
X }
X else lprcat("\nThe stairs lead to a dead end!");
X return;
X };
X}
X
X
X/*
X *********
X OTELEPORT
X *********
X
X subroutine to handle a teleport trap +/- 1 level maximum
X */
Xoteleport(err)
Xint err;
X{
X register int tmp;
X
X if (err) if (rnd(151)<3) died(264); /* stuck in a rock */
X
X /*show ?? on bottomline if been teleported */
X if (!wizard) c[TELEFLAG]=1;
X
X if (level==0)
X tmp=0;
X else if (level < MAXLEVEL) { /* in dungeon */
X tmp=rnd(5)+level-3;
X if (tmp>=MAXLEVEL)
X tmp=MAXLEVEL-1;
X if (tmp<0)
X tmp=0;
X }
X else { /* in volcano */
X tmp=rnd(4)+level-2;
X if (tmp>=MAXLEVEL+MAXVLEVEL)
X tmp=MAXLEVEL+MAXVLEVEL-1;
X if (tmp<MAXLEVEL)
X tmp=0;
X }
X playerx = rnd(MAXX-2);
X playery = rnd(MAXY-2);
X if (level != tmp)
X newcavelevel(tmp);
X positionplayer();
X draws(0,MAXX,0,MAXY);
X bot_linex();
X}
X
X/*
X *******
X OPOTION
X *******
X }
X playerx = rnd(MAXX-2);
X playery = rnd(MAXY-2);
X if (level != tmp)
X newcavelevel(tmp);
X positionplayer();
X draws(0,MAXX,0,MAXY);
X bot_linex();
X}
X
X/*
X *******
X OPOTION
X *******
X
X function to process a potion
X */
Xopotion(pot)
Xint pot;
X{
X lprcat("\nDo you (d) drink it, (t) take it");
X iopts();
X while (1) switch(getcharacter())
X {
X case '\33':
X case 'i':
X ignore();
X return;
X
X case 'd':
X lprcat("drink\n");
X forget(); /* destroy potion */
X quaffpotion(pot);
X return;
X
X case 't':
X lprcat("take\n");
X if (take(OPOTION,pot)==0) forget();
X return;
X };
X}
X
X/*
X function to drink a potion
X */
Xquaffpotion(pot)
Xint pot;
X{
X register int i,j,k;
X if (pot<0 || pot>=MAXPOTION) return; /* check for within bounds */
X potionname[pot][0] = ' ';
X switch(pot)
X {
X case 9:
X lprcat("\nYou feel greedy . . .");
X nap(2000);
X for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
X if ((item[j][i]==OGOLDPILE) || (item[j][i]==OMAXGOLD))
X {
X know[j][i]=1;
X show1cell(j,i);
X }
X showplayer();
X return;
X
X case 19:
X lprcat("\nYou feel greedy . . .");
X nap(2000);
X for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
X {
X k=item[j][i];
X if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) || (k==OMAXGOLD)
X || (k==OSAPPHIRE) || (k==OLARNEYE) || (k==OGOLDPILE))
X {
X know[j][i]=1;
X show1cell(j,i);
X }
X }
X showplayer();
X return;
X
X case 20:
X c[HP] = c[HPMAX];
X break; /* instant healing */
X
X case 1:
X lprcat("\nYou feel better");
X if (c[HP] == c[HPMAX]) raisemhp(1);
X else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX]) c[HP]=c[HPMAX];
X break;
X
X case 2:
X lprcat("\nSuddenly, you feel much more skillful!");
X raiselevel();
X raisemhp(1);
X return;
X
X case 3:
X lprcat("\nYou feel strange for a moment");
X c[rund(6)]++;
X break;
X
X case 4:
X lprcat("\nYou feel more self confident!");
X c[WISDOM] += rnd(2);
X break;
X
X case 5:
X lprcat("\nWow! You feel great!");
X if (c[STRENGTH]<12) c[STRENGTH]=12;
X else c[STRENGTH]++;
X break;
X
X case 6:
X lprcat("\nYour charm went up by one!");
X c[CHARISMA]++;
X break;
X
X case 8:
X lprcat("\nYour intelligence went up by one!");
X c[INTELLIGENCE]++;
X break;
X
X case 10:
X for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
X if (mitem[j][i])
X {
X know[j][i]=1;
X show1cell(j,i);
X }
X /* monster detection */ return;
X
X case 12:
X lprcat("\nThis potion has no taste to it");
X return;
X
X case 15:
X lprcat("\nWOW!!! You feel Super-fantastic!!!");
X if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11;
X c[HERO] += 250;
X break;
X
X case 16:
X lprcat("\nYou have a greater intestinal constitude!");
X c[CONSTITUTION]++;
X break;
X
X case 17:
X lprcat("\nYou now have incredibly bulging muscles!!!");
X if (c[GIANTSTR]==0) c[STREXTRA] += 21;
X c[GIANTSTR] += 700;
X break;
X
X case 18:
X lprcat("\nYou feel a chill run up your spine!");
X c[FIRERESISTANCE] += 1000;
X break;
X
X case 0:
X lprcat("\nYou fall asleep. . .");
X i=rnd(11)-(c[CONSTITUTION]>>2)+2;
X while(--i>0) {
X parse2();
X nap(1000);
X }
X cursors();
X lprcat("\nYou woke up!");
X return;
X
X case 7:
X lprcat("\nYou become dizzy!");
X if (--c[STRENGTH] < 3) c[STRENGTH]=3;
X break;
X
X case 11:
X lprcat("\nYou stagger for a moment . .");
X for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
X know[j][i]=0;
X nap(2000);
X draws(0,MAXX,0,MAXY); /* potion of forgetfulness */
X return;
X
X case 13:
X lprcat("\nYou can't see anything!"); /* blindness */
X c[BLINDCOUNT]+=500;
X return;
X
X case 14:
X lprcat("\nYou feel confused");
X c[CONFUSE]+= 20+rnd(9);
X return;
X
X case 21:
X lprcat("\nYou don't seem to be affected");
X return; /* cure dianthroritis */
X
X case 22:
X lprcat("\nYou feel a sickness engulf you"); /* poison */
X c[HALFDAM] += 200 + rnd(200);
X return;
X
X case 23:
X lprcat("\nYou feel your vision sharpen"); /* see invisible */
X c[SEEINVISIBLE] += rnd(1000)+400;
X monstnamelist[INVISIBLESTALKER] = 'I';
X return;
X };
X bottomline(); /* show new stats */
X return;
X}
X
X/*
X *******
X OSCROLL
X *******
X
X function to process a magic scroll
X */
Xoscroll(typ)
Xint typ;
X{
X lprcat("\nDo you ");
X if (c[BLINDCOUNT]==0) lprcat("(r) read it, ");
X lprcat("(t) take it");
X iopts();
X while (1) switch(getcharacter()) {
X case '\33':
X case 'i':
X ignore();
X return;
X
X case 'r':
X if (c[BLINDCOUNT]) break;
X lprcat("read");
X forget();
X if (typ==2 || typ==15) {
X show1cell(playerx,playery);
X cursors();
X }
X /* destroy it */ read_scroll(typ);
X return;
X
X case 't':
X lprcat("take");
X if (take(OSCROLL,typ)==0) forget(); /* destroy it */
X return;
X };
X}
X
X/*
X data for the function to read a scroll
X */
Xstatic int xh,yh,yl,xl;
Xstatic char curse[] = {
X BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING,
X LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };
Xstatic char exten[] = {
X PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT,
X INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };
Xchar time_change[] = {
X HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT,
X STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION,
X HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST,
X FIRERESISTANCE,GLOBE,SPIRITPRO,UNDEADPRO,HALFDAM,SEEINVISIBLE,
X ITCHING,CLUMSINESS, WTW };
X/*
X * function to adjust time when time warping and taking courses in school
X */
Xadjtime(tim)
Xregister long tim;
X{
X register int j;
X for (j=0; j<26; j++) /* adjust time related parameters */
X if (c[time_change[j]])
X if ((c[time_change[j]] -= tim) < 1) c[time_change[j]]=1;
X regen();
X}
X
X/*
X function to read a scroll
X */
Xread_scroll(typ)
Xint typ;
X{
X register int i,j;
X if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */
X scrollname[typ][0] = ' ';
X switch(typ)
X {
X case 0:
X lprcat("\nYour armor glows for a moment");
X enchantarmor();
X return;
X
X case 1:
X lprcat("\nYour weapon glows for a moment");
X enchweapon();
X return; /* enchant weapon */
X
X case 2:
X lprcat("\nYou have been granted enlightenment!");
X yh = min(playery+7,MAXY);
X xh = min(playerx+25,MAXX);
X yl = max(playery-7,0);
X xl = max(playerx-25,0);
X for (i=yl; i<yh; i++)
X for (j=xl; j<xh; j++)
X know[j][i]=1;
X nap(2000);
X draws(xl,xh,yl,yh);
X return;
X
X case 3:
X lprcat("\nThis scroll seems to be blank");
X return;
X
X case 4:
X createmonster(makemonst(level+1));
X return; /* this one creates a monster */
X
X case 5:
X something(level);
X /* create artifact */
X return;
X
X case 6:
X c[AGGRAVATE]+=800;
X return; /* aggravate monsters */
X
X case 7:
X gtime += (i = rnd(1000) - 850); /* time warp */
X
X if (i>=0) lprintf("\nYou went forward in time by %d mobuls",(long)((i+99)/100));
X else lprintf("\nYou went backward in time by %d mobuls",(long)(-(i+99)/100));
X adjtime((long)i);/* adjust time for time warping */
X return;
X
X case 8:
X oteleport(0);
X return; /* teleportation */
X
X case 9:
X c[AWARENESS] += 1800;
X return; /* expanded awareness */
X
X case 10:
X c[HASTEMONST] += rnd(55)+12;
X lprintf("\nYou feel nervous");
X return; /* haste monster */
X
X case 11:
X for (i=0; i<MAXY; i++)
X for (j=0; j<MAXX; j++)
X if (mitem[j][i])
X hitp[j][i] = monster[mitem[j][i]].hitpoints;
X lprintf("\nYou feel uneasy");
X return; /* monster healing */
X
X case 12:
X c[SPIRITPRO] += 300 + rnd(200);
X bottomline();
X return; /* spirit protection */
X
X case 13:
X c[UNDEADPRO] += 300 + rnd(200);
X bottomline();
X return; /* undead protection */
X
X case 14:
X c[STEALTH] += 250 + rnd(250);
X bottomline();
X return; /* stealth */
X
X case 15:
X lprcat("\nYou have been granted enlightenment!");
X /* magic mapping */
X for (i=0; i<MAXY; i++)
X for (j=0; j<MAXX; j++)
X know[j][i]=1;
X nap(2000);
X draws(0,MAXX,0,MAXY);
X return;
X
X case 16:
X c[HOLDMONST] += 30;
X bottomline();
X return; /* hold monster */
X
X case 17:
X for (i=0; i<26; i++) /* gem perfection */
X switch(iven[i])
X {
X case ODIAMOND:
X case ORUBY:
X case OEMERALD:
X case OSAPPHIRE:
X j = ivenarg[i];
X j &= 255;
X j <<= 1;
X if (j > 255)
X j=255; /*double value */
X ivenarg[i] = j;
X break;
X }
X break;
X
X case 18:
X for (i=0; i<11; i++)
X c[exten[i]] <<= 1; /* spell extension */
X break;
X
X case 19:
X for (i=0; i<26; i++) /* identify */
X {
X if (iven[i]==OPOTION)
X potionname[ivenarg[i]][0] = ' ';
X if (iven[i]==OSCROLL)
X scrollname[ivenarg[i]][0] = ' ';
X }
X break;
X
X case 20:
X for (i=0; i<10; i++) /* remove curse */
X if (c[curse[i]]) c[curse[i]] = 1;
X break;
X
X case 21:
X annihilate();
X break; /* scroll of annihilation */
X
X case 22:
X godirect(22,150,"The ray hits the %s",0,' ');
X /* pulverization */
X break;
X
X case 23:
X c[LIFEPROT]++;
X break; /* life protection */
X };
X}
X
X
Xopit()
X{
X register int i;
X if (rnd(101)<81)
X if (rnd(70) > 9*c[DEXTERITY]-packweight() || rnd(101)<5) {
X for (i=0;i<26;i++)
X if (iven[i]==OWWAND) {
X lprcat("\nYou float right over the pit");
X return;
X }
X if (level==MAXLEVEL-1) obottomless();
X else
X if (level==MAXLEVEL+MAXVLEVEL-1) obottomless();
X else
X {
X if (rnd(101)<20)
X {
X i=0;
X lprcat("\nYou fell into a pit! You land right on top of a poor monster!\n");
X }
X else
X {
X i = rnd(level*3+3);
X lprintf("\nYou fell into a pit! You suffer %d hit points damage",(long)i);
X lastnum=261;
X /* if he dies scoreboard will say so */
X }
X losehp(i);
X nap(2000);
X newcavelevel(level+1);
X draws(0,MAXX,0,MAXY);
X }
X }
X}
X
Xobottomless()
X{
X lprcat("\nYou fell into a pit leading straight to HELL!");
X beep();
X nap(3000);
X died(262);
X}
X
Xoelevator(dir)
Xint dir;
X{
X playerx = rnd(MAXX-2);
X playery = rnd(MAXY-2);
X
X if (dir==1)
X newcavelevel(rund(level));
X else
X newcavelevel(level + rnd(MAXLEVEL-1 - level));
X positionplayer();
X draws(0,MAXX,0,MAXY);
X bot_linex();
X}
X
Xostatue()
X{
X}
X
X
Xomirror()
X{
X}
X
Xobook()
X{
X lprcat("\nDo you ");
X if (c[BLINDCOUNT]==0) lprcat("(r) read it, ");
X lprcat("(t) take it");
X iopts();
X while (1)
X switch(getcharacter()) {
X case '\33':
X case 'i':
X ignore();
X return;
X
X case 'r':
X if (c[BLINDCOUNT]) break;
X lprcat("read");
X readbook(iarg[playerx][playery]);
X /* no more book */
X forget();
X return;
X
X case 't':
X lprcat("take");
X if (take(OBOOK,iarg[playerx][playery])==0) forget(); /* no more book */
X return;
X };
X}
X
X/*
X function to read a book
X */
Xreadbook(arg)
Xregister int arg;
X{
X register int i,tmp;
X
X if (arg<=3)
X i = rund((tmp=splev[arg])?tmp:1);
X else {
X if (arg >= 21)
X arg = 20; /* # entries in splev = 21 */
X i = rnd( (tmp=splev[arg]-9) ?tmp:1 ) + 9;
X }
X spelknow[i]=1;
X lprintf("\nSpell \"%s\": %s\n%s",
X spelcode[i],spelname[i],speldescript[i]);
X if (rnd(10)==4) {
X lprcat("\nYour int went up by one!");
X c[INTELLIGENCE]++;
X bottomline();
X }
X}
X
Xocookie()
X{
X char *p;
X lprcat("\nDo you (e) eat it, (t) take it");
X iopts();
X while (1)
X switch(getcharacter()) {
X case '\33':
X case 'i':
X ignore();
X return;
X
X case 'e':
X lprcat("eat\nThe cookie tasted good.");
X forget(); /* no more cookie */
X if (c[BLINDCOUNT]) return;
X if (!(p=fortune(fortfile))) return;
X lprcat(" A message inside the cookie reads:\n");
X lprcat(p);
X return;
X
X case 't':
X lprcat("take");
X if (take(OCOOKIE,0)==0) forget();
X return;
X };
X}
X
X
X/* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
Xogold(arg)
Xint arg;
X{
X register long i;
X
X i = iarg[playerx][playery];
X
X if (arg==ODGOLD) i *= 10;
X else if (arg==OMAXGOLD) i *= 100;
X else if (arg==OKGOLD) i *= 1000;
X
X lprintf("\nIt is worth %d!",(long)i);
X c[GOLD] += i;
X bottomgold();
X item[playerx][playery] = know[playerx][playery] = 0;/*destroy gold*/
X}
X
Xohome()
X{
X register int i;
X
X nosignal = 1; /* disable signals */
X for (i=0; i<26; i++)
X if (iven[i]==OPOTION)
X if (ivenarg[i]==21)
X { /* remove the potion of cure dianthroritis from inventory */
X iven[i]=0;
X clear();
X lprcat("Congratulations. You found the potion of cure dianthroritis!\n");
X lprcat("\nFrankly, No one thought you could do it. Boy! Did you surprise them!\n");
X if (gtime>TIMELIMIT) {
X lprcat("\niHowever... the doctor has the sad duty to inform you that your daughter has died!\n");
X lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad...\n");
X nap(5000);
X died(269);
X }
X else {
X lprcat("\nThe doctor is now administering the potion, and in a few moments\n");
X lprcat("Your daughter should be well on her way to recovery.\n");
X nap(6000);
X lprcat("\nThe potion is");
X nap(3000);
X lprcat(" working! The doctor thinks that\n");
X lprcat("your daughter will recover in a few days. Congratulations!\n");
X beep();
X nap(5000);
X died(263);
X }
X }
X
X while (1) {
X clear();
X lprintf("Welcome home %s. Latest word from the doctor is not good.\n",logname);
X
X if (gtime>TIMELIMIT) {
X lprcat("\nThe doctor has the sad duty to inform you that your daughter has died!\n");
X lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad...\n");
X nap(5000);
X died(269);
X }
X
X lprcat("\nThe diagnosis is confirmed as dianthroritis. He guesses that\n");
X lprintf("your daughter has only %d mobuls left in this world. It's up to you,\n",(long)((TIMELIMIT-gtime+99)/100));
X lprintf("%s, to find the only hope for your daughter, the very rare\n",logname);
X lprcat("potion of cure dianthroritis. It is rumored that only deep in the\n");
X lprcat("depths of the caves can this potion be found.\n\n\n");
X lprcat("\n ----- press ");
X standout("return");
X lprcat(" to continue, ");
X standout("escape");
X lprcat(" to leave ----- ");
X i=getcharacter();
X while (i!='\33' && i!='\n')
X i=getcharacter();
X if (i=='\33') {
X drawscreen();
X nosignal = 0; /* enable signals */
X
X return;
X }
X }
X}
X
X/* routine to save program space */
Xiopts()
X{
X lprcat(", or (i) ignore it? ");
X}
Xignore()
X{
X lprcat("ignore\n");
X}
END_OF_FILE
if test 32476 -ne `wc -c <'object.c'`; then
echo shar: \"'object.c'\" unpacked with wrong size!
fi
# end of 'object.c'
fi
echo shar: End of archive 1 \(of 8\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 8 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0

Reply all
Reply to author
Forward
0 new messages