games@tekred.TEK.COM (07/26/88)
Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu>
Comp.sources.games: Volume 5, Issue 18
Archive-name: omega2/Part08
#! /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 8 (of 19)."
# Contents: oabyss.dat ocom3.c oitem.c
# Wrapped by billr@saab on Wed Jul 13 10:46:47 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'oabyss.dat' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'oabyss.dat'\"
else
echo shar: Extracting \"'oabyss.dat'\" \(1106 characters\)
sed "s/^X//" >'oabyss.dat' <<'END_OF_FILE'
X0000000000000000000000000.....#####.....000000000000000000000000
X0000000000000000000000000...###~.6###...000000000000000000000000
X0000000000000000000000000..##.......##..000000000000000000000000
X0000000000000000000000000..##".....;##..000000000000000000000000
X0000000000000000000000000...##.....##...000000000000000000000000
X0000000000000000000000000.##1##.V.##2##.000000000000000000000000
X0000000000000000000000000..###..3..###..000000000000000000000000
X0000000000000000000000000...............000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X0000000000000000000000000000000...000000000000000000000000000000
X
END_OF_FILE
if test 1106 -ne `wc -c <'oabyss.dat'`; then
echo shar: \"'oabyss.dat'\" unpacked with wrong size!
fi
# end of 'oabyss.dat'
fi
if test -f 'ocom3.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ocom3.c'\"
else
echo shar: Extracting \"'ocom3.c'\" \(27429 characters\)
sed "s/^X//" >'ocom3.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */
X/* ocom3.c */
X
X/* This file contains some more top level command functions
X called from ocom1.c */
X
X#include "oglob.h"
X#include "odate.h"
X
X/* look at some spot */
Xvoid examine()
X{
X pol ol;
X int x=Player.x,y=Player.y,drewmenu=FALSE;
X
X clearmsg();
X
X setgamestatus(SKIP_MONSTERS);
X mprint("Examine --");
X setspot(&x,&y);
X if (inbounds(x,y)) {
X clearmsg();
X if (Current_Environment == E_COUNTRYSIDE) {
X if (! Country[x][y].explored)
X print3("How should I know what that is?");
X else {
X mprint("That terrain is:");
X mprint(countryid(Country[x][y].current_terrain_type));
X }
X }
X else if (! los_p(Player.x,Player.y,x,y))
X print3("I refuse to examine something I can't see.");
X else {
X clearmsg();
X if (Level->site[x][y].creature != NULL)
X mprint(mstatus_string(Level->site[x][y].creature));
X else if ((Player.x == x) && (Player.y ==y))
X describe_player();
X if (loc_statusp(x,y,SECRET))
X print2("An age-worn stone wall.");
X else
X switch (Level->site[x][y].locchar) {
X case SPACE: print2("An infinite void."); break;
X case PORTCULLIS: print2("A heavy steel portcullis"); break;
X case ABYSS: print2("An entrance to the infinite abyss"); break;
X case FLOOR:
X if (Current_Dungeon == Current_Environment)
X print2("A dirty stone floor.");
X else print2("The ground.");
X break;
X case WALL:
X if (Level->site[x][y].aux == 0)
X print2("A totally impervious wall.");
X else if (Level->site[x][y].aux < 10)
X print2("A pitted concrete wall.");
X else if (Level->site[x][y].aux < 30)
X print2("An age-worn sandstone wall.");
X else if (Level->site[x][y].aux < 50)
X print2("A smooth basalt wall.");
X else if (Level->site[x][y].aux < 70)
X print2("A solid granite wall.");
X else if (Level->site[x][y].aux < 90)
X print2("A wall of steel.");
X else if (Level->site[x][y].aux < 210) {
X if (Current_Environment == E_CITY)
X print2("A thick wall of Rampart bluestone");
X else print2("A magically reinforced wall.");
X }
X else print2("An almost totally impervious wall.");
X break;
X case RUBBLE:print2("A dangerous-looking pile of rubble."); break;
X case SAFE:print2("A steel safe inset into the floor."); break;
X case CLOSED_DOOR:print2("A solid oaken door, now closed."); break;
X case OPEN_DOOR:print2("A solid oaken door, now open."); break;
X case STATUE:print2("A strange-looking statue."); break;
X case UP:print2("A stairway leading up."); break;
X case DOWN:print2("A stairway leading down...."); break;
X case TRAP:print2(trapid(Level->site[x][y].p_locf)); break;
X case HEDGE:
X if (Level->site[x][y].p_locf == L_EARTH_STATION)
X print2("A weird fibrillation of oozing tendrils.");
X else print2("A brambly, thorny hedge.");
X break;
X case LAVA:print2("A bubbling pool of lava."); break;
X case LIFT:print2("A strange glowing disk."); break;
X case ALTAR:print2("An (un?)holy altar."); break;
X case CHAIR:print2("A chair."); break;
X case WHIRLWIND:print2("A strange cyclonic electrical storm."); break;
X case WATER:
X if (Level->site[x][y].p_locf == L_WATER)
X print2("A deep pool of water.");
X else if (Level->site[x][y].p_locf == L_CHAOS)
X print2("A pool of primal chaos.");
X else if (Level->site[x][y].p_locf == L_WATER_STATION)
X print2("A bubbling pool of acid.");
X else print2("An eerie pool of water.");
X break;
X case FIRE:print2("A curtain of fire."); break;
X default:print2("Wow, I haven't the faintest idea!"); break;
X }
X if ((ol = Level->site[x][y].things) != NULL) {
X if (ol->next == NULL)
X print3(itemid(ol->thing));
X else {
X drewmenu = TRUE;
X menuclear();
X menuprint("Things on floor:\n");
X while (ol != NULL) {
X menuprint("\n");
X menuprint(itemid(ol->thing));
X ol = ol->next;
X }
X }
X }
X morewait();
X sign_print(x,y,TRUE);
X }
X }
X if (drewmenu) xredraw();
X}
X
Xvoid help()
X{
X char c;
X char filestr[80];
X int n,filenum;
X clearmsg();
X print1("Please enter the letter indicating what topic you want help on.");
X menuclear();
X menuprint("a: Overview\n");
X menuprint("b: Characters\n");
X menuprint("c: Inventories\n");
X menuprint("d: Movement\n");
X menuprint("e: Combat\n");
X menuprint("f: Bugs\n");
X menuprint("g: Magic\n");
X menuprint("h: The Countryside\n");
X menuprint("i: The Screen Display\n");
X menuprint("j: Saving and Restoring\n");
X menuprint("k: Options Settings\n");
X menuprint("l: Dungeon/City/Other Command List\n");
X menuprint("m: Countryside Command List\n");
X menuprint("n: Everything\n");
X menuprint("ESCAPE: Forget the whole thing.");
X do
X c = mcigetc();
X while ((c < 'a') && (c > 'n') && (c != ESCAPE));
X if (c == 'n') {
X print1("Trying to copy all help files to ./omega.doc ");
X nprint1("Confirm [yn]");
X if (ynq1()=='y') {
X print2("Copying");
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp1.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp2.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp3.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp4.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp5.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp6.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp7.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp8.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp9.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp10.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp11.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp12.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(".");
X strcpy(Str1,"cat ");
X strcat(Str1,OMEGALIB);
X strcat(Str1,"ohelp13.txt");
X strcat(Str1," >> omega.doc");
X system(Str1);
X nprint2(" Done.");
X }
X }
X else if (c != ESCAPE) {
X strcpy(filestr,OMEGALIB);
X strcat(filestr,"ohelp");
X filenum = c+1-'a';
X n = strlen(filestr);
X if (filenum<10) {
X filestr[n] = filenum+'0';
X filestr[n+1] = 0;
X }
X else {
X filestr[n] = '1';
X filenum = c - 'j';
X filestr[n+1] = filenum+'0';
X filestr[n+2] = 0;
X }
X strcat(filestr,".txt");
X print1("Display help file, or Copy help file to file in wd. [dc] ");
X do
X c = mcigetc();
X while ((c != 'd') && (c != 'c')&& (c!=ESCAPE));
X if (c == 'd')
X displayfile(filestr);
X else if (c == 'c') copyfile(filestr);
X }
X xredraw();
X}
X
Xvoid version()
X{
X setgamestatus(SKIP_MONSTERS);
X print3(VERSIONSTRING);
X nprint3(":");
X nprint3(" Last Edited: ");
X nprint3(LAST_OMEGA_EDIT_DATE);
X}
X
Xvoid fire()
X{
X int index,x1,y1,x2,y2;
X pob obj;
X struct monster *m;
X
X clearmsg();
X
X print1("Fire/Throw --");
X index = getitem(NULL);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else if (index == CASHVALUE) print3("Can't fire money at something!");
X else if (cursed(Player.possessions[index]) &&
X Player.possessions[index]->used)
X print3("You can't seem to get rid of it!");
X /* load a crossbow */
X else if ((Player.possessions[O_WEAPON_HAND] != NULL) &&
X (Player.possessions[O_WEAPON_HAND]->id == WEAPONID+27) &&
X (Player.possessions[O_WEAPON_HAND]->aux != LOADED) &&
X (Player.possessions[index]->id == WEAPONID+29)) {
X mprint("You crank back the crossbow and load a bolt.");
X Player.possessions[O_WEAPON_HAND]->aux = LOADED;
X }
X else {
X if (Player.possessions[index]->used) {
X Player.possessions[index]->used = FALSE;
X item_use(Player.possessions[index]);
X }
X obj = Player.possessions[index];
X x1 = x2 = Player.x;
X y1 = y2 = Player.y;
X setspot(&x2,&y2);
X if ((x2 == Player.x) && (y2 == Player.y))
X mprint("You practice juggling for a moment or two.");
X else {
X do_object_los(obj->objchar,&x1,&y1,x2,y2);
X if ((m=Level->site[x1][y1].creature) != NULL) {
X if (obj->dmg == 0) {
X if (m->treasure > 0) { /* the monster can have treasure/objects */
X mprint("Your gift is caught!");
X givemonster(m,obj);
X conform_lost_objects(1,obj);
X }
X else {
X mprint("Your thrown offering is ignored.");
X p_drop_at(x1,y1,1,obj);
X conform_lost_objects(1,obj);
X }
X }
X else if (hitp(Player.hit,m->ac)) {/* ok already, hit the damn thing */
X weapon_use(2*statmod(Player.str),obj,m);
X dispose_lost_objects(1,obj);
X }
X else {
X mprint("You miss it.");
X p_drop_at(x1,y1,1,obj);
X conform_lost_objects(1,obj);
X }
X }
X else {
X p_drop_at(x1,y1,1,obj);
X conform_lost_objects(1,obj);
X }
X }
X }
X}
X
X
X
Xint quit()
X{
X clearmsg();
X mprint("Quit: Are you sure? [yn] ");
X if (ynq()=='y') {
X if (Player.rank[ADEPT] == 0) display_quit();
X else display_bigwin();
X endgraf();
X exit(0);
X }
X else resetgamestatus(SKIP_MONSTERS);
X}
X
X
X
X/* rest in 10 second segments so if woken up by monster won't
Xdie automatically.... */
Xvoid nap()
X{
X static int naptime;
X if (gamestatusp(FAST_MOVE)) {
X if (naptime-- < 1) {
X clearmsg();
X mprint("Yawn. You wake up.");
X resetgamestatus(FAST_MOVE);
X drawvision(Player.x,Player.y);
X }
X }
X else {
X clearmsg();
X mprint("Rest for how long? (in minutes) ");
X naptime = parsenum();
X if (naptime > 600) {
X print3("You can only sleep up to 10 hours (600 minutes)");
X naptime = 3600;
X }
X else naptime *= 6;
X if (naptime > 1) {
X clearmsg();
X setgamestatus(FAST_MOVE);
X mprint("Resting.... ");
X }
X }
X}
X
X
Xvoid charid()
X{
X char id;
X int countryside=FALSE;
X char cstr[80];
X
X clearmsg();
X mprint("Character to identify: ");
X id = mgetc();
X if (Current_Environment == E_COUNTRYSIDE) {
X countryside = TRUE;
X strcpy(cstr,countryid(id));
X if (strcmp(cstr,"I have no idea.")==0)
X countryside = FALSE;
X else mprint(cstr);
X }
X if (! countryside) {
X if (((id >= 'a') && (id <= 'z')) || ((id >= 'A') && (id <= 'Z')))
X mprint("A monster or NPC -- examine (x) to find out exactly.");
X else switch(id) {
X case SPACE:
X mprint(" : An airless void (if seen) or unknown region (if unseen)");
X break;
X case WALL:
X mprint(" : An (impenetrable?) wall");
X break;
X case OPEN_DOOR:
X mprint(" : An open door");
X break;
X case CLOSED_DOOR:
X mprint(" : A closed (possibly locked) door");
X break;
X case LAVA:
X mprint(" : A pool of lava");
X break;
X case HEDGE:
X mprint(" : A dense hedge");
X break;
X case WATER:
X mprint(" : A deep body of water");
X break;
X case FIRE:
X mprint(" : A curtain of fire");
X break;
X case TRAP:
X mprint(" : An uncovered trap");
X break;
X case UP:
X mprint(" : A stairway leading up");
X break;
X case DOWN:
X mprint(" : A stairway leading down");
X break;
X case FLOOR:
X mprint(" : The dungeon floor");
X break;
X case PORTCULLIS:
X mprint(" : A heavy steel portcullis");
X break;
X case ABYSS:
X mprint(" : An entrance to the infinite abyss");
X break;
X case PLAYER:
X mprint(" : You, the player");
X break;
X case CORPSE:
X mprint(" : The remains of some creature");
X break;
X case THING:
X mprint(" : Some random miscellaneous object");
X break;
X case SAFE:
X mprint(" : A steel safe inset into the floor");
X break;
X case RUBBLE:
X mprint(" : A dangerous-looking pile of rubble");
X break;
X case STATUE:
X mprint(" : A statue");
X break;
X case ALTAR:
X mprint(" : A (un?)holy altar");
X break;
X case CASH:
X mprint(" : Bills, specie, gems: cash");
X break;
X case PILE:
X mprint(" : A pile of objects");
X break;
X case FOOD:
X mprint(" : Something edible");
X break;
X case WEAPON:
X mprint(" : Some kind of weapon");
X break;
X case MISSILEWEAPON:
X mprint(" : Some kind of missile weapon");
X break;
X case SCROLL:
X mprint(" : Something readable");
X break;
X case POTION:
X mprint(" : Something drinkable");
X break;
X case ARMOR:
X mprint(" : A suit of armor");
X break;
X case SHIELD:
X mprint(" : A shield");
X break;
X case CLOAK:
X mprint(" : A cloak");
X break;
X case BOOTS:
X mprint(" : A pair of boots");
X break;
X case STICK:
X mprint(" : A stick");
X break;
X case RING:
X mprint(" : A ring");
X break;
X case ARTIFACT:
X mprint(" : An artifact");
X break;
X case CHAIR:
X mprint(" : A chair");
X break;
X case WHIRLWIND:
X mprint(" : A whirlwind");
X break;
X default:
X mprint("That character is unused.");
X break;
X }
X }
X}
X
X
Xvoid wizard()
X{
X setgamestatus(SKIP_MONSTERS);
X if (gamestatusp(CHEATED)) mprint("You're already in wizard mode!");
X else {
X clearmsg();
X mprint("Really try to enter wizard mode? [yn] ");
X if (ynq()=='y') {
X if (strcmp(getlogin(),WIZARD)==0) {
X setgamestatus(CHEATED);
X mprint("Wizard mode set.");
X }
X else {
X mprint("There is a shrieking sound, as of reality being distorted.");
X strcpy(Str1,WIZARD);
X strcat(Str1,", the Wizard of omega appears before you....");
X mprint(Str1);
X mprint("'Do not meddle in the affairs of Wizards --");
X if (random_range(2)) mprint("it makes them soggy and hard to light.'");
X else mprint("for they are subtle, and swift to anger!'");
X }
X }
X }
X}
X
X/* Jump, that is */
Xvoid vault()
X{
X int x=Player.x,y=Player.y,jumper=0;
X
X clearmsg();
X
X if (Player.possessions[O_BOOTS] != NULL)
X if (Player.possessions[O_BOOTS]->usef = I_BOOTS_JUMPING)
X jumper = 2;
X if (Player.status[IMMOBILE] > 0) {
X resetgamestatus(FAST_MOVE);
X print3("You are unable to move");
X }
X else {
X setgamestatus(SKIP_MONSTERS);
X mprint("Jump where?");
X setspot(&x,&y);
X if (! los_p(x,y,Player.x,Player.y))
X print3("The way is obstructed.");
X else if (Player.itemweight > Player.maxweight)
X print3("You are too burdened to jump anywhere.");
X else if (distance(x,y,Player.x,Player.y) >
X max(2,statmod(Player.agi)+2)+jumper)
X print3("The jump is too far for you.");
X else if (Level->site[x][y].creature != NULL)
X print3("You can't jump on another creature.");
X else if (! p_moveable(x,y))
X print3("You can't jump there.");
X else {
X resetgamestatus(SKIP_MONSTERS);
X Player.x = x;
X Player.y = y;
X if ((! jumper) && (random_range(30) > Player.agi)) {
X mprint("Oops -- took a tumble.");
X setgamestatus(SKIP_PLAYER);
X p_damage((Player.itemweight/250),UNSTOPPABLE,"clumsiness");
X }
X p_movefunction(Level->site[Player.x][Player.y].p_locf);
X if (Current_Environment != E_COUNTRYSIDE)
X if ((Level->site[Player.x][Player.y].things != NULL) &&
X (optionp(PICKUP)))
X pickup();
X }
X }
X}
X
X
X/* Sets sequence of combat maneuvers. */
Xvoid tacoptions()
X{
X int actionsleft,done,place;
X float times;
X
X setgamestatus(SKIP_MONSTERS);
X
X done = FALSE;
X actionsleft = maneuvers();
X menuclear();
X place = 0;
X menuprint("Enter a combat maneuvers sequence.\n");
X menuprint("? for help, ! for default, RETURN to save sequence\n");
X do {
X clearmsg1();
X mprint("Maneuvers Left:");
X mnumprint(actionsleft);
X switch(mgetc()) {
X case '?':
X combat_help();
X break;
X case 'a': case 'A':
X if (actionsleft < 1) print3("No more maneuvers!");
X else {
X if (Player.possessions[O_WEAPON_HAND] == NULL) {
X Player.meleestr[place] = 'C';
X menuprint("\nPunch:");
X }
X else if (Player.possessions[O_WEAPON_HAND]->type == THRUSTING) {
X Player.meleestr[place] = 'T';
X menuprint("\nThrust:");
X }
X else if (Player.possessions[O_WEAPON_HAND]->type == STRIKING) {
X Player.meleestr[place] = 'C';
X menuprint("\nStrike:");
X }
X else {
X menuprint("\nCut:");
X Player.meleestr[place] = 'C';
X }
X place++;
X Player.meleestr[place]=getlocation();
X place++;
X actionsleft--;
X }
X break;
X case 'b': case 'B':
X if (actionsleft<1) print3("No more maneuvers!");
X else {
X Player.meleestr[place] = 'B';
X if (Player.possessions[O_WEAPON_HAND] == NULL)
X menuprint("\nDodge (from):");
X else if (Player.possessions[O_WEAPON_HAND]->type == THRUSTING)
X menuprint("\nParry:");
X else menuprint("\nBlock:");
X place++;
X Player.meleestr[place]= getlocation();
X place++;
X actionsleft--;
X }
X break;
X case 'l': case 'L':
X if (actionsleft<2) print3("Not enough maneuvers to lunge!");
X else {
X if (Player.possessions[O_WEAPON_HAND] != NULL) {
X if (Player.possessions[O_WEAPON_HAND]->type != MISSILE) {
X Player.meleestr[place] = 'L';
X place++;
X Player.meleestr[place]=getlocation();
X place++;
X actionsleft -= 2;
X menuprint("\nLunge:");
X }
X else {
X print3("Can't lunge with a missile weapon!");
X morewait();
X }
X }
X else {
X print3("Can't lunge without a weapon!");
X morewait();
X }
X }
X break;
X case 'r': case 'R':
X if (actionsleft<2) print3("Not enough maneuvers to riposte!");
X else {
X if (Player.possessions[O_WEAPON_HAND] != NULL) {
X if (Player.possessions[O_WEAPON_HAND]->type == THRUSTING) {
X Player.meleestr[place] = 'R';
X menuprint("\nRiposte ");
X Player.meleestr[place]=getlocation();
X actionsleft -= 2;
X }
X else {
X print3("Can't riposte without a thrusting weapon!");
X morewait();
X }
X }
X else {
X print3("Can't riposte without a thrusting weapon!");
X morewait();
X }
X }
X break;
X case BACKSPACE:
X case DELETE:
X place = 0;
X actionsleft=maneuvers();
X break;
X case RETURN:
X case LINEFEED:
X case ESCAPE:
X done = TRUE;
X break;
X }
X } while (! done);
X xredraw();
X Player.meleestr[place] = 0;
X}
X
X
X
X
X/* Do the Artful Dodger trick */
Xvoid pickpocket()
X{
X int dx,dy,index=0;
X struct monster *m;
X
X clearmsg();
X
X mprint("Pickpocketing --");
X
X index = getdir();
X
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X dx = Dirs[0][index];
X dy = Dirs[1][index];
X
X if ((! inbounds(Player.x+dx, Player.y+dy)) ||
X (Level->site[Player.x+dx][Player.y+dy].creature == NULL)) {
X print3("There's nothing there to steal from!!!");
X setgamestatus(SKIP_MONSTERS);
X }
X else {
X m = Level->site[Player.x+dx][Player.y+dy].creature;
X if (m->id == ML0+3) {
X mprint("Trying to steal from a guardsman, eh?");
X mprint("Not a clever idea.");
X if (Player.cash > 0) {
X mprint("As a punitive fine, the guard takes all your money.");
X Player.cash = 0;
X dataprint();
X }
X else {
X mprint("The guardsman places you under arrest.");
X morewait();
X send_to_jail();
X }
X }
X else if (m->possessions == NULL) {
X mprint("You couldn't find anything worth taking!");
X mprint("But you managed to annoy it...");
X m_status_set(m,HOSTILE);
X }
X else if (Player.dex*5+Player.rank[THIEVES]*20+random_range(100) >
X random_range(100)+m->level*20) {
X mprint("You successfully complete your crime!");
X mprint("You stole:");
X mprint(itemid(m->possessions->thing));
X Player.alignment--;
X gain_experience(m->level*m->level);
X gain_item(m->possessions->thing);
X m->possessions = m->possessions->next;
X }
X }
X }
X}
X
X
X
Xvoid rename_player()
X{
X setgamestatus(SKIP_MONSTERS);
X clearmsg();
X mprint("Rename Character:");
X strcpy(Player.name,msgscanstring());
X}
X
X
Xvoid abortshadowform()
X{
X setgamestatus(SKIP_MONSTERS);
X if (Player.status[SHADOWFORM] && (Player.status[SHADOWFORM]<1000)) {
X mprint("You abort your spell of Shadow Form.");
X Player.immunity[NORMAL_DAMAGE]--;
X Player.immunity[ACID]--;
X Player.immunity[THEFT]--;
X Player.immunity[INFECTION]--;
X mprint("You feel less shadowy now.");
X Player.status[SHADOWFORM] = 0;
X }
X}
X
Xvoid tunnel()
X{
X int dir,ox,oy,aux;
X
X clearmsg();
X mprint("Tunnel -- ");
X dir = getdir();
X if (dir == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X ox = Player.x + Dirs[0][dir];
X oy = Player.y + Dirs[1][dir];
X if (loc_statusp(ox,oy,SECRET))
X mprint("You have no success as yet.");
X else if (Level->site[ox][oy].locchar != WALL) {
X print3("You can't tunnel through that!");
X setgamestatus(SKIP_MONSTERS);
X }
X else {
X aux = Level->site[ox][oy].aux;
X if (random_range(20)==1){
X if (Player.possessions[O_WEAPON_HAND] == NULL) {
X mprint("Ouch! broke a fingernail...");
X p_damage(Player.str / 6,UNSTOPPABLE,"A broken fingernail");
X }
X else if ((Player.possessions[O_WEAPON_HAND]->type == THRUSTING) ||
X ((Player.possessions[O_WEAPON_HAND]->type != STRIKING) &&
X (Player.possessions[O_WEAPON_HAND]->fragility <
X random_range(20)))) {
X mprint("Clang! Uh oh...");
X damage_item(Player.possessions[O_WEAPON_HAND]);
X }
X else mprint("Your digging implement shows no sign of breaking.");
X }
X if (Player.possessions[O_WEAPON_HAND] == NULL) {
X if ((aux > 0) && ((Player.str/3)+random_range(100) > aux)) {
X mprint("You carve a tunnel through the stone!");
X tunnelcheck();
X Level->site[ox][oy].locchar = RUBBLE;
X Level->site[ox][oy].p_locf = L_RUBBLE;
X }
X else mprint("No joy.");
X }
X else if (Player.possessions[O_WEAPON_HAND]->type == THRUSTING) {
X if ((aux > 0) &&
X (Player.possessions[O_WEAPON_HAND]->dmg*2+random_range(100) >
X aux)) {
X mprint("You carve a tunnel through the stone!");
X tunnelcheck();
X Level->site[ox][oy].locchar = RUBBLE;
X Level->site[ox][oy].p_locf = L_RUBBLE;
X }
X else mprint("No luck.");
X }
X else if ((aux > 0) &&
X (Player.possessions[O_WEAPON_HAND]->dmg+random_range(100)
X > aux)) {
X mprint("You carve a tunnel through the stone!");
X tunnelcheck();
X Level->site[ox][oy].locchar = RUBBLE;
X Level->site[ox][oy].p_locf = L_RUBBLE;
X }
X else mprint("You have no success as yet.");
X }
X }
X}
X
X
X
X
Xvoid hunt(terrain)
Xchar terrain;
X{
X int fertility=0;
X switch(terrain) {
X case SWAMP:
X mprint("You hesitate to hunt for food in the marshy wasteland.");
X break;
X case VOLCANO:
X case CASTLE:
X case TEMPLE:
X case CAVES:
X case STARPEAK:
X case MAGIC_ISLE:
X case DRAGONLAIR:
X mprint("There is nothing alive here (or so it seems)");
X break;
X case VILLAGE:
X case CITY:
X mprint("You can find no food here; perhaps if you went inside....");
X break;
X case ROAD:
X mprint("You feel it would be a better idea to hunt off the road.");
X break;
X case CHAOS_SEA:
X mprint("Food in the Sea of Chaos? Go on!");
X break;
X case DESERT:
X mprint("You wander off into the trackless desert in search of food...");
X Time += 100;
X hourly_check();
X fertility = 10;
X break;
X case JUNGLE:
X mprint("You search the lush and verdant jungle for game....");
X Time += 100;
X hourly_check();
X fertility = 80;
X break;
X case PLAINS:
X mprint("You set off through the tall grass; the game is afoot.");
X Time += 100;
X hourly_check();
X fertility = 50;
X break;
X case TUNDRA:
X mprint("You blaze a trail through the frozen wasteland....");
X Time += 100;
X hourly_check();
X fertility = 30;
X break;
X case FOREST:
X mprint("You try to follow the many tracks through the forest loam....");
X Time += 100;
X hourly_check();
X fertility = 70;
X break;
X case MOUNTAINS: case PASS:
X mprint("You search the cliff walls looking for something to eat....");
X Time += 100;
X hourly_check();
X fertility = 30;
X break;
X case RIVER:
X mprint("The halcyon river is your hopeful food source...");
X Time += 100;
X hourly_check();
X fertility = 80;
X break;
X }
X if (((Date % 360 < 60) || (Date % 360 > 300)) &&
X (terrain != DESERT) &&
X (terrain != JUNGLE)) {
X mprint("The cold weather impedes your hunt....");
X fertility = fertility / 2;
X }
X if (fertility > random_range(100)) {
X mprint("You have an encounter...");
X change_environment(E_TACTICAL_MAP);
X }
X else mprint("Your hunt is fruitless.");
X}
X
Xvoid dismount_steed()
X{
X pml ml;
X if (! gamestatusp(MOUNTED))
X print3("You're on foot already!");
X else if (Current_Environment == E_COUNTRYSIDE) {
X mprint("If you leave your steed here he will wander away!");
X mprint("Do it anyway? [yn] ");
X if (ynq()=='y') resetgamestatus(MOUNTED);
X }
X else {
X resetgamestatus(MOUNTED);;
X ml = ((pml) malloc(sizeof(mltype)));
X ml->m = ((pmt) malloc(sizeof(montype)));
X *(ml->m) = Monsters[HORSE];
X ml->m->x = Player.x;
X ml->m->y = Player.y;
X ml->m->status = MOBILE+SWIMMING;
X ml->next = Level->mlist;
X Level->site[Player.x][Player.y].creature = ml->m;
X Level->mlist = ml;
X }
X calc_melee();
X}
X
X
Xvoid city_move()
X{
X int site,x=Player.x,y=Player.y,toggle=FALSE;
X clearmsg();
X if (Current_Environment != E_CITY) {
X print3("This command only works in the city!");
X setgamestatus(SKIP_MONSTERS);
X }
X else if (Player.status[IMMOBILE] > 0)
X print3("You can't even move!");
X else if (hostilemonstersnear()) {
X setgamestatus(SKIP_MONSTERS);
X print3("You can't move this way with hostile monsters around!");
X }
X else if (Level->site[Player.x][Player.y].aux == NOCITYMOVE)
X print3("You can't use the 'M' command from this location.");
X else {
X mprint("Move to which establishment [? for help, ESCAPE to quit] ");
X site = parsecitysite();
X if (site != ABORT) {
X mprint("You're on your way...");
X morewait();
X while ((x != CitySiteList[site][1]) || (y != CitySiteList[site][2])) {
X toggle = ! toggle;
X if (toggle) {
X Time++;
X if (Time % 10 == 0) tenminute_check();
X else minute_status_check();
X }
X x += sign(CitySiteList[site][1] - x);
X y += sign(CitySiteList[site][2] - y);
X screencheck(y);
X showcursor(x,y);
X }
X Player.x = x;
X Player.y = y;
X screencheck(Player.y);
X mprint("Made it!");
X morewait();
X p_movefunction(Level->site[x][y].p_locf);
X }
X }
X}
X
X
X
Xvoid frobgamestatus()
X{
X char response;
X long num;
X mprint("Set or Reset or Forget it [s,r,ESCAPE]:");
X do response = mcigetc();
X while ((response != 'r') && (response != 's') && (response != ESCAPE));
X if (response != ESCAPE) {
X mprint("Enter log2 of flag:");
X num = parsenum();
X if (num > -1) {
X num = pow2(num);
X if (response == 's') setgamestatus(num);
X else resetgamestatus(num);
X mprint("Done....");
X }
X }
X}
X
END_OF_FILE
if test 27429 -ne `wc -c <'ocom3.c'`; then
echo shar: \"'ocom3.c'\" unpacked with wrong size!
fi
# end of 'ocom3.c'
fi
if test -f 'oitem.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'oitem.c'\"
else
echo shar: Extracting \"'oitem.c'\" \(22667 characters\)
sed "s/^X//" >'oitem.c' <<'END_OF_FILE'
X/* omega copyright (C) 1987,1988 by Laurence Raphael Brothers */
X/* oitem.c */
X
X#include "oglob.h"
X
X/* make a random new object, returning pointer */
X/* may return NULL. */
Xpob create_object(itemlevel)
Xint itemlevel;
X{
X pob new;
X int r;
X int ok = FALSE;
X
X while (! ok) {
X new = ((pob) malloc(sizeof(objtype)));
X r= random_range(135);
X if (r < 20) make_thing(new,-1);
X else if (r < 40) make_food(new,-1);
X else if (r < 50) make_scroll(new,-1);
X else if (r < 60) make_potion(new,-1);
X else if (r < 70) make_weapon(new,-1);
X else if (r < 80) make_armor(new,-1);
X else if (r < 90) make_shield(new,-1);
X else if (r < 100) make_stick(new,-1);
X else if (r < 110) make_boots(new,-1);
X else if (r < 120) make_cloak(new,-1);
X else if (r < 130) make_ring(new,-1);
X else make_artifact(new,-1);
X /* not ok if object is too good for level, or if unique and already made */
X /* 1/100 chance of finding object if too good for level */
X ok = ((new->uniqueness != UNIQUE_MADE) &&
X ((new->level < itemlevel+random_range(3))
X || (random_range(100)==23)));
X if (!ok) free((char *) new);
X }
X if (new->uniqueness == UNIQUE_UNMADE)
X Objects[new->id].uniqueness=UNIQUE_MADE;
X return(new);
X}
X
Xvoid make_cash(new,level)
Xpob new;
Xint level;
X{
X *new = Objects[CASHID];
X new->basevalue = random_range(level*level+10)+1; /* aux is AU value */
X new->objstr = salloc(cashstr());
X new->cursestr = new->truename = new->objstr;
X}
X
Xvoid make_food(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMFOODS);
X *new = Objects[FOODID+id];
X}
X
X
Xvoid make_corpse(new,m)
Xpob new;
Xstruct monster *m;
X{
X *new = Objects[CORPSEID];
X new->charge = m->id;
X new->weight = m->corpseweight;
X new->basevalue = m->corpsevalue;
X new->known = 2;
X new->objstr = salloc(m->corpsestr);
X new->truename = new->cursestr = new->objstr;
X if (m->monchar == '@')
X new->usef = I_CANNIBAL;
X else if (m_statusp(m,EDIBLE)) {
X new->usef = I_FOOD;
X new->aux = 6;
X }
X else if (m_statusp(m,POISONOUS))
X new->usef = I_POISON_FOOD;
X /* Special corpse-eating effects */
X else switch(m->id) {
X case ML1+1: /*tse tse fly */
X case ML4+9: /*torpor beast */
X new->usef = I_SLEEP_SELF;
X break;
X case ML2+5:
X new->usef = I_INVISIBLE;
X break;
X case ML1+5: /* blipper */
X new->usef = I_TELEPORT;
X break;
X case ML2+3: /* floating eye -- it's traditional.... */
X new->usef = I_CLAIRVOYANCE;
X break;
X case ML4+11: /*astral fuzzy */
X new->usef = I_DISPLACE;
X break;
X case ML4+12: /*s o law */
X new->usef = I_CHAOS;
X break;
X case ML4+13: /*s o chaos */
X new->usef = I_LAW;
X break;
X case ML5+9: /* astral vampire */
X new->usef = I_ENCHANT;
X break;
X case ML5+11: /* manaburst */
X new->usef = I_SPELLS;
X break;
X case ML6+9: /* rakshasa */
X new->usef = I_TRUESIGHT;
X break;
X case ML7+0: /* behemoth */
X new->usef = I_HEAL;
X break;
X case ML7+2: /* unicorn */
X new->usef = I_NEUTRALIZE_POISON;
X break;
X case ML8+10: /*coma beast */
X new->usef = I_ALERT;
X break;
X default:
X new->usef = I_INEDIBLE;
X break;
X }
X}
X
X
X
X
Xvoid make_ring(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMRINGS);
X *new = Objects[RINGID+id];
X if (new->blessing == 0) new->blessing = itemblessing();
X if (new->plus == 0) new->plus = itemplus()+1;
X if (new->blessing < 0) new->plus = -1 - abs(new->plus);
X}
X
Xvoid make_thing(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMTHINGS);
X *new = Objects[THINGID+id];
X if (strcmp(new->objstr,"grot") == 0) {
X new->objstr = salloc(grotname());
X new->truename = new->cursestr = new->objstr;
X }
X}
X
X
Xvoid make_scroll(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMSCROLLS);
X *new = Objects[SCROLLID+id];
X /* if a scroll of spells, aux is the spell id in Spells */
X if (new->id == SCROLLID+1) {
X new->aux = random_range(NUMSPELLS);
X }
X}
X
Xvoid make_potion(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMPOTIONS);
X *new = Objects[POTIONID+id];
X if (new->plus == 0) new->plus = itemplus();
X}
X
Xvoid make_weapon(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMWEAPONS);
X *new = Objects[WEAPONID+id];
X if ((id == 28) || (id == 29)) /* bolt or arrow */
X new->number = random_range(20)+1;
X if (new->blessing == 0) new->blessing = itemblessing();
X if (new->plus == 0) {
X new->plus = itemplus();
X if (new->blessing < 0)
X new->plus = -1 - abs(new->plus);
X else if (new->blessing > 0)
X new->plus = 1 + abs(new->plus);
X }
X}
X
Xvoid make_shield(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMSHIELDS);
X *new = Objects[SHIELDID+id];
X if (new->plus == 0)
X new->plus = itemplus();
X if (new->blessing == 0) new->blessing = itemblessing();
X if (new->blessing < 0)
X new->plus = -1 - abs(new->plus);
X else if (new->blessing > 0)
X new->plus = 1 + abs(new->plus);
X}
X
Xvoid make_armor(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMARMOR);
X *new = Objects[ARMORID+id];
X if (new->plus == 0) new->plus = itemplus();
X if (new->blessing == 0) new->blessing = itemblessing();
X if (new->blessing < 0)
X new->plus = -1 - abs(new->plus);
X else if (new->blessing > 0)
X new->plus = 1 + abs(new->plus);
X}
X
Xvoid make_cloak(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMCLOAKS);
X Objects[CLOAKID+4].plus = 2;
X *new = Objects[CLOAKID+id];
X if (new->blessing == 0) new->blessing = itemblessing();
X}
X
Xvoid make_boots(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMBOOTS);
X *new = Objects[BOOTID+id];
X if (new->blessing == 0) new->blessing = itemblessing();
X}
X
Xvoid make_stick(new,id)
Xpob new;
Xint id;
X{
X if (id == -1) id = random_range(NUMSTICKS);
X *new = Objects[STICKID+id];
X new->charge = itemcharge();
X if (new->blessing == 0) new->blessing = itemblessing();
X}
X
Xvoid make_artifact(new,id)
Xpob new;
X{
X if (id == -1) id = random_range(NUMARTIFACTS);
X *new = Objects[ARTIFACTID+id];
X}
X
X
X
X
X/* item name functions */
X
Xchar *scrollname(reset,id)
Xint reset,id;
X
X{
X static int ids[30];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<30;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(30);
X k = ids[i % 30];
X ids[i % 30]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch(ids[id]) {
X case 0: strcpy(Str4,"scroll-GRISTOGRUE"); break;
X case 1: strcpy(Str4,"scroll-Kho Reck Tighp"); break;
X case 2: strcpy(Str4,"scroll-E Z"); break;
X case 3: strcpy(Str4,"scroll-Kevitz"); break;
X case 4: strcpy(Str4,"scroll-Arcanum Prime"); break;
X case 5: strcpy(Str4,"scroll-NYARLATHOTEP"); break;
X case 6: strcpy(Str4,"scroll-Gilthoniel"); break;
X case 7: strcpy(Str4,"scroll-Zarathustra"); break;
X case 8: strcpy(Str4,"scroll-Ancient Lore"); break;
X case 9: strcpy(Str4,"scroll-Eyes Only"); break;
X case 10: strcpy(Str4,"scroll-Ambogar Empheltz"); break;
X case 11: strcpy(Str4,"scroll-Isengard"); break;
X case 12: strcpy(Str4,"scroll-Deosil Widdershins"); break;
X case 13: strcpy(Str4,"scroll-Magister Paracelsus"); break;
X case 14: strcpy(Str4,"scroll-Qlipphotic Summons"); break;
X case 15: strcpy(Str4,"scroll-Aratron Samael"); break;
X case 16: strcpy(Str4,"scroll-De Wormiis Mysterius"); break;
X case 17: strcpy(Str4,"scroll-Necronomicon"); break;
X case 18: strcpy(Str4,"scroll-Pnakotic Manuscript"); break;
X case 19: strcpy(Str4,"scroll-Codex of Xalimar"); break;
X case 20: strcpy(Str4,"scroll-The Mabinogion"); break;
X case 21: strcpy(Str4,"scroll-Ginseng Shiatsu"); break;
X case 22: strcpy(Str4,"scroll-Tome of Tromax"); break;
X case 23: strcpy(Str4,"scroll-Book of the Dead "); break;
X case 24: strcpy(Str4,"scroll-The Flame Tongue"); break;
X case 25: strcpy(Str4,"scroll-Karst Khogar"); break;
X case 26: strcpy(Str4,"scroll-The Yellow Sign"); break;
X case 27: strcpy(Str4,"scroll-The Kevillist Manifesto"); break;
X case 28: strcpy(Str4,"scroll-Goshtar Script"); break;
X case 29: strcpy(Str4,"scroll-Pendragon Encryption"); break;
X }
X }
X return(Str4);
X}
X
X
Xchar *grotname()
X{
X switch(random_range(20)) {
X case 0: strcpy(Str4,"pot lid"); break;
X case 1: strcpy(Str4,"mound of offal"); break;
X case 2: strcpy(Str4,"sword that was broken"); break;
X case 3: strcpy(Str4,"salted snail"); break;
X case 4: strcpy(Str4,"key"); break;
X case 5: strcpy(Str4,"toadstool"); break;
X case 6: strcpy(Str4,"greenish spindle"); break;
X case 7: strcpy(Str4,"tin soldier"); break;
X case 8: strcpy(Str4,"broken yo-yo"); break;
X case 9: strcpy(Str4,"NYC subway map"); break;
X case 10: strcpy(Str4,"Nixon's the One! button"); break;
X case 11: strcpy(Str4,"beer can (empty)"); break;
X case 12: strcpy(Str4,"golden bejewelled falcon"); break;
X case 13: strcpy(Str4,"hamster cage"); break;
X case 14: strcpy(Str4,"wooden nickel"); break;
X case 15: strcpy(Str4,"three-dollar bill"); break;
X case 16: strcpy(Str4,"rosebud"); break;
X case 17: strcpy(Str4,"water pistol"); break;
X case 18: strcpy(Str4,"shattered skull"); break;
X case 19: strcpy(Str4,"jawbone of an ass"); break;
X }
X return(Str4);
X}
X
X
X
X
Xchar *potionname(reset,id)
Xint reset,id;
X{
X static int ids[20];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<20;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(20);
X k = ids[i % 20];
X ids[i % 20]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch (ids[id]) {
X case 0: strcpy(Str4,"vial of dewy liquid"); break;
X case 1: strcpy(Str4,"jug of tarry black substance"); break;
X case 2: strcpy(Str4,"flask of cold smoking froth"); break;
X case 3: strcpy(Str4,"phial of glowing fluid"); break;
X case 4: strcpy(Str4,"bottle of sickening slime"); break;
X case 5: strcpy(Str4,"sac of greenish gel"); break;
X case 6: strcpy(Str4,"wineskin of odorous goo"); break;
X case 7: strcpy(Str4,"canteen of sweet sap"); break;
X case 8: strcpy(Str4,"urn of clear fluid"); break;
X case 9: strcpy(Str4,"clotted grey ooze"); break;
X case 10: strcpy(Str4,"keg of bubbly golden fluid"); break;
X case 11: strcpy(Str4,"tube of minty paste"); break;
X case 12: strcpy(Str4,"pitcher of aromatic liquid"); break;
X case 13: strcpy(Str4,"pot of rancid grease"); break;
X case 14: strcpy(Str4,"thermos of hot black liquid"); break;
X case 15: strcpy(Str4,"magnum of deep red liquid"); break;
X case 16: strcpy(Str4,"vase full of ichor"); break;
X case 17: strcpy(Str4,"container of white cream"); break;
X case 18: strcpy(Str4,"syringe of clear fluid"); break;
X case 19: strcpy(Str4,"can of volatile essence"); break;
X }
X return(Str4);
X }
X}
X
X
Xchar *stickname(reset,id)
Xint reset,id;
X{
X static int ids[20];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<20;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(20);
X k = ids[i % 20];
X ids[i % 20]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch (ids[id]) {
X case 0: strcpy(Str4,"oaken staff"); break;
X case 1: strcpy(Str4,"heavy metal rod"); break;
X case 2: strcpy(Str4,"shaft of congealed light"); break;
X case 3: strcpy(Str4,"slender ceramic wand"); break;
X case 4: strcpy(Str4,"rune-inscribed bone wand"); break;
X case 5: strcpy(Str4,"knurly staff"); break;
X case 6: strcpy(Str4,"steel knobbed rod"); break;
X case 7: strcpy(Str4,"lucite wand"); break;
X case 8: strcpy(Str4,"sturdy alpenstock"); break;
X case 9: strcpy(Str4,"gem-studded ebony staff"); break;
X case 10: strcpy(Str4,"chromed sequinned staff"); break;
X case 11: strcpy(Str4,"old peeling stick"); break;
X case 12: strcpy(Str4,"jointed metal rod"); break;
X case 13: strcpy(Str4,"wand with lead ferrules"); break;
X case 14: strcpy(Str4,"forked wooden stick"); break;
X case 15: strcpy(Str4,"cane with gold eagle handle"); break;
X case 16: strcpy(Str4,"crystalline wand"); break;
X case 17: strcpy(Str4,"metal stick with trigger"); break;
X case 18: strcpy(Str4,"leather-handled stone rod"); break;
X case 19: strcpy(Str4,"tiny mithril wand"); break;
X }
X return(Str4);
X }
X}
X
Xchar *ringname(reset,id)
Xint reset,id;
X{
X static int ids[20];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<20;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(20);
X k = ids[i % 20];
X ids[i % 20]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch (ids[id]) {
X case 0: strcpy(Str4,"gold ring with a blue gem"); break;
X case 1: strcpy(Str4,"brass ring"); break;
X case 2: strcpy(Str4,"mithril ring with a red gem"); break;
X case 3: strcpy(Str4,"platinum ring"); break;
X case 4: strcpy(Str4,"gold dragon's head ring"); break;
X case 5: strcpy(Str4,"bronze ring"); break;
X case 6: strcpy(Str4,"aardvark seal ring"); break;
X case 7: strcpy(Str4,"grey metal ring"); break;
X case 8: strcpy(Str4,"silver skull ring"); break;
X case 9: strcpy(Str4,"onyx ring"); break;
X case 10: strcpy(Str4,"Collegium Magii class ring"); break;
X case 11: strcpy(Str4,"worn stone ring"); break;
X case 12: strcpy(Str4,"diorite ring"); break;
X case 13: strcpy(Str4,"ancient scarab ring"); break;
X case 14: strcpy(Str4,"plastic charm ring"); break;
X case 15: strcpy(Str4,"soapy gypsum ring"); break;
X case 16: strcpy(Str4,"glass ring"); break;
X case 17: strcpy(Str4,"glowing bluestone ring"); break;
X case 18: strcpy(Str4,"ring with eye sigil"); break;
X case 19: strcpy(Str4,"zirconium ring"); break;
X }
X return(Str4);
X }
X}
X
X
Xchar *cloakname(reset,id)
Xint reset,id;
X{
X static int ids[20];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<20;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(20);
X k = ids[i % 20];
X ids[i % 20]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch (ids[id]) {
X case 0: strcpy(Str4,"tattered piece of cloth"); break;
X case 1: strcpy(Str4,"fuligin cloak"); break;
X case 2: strcpy(Str4,"chintz cloak"); break;
X case 3: strcpy(Str4,"diaphanous cape"); break;
X case 4: strcpy(Str4,"red half-cloak"); break;
X case 5: strcpy(Str4,"mouse-hide cloak"); break;
X case 6: strcpy(Str4,"kelly green cloak"); break;
X case 7: strcpy(Str4,"cloth-of-gold cloak"); break;
X case 8: strcpy(Str4,"dirty old cloak"); break;
X case 9: strcpy(Str4,"weightless cloak"); break;
X case 10: strcpy(Str4,"boat cloak"); break;
X case 11: strcpy(Str4,"greasy tarpaulin"); break;
X case 12: strcpy(Str4,"sable cloak"); break;
X case 13: strcpy(Str4,"soft velvet cloak"); break;
X case 14: strcpy(Str4,"opera cape"); break;
X case 15: strcpy(Str4,"elegant brocade cloak"); break;
X case 16: strcpy(Str4,"cloak of many colors"); break;
X case 17: strcpy(Str4,"grey-green rag"); break;
X case 18: strcpy(Str4,"puce and chartreuse cloak"); break;
X case 19: strcpy(Str4,"smoky cloak"); break;
X }
X return(Str4);
X }
X}
X
Xchar *bootname(reset,id)
Xint reset,id;
X{
X static int ids[20];
X int i,j,k;
X
X if (reset) {
X for(i=0;i<20;i++)
X ids[i]=i;
X for(i=0;i<500;i++) {
X j = random_range(20);
X k = ids[i % 20];
X ids[i % 20]=ids[j];
X ids[j]=k;
X }
X }
X else {
X switch (ids[id]) {
X case 0: strcpy(Str4,"sturdy leather boots"); break;
X case 1: strcpy(Str4,"calf-length moccasins"); break;
X case 2: strcpy(Str4,"dark-colored tabi"); break;
X case 3: strcpy(Str4,"patent-leather shoes"); break;
X case 4: strcpy(Str4,"beaten-up gumshoes"); break;
X case 5: strcpy(Str4,"alligator-hide boots"); break;
X case 6: strcpy(Str4,"comfortable sandals"); break;
X case 7: strcpy(Str4,"roller skates"); break;
X case 8: strcpy(Str4,"purple suede gaiters"); break;
X case 9: strcpy(Str4,"mirror-plated wingtips"); break;
X case 10: strcpy(Str4,"heavy workboots"); break;
X case 11: strcpy(Str4,"polyurethane-soled sneakers"); break;
X case 12: strcpy(Str4,"clodhoppers"); break;
X case 13: strcpy(Str4,"wooden shoes"); break;
X case 14: strcpy(Str4,"ski boots"); break;
X case 15: strcpy(Str4,"hob-nailed boots"); break;
X case 16: strcpy(Str4,"elven boots"); break;
X case 17: strcpy(Str4,"cowboy boots"); break;
X case 18: strcpy(Str4,"flipflop slippers"); break;
X case 19: strcpy(Str4,"riding boots"); break;
X }
X return(Str4);
X }
X}
X
X
X
Xint itemplus()
X{
X int p = 0;
X
X while (random_range(2) == 0)
X p++;
X return(p);
X}
X
X
X
Xint itemcharge()
X{
X return(random_range(20)+1);
X}
X
X
X
Xint itemblessing()
X{
X switch(random_range(10)) {
X case 0:
X case 1:return(-1-random_range(10)); break;
X case 8:
X case 9:return(1+random_range(10)); break;
X default: return(0);
X }
X}
X
X
Xint twohandedp(id)
Xint id;
X{
X switch(id) {
X case WEAPONID+5:
X case WEAPONID+12:
X case WEAPONID+18:
X case WEAPONID+20:
X case WEAPONID+26:
X case WEAPONID+27:
X case WEAPONID+32:
X case WEAPONID+36:
X case WEAPONID+38:
X case WEAPONID+39:
X return(TRUE); break;
X default: return(FALSE); break;
X }
X}
X
X
Xvoid item_use(o)
Xstruct object *o;
X{
X clearmsg();
X switch(o->usef) {
X case -1:i_no_op(o); break;
X case 0:i_nothing(o); break;
X
X /* scrolls */
X case I_SPELLS: i_spells(o); break;
X case I_BLESS: i_bless(o); break;
X case I_ACQUIRE: i_acquire(o); break;
X case I_ENCHANT: i_enchant(o); break;
X case I_TELEPORT: i_teleport(o); break;
X case I_WISH: i_wish(o); break;
X case I_CLAIRVOYANCE: i_clairvoyance(o); break;
X case I_DISPLACE: i_displace(o); break;
X case I_ID: i_id(o); break;
X case I_JANE_T: i_jane_t(o); break;
X case I_FLUX: i_flux(o); break;
X case I_WARP: i_warp(o); break;
X case I_ALERT: i_alert(o); break;
X case I_CHARGE: i_charge(o); break;
X case I_KNOWLEDGE: i_knowledge(o); break;
X case I_LAW: i_law(o); break;
X case I_HINT: hint(); break;
X case I_HERO: i_hero(o); break;
X case I_TRUESIGHT: i_truesight(o); break;
X case I_ILLUMINATE: i_illuminate(o); break;
X case I_DEFLECT: i_deflect(o); break;
X
X /* potion functions */
X case I_HEAL: i_heal(o); break;
X case I_OBJDET: i_objdet(o); break;
X case I_MONDET: i_mondet(o); break;
X case I_SLEEP_SELF: i_sleep_self(o); break;
X case I_NEUTRALIZE_POISON: i_neutralize_poison(o); break;
X case I_RESTORE: i_restore(o); break;
X case I_AZOTH: i_azoth(o); break;
X case I_AUGMENT: i_augment(o); break;
X case I_REGENERATE: i_regenerate(o); break;
X case I_INVISIBLE: i_invisible(o); break;
X case I_BREATHING: i_breathing(o); break;
X case I_FEAR_RESIST: i_fear_resist(o); break;
X case I_CHAOS: i_chaos(o); break;
X case I_ACCURACY: i_accuracy(o); break;
X case I_LEVITATION: i_levitate(o); break;
X case I_CURE: i_cure(o); break;
X
X /* stick functions */
X case I_FIREBOLT: i_firebolt(o); break;
X case I_LBOLT: i_lbolt(o); break;
X case I_MISSILE: i_missile(o); break;
X case I_SLEEP_OTHER: i_sleep_other(o); break;
X case I_FIREBALL: i_fireball(o); break;
X case I_LBALL: i_lball(o); break;
X case I_SNOWBALL: i_snowball(o); break;
X case I_SUMMON: i_summon(o); break;
X case I_HIDE: i_hide(o); break;
X case I_DISRUPT: i_disrupt(o); break;
X case I_DISINTEGRATE: i_disintegrate(o); break;
X case I_APPORT: i_apport(o); break;
X case I_DISPEL: i_dispel(o); break;
X case I_POLYMORPH: i_polymorph(o); break;
X case I_FEAR:i_fear(o); break;
X
X /* food functions */
X case I_FOOD: i_food(o); break;
X case I_LEMBAS: i_lembas(o); break;
X case I_STIM: i_stim(o); break;
X case I_POW: i_pow(o); break;
X case I_IMMUNE: i_immune(o); break;
X case I_POISON_FOOD: i_poison_food(o); break;
X case I_PEPPER_FOOD: i_pepper_food(o); break;
X case I_CORPSE: i_corpse(o); break;
X
X /* boots functions */
X case I_PERM_SPEED: i_perm_speed(o); break;
X case I_PERM_HERO: i_perm_hero(o); break;
X case I_PERM_LEVITATE: i_perm_levitate(o); break;
X case I_PERM_AGILITY: i_perm_agility(o); break;
X
X /* artifact functions */
X case I_SCEPTRE:i_sceptre(o);break;
X case I_PLANES:i_planes(o);break;
X case I_STARGEM:i_stargem(o);break;
X case I_SYMBOL:i_symbol(o); break;
X case I_ORBMASTERY: i_orbmastery(o); break;
X case I_ORBFIRE: i_orbfire(o); break;
X case I_ORBWATER: i_orbwater(o); break;
X case I_ORBEARTH: i_orbearth(o); break;
X case I_ORBAIR: i_orbair(o); break;
X case I_ORBDEAD: i_orbdead(o); break;
X case I_CRYSTAL: i_crystal(o); break;
X case I_LIFE: i_life(o); break;
X case I_DEATH: i_death(o); break;
X case I_ANTIOCH: i_antioch(o); break;
X case I_HELM: i_helm(o); break;
X case I_KOLWYNIA: i_kolwynia(o); break;
X case I_ENCHANTMENT: i_enchantment(o); break;
X case I_JUGGERNAUT: i_juggernaut(o); break;
X
X /* cloak functions */
X case I_PERM_DISPLACE: i_perm_displace(o); break;
X case I_PERM_NEGIMMUNE: i_perm_negimmune(o); break;
X case I_PERM_INVISIBLE: i_perm_invisible(o); break;
X case I_PERM_PROTECTION: i_perm_protection(o);break;
X case I_PERM_ACCURACY: i_perm_accuracy(o);break;
X case I_PERM_TRUESIGHT: i_perm_truesight(o); break;
X
X /* ring functions */
X case I_PERM_BURDEN: i_perm_burden(o); break;
X case I_PERM_STRENGTH: i_perm_strength(o); break;
X case I_PERM_GAZE_IMMUNE: i_perm_gaze_immune(o); break;
X case I_PERM_FIRE_RESIST: i_perm_fire_resist(o); break;
X case I_PERM_POISON_RESIST: i_perm_poison_resist(o); break;
X case I_PERM_REGENERATE: i_perm_regenerate(o); break;
X case I_PERM_KNOWLEDGE: i_perm_knowledge(o); break;
X
X /* armor functions */
X case I_NORMAL_ARMOR: i_normal_armor(o); break;
X case I_PERM_FEAR_RESIST: i_perm_fear_resist(o); break;
X case I_PERM_ENERGY_RESIST: i_perm_energy_resist(o); break;
X case I_PERM_BREATHING: i_perm_breathing(o); break;
X
X /* weapons functions */
X case I_NORMAL_WEAPON: i_normal_weapon(o); break;
X case I_LIGHTSABRE: i_lightsabre(o); break;
X case I_DEMONBLADE: i_demonblade(o); break;
X case I_DESECRATE: i_desecrate(o); break;
X case I_MACE_DISRUPT: i_mace_disrupt(o); break;
X case I_DEFEND: i_defend(o); break;
X case I_VICTRIX: i_victrix(o); break;
X
X /* thing functions */
X case I_PICK: i_pick(o); break;
X case I_KEY: i_key(o); break;
X case I_PERM_ILLUMINATE: i_perm_illuminate(o); break;
X case I_TRAP: i_trap(o); break;
X case I_RAISE_PORTCULLIS:i_raise_portcullis(o); break;
X
X /* shield functions */
X case I_NORMAL_SHIELD: i_normal_shield(o); break;
X case I_PERM_DEFLECT: i_perm_deflect(o); break;
X }
X}
X
END_OF_FILE
if test 22667 -ne `wc -c <'oitem.c'`; then
echo shar: \"'oitem.c'\" unpacked with wrong size!
fi
# end of 'oitem.c'
fi
echo shar: End of archive 8 \(of 19\).
cp /dev/null ark8isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 19 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0