games@tekred.TEK.COM (07/28/88)
Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu> Comp.sources.games: Volume 5, Issue 39 Archive-name: omega2/Part20 [This file got left out of the distribution. Sorry 'bout that. -br] #! /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 shell archive." # Contents: oaux3.c # Wrapped by billr@saab on Wed Jul 27 14:34:54 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'oaux3.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oaux3.c'\" else echo shar: Extracting \"'oaux3.c'\" \(30103 characters\) sed "s/^X//" >'oaux3.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */ X X/* oaux3.c */ X X/* some functions called by ocom.c, also see oaux1.c, oaux2.c */ X/* This is a real grab bag file. It contains functions used by X oaux1 and o.c, as well as elsewhere. It is mainly here so oaux1.c X and oaux2 are not huge */ X X#include "oglob.h" X X/* check every ten minutes */ Xvoid tenminute_check() X{ X if (Time % 60 == 0) hourly_check(); X else { X if (Current_Environment == Current_Dungeon) wandercheck(); X minute_status_check(); X tenminute_status_check(); X if ((Player.status[DISEASED] < 1) && (Player.hp < Player.maxhp)) X Player.hp = min(Player.maxhp,Player.hp+Player.level+1); X if (Current_Environment != E_COUNTRYSIDE) X indoors_random_event(); X } X} X X X X/* hourly check is same as ten_minutely check except food is also X checked, and since time moves in hours out of doors, also X outdoors_random_event is possible */ X Xvoid hourly_check() X{ X Player.food--; X foodcheck(); X if (hour()==0) { /* midnight, a new day */ X moon_check(); X Date++; X } X torch_check(); X if (Current_Environment == Current_Dungeon) wandercheck(); X minute_status_check(); X tenminute_status_check(); X if ((Player.status[DISEASED] == 0) && (Player.hp < Player.maxhp)) X Player.hp = min(Player.maxhp,Player.hp+Player.level+1); X if (Current_Environment != E_COUNTRYSIDE) X indoors_random_event(); X} X X X X Xvoid indoors_random_event() X{ X pml ml; X pol ol; X switch(random_range(1000)) { X case 0: X print3("You feel an unexplainable elation."); X morewait(); X break; X case 1: X print3("You hear a distant rumbling."); X morewait(); X break; X case 2: X print3("You realize your fly is open."); X morewait(); X break; X case 3: X print3("You have a sudden craving for a pecan twirl."); X morewait(); X break; X case 4: X print3("A mysterious healing flux settles over the level."); X morewait(); X for (ml=Level->mlist;ml!=NULL;ml=ml->next) X if (ml->m->hp > 0) ml->m->hp = Monsters[ml->m->id].hp; X Player.hp = max(Player.hp,Player.maxhp); X break; X case 5: X print3("You discover an itch just where you can't scratch it."); X morewait(); X break; X case 6: X print3("A cosmic ray strikes!"); X p_damage(10,UNSTOPPABLE,"a cosmic ray"); X morewait(); X break; X case 7: X print3("You catch your second wind...."); X Player.hp = ++Player.maxhp; X Player.mana = max(Player.mana, calcmana()); X morewait(); X break; X case 8: X print3("You find some spare change in a hidden pocket."); X Player.cash += Player.level*Player.level+1; X morewait(); X break; X case 9: X print3("You feel strangely lucky."); X morewait(); X break; X case 10: X print3("You trip over something hidden in a shadow..."); X morewait(); X ol = ((pol) malloc(sizeof(oltype))); X ol->thing = create_object(difficulty()); X ol->next = Level->site[Player.x][Player.y].things; X Level->site[Player.x][Player.y].things = ol; X pickup(); X break; X case 11: X print3("A mysterious voice echoes all around you...."); X hint(); X morewait(); X break; X case 12: X if (Balance > 0) { X print3("You get word of the failure of your bank!"); X Balance = 0; X } X else print3("You feel lucky."); X break; X case 13: X if (Balance > 0) { X print3("You get word of a bank error in your favor!"); X Balance += 5000; X } X else print3("You feel unlucky."); X break; X } X showflags(); X} X X X Xvoid outdoors_random_event() X{ X int num,i,j; X pob ob; X X switch(random_range(300)) { X case 0: X switch(Country[Player.x][Player.y].current_terrain_type) { X case TUNDRA: X mprint("It begins to snow. Heavily."); X break; X case DESERT: X mprint("A sandstorm swirls around you."); X break; X default: X if ((Date > 75) && (Date < 330)) X mprint("You are drenched by a sudden downpour!"); X else mprint("It begins to snow. Heavily."); X } X mprint("Due to the inclement weather conditions, you have become lost."); X Precipitation+=random_range(12)+1; X setgamestatus(LOST); X break; X case 1: X mprint("You enter a field of brightly colored flowers..."); X mprint("Wow, man! These are some pretty poppies..."); X morewait(); X mprint("poppies..."); X morewait(); X mprint("poppies..."); X morewait(); X print3("You become somewhat disoriented..."); X setgamestatus(LOST); X break; X case 2: X mprint("You discover a sprig of athelas growing lonely in the wild."); X mprint("Using your herbalist lore you cook a cake of lembas...."); X ob = ((pob) malloc(sizeof(objtype))); X *ob = Objects[FOODID+1]; X gain_item(ob); X break; X case 3: X if (Precipitation > 0) { X mprint("You are struck by a bolt of lightning!"); X p_damage(random_range(25),ELECTRICITY,"a lightning strike"); X } X else mprint("You feel static cling"); X break; X case 4: X mprint("You find a fast-food establishment."); X l_commandant(); X break; X case 5: X mprint("A weird howling tornado hits from out of the West!"); X mprint("You've been caught in a chaos storm!"); X num = random_range(300); X if (num <10) { X mprint("Your cell-structure was disrupted!"); X p_damage(random_range(100),UNSTOPPABLE,"a chaos storm"); X } X else if (num < 20) { X mprint("The chaos storm warps your frame!"); X mprint("Your statistical entropy has been maximized."); X mprint("You feel average..."); X Player.str = Player.maxstr = Player.con = Player.maxcon = X Player.dex = Player.maxdex = Player.agi = Player.maxagi = X Player.iq = Player.maxiq = Player.pow = Player.maxpow = X ((Player.maxstr+Player.maxcon+Player.maxdex+Player.maxagi+ X Player.maxiq+Player.maxpow+12)/6); X } X else if (num < 30) { X mprint("Your entire body glows with an eerie flickering light."); X for(i=1;i<MAXITEMS;i++) X if (Player.possessions[i] != NULL) { X Player.possessions[i]->plus++; X if (Player.possessions[i]->objchar == STICK) X Player.possessions[i]->charge+=10; X Player.possessions[i]->blessing+=10; X } X cleanse(1); X mprint("You feel filled with energy!"); X Player.maxpow += 5; X Player.pow += 5; X Player.mana = Player.maxmana = calcmana() * 5; X mprint("You also feel weaker. Paradoxical, no?"); X Player.con -= 5; X Player.maxcon -= 5; X if (Player.con < 3) X p_death("congestive heart failure"); X } X else if (num < 40) { X mprint("Your entire body glows black."); X dispel(-1); X dispel(-1); X Player.pow-=10; X Player.mana=0; X } X else if (num < 60) { X mprint("The storm deposits you in a strange place...."); X Player.x = random_range(WIDTH); X Player.y = random_range(LENGTH); X screencheck(Player.y); X } X else if (num < 70) { X mprint("A tendril of the storm condenses and falls into your hands."); X ob = ((pob) malloc(sizeof(objtype))); X make_artifact(ob,-1); X gain_item(ob); X } X else if (num < 80) { X if (gamestatusp(MOUNTED)) { X mprint("Your horse screams as he is transformed into an"); X mprint("imaginary unseen dead tortoise."); X mprint("You are on foot."); X resetgamestatus(MOUNTED); X } X else { X mprint("You notice you are riding a horse. Odd. Very odd...."); X mprint("Now that's a horse of a different color!"); X setgamestatus(MOUNTED); X } X } X else if (num < 90) { X mprint("You feel imbued with godlike power...."); X wish(1); X } X else if (num < 100) { X mprint("The chaos storm has wiped your memory!"); X mprint("You feel extraordinarily naive...."); X mprint("You can't remember a thing! Not even your name."); X Player.xp = 0; X Player.level = 0; X for (i=0;i<NUMRANKS;i++) Player.rank[i] = 0; X for (i=0;i<NUMSPELLS;i++) Spells[i].known = FALSE; X rename_player(); X } X else { X mprint("You survive the chaos storm relatively unscathed."); X mprint("It was a learning experience."); X gain_experience(1000); X } X break; X case 6: case 7: case 8: case 9: case 10: X mprint("An encounter!"); X change_environment(E_TACTICAL_MAP); X break; X case 11: X mprint("You find a Traveller's Aid station with maps of the local area."); X if (gamestatusp(LOST)) { X resetgamestatus(LOST); X mprint("You know where you are now."); X } X for(i=Player.x-5;i<Player.x+6;i++) X for(j=Player.y-5;j<Player.y+6;j++) X if (inbounds(i,j)) { X Country[i][j].explored = TRUE; X Country[i][j].current_terrain_type = X Country[i][j].base_terrain_type; X } X show_screen(); X break; X case 12: X if (! gamestatusp(MOUNTED)) { X mprint("You develop blisters...."); X p_damage(1,UNSTOPPABLE,"blisters"); X } X break; X case 13: X mprint("You discover an itch just where you can't scratch it."); X break; X case 14: X mprint("A cosmic ray strikes!"); X p_damage(10,UNSTOPPABLE,"a cosmic ray"); X break; X case 15: X mprint("You feel strangely lucky."); X break; X case 16: X mprint("The west wind carries with it a weird echoing voice...."); X hint(); X break; X } X dataprint(); X showflags(); X} X X Xchar getlocation() X{ X char response; X menuprint(" (enter location [HCL])"); X do response = mcigetc(); X while ((response != 'h') && X (response != 'c') && X (response != 'l')); X switch(response){ X case 'h':menuprint(" High."); return ('H'); break; X case 'c':menuprint(" Center."); return('C'); break; X case 'l':menuprint(" Low."); return('L'); break; X } X} X X X X X X X/* chance for player to resist magic somehow */ X/* hostile_magic ranges in power from 0 (weak) to 10 (strong) */ Xint magic_resist(hostile_magic) Xint hostile_magic; X{ X if ((Player.rank[COLLEGE]+Player.rank[CIRCLE] > 0) && X (Player.level/2 + random_range(20) > X hostile_magic + random_range(20))) { X if (Player.mana > hostile_magic * hostile_magic) { X mprint("Thinking fast, you defend youself with a counterspell!"); X Player.mana -= hostile_magic * hostile_magic; X dataprint(); X return(TRUE); X } X } X if (Player.level/4 + Player.status[PROTECTION] + random_range(20) > X hostile_magic + random_range(30)) { X mprint("You make your saving throw!"); X return(TRUE); X } X else return(FALSE); X} X X X X X Xvoid terrain_check(takestime) Xint takestime; X{ X if (! takestime) X switch(random_range(32)) { X case 0:print2("Boingg!"); break; X case 1:print2("Whooosh!"); break; X case 2:print2("Over hill, over dale...."); break; X case 3:print2("...able to leap over 7 leagues in a single bound...."); X break; X } X else if (gamestatusp(MOUNTED)) X switch(random_range(32)) { X case 0: X case 1:print2("Clippity Clop.");break; X case 2:print2("....my spurs go jingle jangle jingle....");break; X case 3:print2("....as I go riding merrily along....");break; X } X else switch(random_range(32)) { X case 0:print2("Trudge. Trudge."); break; X case 1:print2("The road goes ever onward...."); break; X } X switch(Country[Player.x][Player.y].current_terrain_type) { X case RIVER: X if ((Player.y < 6) && (Player.x > 20)) locprint("Star Lake."); X else if (Player.y < 41) { X if (Player.x < 10) locprint("Aerie River."); X else locprint("The Great Flood."); X } X else if (Player.x < 42) locprint("The Swamp Runs."); X else locprint("River Greenshriek."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X break; X case ROAD: X locprint("A well-maintained road."); X if (takestime) { X Time += 60; X hourly_check(); X } X break; X case PLAINS: X locprint("A rippling sea of grass."); X if (takestime) { X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case TUNDRA: X locprint("The Great Northern Wastes."); X if (takestime) { X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case FOREST: X if (Player.y < 10) locprint("The Deepwood."); X else if (Player.y < 18) locprint("The Forest of Erelon."); X else if (Player.y < 46) locprint("The Great Forest."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case JUNGLE: X locprint("Greenshriek Jungle."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case DESERT: X locprint("The Waste of Time."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case MOUNTAINS: X if ((Player.y < 9) && (Player.x < 12)) X locprint("The Magic Mountains"); X else if ((Player.y < 9) && (Player.y > 2) && (Player.x < 40)) X locprint("The Peaks of the Fist."); X else if (Player.x < 52) X locprint("The Rift Mountains."); X else locprint("Borderland Mountains."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case PASS: X locprint("A hidden pass."); X if (takestime) { X Time += 60; X hourly_check(); X } X break; X case CHAOS_SEA: X locprint("The Sea of Chaos."); X if (takestime) { X Time += 60; X hourly_check(); X } X l_chaos(); X mprint("You have entered the sea of chaos..."); X break; X case SWAMP: X locprint("The Loathly Swamp."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case CITY: X if (gamestatusp(LOST)) { X resetgamestatus(LOST); X mprint("Well, I guess you know where you are now...."); X } X locprint("Outside Rampart, the city."); X break; X case VILLAGE: X if (gamestatusp(LOST)) { X resetgamestatus(LOST); X mprint("The village guards let you know where you are...."); X } X locprint("Outside a small village."); X break; X case CAVES: X locprint("A deserted hillside."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You notice a concealed entrance into the hill."); X break; X case CASTLE: X locprint("Near a fortified castle."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("The castle is hewn from solid granite. The drawbridge is down."); X break; X case TEMPLE: X switch(Country[Player.x][Player.y].aux) { X case ODIN: locprint("A rough-hewn granite temple."); break; X case SET: locprint("A black pyramidal temple made of sandstone."); break; X case ATHENA: locprint("A classical marble-columned temple."); break; X case HECATE: locprint("A temple of ebony adorned with ivory."); break; X case DRUID: locprint("A temple formed of living trees."); break; X case DESTINY: locprint("A temple of some mysterious blue crystal."); break; X } X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You notice an entrance conveniently at hand."); X break; X case MAGIC_ISLE: X locprint("A strange island in the midst of the Sea of Chaos."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("There is a narrow causeway to the island from here."); X break; X case STARPEAK: X locprint("Star Peak."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("The top of the mountain seems to glow with a allochroous aura."); X break; X case DRAGONLAIR: X locprint("A rocky chasm."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You are at a cave entrance from which you see the glint of gold."); X break; X case VOLCANO: X locprint("HellWell Volcano."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("A shimmer of heat lightning plays about the crater rim."); X break; X default: X locprint("I haven't any idea where you are!!!"); X break; X } X outdoors_random_event(); X} X X X Xvoid countrysearch() X{ X int x,y; X Time+=60; X hourly_check(); X for (x=Player.x-1;x<Player.x+2;x++) X for (y=Player.y-1;y<Player.y+2;y++) X if (inbounds(x,y)) { X if (Country[x][y].current_terrain_type != X Country[x][y].base_terrain_type) { X mprint("Your search was fruitful!"); X Country[x][y].current_terrain_type=Country[x][y].base_terrain_type; X mprint("You discovered:"); X mprint(countryid(Country[x][y].base_terrain_type)); X } X } X} X Xchar *countryid(terrain) Xchar terrain; X{ X switch(terrain) { X case MOUNTAINS: X strcpy(Str1,"Almost impassable mountains"); X break; X case PLAINS: X strcpy(Str1,"Seemingly endless plains"); X break; X case TUNDRA: X strcpy(Str1,"A frosty stretch of tundra"); X break; X case ROAD: X strcpy(Str1,"A paved highway"); X break; X case PASS: X strcpy(Str1,"A secret mountain pass"); X break; X case RIVER: X strcpy(Str1,"A rolling river"); X break; X case CITY: X strcpy(Str1,"The city of Rampart"); X break; X case VILLAGE: X strcpy(Str1,"A rural village"); X break; X case FOREST: X strcpy(Str1,"A verdant forest"); X break; X case JUNGLE: X strcpy(Str1,"A densely overgrown jungle"); X break; X case SWAMP: X strcpy(Str1,"A swampy fen"); X break; X case VOLCANO: X strcpy(Str1,"A huge active volcano"); X break; X case CASTLE: X strcpy(Str1,"An imposing castle"); X break; X case STARPEAK: X strcpy(Str1,"A mysterious mountain."); X break; X case DRAGONLAIR: X strcpy(Str1,"A cavern filled with treasure."); X break; X case MAGIC_ISLE: X strcpy(Str1,"An island emanating magic."); X break; X case CAVES: X strcpy(Str1,"A hidden cave entrance"); X break; X case TEMPLE: X strcpy(Str1,"A neoclassical temple"); X break; X case DESERT: X strcpy(Str1,"A sere desert"); X break; X case CHAOS_SEA: X strcpy(Str1,"The Sea of Chaos"); X break; X default: X strcpy(Str1,"I have no idea."); X break; X } X return(Str1); X} X X/* i is the offset from CITYSITEBASE, not the actual constant */ Xchar *citysiteid(i) Xint i; X{ X switch(i+CITYSITEBASE) { X case L_CHARITY:strcpy(Str4,"hospice"); break; X case L_ORDER:strcpy(Str4,"order of paladins"); break; X case L_ARMORER:strcpy(Str4,"armorer"); break; X case L_CLUB:strcpy(Str4,"explorers' club"); break; X case L_GYM:strcpy(Str4,"gymnasium"); break; X case L_THIEVES_GUILD:strcpy(Str4,"thieves' guild"); break; X case L_COLLEGE:strcpy(Str4,"collegium magii"); break; X case L_HEALER:strcpy(Str4,"healer"); break; X case L_CASINO:strcpy(Str4,"casino"); break; X case L_TAVERN:strcpy(Str4,"tavern"); break; X case L_MERC_GUILD:strcpy(Str4,"mercenary guild"); break; X case L_ALCHEMIST:strcpy(Str4,"alchemist"); break; X case L_SORCERORS:strcpy(Str4,"sorcerors' guild "); break; X case L_CASTLE:strcpy(Str4,"castle"); break; X case L_ARENA:strcpy(Str4,"arena"); break; X case L_DPW:strcpy(Str4,"department of public works"); break; X case L_LIBRARY:strcpy(Str4,"library"); break; X case L_PAWN_SHOP:strcpy(Str4,"pawn shop"); break; X case L_BANK:strcpy(Str4,"bank"); break; X case L_CONDO:strcpy(Str4,"condo"); break; X case L_ORACLE:strcpy(Str4,"oracle"); break; X case L_BROTHEL:strcpy(Str4,"brothel"); break; X case L_DINER:strcpy(Str4,"diner"); break; X case L_COMMANDANT:strcpy(Str4,"fast food"); break; X case L_CRAP:strcpy(Str4,"les crapuleux"); break; X case L_TEMPLE:strcpy(Str4,"temple"); break; X case L_COUNTRYSIDE:strcpy(Str4,"city gates"); break; X default:strcpy(Str4,"???"); break; X } X return(Str4); X} X X X Xvoid expandsiteabbrevs(prefix) Xchar prefix[80]; X{ X int i,printed=FALSE; X X menuclear(); X menuprint("\nPossible Sites:\n"); X for (i=0;i<NUMCITYSITES;i++) X if (CitySiteList[i][0] && strprefix(prefix,citysiteid(i))) { X menuprint(citysiteid(i)); X menuprint("\n"); X printed = TRUE; X } X if (! printed) X menuprint("\nNo known sites match that prefix!"); X} X X Xint expandsite(prefix) Xchar prefix[80]; X{ X int i,site,matched=0; X X for (i=0;i<NUMCITYSITES;i++) X if (CitySiteList[i][0] && strprefix(prefix,citysiteid(i))) { X site = i; X matched++; X } X if (matched==0) { X print3("No known locations match that prefix!"); X return(ABORT); X } X else if (matched > 1) { X print3("That is an ambiguous abbreviation!"); X return(ABORT); X } X else return(site); X} X X X Xint parsecitysite() X{ X int site= -3,place=0; X char byte,prefix[80]; X X prefix[0]=0; X X do { X byte = mgetc(); X if ((byte >= 'A') && (byte <= 'Z')) { X maddch(byte+'a'-'A'); X prefix[place] = byte+'a'-'A'; X prefix[place+1] = 0; X place++; X } X else if ((byte == ' ') || ((byte >= 'a') && (byte <= 'z'))) { X maddch(byte); X prefix[place] = byte; X prefix[place+1] = 0; X place++; X } X else if ((byte == 8) || (byte == 127)) { /* ^h or delete */ X prefix[place]=0; X if (place > 0) { X place--; X dobackspace(); X } X } X else if (byte == '?') { X maddch(byte); X expandsiteabbrevs(prefix); X dobackspace(); X } X else if (byte == '\n') X site = expandsite(prefix); X else if (byte == ESCAPE) X site = ABORT; X } while (site == -3); X xredraw(); X return(site); X} X X/* are there hostile monsters within 2 moves? */ Xint hostilemonstersnear() X{ X int i,j,hostile = FALSE; X X for (i=Player.x-2;((i<Player.x+3)&&(! hostile));i++) X for (j=Player.y-2;((j<Player.y+3)&&(! hostile));j++) X if (inbounds(i,j)) X if (Level->site[i][j].creature != NULL) X hostile = m_statusp(Level->site[i][j].creature,HOSTILE); X X return(hostile); X} X X/* random effects from some of stones in villages */ X/* if alignment of stone is alignment of player, gets done sooner */ Xint stonecheck(alignment) X{ X int *stone,match=FALSE,cycle=FALSE,i; X X if (alignment == 1) { X stone = &Lawstone; X match = Player.alignment > 0; X } X else if (alignment == -1) { X stone = &Chaostone; X match = Player.alignment < 0; X } X else { X stone = &Mindstone; X match = FALSE; X } X *stone += random_range(4) + (match ? random_range(4) : 0); X switch((*stone)++) { X case 0:case 2:case 4:case 6:case 8:case 10:case 12:case 14:case 16:case 18: X case 20:case 22:case 24:case 26:case 28:case 30:case 32:case 34:case 36: X case 38:case 40: print1("The stone glows grey."); X print2("Not much seems to happen this time."); X (*stone)--; X break; X case 1: print1("The stone glows black"); X print2("A burden has been removed from your shoulders....."); X print3("Your pack has disintegrated!"); X for(i=0;i<MAXPACK;i++) X if (Player.pack[i] != NULL) { X free((char *) Player.pack[i]); X Player.pack[i] = NULL; X } X Player.packptr = 0; X break; X case 3: print1("The stone glows microwave"); X print2("A vortex of antimana spins about you!"); X dispel(-1); X break; X case 5: print1("The stone glows infrared"); X print2("A portal opens nearby and an obviously confused monster appears!"); X summon(-1,-1); X break; X case 7: print1("The stone glows brick red"); X print2("A gold piece falls from the heavens into your money pouch!"); X Player.cash++; X break; X case 9: print1("The stone glows cherry red"); X print2("A flush of warmth spreads through your body."); X augment(1); X break; X case 11: print1("The stone glows orange"); X print2("A flux of energy blasts you!"); X manastorm(Player.x,Player.y,random_range(Player.maxhp)+1); X break; X case 13: print1("The stone glows lemon yellow"); X print2("You're surrounded by enemies! You begin to foam at the mouth."); X Player.status[BERSERK] += 10; X break; X case 15: print1("The stone glows yellow"); X print2("Oh no! The DREADED AQUAE MORTIS!"); X morewait(); X print2("No, wait, it's just your imagination."); X break; X case 17: print1("The stone glows chartreuse"); X print2("Your joints stiffen up."); X Player.agi -= 3; X break; X case 19: print1("The stone glows green"); X print2("You come down with an acute case of Advanced Leprosy."); X Player.status[DISEASED] = 1100; X Player.hp = 1; X Player.dex -= 5; X break; X case 21: print1("The stone glows forest green"); X print2("You feel wonderful!"); X Player.status[HERO]+=10; X break; X case 23: print1("The stone glows cyan"); X print2("You feel a strange twisting sensation...."); X strategic_teleport(-1); X break; X case 25: print1("The stone glows blue"); X morewait(); X print1("You feel a tingle of an unearthly intuition:"); X hint(); X break; X case 27: print1("The stone glows navy blue"); X print2("A sudden shock of knowledge overcomes you."); X morewait(); X clearmsg(); X identify(1); X knowledge(1); X break; X case 29: print1("The stone glows blue-violet"); X print2("You feel forgetful."); X for(i=0;i<NUMSPELLS;i++) X if (Spells[i].known) { X Spells[i].known = FALSE; X break; X } X break; X case 31: print1("The stone glows violet"); X acquire(0); X break; X case 33: print1("The stone glows deep purple"); X print2("You vanish."); X Player.status[INVISIBLE]+=10; X break; X case 35: print1("The stone glows ultraviolet"); X print2("All your hair rises up on end.... A bolt of lightning hits you!"); X p_damage(random_range(Player.maxhp),ELECTRICITY,"mystic lightning"); X break; X case 37: print1("The stone glows roentgen"); X print2("You feel more experienced."); X gain_experience((Player.level+1)*250); X break; X case 39: print1("The stone glows gamma"); X print2("Your left hand shines silvery, and your right emits a golden aura."); X enchant(1); X bless(1); X print3("Your hands stop glowing."); X break; X case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49: X print1("The stone glows cosmic!"); X print2("The stone's energy field quiets for a moment..."); X *stone = 50; X cycle = TRUE; X break; X default: print1("The stone glows polka-dot (?!?!?!?)"); X print2("You feel a strange twisting sensation...."); X *stone = 0; X strategic_teleport(-1); X break; X } X calc_melee(); X return(cycle); X} X Xvoid alert_guards() X{ X int foundguard=FALSE; X pml ml; X for(ml=Level->mlist;ml!=NULL;ml=ml->next) X if (((ml->m->id == ML0+3) || /*guard*/ X ((ml->m->id == ML0+8) && (ml->m->aux2 == 15))) && /*justiciar*/ X (ml->m->hp > 0)) { X foundguard=TRUE; X m_status_set(ml->m,AWAKE); X m_status_set(ml->m,HOSTILE); X } X if (foundguard) print2("You hear a whistle and the sound of running feet!"); X if ((! foundguard) && (Current_Environment == E_CITY)) { X print2("The last member of the Order of Paladins dies...."); X gain_experience(1000); X Player.alignment -= 250; X if (! gamestatusp(KILLED_LAWBRINGER)) { X morewait(); X print1("A chime sounds from far away.... The sound grows stronger...."); X print2("Suddenly the great shadowy form of the LawBringer appears over"); X print3("the city. He points his finger at you...."); X morewait(); X print1("Cursed art thou, minion of chaos! May thy strength fail thee"); X print2("in thy hour of need! You feel an unearthly shiver as the"); X print3("LawBringer waves his palm across the city skies...."); X Player.str /= 2; X morewait(); X print1("You hear a bell tolling, and eerie moans all around you...."); X print2("Suddenly, the image of the LawBringer is gone."); X print3("You hear a guardsman's whistle in the distance!"); X morewait(); X resurrect_guards(); X } X else { X print1("The Order's magical defenses have dropped, and the"); X print2("Legions of Chaos strike...."); X morewait(); X print1("The city shakes! An earthquake has struck!"); X print2("Cracks open in the street, and a chasm engulfs the Order HQ!"); X print3("Flames lick across the sky and you hear wild laughter...."); X gain_experience(5000); X destroy_order(); X } X } X} X X X/* can only occur when player is in city, so OK to use Level */ Xvoid destroy_order() X{ X int i,j; X setgamestatus(DESTROYED_ORDER); X if (Level != City) print1("Zounds! A Serious Mistake!"); X else X for(i=35;i<46;i++) X for(j=61;j<64;j++) { X Level->site[i][j].locchar = RUBBLE; X Level->site[i][j].p_locf = L_RUBBLE; X if (Level->site[i][j].creature != NULL) X free((char *) Level->site[i][j].creature); X make_site_monster(i,j,ML2+6); X Level->site[i][j].creature->monstring = X salloc("ghost of a Paladin"); X m_status_set(Level->site[i][j].creature,HOSTILE); X } X} X X X Xint maneuvers() X{ X int m; X float times; X times = (Player.status[HASTED] ? 2.0 : 1.0); X times *= (Player.status[SLOWED] ? 0.5 : 1.0); X X m = 2 + Player.level/7; X if (Player.rank[ARENA]) m++; X m = ((int) (m*times)); X m = min(8,max(1,m)); X X return(m); X} X X/* for when haste runs out, etc. */ Xvoid default_maneuvers() X{ X int i; X morewait(); X clearmsg(); X print1("Warning, resetting your combat options to the default."); X print2("Use the 'F' command to select which options you prefer."); X morewait(); X for(i=0;i<maneuvers();i+=2) { X Player.meleestr[i*2]='A'; X Player.meleestr[(i+1)*2]='B'; X Player.meleestr[((i+1)*2)+1]='C'; X Player.meleestr[(i*2)+1]='C'; X } X Player.meleestr[maneuvers()*2]=0; X} END_OF_FILE if test 30103 -ne `wc -c <'oaux3.c'`; then echo shar: \"'oaux3.c'\" unpacked with wrong size! fi # end of 'oaux3.c' fi echo shar: End of shell archive. exit 0