games@tekred.TEK.COM (07/26/88)
Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu> Comp.sources.games: Volume 5, Issue 22 Archive-name: omega2/Part12 #! /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 12 (of 19)." # Contents: o.c oaux1.c oeffect2.c # Wrapped by billr@saab on Wed Jul 13 10:46:52 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'o.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'o.c'\" else echo shar: Extracting \"'o.c'\" \(9065 characters\) sed "s/^X//" >'o.c' <<'END_OF_FILE' X/* omega copyright (c) 1987,1988 by Laurence Raphael Brothers */ X X/* this file includes main() and some top-level functions */ X/* o.c */ X X#include <signal.h> X X#include "odefs.h" X X#include "oextern.h" X X#include "ominit.h" X X#include "oiinit.h" X X/* most globals originate in o.c */ X X/* one of each spell */ Xstruct spell Spells[NUMSPELLS+1]; X X/* locations of city sites [0] - found, [1] - x, [2] - y */ Xint CitySiteList[NUMCITYSITES][3]; X X/* Currently defined in caps since it is now a variable, was a constant */ Xint LENGTH=MAXLENGTH; Xint WIDTH=MAXWIDTH; X Xint GameStatus=0L; /* Game Status bit vector */ Xint ScreenLength; /* How large is level window */ Xstruct player Player; /* the player */ Xstruct terrain Country[MAXWIDTH][MAXLENGTH];/* The countryside */ Xstruct level *City=NULL; /* The city of Rampart */ Xstruct level *TempLevel=NULL; /* Place holder */ Xstruct level *Level=NULL; /* Pointer to current Level */ Xstruct level *Dungeon=NULL; /* Pointer to current Dungeon */ Xint Villagenum; /* Current Village number */ Xint ScreenOffset; /* Offset of displayed screen to level */ Xint MaxDungeonLevels; /* Deepest level allowed in dungeon */ Xint Current_Dungeon= -1; /* What is Dungeon now */ Xint Current_Environment= E_CITY; /* Which environment are we in */ Xint Last_Environment= E_COUNTRYSIDE; /* Which environment were we in */ Xint Dirs[2][9]; /* 9 xy directions */ Xchar Cmd='s'; /* last player command */ Xint Command_Duration = 0; /* how long does current command take */ Xstruct monster *Arena_Monster=NULL; /* Opponent in arena */ Xint Arena_Opponent=0; /* case label of opponent in l_arena()*/ Xint Arena_Victory; /* did player win in arena? */ Xint Imprisonment=0; /* amount of time spent in jail */ Xint Precipitation=0; /* Hours of rain, snow, etc */ Xint Lunarity=0; /* Effect of the moon on character */ Xint Phase; /* Phase of the moon */ Xint Date; /* Starting date */ Xint Pawndate; /* Pawn Shop item generation date */ Xpob Pawnitems[PAWNITEMS] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; X/* items in pawn shop */ Xint SymbolUseHour= -1; /* holy symbol use marker */ Xint ViewHour= -1; /* crystal ball use marker */ Xint ZapHour= -1; /* staff of enchantment use marker */ Xint HelmHour= -1; /* helm of teleportation use marker*/ Xint Constriction=0; /* Dragonlord Attack State */ Xint Blessing=FALSE; /* Altar Blessing State */ Xint LastDay= -1; /* DPW date of dole */ Xint RitualHour= -1; /* last use of ritual magic */ Xint RitualRoom= -1; /* last room of ritual magic */ Xint Lawstone=0; /* magic stone counter */ Xint Chaostone=0; /* magic stone counter */ Xint Mindstone=0; /* magic stone counter */ Xint Searchnum = 1; /* number of times to search on 's' */ Xint Verbosity = VERBOSE; /* verbosity level */ Xchar Seed; /* random seed */ Xint Time = 0; /* turn number */ Xint Tick = 0; /* 10 a turn; action coordinator */ Xchar Stringbuffer[10][80] = { X "First String", "First String", "First String", "First String", X "First String", "First String", "First String", "First String", X "First String", "First String"}; /* last 10 strings */ Xint Gymcredit = 0; /* credit at rampart gym */ Xint Spellsleft = 0; /* research allowance at college */ Xint StarGemUse = 0; /* last date of star gem use */ Xint HiMagicUse = 0; /* last date of high magic use */ Xint HiMagic = 0; /* current level for l_throne */ Xint Balance = 0; /* bank account */ Xint FixedPoints = 0; /* points are frozen after adepthood*/ Xint LastTownLocX=0; /* previous position in village or city */ Xint LastTownLocY=0; /* previous position in village or city */ Xint LastCountryLocX=0; /* previous position in countryside */ Xint LastCountryLocY=0; /* previous position in countryside */ Xchar Password[64]; /* autoteller password */ Xchar Str1[100],Str2[100],Str3[100],Str4[100]; X /* Some string space, random uses */ X Xpol Condoitems=NULL; /* Items in condo */ X X/* high score names, levels, behavior */ Xint Shadowlordbehavior,Archmagebehavior,Primebehavior,Commandantbehavior; Xint Championbehavior,Priestbehavior[7],Hibehavior,Dukebehavior; Xint Chaoslordbehavior,Lawlordbehavior,Justiciarbehavior; Xchar Shadowlord[80],Archmage[80],Prime[80],Commandant[80],Duke[80]; Xchar Champion[80],Priest[7][80],Hiscorer[80],Hidescrip[80]; Xchar Chaoslord[80],Lawlord[80],Justiciar[80]; Xint Shadowlordlevel,Archmagelevel,Primelevel,Commandantlevel,Dukelevel; Xint Championlevel,Priestlevel[7],Hiscore,Hilevel,Justiciarlevel; Xint Chaoslordlevel,Lawlordlevel,Chaos,Law; X X/* This may be implementation dependent */ X/* SRANDFUNCTION is defined in odefs.h */ Xvoid initrand() X{ X SRANDFUNCTION; X} X X Xint game_restore(argc,argv) Xint argc; Xchar *argv[]; X{ X char savestr[80]; X int ok; X if (argc==2) { X strcpy(savestr,argv[1]); X ok = restore_game(savestr); X unlink(savestr); X if (! ok) { X endgraf(); X printf("Try again with the right save file, luser!\n"); X exit(0); X } X return(TRUE); X } X else return(FALSE); X} X X Xmain(argc,argv) Xint argc; Xchar *argv[]; X{ X int continuing; X X X /* always catch ^c and hang-up signals */ X X signal(SIGINT,quit); X signal(SIGHUP,signalsave); X X if (CATCH_SIGNALS) { X signal(SIGQUIT,signalexit); X signal(SIGILL,signalexit); X signal(SIGTRAP,signalexit); X signal(SIGIOT,signalexit); X signal(SIGEMT,signalexit); X signal(SIGFPE,signalexit); X signal(SIGBUS,signalexit); X signal(SIGSEGV,signalexit); X signal(SIGSYS,signalexit); X } X X X X /* if filecheck is 0, some necessary data files are missing */ X if (filecheck() == 0) exit(0); X X /* all kinds of initialization */ X initgraf(); X initdirs(); X initrand(); X inititem(); X initspells(); X X strcpy(Stringbuffer[0],"First String"); X strcpy(Stringbuffer[1],"First String"); X strcpy(Stringbuffer[2],"First String"); X strcpy(Stringbuffer[3],"First String"); X strcpy(Stringbuffer[4],"First String"); X strcpy(Stringbuffer[5],"First String"); X strcpy(Stringbuffer[6],"First String"); X strcpy(Stringbuffer[7],"First String"); X strcpy(Stringbuffer[8],"First String"); X strcpy(Stringbuffer[9],"First String"); X X X /* game restore attempts to restore game if there is an argument */ X continuing = game_restore(argc,argv); X X X /* monsters initialized in game_restore if game is being restored */ X if (! continuing) { X initplayer(); X X Date = random_range(360); X Phase = random_range(24); X moon_check(); X strcpy(Password,""); X X init_world(); X X mprint("'?' for help or commandlist, 'Q' to quit."); X } X else mprint("Your adventure continues...."); X X dataprint(); X timeprint(); X showflags(); X X screencheck(Player.y); X X /* game cycle */ X time_clock(TRUE); X while (TRUE) { X if (Current_Environment == E_COUNTRYSIDE) X p_country_process(); X else time_clock(FALSE); X } X} X Xint signalexit() X{ X mprint("Yikes!"); X morewait(); X mprint("Sorry, caught a core-dump signal."); X mprint("Want to try and save the game?"); X if (ynq()=='y') X save(FALSE); /* don't compress */ X mprint("Bye!"); X endgraf(); X exit(0); X} X X X X X/* Start up game with new dungeons; start with player in city */ Xvoid init_world() X{ X if (Level != NULL) free((char *) Level); X if (City != NULL) free((char *) City); X if (TempLevel != NULL) free((char *) TempLevel); X if (Dungeon != NULL) free_dungeon(); X City = Level = TempLevel = Dungeon = NULL; X load_country(); X load_city(); X change_environment(E_CITY); X locprint("The City of Rampart."); X} X X/* set variable item names */ Xvoid inititem() X{ X int i; X scrollname(TRUE,0); X for(i=0;i<NUMSCROLLS;i++) { X Objects[SCROLLID+i].objstr = salloc(scrollname(FALSE,i)); X } X potionname(TRUE,0); X for(i=0;i<NUMPOTIONS;i++) { X Objects[POTIONID+i].objstr = salloc(potionname(FALSE,i)); X } X stickname(TRUE,0); X for(i=0;i<NUMSTICKS;i++) { X Objects[STICKID+i].objstr = salloc(stickname(FALSE,i)); X } X bootname(TRUE,0); X for(i=0;i<NUMBOOTS;i++) { X Objects[BOOTID+i].objstr = salloc(bootname(FALSE,i)); X } X cloakname(TRUE,0); X for(i=0;i<NUMCLOAKS;i++) { X Objects[CLOAKID+i].objstr = salloc(cloakname(FALSE,i)); X } X ringname(TRUE,0); X for(i=0;i<NUMRINGS;i++) { X Objects[RINGID+i].objstr = salloc(ringname(FALSE,i)); X } X} X END_OF_FILE if test 9065 -ne `wc -c <'o.c'`; then echo shar: \"'o.c'\" unpacked with wrong size! fi # end of 'o.c' fi if test -f 'oaux1.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oaux1.c'\" else echo shar: Extracting \"'oaux1.c'\" \(25383 characters\) sed "s/^X//" >'oaux1.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */ X X/* oaux1.c */ X X/* auxiliary functions for those in ocom.c, also see oaux2.c X and oaux3.c */ X X#include "oglob.h" X X X X/* check to see if too much tunneling has been done in this level */ Xvoid tunnelcheck() X{ X Level->tunnelled++; X if ((Level->tunnelled) > LENGTH/4) X mprint("Dust and stone fragments fall on you from overhead."); X if ((Level->tunnelled) > LENGTH/2) X mprint("You hear groaning and creaking noises."); X if ((Level->tunnelled) > 3*LENGTH/4) X mprint("The floor trembles and you hear a loud grinding screech."); X if ((Level->tunnelled) > LENGTH) { X mprint("With a scream of tortured stone, the entire level caves in!!!"); X gain_experience(5000); X mprint("You are flattened into an unpleasant jellylike substance."); X p_death("dungeon cave-in"); X } X} X X/* displays a room's name */ Xvoid showroom(i) Xint i; X{ X strcpy(Str1,""); X strcpy(Str2,""); X switch(Current_Environment) { X case E_MANSION: X strcpy(Str2,"A luxurious mansion: "); X break; X case E_HOUSE: X strcpy(Str2,"A house:"); X break; X case E_HOVEL: X strcpy(Str2,"A hovel:"); X break; X case E_CITY: X strcpy(Str2,"The City of Rampart"); X break; X case E_VILLAGE: X switch(Villagenum) { X case 1: strcpy(Str2,"The Village of Star View"); break; X case 2: strcpy(Str2,"The Village of Woodmere"); break; X case 3: strcpy(Str2,"The Village of Stormwatch"); break; X case 4: strcpy(Str2,"The Village of Thaumaris"); break; X case 5: strcpy(Str2,"The Village of Skorch"); break; X case 6: strcpy(Str2,"The Village of Whorfen"); break; X } X break; X case E_CAVES: X strcpy(Str2,"The Goblin Caves: "); X break; X case E_CASTLE: X strcpy(Str2,"The Archmage's Castle: "); X break; X case E_ASTRAL: X strcpy(Str2,"The Astral Plane: "); X break; X case E_VOLCANO: X strcpy(Str2,"The Volcano: "); X break; X case E_SEWERS: X strcpy(Str2,"The Sewers: "); X break; X case E_TACTICAL_MAP: X strcpy(Str2,"The Tactical Map "); X break; X } X if ((Current_Environment == E_MANSION) || X (Current_Environment == E_HOUSE)) X strcpy(Str1,roomname(i)); X else if (Current_Environment == Current_Dungeon) { X strcpy(Str1,"Level "); X if (Level->depth < 10) { X Str1[6] = Level->depth + '0'; X Str1[7] = 0; X } X else { X Str1[6] = (Level->depth / 10) + '0'; X Str1[7] = (Level->depth % 10) + '0'; X Str1[8] = 0; X } X strcat(Str1," ("); X strcat(Str1,roomname(i)); X strcat(Str1,")"); X } X strcat(Str2,Str1); X locprint(Str2); X} X X Xint player_on_sanctuary() X{ X if ((Player.x==Player.sx) && X (Player.y==Player.sy)) X return(TRUE); X else { X if (Player.patron) { X if ((Level->site[Player.x][Player.y].locchar == ALTAR) && X (Level->site[Player.x][Player.y].aux == Player.patron)) X return(TRUE); X else return(FALSE); X } X else return(FALSE); X } X} X X X/* check a move attempt, maybe attack something, return TRUE if ok to move. */ X/* x y is the proposed place to move to */ Xint p_moveable(x,y) Xint x,y; X{ X setgamestatus(SKIP_MONSTERS); X if (! inbounds(x,y)) return (FALSE); X else if (Player.status[SHADOWFORM]) { X resetgamestatus(SKIP_MONSTERS); X return(TRUE); X } X else if (loc_statusp(x,y,SECRET)) { X if (!gamestatusp(FAST_MOVE)) print3("Ouch!"); X return(FALSE); X } X else if (Level->site[x][y].creature != NULL) { X if (! gamestatusp(FAST_MOVE)) { X fight_monster(Level->site[x][y].creature); X resetgamestatus(SKIP_MONSTERS); X return(FALSE); X } X else return(FALSE); X } X else if ((Level->site[x][y].locchar == WALL) || X (Level->site[x][y].locchar == STATUE) || X (Level->site[x][y].locchar == PORTCULLIS) || X (Level->site[x][y].locchar == CLOSED_DOOR) || X (gamestatusp(FAST_MOVE) && X ((Level->site[x][y].locchar == HEDGE) || X (Level->site[x][y].locchar == LAVA) || X (Level->site[x][y].locchar == ABYSS) || X (Level->site[x][y].locchar == FIRE) || X (Level->site[x][y].locchar == WATER) || X (Level->site[x][y].locchar == LIFT) || X (Level->site[x][y].locchar == TRAP)))) { X if (! gamestatusp(FAST_MOVE)) print3("Ouch!"); X return(FALSE); X } X else if (optionp(CONFIRM)) { X if ((Level->site[x][y].locchar == HEDGE) || X (Level->site[x][y].locchar == LAVA) || X (Level->site[x][y].locchar == FIRE) || X (Level->site[x][y].locchar == ABYSS) || X (Level->site[x][y].locchar == WATER) || X (Level->site[x][y].locchar == RUBBLE) || X (Level->site[x][y].locchar == LIFT) || X (Level->site[x][y].locchar == TRAP)) { X /* horses WILL go into water... */ X if (gamestatusp(MOUNTED)) { X if (Level->site[x][y].locchar != WATER) { X print1("You can't convince your steed to continue."); X setgamestatus(SKIP_MONSTERS); X return(FALSE); X } X else return(TRUE); X } X else if (confirmation()) resetgamestatus(SKIP_MONSTERS); X else setgamestatus(SKIP_MONSTERS); X return(!gamestatusp(SKIP_MONSTERS)); X } X else { X resetgamestatus(SKIP_MONSTERS); X return(TRUE); X } X } X else { X resetgamestatus(SKIP_MONSTERS); X return(TRUE); X } X} X X X X/* check a move attempt in the countryside */ Xint p_country_moveable(x,y) Xint x,y; X{ X if (! inbounds(x,y)) return (FALSE); X else if (optionp(CONFIRM)) { X if ((Country[x][y].current_terrain_type == CHAOS_SEA) || X (Country[x][y].current_terrain_type == MOUNTAINS)) X return(confirmation()); X else return(TRUE); X } X else return(TRUE); X} X X X X X X/* search once particular spot */ Xvoid searchat(x,y) Xint x,y; X{ X int i; X if (inbounds(x,y) && (random_range(3) || Player.status[ALERT])) { X if (loc_statusp(x,y,SECRET)) { X lreset(x,y,SECRET); X if ((Level->site[x][y].locchar==OPEN_DOOR) || X (Level->site[x][y].locchar==CLOSED_DOOR)) X mprint("You find a secret door!"); X else mprint("You find a secret passage!"); X for(i=0;i<8;i++) X lset(x+Dirs[0][i],y+Dirs[1][i],STOPS); X drawvision(Player.x,Player.y); X } X if ((Level->site[x][y].p_locf >= TRAP_BASE) && X (Level->site[x][y].locchar != TRAP) && X (Level->site[x][y].p_locf <= TRAP_BASE+NUMTRAPS)) { X Level->site[x][y].locchar = TRAP; X mprint("You find a trap!"); X drawvision(Player.x,Player.y); X resetgamestatus(FAST_MOVE); X } X } X} X X X X/* This is to be called whenever anything might change player performance in X melee, such as changing weapon, statistics, etc. */ Xvoid calc_melee() X{ X calc_weight(); X X Player.maxweight = (Player.str * Player.agi * 10); X Player.absorption = Player.status[PROTECTION]; X Player.defense = 2 * statmod(Player.agi)+(Player.level/2); X Player.hit = Player.level + statmod(Player.dex)+1; X Player.dmg = statmod(Player.str)+3; X Player.speed = 5 - min(4,(statmod(Player.agi)/2)); X if (Player.status[HASTED] > 0) Player.speed = Player.speed / 2; X if (Player.status[SLOWED] > 0) Player.speed = Player.speed * 2; X if (Player.itemweight > 0) X switch(Player.maxweight / Player.itemweight) { X case 0: Player.speed+=6; break; X case 1: Player.speed+=3; break; X case 2: Player.speed+=2; break; X case 3: Player.speed+=1; break; X } X X if (Player.status[ACCURATE]) Player.hit+=20; X if (Player.status[HERO]) Player.hit+=Player.dex; X if (Player.status[HERO]) Player.dmg+=Player.str; X if (Player.status[HERO]) Player.defense+=Player.agi; X if (Player.status[HERO]) Player.speed=Player.speed / 2; X X Player.speed = max(1,min(25,Player.speed)); X X if (gamestatusp(MOUNTED)) { X Player.speed = 3; X Player.hit += 10; X Player.dmg += 10; X } X X /* weapon */ X /* have to check for used since it could be a 2h weapon just carried X in one hand */ X if (Player.possessions[O_WEAPON_HAND] != NULL) X if (Player.possessions[O_WEAPON_HAND]->used && X ((Player.possessions[O_WEAPON_HAND]->objchar==WEAPON)|| X (Player.possessions[O_WEAPON_HAND]->objchar==MISSILEWEAPON))) { X Player.hit += X Player.possessions[O_WEAPON_HAND]->hit + X Player.possessions[O_WEAPON_HAND]->plus; X Player.dmg += X Player.possessions[O_WEAPON_HAND]->dmg + X Player.possessions[O_WEAPON_HAND]->plus; X } X X /* shield or defensive weapon */ X if (Player.possessions[O_SHIELD] != NULL) { X Player.defense += X Player.possessions[O_SHIELD]->aux + X Player.possessions[O_SHIELD]->plus; X } X X /* armor */ X if (Player.possessions[O_ARMOR] != NULL) { X Player.absorption += Player.possessions[O_ARMOR]->dmg; X Player.defense += X Player.possessions[O_ARMOR]->plus - X Player.possessions[O_ARMOR]->aux; X } X X if (strlen(Player.meleestr) > 2*maneuvers()) X default_maneuvers(); X comwinprint(); X showflags(); X dataprint(); X} X X X/* player attacks monster m */ Xvoid fight_monster(m) Xstruct monster *m; X{ X int hitmod = 0; X int reallyfight = TRUE; X X if (Player.status[AFRAID]) { X print3("You are much too afraid to fight!"); X reallyfight = FALSE; X } X else if (player_on_sanctuary()) { X print3("You restrain yourself from desecrating this holy place."); X reallyfight = FALSE; X } X else if (Player.status[SHADOWFORM]) { X print3("Your attack has no effect in your shadowy state."); X reallyfight = FALSE; X } X else if ((Player.status[BERSERK]<1) && (! m_statusp(m,HOSTILE))) { X if (optionp(BELLICOSE)) reallyfight = TRUE; X else reallyfight = confirmation(); X } X else reallyfight = TRUE; X X if (reallyfight) { X X if (Lunarity == 1) hitmod += Player.level; X else if (Lunarity == -1) hitmod -= (Player.level / 2); X X if (! m->attacked) Player.alignment -= 2; /* chaotic action */ X m_status_set(m,AWAKE); X m_status_set(m,HOSTILE); X m->attacked = TRUE; X Player.hit += hitmod; X tacplayer(m); X Player.hit -= hitmod; X } X} X X X X X/* Attempt to break an object o */ Xvoid damage_item(o) Xpob o; X{ X int i; X /* special case -- break star gem */ X if (o->id == ARTIFACTID+21) { X print1("The Star Gem shatters into a million glistening shards...."); X if (Current_Environment == E_STARPEAK) { X if (! gamestatusp(KILLED_LAWBRINGER)) X print2("You hear an agonizing scream of anguish and despair."); X morewait(); X print1("A raging torrent of energy escapes in an explosion of magic!"); X print2("The energy flows to the apex of Star Peak where there is"); X morewait(); X clearmsg(); X print1("an enormous explosion!"); X morewait(); X annihilate(1); X print3("You seem to gain strength in the chaotic glare of magic!"); X Player.str = Player.maxstr + 5; X Player.pow = Player.maxpow + 5; X Player.alignment -= 200; X dispose_lost_objects(1,o); X } X else { X morewait(); X print1("The shards coalesce back together again, and vanish"); X print2("with a muted giggle."); X dispose_lost_objects(1,o); X } X } X else { X if (o->fragility < random_range(30)) { X if (o->objchar == STICK) { X strcpy(Str1,"Your "); X strcat(Str1,(o->blessing >= 0 ? o->truename : o->cursestr)); X strcat(Str1," explodes!"); X print1(Str1); X morewait(); X if (o->charge < 1) X nprint1(" Fzzz... Out of Power... Oh well..."); X else { X nprint1(" Ka-Blamm!!!"); X /* general case. Some sticks will eventually do special things */ X morewait(); X for(i=0;i<9;i++) X manastorm(Player.x+Dirs[0][i], X Player.y+Dirs[1][i], X o->charge*o->level*10); X dispose_lost_objects(1,o); X } X } X else if ((o->blessing > 0) && (o->level >= random_range(10))) { X strcpy(Str1,"Your "); X strcat(Str1,itemid(o)); X strcat(Str1," glows strongly."); X print1(Str1); X } X else if ((o->blessing < -1) && (o->level >= random_range(10))) { X strcpy(Str1,"You hear an evil giggle from your "); X strcat(Str1,itemid(o)); X print1(Str1); X } X else if (o->plus > 0) { X strcpy(Str1,"Your "); X strcat(Str1,itemid(o)); X strcat(Str1," glows and then fades."); X print1(Str1); X o->plus--; X } X else { X if (o->blessing > 0) print1("You hear a faint despairing cry!"); X else if (o->blessing < 0) print1("You hear an agonized scream!"); X strcpy(Str1,"Your "); X strcat(Str1,itemid(o)); X strcat(Str1," shatters in a thousand lost fragments!"); X print2(Str1); X dispose_lost_objects(1,o); X } X } X } X} X X X X X X X X/* do dmg points of damage of type dtype, from source fromstring */ Xvoid p_damage(dmg,dtype,fromstring) Xint dmg,dtype; Xchar *fromstring; X{ X if (! p_immune(dtype)) { X if (gamestatusp(FAST_MOVE)) { X drawvision(Player.x,Player.y); X resetgamestatus(FAST_MOVE); X } X if (dtype == NORMAL_DAMAGE) Player.hp -= max(1,(dmg-Player.absorption)); X else Player.hp -= dmg; X if (Player.hp < 1) p_death(fromstring); X } X else mprint("You resist the effects!"); X dataprint(); X} X X/* game over, you lose! */ Xvoid p_death(fromstring) Xchar *fromstring; X{ X Player.hp = -1; X print3("You died!"); X morewait(); X display_death(fromstring); X endgraf(); X exit(0); X} X X X/* move the cursor around, like for firing a wand, sets x and y to target */ Xvoid setspot(x,y) Xint *x,*y; X{ X char c = ' '; X mprint("Targeting.... ? for help"); X showcursor(*x,*y); X while ((c != '.') && (c != ESCAPE)) { X c = lgetc(); X switch(c) { X case 'h':case '4': movecursor(x,y,-1,0); break; X case 'j':case '2': movecursor(x,y,0,1); break; X case 'k':case '8': movecursor(x,y,0,-1); break; X case 'l':case '6': movecursor(x,y,1,0); break; X case 'b':case '1': movecursor(x,y,-1,1); break; X case 'n':case '3': movecursor(x,y,1,1); break; X case 'y':case '7': movecursor(x,y,-1,-1); break; X case 'u':case '9': movecursor(x,y,1,-1); break; X case '?': X clearmsg(); X mprint("Use vi keys or numeric keypad to move cursor to target."); X mprint("Hit the '.' key when done, or ESCAPE to abort."); X break; X } X } X if (c==ESCAPE) *x = *y= ABORT; X screencheck(Player.y); X} X X X/* get a direction: return index into Dirs array corresponding to direction */ Xint getdir() X{ X int ok = TRUE; X do { X mprint("Select direction [hjklyubn, ESCAPE to quit]: "); X switch (mgetc()) { X case '4': X case 'h': X case 'H': return(5); break; X case '2': X case 'j': X case 'J': return(6); break; X case '8': X case 'k': X case 'K': return(7); break; X case '6': X case 'l': X case 'L': return(4); break; X case '7': X case 'y': X case 'Y': return(3); break; X case '9': X case 'u': X case 'U': return(1); break; X case '1': X case 'b': X case 'B': return(2); break; X case '3': X case 'n': X case 'N': return(0); break; X case ESCAPE: return(ABORT); break; X default: print3("That's not a direction! "); ok = FALSE; break; X } X } while (! ok); X} X X X X X/* bitwise access functions to Player.options */ X Xint optionp(o) Xint o; X{ X return(Player.options&o); X} X Xvoid optionset(o) Xint o; X{ X Player.options |= o; X} X Xvoid optionreset(o) Xint o; X{ X Player.options &= ~o; X} X X X X/* functions describes monster m's state for examine function */ Xchar *mstatus_string(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X if (m->hp < Monsters[m->id].hp / 3) X strcpy(Str2,"a grievously injured "); X else if (m->hp < Monsters[m->id].hp / 2) X strcpy(Str2,"a severely injured "); X else if (m->hp < Monsters[m->id].hp) X strcpy(Str2,"an injured "); X else strcpy(Str2,getarticle(m->monstring)); X if (m->level > Monsters[m->id].level) { X strcat(Str2," (level "); X strcat(Str2,wordnum(m->level+1-Monsters[m->id].level)); X strcat(Str2,") "); X } X strcat(Str2,m->monstring); X } X else { X strcpy(Str2,m->monstring); X if (m->hp < Monsters[m->id].hp / 3) X strcat(Str2," who is grievously injured "); X else if (m->hp < Monsters[m->id].hp / 2) X strcat(Str2," who is severely injured "); X else if (m->hp < Monsters[m->id].hp) X strcat(Str2," who is injured "); X } X return(Str2); X} X X X X X/* for the examine function */ Xvoid describe_player() X{ X if (Player.hp < (Player.maxhp /5)) X print1("A grievously injured "); X else if (Player.hp < (Player.maxhp /2)) X print1("A seriously wounded "); X else if (Player.hp < Player.maxhp) X print1("A somewhat bruised "); X else print1("A fit "); X X nprint1(levelname(Player.level)); X nprint1(" named "); X nprint1(Player.name); X} X X X/* access to player experience... */ X/* share out experience among guild memberships */ Xvoid gain_experience(amount) Xint amount; X{ X int i,count=0,share; X Player.xp += amount; X gain_level(); /* actually, check to see if should gain level */ X for(i=0;i<NUMRANKS;i++) X if (Player.guildxp[i] > 0) count++; X share = amount/(max(count,1)); X for(i=0;i<NUMRANKS;i++) X if (Player.guildxp[i] > 0) Player.guildxp[i]+=share; X} X X X/* try to hit a monster in an adjacent space. If there are none X return FALSE. Note if you're berserk you get to attack ALL X adjacent monsters! */ Xint goberserk() X{ X int wentberserk=FALSE,i; X char meleestr[80]; X strcpy(meleestr,Player.meleestr); X strcpy(Player.meleestr,"ALACAH"); X for(i=0;i<8;i++) X if (Level->site X [Player.x+Dirs[0][i]] X [Player.y+Dirs[1][i]] X .creature X != NULL) { X wentberserk=TRUE; X fight_monster(Level->site X [Player.x+Dirs[0][i]] X [Player.y+Dirs[1][i]] X .creature); X morewait(); X } X strcpy(Player.meleestr,meleestr); X return(wentberserk); X} X X/* identifies a trap for examine() by its aux value */ Xchar *trapid(trapno) Xint trapno; X{ X switch (trapno) { X case L_TRAP_SIREN:return("A siren trap");break; X case L_TRAP_DART:return("A dart trap");break; X case L_TRAP_PIT:return("A pit");break; X case L_TRAP_SNARE:return("A snare");break; X case L_TRAP_BLADE:return("A blade trap");break; X case L_TRAP_FIRE:return("A fire trap");break; X case L_TRAP_TELEPORT:return("A teleport trap");break; X case L_TRAP_DISINTEGRATE:return("A disintegration trap");break; X case L_TRAP_DOOR:return("A trap door");break; X case L_TRAP_MANADRAIN:return("A manadrain trap");break; X case L_TRAP_ACID:return("An acid shower trap");break; X case L_TRAP_SLEEP_GAS:return("A sleep gas trap");break; X case L_TRAP_ABYSS:return("A concealed entrance to the abyss");break; X default: return("A completely inoperative trap.");break; X } X} X X X/* checks current food status of player, every hour, and when food is eaten */ Xvoid foodcheck() X{ X if (Player.food > 48) { X print3("You vomit up your huge meal."); X Player.food = 12; X } X else if (Player.food == 30) X print3("Time for a smackerel of something."); X else if (Player.food == 20) X print3("You feel hungry."); X else if (Player.food == 12) X print3("You are ravenously hungry."); X else if (Player.food == 3) { X print3("You feel weak."); X if (gamestatusp(FAST_MOVE)) { X drawvision(Player.x,Player.y); X resetgamestatus(FAST_MOVE); X } X } X else if (Player.food < 0) { X if (gamestatusp(FAST_MOVE)) { X drawvision(Player.x,Player.y); X resetgamestatus(FAST_MOVE); X } X print3("You're starving!"); X p_damage(-5*Player.food,UNSTOPPABLE,"starvation"); X } X showflags(); X} X X X X X/* see whether room should be illuminated */ Xvoid roomcheck() X{ X static int oldroomno = -1; X static plv oldlevel = NULL; X int roomno = Level->site[Player.x][Player.y].roomnumber; X X if ((roomno == RS_CAVERN) || X (roomno == RS_SEWER_DUCT) || X (roomno == RS_KITCHEN) || X (roomno == RS_BATHROOM) || X (roomno == RS_BEDROOM) || X (roomno == RS_DININGROOM) || X (roomno == RS_CLOSET) || X (roomno > ROOMBASE)) X if ((! loc_statusp(Player.x,Player.y,LIT)) && X (! Player.status[BLINDED]) && X (Player.status[ILLUMINATION] || (difficulty() < 6))) { X showroom(Level->site[Player.x][Player.y].roomnumber); X spreadroomlight(Player.x,Player.y,roomno); X levelrefresh(); X } X if ((oldroomno != roomno) || (oldlevel != Level)) { X showroom(roomno); X oldroomno = roomno; X oldlevel = Level; X } X} X X X X X X/* ask for mercy */ Xvoid surrender(m) Xstruct monster *m; X{ X int i,bestitem,bestvalue; X pml ml; X switch(random_range(4)) { X case 0: print1("You grovel at the monster's feet..."); break; X case 1: print1("You cry 'uncle'!"); break; X case 2: print1("You beg for mercy."); break; X case 3: print1("You yield to the monster."); break; X } X if ((m->id == ML0+3) && (! m_statusp(m,HOSTILE))) { X print2("The guard (bored): Have you broken a law? [yn] "); X if (ynq2() == 'y') { X print2("The guard grabs you, and drags you to court."); X for(ml=Level->mlist;ml!=NULL;ml=ml->next) X if (ml->m->id == ML0+3) X m_status_reset(ml->m,HOSTILE); X morewait(); X send_to_jail(); X } X else print2("Then don't bother me. Scat!"); X } X else if ((m->talkf==M_NO_OP) || X (m->talkf==M_TALK_STUPID)) X print3("Your plea is ignored."); X else { X morewait(); X print1("Your surrender is accepted."); X if (Player.cash > 0) nprint1(" All your gold is taken...."); X Player.cash = 0; X bestvalue = 0; X bestitem = ABORT; X for (i=1;i<MAXITEMS;i++) X if (Player.possessions[i] != NULL) X if (bestvalue < true_item_value(Player.possessions[i])) { X bestitem = i; X bestvalue = true_item_value(Player.possessions[i]); X } X if (bestitem != ABORT) { X print2("You also give away your best item... "); X nprint2(itemid(Player.possessions[bestitem])); X nprint2("."); X morewait(); X givemonster(m,Player.possessions[bestitem]); X morewait(); /* msgs come from givemonster */ X conform_lost_object(Player.possessions[bestitem]); X } X print2("You feel less experienced... "); X Player.xp = max(0,Player.xp - m->xpv); X nprint2("The monster seems more experienced!"); X m->level = (min(10,m->level+1)); X m->hp += m->level*20; X m->hit += m->level; X m->dmg += m->level; X m->ac += m->level; X m->xpv += m->level*10; X morewait(); X clearmsg(); X if ((m->talkf == M_TALK_EVIL) && random_range(10)) { X print1("It continues to attack you, laughing evilly!"); X m_status_set(m,HOSTILE); X m_status_reset(m,GREEDY); X } X else if (m->id == ML0+0 || m->id == ML0+3) X print1("It continues to attack you. "); X else { X print1("The monster leaves, chuckling to itself...."); X m_teleport(m); X } X } X dataprint(); X} X X X/* threaten a monster */ Xvoid threaten(m) Xstruct monster *m; X{ X char response; X switch(random_range(4)) { X case 0:mprint("You demand that your opponent surrender!"); break; X case 1:mprint("You threaten to do bodily harm to it."); break; X case 2:mprint("You attempt to bluster it into submission."); break; X case 3:mprint("You try to cow it with your awesome presence."); break; X } X if (! m_statusp(m,HOSTILE)) { X print3("You only annoy it with your futile demand."); X m_status_set(m,HOSTILE); X } X else if (((m->level*2 > Player.level) && (m->hp > Player.dmg)) || X (m->uniqueness != COMMON)) X print1("It sneers contemptuously at you."); X else if ((m->talkf != M_TALK_GREEDY) && X (m->talkf != M_TALK_HUNGRY) && X (m->talkf != M_TALK_EVIL) && X (m->talkf != M_TALK_MAN) && X (m->talkf != M_TALK_BEG) && X (m->talkf != M_TALK_THIEF) && X (m->talkf != M_TALK_MERCHANT) && X (m->talkf != M_TALK_IM)) X print1("Your demand is ignored"); X else { X print1("It yields to your mercy."); X Player.alignment+=3; X print2("Kill it, rob it, or free it? [krf] "); X do response = mcigetc(); X while ((response != 'k')&&(response != 'r')&&(response !='f')); X if (response == 'k') { X m_death(m); X print2("You treacherous rogue!"); X Player.alignment -= 13; X } X else if (response == 'r') { X Player.alignment-=2; X print2("It drops its treasure and flees."); X m_dropstuff(m); X m->hp = -1; X Level->site[m->x][m->y].creature = NULL; X putspot(m->x,m->y,getspot(m->x,m->y,FALSE)); X } X else { X Player.alignment+=2; X print2("'If you love something set it free ... '"); X if (random_range(100)==13) { X morewait(); X print2("'...If it doesn't come back, hunt it down and kill it.'"); X } X print3("It departs with a renewed sense of its own mortality."); X m->hp = -1; X Level->site[m->x][m->y].creature = NULL; X putspot(m->x,m->y,getspot(m->x,m->y,FALSE)); X } X } X} X X/* name of the player's experience level */ Xchar *levelname(level) X{ X switch(level) { X case 0:strcpy(Str3,"neophyte");break; X case 1:strcpy(Str3,"beginner");break; X case 2:strcpy(Str3,"tourist");break; X case 3:strcpy(Str3,"traveller");break; X case 4:strcpy(Str3,"wayfarer");break; X case 5:strcpy(Str3,"peregrinator");break; X case 6:strcpy(Str3,"wanderer");break; X case 7:strcpy(Str3,"hunter");break; X case 8:strcpy(Str3,"scout");break; X case 9:strcpy(Str3,"trailblazer");break; X case 10:strcpy(Str3,"discoverer");break; X case 11:strcpy(Str3,"explorer");break; X case 12:strcpy(Str3,"senior explorer");break; X case 13:strcpy(Str3,"ranger");break; X case 14:strcpy(Str3,"ranger captain");break; X case 15:strcpy(Str3,"ranger knight");break; X case 16:strcpy(Str3,"adventurer");break; X case 17:strcpy(Str3,"experienced adventurer");break; X case 18:strcpy(Str3,"skilled adventurer");break; X case 19:strcpy(Str3,"master adventurer");break; X case 20:strcpy(Str3,"hero");break; X case 21:strcpy(Str3,"superhero");break; X case 22:strcpy(Str3,"demigod");break; X default: X if (level < 100) { X strcpy(Str3,"Order "); X Str3[6] = ((level/10)-2) + '0'; X Str3[7] = 0; X strcat(Str3," Master of Omega"); X } X else strcpy(Str3,"Ultimate Master of Omega"); X break; X } X return(Str3); X} END_OF_FILE if test 25383 -ne `wc -c <'oaux1.c'`; then echo shar: \"'oaux1.c'\" unpacked with wrong size! fi # end of 'oaux1.c' fi if test -f 'oeffect2.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oeffect2.c'\" else echo shar: Extracting \"'oeffect2.c'\" \(16784 characters\) sed "s/^X//" >'oeffect2.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */ X/* oeffect2.c */ X X#include "oglob.h" X X X Xvoid knowledge(blessing) Xint blessing; X{ X if (blessing < 0) X mprint("You feel ignorant."); X else { X mprint("You feel knowledgeable!"); X menuclear(); X menuprint("Current Point Total: "); X menunumprint(calc_points()); X menuprint("\nAlignment:"); X if (Player.alignment == 0) X menuprint("Neutral, embodying the Cosmic Balance"); X else if (abs(Player.alignment) < 10) X menuprint("Neutral, tending toward "); X else if (abs(Player.alignment) < 50) X menuprint("Neutral-"); X else if (abs(Player.alignment) < 100) ; X else if (abs(Player.alignment) < 200) X menuprint("Servant of "); X else if (abs(Player.alignment) < 400) X menuprint("Master of "); X else if (abs(Player.alignment) < 800) X menuprint("The Essence of "); X else menuprint("The Ultimate Avatar of "); X if (Player.alignment < 0) menuprint("Chaos\n"); X else if (Player.alignment > 0) menuprint("Law\n"); X morewait(); X menuclear(); X menuprint("Current stati:\n"); X if (Player.status[BLINDED]) X menuprint("Blinded\n"); X if (Player.status[SLOWED]) X menuprint("Slowed\n"); X if (Player.status[HASTED]) X menuprint("Hasted\n"); X if (Player.status[DISPLACED]) X menuprint("Displaced\n"); X if (Player.status[SLEPT]) X menuprint("Slept\n"); X if (Player.status[DISEASED]) X menuprint("Diseased\n"); X if (Player.status[POISONED]) X menuprint("Poisoned\n"); X if (Player.status[BREATHING]) X menuprint("Breathing\n"); X if (Player.status[INVISIBLE]) X menuprint("Invisible\n"); X if (Player.status[REGENERATING]) X menuprint("Regenerating\n"); X if (Player.status[VULNERABLE]) X menuprint("Vulnerable\n"); X if (Player.status[BERSERK]) X menuprint("Berserk\n"); X if (Player.status[IMMOBILE]) X menuprint("Immobile\n"); X if (Player.status[ALERT]) X menuprint("Alert\n"); X if (Player.status[AFRAID]) X menuprint("Afraid\n"); X if (Player.status[ACCURATE]) X menuprint("Accurate\n"); X if (Player.status[HERO]) X menuprint("Heroic\n"); X if (Player.status[LEVITATING]) X menuprint("Levitating\n"); X morewait(); X menuclear(); X menuprint("Immunities:\n"); X if (p_immune(NORMAL_DAMAGE)) X menuprint("Normal Damage\n"); X if (p_immune(FLAME)) X menuprint("Flame\n"); X if (p_immune(ELECTRICITY)) X menuprint("Electricity\n"); X if (p_immune(COLD)) X menuprint("Cold\n"); X if (p_immune(POISON)) X menuprint("Poison\n"); X if (p_immune(ACID)) X menuprint("Acid\n"); X if (p_immune(FEAR)) X menuprint("Fear\n"); X if (p_immune(SLEEP)) X menuprint("Sleep\n"); X if (p_immune(NEGENERGY)) X menuprint("Negative Energies\n"); X if (p_immune(THEFT)) X menuprint("Theft\n"); X if (p_immune(GAZE)) X menuprint("Gaze\n"); X if (p_immune(INFECTION)) X menuprint("Infection\n"); X morewait(); X menuclear(); X menuprint("Ranks:\n"); X switch(Player.rank[LEGION]) { X case COMMANDANT: X menuprint("Commandant of the Legion"); X break; X case COLONEL: X menuprint("Colonel of the Legion"); X break; X case FORCE_LEADER: X menuprint("Force Leader of the Legion"); X break; X case CENTURION: X menuprint("Centurion of the Legion"); X break; X case LEGIONAIRE: X menuprint("Legionaire"); X break; X } X if (Player.rank[LEGION] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[LEGION]); X menuprint(" XP).\n"); X } X switch(Player.rank[ARENA]) { X case -1: X menuprint("Ex-gladiator\n"); X break; X case CHAMPION: X menuprint("Gladiator Champion"); X break; X case GLADIATOR: X menuprint("Gladiator of the Arena"); X break; X case RETIARIUS: X menuprint("Retiarius of the Arena"); X break; X case BESTIARIUS: X menuprint("Bestiarius of the Arena"); X break; X case TRAINEE: X menuprint("Gladiator Trainee of the Arena"); X break; X } X if (Player.rank[ARENA] > 0) { X menuprint(" (Opponent "); X menunumprint(Arena_Opponent); X menuprint(")\n"); X } X switch(Player.rank[COLLEGE]) { X case ARCHMAGE: X menuprint("Archmage of the Collegium Magii"); X break; X case MAGE: X menuprint("Collegium Magii: Mage"); X break; X case PRECEPTOR: X menuprint("Collegium Magii: Preceptor"); X break; X case STUDENT: X menuprint("Collegium Magii: Student"); X break; X case NOVICE: X menuprint("Collegium Magii: Novice"); X break; X } X if (Player.rank[COLLEGE] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[COLLEGE]); X menuprint(" XP).\n"); X } X switch(Player.rank[NOBILITY]) { X case DUKE: X menuprint("Duke of Rampart"); X break; X case LORD: X menuprint("Peer of the Realm"); X break; X case KNIGHT: X menuprint("Order of the Knights of Rampart"); X break; X case ESQUIRE: X menuprint("Squire of Rampart"); X break; X case COMMONER: X menuprint("Commoner"); X break; X default: X menuprint("Lowly Commoner\n"); X break; X } X if (Player.rank[NOBILITY] > 0) { X menuprint(" ("); X menunumprint(Player.rank[NOBILITY]); X menuprint(ordinal(Player.rank[NOBILITY])); X menuprint(" Quest Completed)\n"); X } X switch(Player.rank[CIRCLE]) { X case -1: X menuprint("Former member of the Circle.\n"); X break; X case PRIME: X menuprint("Prime Sorceror of the Inner Circle"); X break; X case HIGHSORCEROR: X menuprint("High Sorceror of the Inner Circle"); X break; X case SORCEROR: X menuprint("Member of the Circle of Sorcerors"); X break; X case ENCHANTER: X menuprint("Member of the Circle of Enchanters"); X break; X case INITIATE: X menuprint("Member of the Circle of Initiates"); X break; X } X if (Player.rank[CIRCLE] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[CIRCLE]); X menuprint(" XP).\n"); X } X switch(Player.rank[ORDER]) { X case -1: X menuprint("Washout from the Order of Paladins\n"); X case JUSTICIAR: X menuprint("Justiciar of the Order of Paladins"); X break; X case PALADIN: X menuprint("Paladin of the Order"); X break; X case CHEVALIER: X menuprint("Chevalier of the Order"); X break; X case GUARDIAN: X menuprint("Guardian of the Order"); X break; X case GALLANT: X menuprint("Gallant of the Order"); X break; X } X if (Player.rank[ORDER] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[ORDER]); X menuprint(" XP).\n"); X } X switch(Player.rank[THIEVES]) { X case SHADOWLORD: X menuprint("Guild of Thieves: Shadowlord"); X break; X case TMASTER: X menuprint("Guild of Thieves: Master Thief"); X break; X case THIEF: X menuprint("Guild of Thieves: Thief"); X break; X case ATHIEF: X menuprint("Guild of Thieves: Apprentice Thief"); X break; X case TMEMBER: X menuprint("Guild of Thieves: Candidate Member"); X break; X } X if (Player.rank[THIEVES] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[THIEVES]); X menuprint(" XP).\n"); X } X switch(Player.rank[PRIESTHOOD]) { X case LAY: X menuprint("A lay devotee of "); X break; X case ACOLYTE: X menuprint("An Acolyte of "); X break; X case PRIEST: X menuprint("A Priest of "); X break; X case SPRIEST: X menuprint("A Senior Priest of "); X break; X case HIGHPRIEST: X menuprint("The High Priest of "); X break; X } X switch(Player.patron) { X case ODIN: X menuprint("Odin"); X break; X case SET: X menuprint("Set"); X break; X case ATHENA: X menuprint("Athena"); X break; X case HECATE: X menuprint("Hecate"); X break; X case DRUID: X menuprint("Druidism"); X break; X case DESTINY: X menuprint("the Lords of Destiny"); X break; X } X if (Player.rank[PRIESTHOOD] > 0) { X menuprint(" ("); X menunumprint(Player.guildxp[PRIESTHOOD]); X menuprint(" XP).\n"); X } X if (Player.rank[ADEPT] > 0) X menuprint("**************\n*Omegan Adept*\n**************\n"); X morewait(); X xredraw(); X } X} X X X/* Recreates the current level */ Xvoid flux(blessing) Xint blessing; X{ X mprint("The universe warps around you!"); X if (Current_Environment == E_CITY) { X mprint("Sensing dangerous high order magic, the Collegium Magii"); X mprint("and the Circle of Sorcerors join forces to negate the spell."); X mprint("You are zapped by an antimagic ray!!!"); X dispel(-1); X mprint("The universe unwarps itself...."); X } X else if (Current_Environment != Current_Dungeon) X mprint("Odd.... No effect!"); X else { X mprint("You stagger as the very nature of reality warps!"); X erase_level(); X Level->generated = FALSE; X mprint("The fabric of spacetime reknits...."); X change_level(Level->depth-1,Level->depth,TRUE); X } X} X X/*Turns on displacement status for the player */ Xvoid displace(blessing) Xint blessing; X{ X if (blessing > -1) { X mprint("You feel a sense of dislocation."); X Player.status[DISPLACED] = blessing + random_range(6); X } X else { X mprint("You feel vulnerable"); X Player.status[VULNERABLE] += random_range(6) - blessing; X } X} X X X Xvoid invisible(blessing) Xint blessing; X{ X if (blessing > -1) { X mprint("You feel transparent!"); X Player.status[INVISIBLE]+= 2+5*blessing; X } X else { X mprint("You feel dangerous!"); X Player.status[VULNERABLE] += X random_range(10)+1; X } X} X X Xvoid warp(blessing) Xint blessing; X{ X int newlevel; X if (Current_Environment != Current_Dungeon) X mprint("How strange! No effect...."); X else { X if (blessing > -1) { X mprint("Warp to which level? "); X newlevel = parsenum(); X } X if (newlevel >= MaxDungeonLevels) { X mprint("You have been deflected!"); X newlevel=random_range(MaxDungeonLevels); X } X mprint("You dematerialize..."); X change_level(Level->depth,newlevel,FALSE); X } X roomcheck(); X} X Xvoid alert(blessing) X int blessing; X{ X if (blessing > -1) { X mprint("You feel a sense of insomnia."); X Player.status[ALERT]+= 4+(5*blessing); X } X else sleep_player(abs(blessing)+3); X} X Xvoid regenerate(blessing) Xint blessing; X{ X if (blessing < 0) X heal(blessing * 10); X else { X mprint("You feel abnormally healthy."); X Player.status[REGENERATING] += (blessing+1)*50; X } X} X Xvoid haste(blessing) Xint blessing; X{ X if (blessing > -1) { X if (! Player.status[HASTED]) X mprint("The world slows down!"); X else mprint("Nothing much happens."); X if (Player.status[SLOWED]) X Player.status[SLOWED] = 0; X Player.status[HASTED] += (blessing*100)+random_range(250); X } X else { X mprint("You feel slower."); X if (Player.status[HASTED] > 0) mprint("...but the feeling quickly fades."); X else Player.status[SLOWED] += random_range(250)+250; X } X} X X Xvoid recover_stat(blessing) Xint blessing; X{ X if (blessing < 0) { X mprint("You feel a cold surge!"); X switch(random_range(6)) { X case 0: Player.str = min(Player.str-1,Player.maxstr-1); break; X case 1: Player.con = min(Player.con-1,Player.maxcon-1); break; X case 2: Player.dex = min(Player.dex-1,Player.maxdex-1); break; X case 3: Player.agi = min(Player.agi-1,Player.maxagi-1); break; X case 4: Player.iq = min(Player.iq-1,Player.maxiq-1); break; X case 5: Player.pow = min(Player.pow-1,Player.maxpow-1); break; X } X } X else { X mprint("You feel a warm tingle!"); X Player.str = max(Player.str,Player.maxstr); X Player.con = max(Player.con,Player.maxcon); X Player.dex = max(Player.dex,Player.maxdex); X Player.agi = max(Player.agi,Player.maxagi); X Player.iq = max(Player.iq,Player.maxiq); X Player.pow = max(Player.pow,Player.maxpow); X } X calc_melee(); X} X Xvoid augment(blessing) Xint blessing; X{ X if (blessing < 0) { X mprint("You feel a cold surge!"); X switch(random_range(6)) { X case 0: Player.str = min(Player.str-1,Player.maxstr-1); break; X case 1: Player.con = min(Player.con-1,Player.maxcon-1); break; X case 2: Player.dex = min(Player.dex-1,Player.maxdex-1); break; X case 3: Player.agi = min(Player.agi-1,Player.maxagi-1); break; X case 4: Player.iq = min(Player.iq-1,Player.maxiq-1); break; X case 5: Player.pow = min(Player.pow-1,Player.maxpow-1); break; X } X } X else if (blessing == 0) { X mprint("You feel a warm tingle!"); X switch(random_range(6)) { X case 0: Player.str = max(Player.str+1,Player.maxstr+1); break; X case 1: Player.con = max(Player.con+1,Player.maxcon+1); break; X case 2: Player.dex = max(Player.dex+1,Player.maxdex+1); break; X case 3: Player.agi = max(Player.agi+1,Player.maxagi+1); break; X case 4: Player.iq = max(Player.iq+1,Player.maxiq+1); break; X case 5: Player.pow = max(Player.pow+1,Player.maxpow+1); break; X } X } X else { X mprint("You feel a hot flash!"); X Player.str = max(Player.str+1,Player.maxstr+1); X Player.con = max(Player.con+1,Player.maxcon+1); X Player.dex = max(Player.dex+1,Player.maxdex+1); X Player.agi = max(Player.agi+1,Player.maxagi+1); X Player.iq = max(Player.iq+1,Player.maxiq+1); X Player.pow = max(Player.pow+1,Player.maxpow+1); X } X calc_melee(); X} X Xvoid breathe(blessing) Xint blessing; X{ X if (blessing > -1) { X mprint("Your breath is energized!"); X Player.status[BREATHING] += 6+blessing; X } X else { X mprint("You choke as your lungs fill with water!"); X p_damage(50,UNSTOPPABLE,"drowning"); X } X} X X Xvoid i_chaos(o) Xpob o; X{ X if (Player.alignment < 0) { X Player.alignment -= random_range(20); X mprint("You feel deliciously chaotic!"); X gain_experience(abs(Player.alignment)*10); X } X else { X mprint("You feel a sense of inner turmoil!"); X Player.alignment -= random_range(20); X } X} X Xvoid i_law(o) Xpob o; X{ X if (Player.alignment > 0) { X Player.alignment += random_range(20); X mprint("You feel wonderfully lawful!"); X gain_experience(Player.alignment*10); X } X else { X mprint("You feel a sense of inner constraint!"); X Player.alignment += random_range(20); X } X} X Xvoid sanctify(blessing) Xint blessing; X{ X if (blessing > -1) { X if (Level->environment == E_TEMPLE) X mprint("Odd, the spell has no effect. I wonder why."); X else if (Level->site[Player.x][Player.y].locchar == ALTAR) X mprint("This site can't get any holier!"); X else if (Player.patron == 0) { X mprint("The gods are angered!"); X Level->site[Player.x][Player.y].locchar = LAVA; X Level->site[Player.x][Player.y].p_locf = L_LAVA; X p_movefunction(L_LAVA); X } X else { X Level->site[Player.x][Player.y].locchar = ALTAR; X Level->site[Player.x][Player.y].aux = Player.patron; X Level->site[Player.x][Player.y].p_locf = L_ALTAR; X mprint("You are standing on sacred ground!"); X } X } X else { X if (Level->site[Player.x][Player.y].locchar == ALTAR) { X mprint("The altar crumbles before your unholy blast...."); X Level->site[Player.x][Player.y].locchar = FLOOR; X Level->site[Player.x][Player.y].p_locf = L_NO_OP; X if (Level->site[Player.x][Player.y].aux == Player.patron) { X mprint("Your deity is not amused...."); X p_damage(Player.hp-1,UNSTOPPABLE,"Divine Wrath"); X } X else if ((Player.patron == ATHENA) || (Player.patron == ODIN)) { X if ((Level->site[Player.x][Player.y].aux == SET) || X (Level->site[Player.x][Player.y].aux == HECATE)) { X mprint("Your deity applauds the eradication of Chaos' taint"); X gain_experience(1000); X } X else { X mprint("Your deity approves of your action."); X gain_experience(100); X } X } X if ((Player.patron == SET) || (Player.patron == HECATE)) { X if ((Level->site[Player.x][Player.y].aux == ODIN) || X (Level->site[Player.x][Player.y].aux == ATHENA)) { X mprint("Your deity applauds the obliteration of Law"); X gain_experience(1000); X } X else { X mprint("Your deity approves of your action."); X gain_experience(100); X } X } X else if (Player.patron == DRUID) { X mprint("Your attempt to maintain the Balance is applauded...."); X gain_experience(250); X } X else mprint("Nothing much happens"); X } X else mprint("You feel an aura of unholiness arising from this spot...."); X } X} X Xvoid accuracy(blessing) Xint blessing; X{ X if (blessing > -1) { X mprint("Everything seems covered in bullseyes!"); X Player.status[ACCURACY] += random_range(5)+1+blessing*5; X calc_melee(); X } X else { X Player.status[ACCURACY]=0; X calc_melee(); X mprint("Your vision blurs..."); X } X} END_OF_FILE if test 16784 -ne `wc -c <'oeffect2.c'`; then echo shar: \"'oeffect2.c'\" unpacked with wrong size! fi # end of 'oeffect2.c' fi echo shar: End of archive 12 \(of 19\). cp /dev/null ark12isdone 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