games-request@tekred.TEK.COM (01/20/88)
Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu> Comp.sources.games: Volume 3, Issue 54 Archive-name: omega/Part07 #! /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 7 (of 15)." # Contents: oglob.h omonf.c omove.c # Wrapped by billr@tekred on Mon Jan 18 10:20:29 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f oglob.h -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"oglob.h\" else echo shar: Extracting \"oglob.h\" \(3056 characters\) sed "s/^X//" >oglob.h <<'END_OF_oglob.h' X/* omega copyright (c) 1987 by Laurence Raphael Brothers */ X X/* this file contains extern declarations of global variables used X throughout the program */ X X/* oglob.h */ X X#include "odefs.h" X X/* one of each monster */ Xextern struct monster Monsters[NUMMONSTERS]; X X/* one of each spell */ Xextern struct spell Spells[NUMSPELLS+1]; X X/* one of each item */ Xextern struct object Objects[TOTALITEMS]; X Xextern pml Mlist[NUMLEVELS]; X/* monsters on each level */ X Xextern struct player Player; X/* the player */ X Xextern struct location Dungeon[NUMLEVELS][WIDTH][LENGTH]; X/* the whole dungeon */ X Xextern struct level_data Leveldata[NUMLEVELS]; X/* info about various levels */ X Xextern int Dirs[2][9]; X/* 9 xy directions */ X Xextern char Cmd; X/* last player command */ X Xextern int Lunarity; X/* Player affected by phae of moon? */ X Xextern int Phase; X/* Phase of the moon */ X Xextern int Date; X/* day of the year */ X Xextern int Searchnum; X/* number of times to search on 's' */ X Xextern int Wizard; X/* Wizard mode flag */ X Xextern int Cheated; X/* If ever used wizard mode */ X Xextern int Fastmove; X/* are we in the middle of a fast move */ X Xextern int Skipmonsters; X/* don't deal with them this move */ X Xextern int Skipplayer; X/* don't deal with him this move */ X Xextern int Gameover; X/* yow! are we having fun yet? */ X Xextern int Dlevel; X/* current dungeon level */ X Xextern int WhichScreen; X/* which screen are we on? (0..3) */ X Xextern char Seed; X/* random seed */ X Xextern int Time; X/* turn number */ X Xextern int Tick; X/* 1/10 a turn; action coordinator */ X Xextern char Laststring[80]; X/* the last mprint string */ X Xextern int Logsize; X/* number of players in log */ X Xextern int Tacmode; X/* In tactical combat mode? */ X Xextern int Arena; X/* Arena combat leaves no corpses */ X Xextern int Final; X/* Final duel flag */ X Xextern int Gymcredit; X/* credit at rampart gym */ X Xextern int Balance; X/* bank account */ X Xextern int Bank_Broken; X/* has bank been robbed */ X Xextern char Password[64]; X/* autoteller password */ X Xextern int Deepest; X/* The deepest level attained */ X Xextern int SuppressPrinting; X/* turn off mprint, printm, when TRUE */ X Xextern char Str1[100],Str2[100],Str3[100],Str4[100]; X/* Some string space, random uses */ X X X X/* high score names, levels, behavior */ X Xextern int Shadowlordbehavior,Archmagebehavior,Primebehavior; Xextern int Commandantbehavior; Xextern int Championbehavior,Priestbehavior[7],Hibehavior,Dukebehavior; Xextern char Shadowlord[80],Archmage[80],Prime[80],Commandant[80],Duke[80]; Xextern char Champion[80],Priest[7][80],Hiscorer[80],Hidescrip[80]; Xextern int Shadowlordlevel,Archmagelevel,Primelevel,Commandantlevel,Dukelevel; Xextern int Championlevel,Priestlevel[7],Hiscore,Hilevel; X Xextern int Clubmember; Xextern int Sawdruid; Xextern int Soldcondo; Xextern pol Condoitems; X Xextern int Thieflevel,Clericlevel,Sorcerorlevel,Collegelevel,Merclevel; END_OF_oglob.h if test 3056 -ne `wc -c <oglob.h`; then echo shar: \"oglob.h\" unpacked with wrong size! fi # end of overwriting check fi if test -f omonf.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"omonf.c\" else echo shar: Extracting \"omonf.c\" \(36011 characters\) sed "s/^X//" >omonf.c <<'END_OF_omonf.c' X/* omega copyright (c) 1987 by Laurence Raphael Brothers */ X/* omonf.c */ X/* monster: talk, move, melee, range, and special functions */ X X#include <strings.h> X#include "oglob.h" X X/* from oscr */ Xextern void mprint(),printm(),prepmsg(),drawspot(),drawmon(),locprint(); Xextern void drawvision(),erase_level(),mnumprint(); Xextern void showflags(),menuprint(),plotspot(); Xextern char ynq(); X X/* from ocity */ Xextern void load_city(); X X/* from omovef */ Xextern void send_to_jail(); X X/* from oetc */ Xextern void hint(); X X/* from outil */ Xextern int random_range(),sign(),max(),distance(),m_unblocked(),bitp(); Xextern void do_los(),bitset(),bitreset(); Xextern int pow2(); X X/* from oaux */ Xextern void p_damage(),p_death(),drop_at(),p_poison(),p_teleport(); Xextern void sleep_player(),conform_lost_object(),darkenroom(); Xextern void gain_experience(),calc_melee(); Xextern char *itemid(); Xextern int p_immune(); X X X/* from omove */ Xextern void l_whirlwind(); X X/* from oeffect (1 or 2) */ Xextern void lball(),fbolt(),fball(),summon(),aggravate(),findspace(); Xextern void acid_cloud(),snowball(),nbolt(),level_drain(),manastorm(); Xextern void bless(),acquire(),disrupt(),disintegrate(),wish(); Xextern void cure(),dispel(),haste(),enchant(); X X X X/* from oitem */ Xextern pob create_object(); X X/* from oinv */ Xextern void add_item_to_pack(); X X/* from omon */ Xextern int m_statusp(),m_immunityp(); Xextern int m_open_door(); Xextern void m_pulse(),m_status_set(),m_damage(); Xextern void m_death(),m_hit(),m_miss(),m_pickup(),m_dropstuff(); Xextern void m_status_reset(),monster_strike(),movemonster(); Xextern void monster_talk(),monster_melee(),monster_move(),monster_special(); X X/* omonf functions */ Xvoid m_normal_melee(),m_normal_move(),m_no_op(); Xvoid m_smart_move(),m_simple_move(),m_spirit_move(),m_vanish(); Xvoid m_fire_melee(),m_firebolt(),m_guard_talk(),m_random_move(); Xvoid m_flutter_move(),m_nbolt(),m_sp_surprise(),m_dragon_melee(); Xvoid m_stupid_talk(),m_hungry_talk(),m_silent_talk(),m_greedy_talk(); Xvoid m_mp_talk(),m_follow_move(),m_mp_melee(),m_sp_mp(),m_evil_talk(); Xvoid m_elec_melee(),m_lball(),m_fireball(),m_poison_melee(),m_titter(); Xvoid m_ng_melee(),m_sp_poison_cloud(),m_huge_sounds(),m_robot_talk(); Xvoid m_sleep_melee(),m_blind_strike(),m_im_talk(),m_confused_move(); Xvoid m_thief_f(),m_man_talk(),m_spectral_melee(),m_summon(); Xvoid m_teleport(),m_disease_melee(),m_illusion(),m_aggravate(); Xvoid m_sp_explode(),m_cold_melee(),m_sp_acid_cloud(); Xvoid m_sp_whirl(),m_sp_escape(),m_sp_ghost(),m_ghost_talk(); Xvoid m_mimsy_talk(),m_slithy_talk(),m_burble_talk(),m_sp_spell(); Xvoid m_scaredy_move(),m_good_fairy_talk(),m_evil_fairy_talk(); Xvoid m_sp_seductor(),m_demonlover_talk(),m_seductor_talk(); Xvoid m_sp_eater(),m_sp_dragonlord(),m_ninja_talk(),m_assassin_talk(); Xvoid m_sp_blackout(); X Xvoid m_no_op(m) Xstruct monster *m; X{ X} X X Xvoid m_silent_talk(m) Xstruct monster *m; X{ X X int reply = random_range(4); X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (reply) { X case 0:strcat(Str2," does not reply. "); break; X case 1:strcat(Str2," shrugs silently. "); break; X case 2:strcat(Str2," hold a finger to his mouth. "); break; X case 3:strcat(Str2," glares at you but says nothing. "); break; X } X mprint(Str2); X} X Xvoid m_stupid_talk(m) Xstruct monster *m; X{ X X int reply = random_range(4); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (reply) { X case 0:strcat(Str2," looks at you with mute incomprehension. "); break; X case 1:strcat(Str2," growls menacingly and ignores you. "); break; X case 2:strcat(Str2," does not seem to have heard you. "); break; X case 3:strcat(Str2," could not be expected to talk!!!. "); break; X } X mprint(Str2); X} X Xvoid m_greedy_talk(m) Xstruct monster *m; X{ X X int reply = random_range(4); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (reply) { X case 0:strcat(Str2," says: Give me a treasure.... ");break; X case 1:strcat(Str2," says: Stand and deliver, knave! "); break; X case 2:strcat(Str2," says: Your money or your life! "); break; X case 3:strcat(Str2," says: Yield or Die! "); break; X } X mprint(Str2); X} X Xvoid m_hungry_talk(m) Xstruct monster *m; X{ X X int reply = random_range(4); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (reply) { X case 0:strcat(Str2," says: I hunger, foolish adventurer! "); break; X case 1:strcat(Str2," drools menacingly at you. "); break; X case 2:strcat(Str2," says: You're invited to be lunch! "); break; X case 3:strcat(Str2," says: Feeed Meee! "); break; X } X mprint(Str2); X} X X X X X/* like m_normal_move, but can open doors */ Xvoid m_smart_move(m) Xstruct monster *m; X{ X m_simple_move(m,TRUE); X} X X/* not very smart, but not altogether stupid movement */ Xvoid m_normal_move(m) Xstruct monster *m; X{ X m_simple_move(m,FALSE); X} X X X/* used by both m_normal_move and m_smart_move */ Xvoid m_simple_move(m,canopen) Xstruct monster *m; Xint canopen; X{ X int dx = sign(Player.x - m->x); X int dy = sign(Player.y - m->y); X X if (m_statusp(m,COWARDLY) || (m->hp < ((int) (Monsters[m->id].hp/6)))) { X dx = -dx; X dy = -dy; X } X X if ((! m_statusp(m,HOSTILE)) || X (Player.status[INVISIBLE] > 0)) m_random_move(m); X else { X if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X (m_unblocked(m,m->x+dx,m->y+dy))) X movemonster(m,m->x+dx,m->y+dy); X else if (dx == 0) { X if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X m_unblocked(m,m->x+1,m->y+dy)) X movemonster(m,m->x+1,m->y+dy); X else if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X m_unblocked(m,m->x-1,m->y+dy)) X movemonster(m,m->x-1,m->y+dy); X } X X else if (dy == 0) { X if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X m_unblocked(m,m->x+dx,m->y+1)) X movemonster(m,m->x+dx,m->y+1); X else if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X m_unblocked(m,m->x+dx,m->y-1)) X movemonster(m,m->x+dx,m->y-1); X } X X else { X if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && m_unblocked(m,m->x+dx,m->y)) X movemonster(m,m->x+dx,m->y); X else if ((m_open_door(m,m->x+dx,m->y+dy,canopen)) && X m_unblocked(m,m->x,m->y+dy)) X movemonster(m,m->x,m->y+dy); X } X } X} X X/* for spirits (and earth creatures) who can ignore blockages because X either they are noncorporeal or they can move through stone */ Xvoid m_spirit_move(m) Xstruct monster *m; X{ X int dx = sign(Player.x - m->x); X int dy = sign(Player.y - m->y); X X if (m_statusp(m,COWARDLY) || (m->hp < ((int) (Monsters[m->id].hp/6)))) { X dx = -dx; X dy = -dy; X } X X if (Player.status[INVISIBLE] > 0) m_random_move(m); X else movemonster(m,m->x+dx,m->y+dy); X} X X X X/* fluttery dumb movement */ Xvoid m_flutter_move(m) Xstruct monster *m; X{ X int trange,range = distance(m->x,m->y,Player.x,Player.y); X int i,tx,ty,nx=m->x,ny=m->y; X X if (Player.status[INVISIBLE] > 0) m_random_move(m); X else { X for (i=0;i<8;i++) { X tx = m->x+Dirs[0][i]; X ty = m->y+Dirs[1][i]; X trange = distance(tx,ty,Player.x,Player.y); X if (m_statusp(m,COWARDLY) || (m->hp < ((int) (Monsters[m->id].hp/6)))) { X if ((trange > range) && m_unblocked(m,tx,ty)) { X range = trange; X nx = tx; X ny = ty; X } X } X else if ((trange <= range) && m_unblocked(m,tx,ty)) { X range = trange; X nx = tx; X ny = ty; X } X } X movemonster(m,nx,ny); X } X} X X/* dragon type attacks */ Xvoid m_dragon_melee(m) Xstruct monster *m; X{ X m_fire_melee(m); X m_normal_melee(m); X} X X X Xvoid m_fire_melee(m) Xstruct monster *m; X{ X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(m->hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," blasts you with fire!"); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X m_hit(m,FLAME); X } X else { X strcat(Str2," misses you with a fiery blast!"); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X } X} X X X X Xvoid m_cold_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," freezes you with cold!"); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X m_hit(m,COLD); X } X else { X strcat(Str2," misses you with a frosty blast!"); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X } X} X X X X Xvoid m_elec_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," jolts you with electricity!"); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X m_hit(m,ELECTRICITY); X } X else { X strcat(Str2," misses you."); X if (Tacmode) { X menuprint("\n"); X menuprint(Str2); X } X else mprint(Str2); X } X} X X Xvoid m_normal_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," hit you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X m_hit(m,NORMAL_DAMAGE); X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X X X Xvoid m_firebolt(m) Xstruct monster *m; X{ X fbolt(m->x,m->y,Player.x,Player.y,m->hit,m->dmg); X} X Xvoid m_nbolt(m) Xstruct monster *m; X{ X nbolt(m->x,m->y,Player.x,Player.y,m->hit,m->dmg); X} X X Xvoid m_lball(m) Xstruct monster *m; X{ X lball(m->x,m->y,Player.x,Player.y,m->dmg); X} X Xvoid m_fireball(m) Xstruct monster *m; X{ X fball(m->x,m->y,Player.x,Player.y,m->dmg); X} X X Xvoid m_snowball(m) Xstruct monster *m; X{ X snowball(m->x,m->y,Player.x,Player.y,m->dmg); X} X X X X X X X Xvoid m_guard_talk(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE)) { X mprint("Surrender in the name of the Law!"); X mprint("Do it? [yn]"); X if (ynq()=='y') { X Player.alignment++; X mprint("Go directly to jail. Do not pass go, do not collect 200Au."); X erase_level(); X Dlevel=0; X if (! Leveldata[0].generated) load_city(); X mprint("You are taken to the city gaol."); X send_to_jail(); X locprint("The City of Rampart."); X drawvision(Player.x,Player.y,Player.vision); X } X else mprint("All right, you criminal scum, you asked for it!"); X } X else mprint("Move it right along, stranger!"); X} X X X X Xvoid m_follow_move(m) Xstruct monster *m; X{ X if (! m_statusp(m,HOSTILE)) X m_normal_move(m); X} X X Xvoid m_mp_talk(m) Xstruct monster *m; X{ X strcpy(m->monstring,"mendicant priest"); X if (m->monchar == 'w') X mprint("The old woman asks you to spare some treasure for the needy"); X else X mprint("The old man asks you to spare some treasure for the needy"); X} X Xvoid m_mp_melee(m) Xstruct monster *m; X{ X if (m->monchar == 'w') X mprint("The old woman impotently waves her cane at you."); X else X mprint("The old man impotently waves his cane at you."); X} X X Xvoid m_sp_mp(m) Xstruct monster *m; X{ X if (m->attacked && (random_range(3) == 1)) { X mprint("You feel cursed!"); X p_damage(10,UNSTOPPABLE,"a mendicant priest's curse"); X m_vanish(m); X } X else if (! m_statusp(m,NEEDY)) { X mprint("The mendicant priest makes a mystical gesture...."); X mprint("You feel impressed..."); X Player.alignment += 5; X if (Player.alignment > 20) X Player.hp = max(Player.hp,Player.maxhp); X m_vanish(m); X } X} X Xvoid m_huge_sounds(m) Xstruct monster *m; X{ X if (m_statusp(m,AWAKE) && X (! los_p(m->x,m->y,Player.x,Player.y)) && X (random_range(10) == 1)) X mprint("The dungeon shakes!"); X} X Xvoid m_titter(m) Xstruct monster *m; X{ X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," titters obscenely at you."); X mprint(Str2); X} X Xvoid m_ng_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)) { X strcat(Str2," hit you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X m_hit(m,NORMAL_DAMAGE); X if ((random_range(5) == 1) || (Player.status[VULNERABLE]>0)) { X mprint("It grabs you and carries you off!"); X mprint("Its leathery wings flap and flap, and it giggles insanely."); X mprint("It tickles you cunningly to render you incapable of escape."); X mprint("Finally, it deposits you in a strange place."); X Tacmode = FALSE; X p_teleport(0); X } X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X X Xvoid m_poison_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)) { X strcat(Str2," hit you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X m_hit(m,NORMAL_DAMAGE); X if ((random_range(3) == 1) || (Player.status[VULNERABLE]>0)) { X mprint("You've been poisoned!"); X p_poison(10); X } X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X X Xvoid m_sp_poison_cloud(m) Xstruct monster *m; X{ X if (distance(m->x,m->y,Player.x,Player.y) < 3) { X mprint("A cloud of poison gas surrounds you!"); X if (Player.status[BREATHING] > 0) X mprint("You can breathe freely, however."); X else p_poison(7); X } X} X Xvoid m_sleep_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," hit you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X m_hit(m,NORMAL_DAMAGE); X sleep_player(m->level); X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X Xvoid m_blind_strike(m) Xstruct monster *m; X{ X X pml ml; X if ((Player.status[BLINDED] == 0) && X los_p(m->x,m->y,Player.x,Player.y) && X (distance(m->x,m->y,Player.x,Player.y) < 5)) { X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," gazes at you menacingly"); X mprint(Str2); X if (! p_immune(GAZE)) { X mprint("You've been blinded!"); X Player.status[BLINDED] = random_range(4)+1; X for(ml=Mlist[Dlevel];ml!=NULL;ml=ml->next) X plotspot(ml->m->x,ml->m->y,FALSE); X } X else mprint("You gaze steadily back...."); X } X} X Xvoid m_ninja_talk(m) Xstruct monster *m; X{ X mprint("The black-garbed figure says apologetically:"); X mprint("'Situree simasita, wakarimasen.'"); X strcpy(m->monstring,"ninja"); X} X X X Xvoid m_thief_talk(m) Xstruct monster *m; X{ X if (Player.rank[THIEVES]) { X if (m->level == 2) X strcpy(m->monstring,"sneak thief"); X else strcpy(m->monstring,"master thief"); X mprint("The cloaked figure makes a gesture which you recognize..."); X mprint("...the thieves' guild recognition signal!"); X mprint("'Sorry, mate, thought you were a mark....'"); X m_vanish(m); X } X else m_man_talk(m); X X} X X X Xvoid m_assassin_talk(m) Xstruct monster *m; X{ X strcpy(m->monstring,"master assassin"); X mprint("The ominous figure does not reply, but hands you an embossed card:"); X mprint("'Guild of Assassins Ops are forbidden to converse with targets.'"); X} X X Xvoid m_im_talk(m) Xstruct monster *m; X{ X strcpy(m->monstring,"itinerant merchant"); X if (m->possessions == NULL) X mprint("The merchant says: Alas! I have nothing to sell!"); X else { X m->possessions->thing->known = 2; X printm("\nI have a fine"); X mprint(itemid(m->possessions->thing)); X mprint("for only"); X mnumprint(max(10,4*true_item_value(m->possessions->thing))); X mprint("Au."); X mprint("Want it? [yn]"); X if (ynq()=='y') { X if (Player.cash < (max(10,4*true_item_value(m->possessions->thing)))) { X if (Player.alignment > 10) { X mprint("Well, I'll let you have it for what you've got."); X Player.cash = 0; X add_item_to_pack(m->possessions->thing); X m->possessions = NULL; X } X else mprint("Beat it, you deadbeat!"); X } X else { X mprint("Here you are. Have a good day."); X Player.cash -= max(10,(4*item_value(m->possessions->thing))); X add_item_to_pack(m->possessions->thing); X m->possessions = NULL; X } X } X else mprint("Well then, I must be off. Good day."); X m_vanish(m); X } X} X X Xvoid m_man_talk(m) Xstruct monster *m; X{ X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (random_range(4)) { X case 0:strcat(Str2," asks you for the way home."); break; X case 1:strcat(Str2," wishes you a pleasant day."); break; X case 2:strcat(Str2," sneers at you contemptuously."); break; X case 3:strcat(Str2," smiles and nods."); break; X } X mprint(Str2); X} X X Xvoid m_evil_talk(m) Xstruct monster *m; X{ X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (random_range(4)) { X case 0:strcat(Str2," says: 'THERE CAN BE ONLY ONE!'"); break; X case 1:strcat(Str2," says: 'Prepare to die, Buckwheat!'"); break; X case 2:strcat(Str2," says: 'Time to die!'"); break; X case 3:strcat(Str2," says: 'There will be no mercy.'"); break; X } X mprint(Str2); X} X X Xvoid m_robot_talk(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X switch (random_range(4)) { X case 0:strcat(Str2," says: 'exterminate...Exterminate...EXTERMINATE!!!'"); X break; X case 1:strcat(Str2," says: 'Kill ... Crush ... Destroy'"); break; X break; X case 2:strcat(Str2," says: 'Danger -- Danger'"); break; X break; X case 3:strcat(Str2," says: 'Yo Mama -- core dumped.'"); break; X break; X } X mprint(Str2); X} X X Xvoid m_thief_f(m) Xstruct monster *m; X{ X int i = random_item(); X if (random_range(3) == 1) { X if (distance(Player.x,Player.y,m->x,m->y) < 2) { X if (p_immune(THEFT) || (Player.level > (m->level*2)+random_range(20))) { X if (m->level == 2) X strcpy(m->monstring,"sneak thief"); X else strcpy(m->monstring,"master thief"); X mprint("You feel secure."); X } X else { X if (i == ABORT) X mprint("You feel fortunate."); X else if ((Player.possessions[i]->used) || X (Player.dex < m->level*random_range(10))) { X mprint("You feel a sharp tug.... You hold on!"); X if (m->level == 2) X strcpy(m->monstring,"sneak thief"); X else strcpy(m->monstring,"master thief"); X } X else { X mprint("You feel uneasy for a moment."); X mprint("The thief runs away!"); X m_teleport(m); X m->movef = M_MOVE_SCAREDY; X m->specialf = M_MOVE_SCAREDY; X m_pickup(m,Player.possessions[i]); X conform_lost_object(Player.possessions[i]); X } X if (m->id == ML2+2) { /* the sneak thief, naturally */ X m->monchar = 't'; X strcpy(m->monstring,"sneak thief"); X m->talkf = M_TALK_GREEDY; X } X } X } X } X} X Xvoid m_spectral_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X m_normal_melee(m); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)){ X strcat(Str2," touches you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X mprint("You feel cold!"); X if (p_immune(NEGENERGY)) X mprint("... but the feeling quickly fades."); X else { X switch(random_range(2)) { X case 0: X mprint("The coldness spreads throughout your body..."); X Player.str--; X Player.con--; X if ((Player.str < 3) || (Player.con < 3)) { X mprint("You suffer a fatal heart attack!!!"); X Player.hp = 0; X if (m->uniqueness == COMMON) { X strcpy(Str2,"a "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X p_death(Str2); X } X break; X case 1: X mprint("The coldness saps your very soul..."); X if (m->uniqueness == COMMON) { X strcpy(Str2,"a "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X level_drain(m->level,Str2); X break; X } X } X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X X Xvoid m_summon(m) Xstruct monster *m; X{ X if ((distance(Player.x,Player.y,m->x,m->y) < 2) && X (random_range(3) == 1)) { X summon(0,-1); X summon(0,-1); X } X} X X Xvoid m_disease_melee(m) Xstruct monster *m; X{ X X int hit = m->hit+(Tacmode ? 0 :m->actions*2); X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X if (hitp(hit,Player.defense) || (Player.status[VULNERABLE]>0)) { X strcat(Str2," bit you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X m_hit(m,NORMAL_DAMAGE); X if (random_range(30) > Player.con) { X mprint("You feel ill."); X if (p_immune(INFECTION)) X mprint("...but the feeling quickly fades."); X else { X mprint("You begin to shake with ague."); X Player.status[DISEASED] += m->level; X } X } X showflags(); X } X else { X strcat(Str2," missed you."); X if (Tacmode) { X menuprint(Str2); X menuprint("\n"); X } X else mprint(Str2); X } X} X Xvoid m_aggravate(m) Xstruct monster *m; X{ X X if (m_statusp(m,HOSTILE)) { X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," emits an irritating humming sound."); X mprint(Str2); X aggravate(); X m_status_reset(m,HOSTILE); X } X} X X Xvoid m_teleport(m) Xstruct monster *m; X{ X if (m_statusp(m,AWAKE)) { X Dungeon[Dlevel][m->x][m->y].creature = NULL; X findspace(&(m->x),&(m->y)); X Dungeon[Dlevel][m->x][m->y].creature = m; X } X} X X Xvoid m_illusion(m) Xstruct monster *m; X{ X int i = random_range(NUMMONSTERS); X if (i==ML0+4) i = m->id; /* can't imitate NPC */ X if (Player.status[TRUESIGHT]) { X m->monchar = Monsters[m->id].monchar; X strcpy(m->monstring,Monsters[m->id].monstring); X } X else if (random_range(5) == 1) { X m->monchar = Monsters[i].monchar; X strcpy(m->monstring,Monsters[i].monstring); X } X} X X X/* allows monsters to fall into pools, revealed traps, etc */ Xvoid m_confused_move(m) Xstruct monster *m; X{ X int i,nx,ny,done=FALSE; X for (i=0;((i<8)&&(! done));i++) { X nx = m->x+random_range(3)-1; X ny = m->y+random_range(3)-1; X if (unblocked(nx,ny) && X ((nx != Player.x) || X (ny != Player.y))) { X done = TRUE; X movemonster(m,nx,ny); X } X } X} X Xvoid m_random_move(m) Xstruct monster *m; X{ X int i,nx,ny,done=FALSE; X for (i=0;((i<8)&&(! done));i++) { X nx = m->x+random_range(3)-1; X ny = m->y+random_range(3)-1; X if (m_unblocked(m,nx,ny) && X ((nx != Player.x) || X (ny != Player.y))) { X done = TRUE; X movemonster(m,nx,ny); X } X } X} X Xvoid m_sp_explode(m) Xstruct monster *m; X{ X if ((distance(Player.x,Player.y,m->x,m->y)<2) && X (m-> hp > 0) && X (m->hp < Monsters[m->id].hp)) X fball(m->x,m->y,m->x,m->y,m->hp); X} X X X Xvoid m_sp_demon(m) Xstruct monster *m; X{ X int mid; X X if ((m->id != ML4+6) && /*succubi don't give fear */ X los_p(m->x,m->y,Player.x,Player.y) && X (random_range(30) > Player.level+10) && X (Player.status[AFRAID] == 0)) { X mprint("You are suddenly stricken with gibbering terror!"); X if (! p_immune(FEAR)) Player.status[AFRAID] += m->level; X else mprint("You master your reptile brain and stand fast."); X } X if ((m->hp < (m->level * 5)) && (m->hp > 1)) { X mprint("The demon uses its waning lifeforce to summon help!"); X m->hp = 1; X switch(m->level) { X case 3: mid = ML2+1; break; /* night gaunt */ X case 4: X case 5: mid = ML3+2; break; /* lesser frost demon */ X case 8: mid = ML5+4; break; /* lesser frost demon */ X } X summon(-1,mid); X summon(-1,mid); X } X} X X Xvoid m_sp_acid_cloud(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE) && X (distance(m->x,m->y,Player.x,Player.y) < 3)) X acid_cloud(); X} X X Xvoid m_sp_escape(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE)) X m_vanish(m); X} X X Xvoid m_vanish(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," vanishes in the twinkling of an eye!"); X mprint(Str2); X Dungeon[Dlevel][m->x][m->y].creature = NULL; X Dungeon[Dlevel][m->x][m->y].showchar = ' '; X drawspot(m->x,m->y); X m->hp = -1; X} X X Xvoid m_slithy_talk(m) Xstruct monster *m; X{ X mprint("It can't talk -- it's too slithy!"); X} X X Xvoid m_mimsy_talk(m) Xstruct monster *m; X{ X mprint("It can't talk -- it's too mimsy!"); X} X X X Xvoid m_burble_talk(m) Xstruct monster *m; X{ X X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," burbles hatefully at you."); X mprint(Str2); X} X X Xvoid m_sp_ghost(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE)) { X mprint("The ghost moans horribly...."); X p_damage(3,FEAR,"a ghost-inspired heart attack"); X mprint("You are suddenly stricken with gibbering terror!"); X if (! p_immune(FEAR)) Player.status[AFRAID] += m->level; X else mprint("You master your reptile brain and stand fast."); X } X} X X X Xvoid m_ghost_talk(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE)) X mprint("The ghost doesn't seem interested in conversation"); X else { X mprint("The ghost passes on some useful information!"); X m->talkf = M_TALK_SILENT; X hint(); X } X} X X X/* random spell cast by monster */ Xvoid m_sp_spell(m) Xstruct monster *m; X{ X char action[80]; X int spell; X if (m_statusp(m,HOSTILE) && los_p(Player.x,Player.y,m->x,m->y)) { X if (m->uniqueness == COMMON) strcpy(action,"The "); X else strcpy(action,""); X strcat(action,m->monstring); X strcat(action," casts a spell..."); X mprint(action); X X switch (random_range(m->level+7)) { X case 0: X nbolt(m->x,m->y,Player.x,Player.y,m->hit,10); X break; X case 1: X mprint("It seems stronger..."); X m->hp += random_range(m->level*m->level); X break; X case 2: X haste(-1); X break; X case 3: X cure(-1); X break; X case 4: X lball(m->x,m->y,Player.x,Player.y,20); X break; X case 5: X enchant(-1); X case 6: X snowball(m->x,m->y,Player.x,Player.y,30); X break; X case 7: X bless(0-m->level); X break; X case 8: X p_poison(m->level); X break; X case 9: X sleep_player(m->level/2); X break; X case 10: X fbolt(m->x,m->y,Player.x,Player.y,m->hit*3,50); X break; X case 11: X acquire(0-m->level); X break; X case 12: X dispel(-1); X break; X case 13: X disrupt(Player.x,Player.y,50); X break; X case 14: X if (m->uniqueness == COMMON) { X strcpy(Str2,"a "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X level_drain(m->level,Str2); X break; X case 15: X case 16: X disintegrate(Player.x,Player.y); X break; X } X } X} X X Xvoid m_scaredy_move(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE) && (m->hp < m->level*4)) X m_vanish(m); X else m_normal_move(m); X} X Xvoid m_beg_talk(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," asks you for alms."); X mprint(Str2); X} X X Xvoid m_hint_talk(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2,"whispers in your ear."); X mprint(Str2); X hint(); X m->talkf = M_TALK_SILENT; X} X Xvoid m_good_fairy_talk(m) Xstruct monster *m; X{ X mprint("The good fairy glints: Would you like a wish?"); X if (ynq()=='y') { X mprint("The good fairy glows: Are you sure?"); X if (ynq()=='y') { X mprint("The good fairy radiates: Really really sure?"); X if (ynq()=='y') { X mprint("The good fairy beams: I mean, like, sure as sure can be?"); X if (ynq()=='y') { X mprint("The good fairy dazzles: You don't want a wish, right?"); X if (ynq()=='y') mprint("The good fairy laughs: I thought not."); X else wish(0); X } X } X } X } X mprint("In a flash of sweet-smelling light, the fairy vanishes...."); X Player.hp = max(Player.hp,Player.maxhp); X Player.mana = max(Player.mana,calcmana()); X mprint("You feel mellow."); X m_vanish(m); X} X Xvoid m_evil_fairy_talk(m) Xstruct monster *m; X{ X mprint("The evil fairy roils: Eat my pixie dust!"); X mprint("She waves her black-glowing wand, which screams thinly...."); X m->movef=M_MOVE_SMART; X m->meleef=M_MELEE_POISON; X m->specialf=M_SP_THIEF; X acquire(-1); X bless(-1); X sleep_player(m->level/2); X summon(-1,-1); X summon(-1,-1); X summon(-1,-1); X summon(-1,-1); X} X X Xvoid m_seductor_talk(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," beckons seductively..."); X mprint(Str2); X mprint("Flee? [yn] "); X if (ynq()=='y') { X mprint("You feel stupid."); X } X else { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X strcat(Str2," shows you a good time...."); X mprint(Str2); X gain_experience(500); X Player.con++; X } X m_vanish(m); X} X X/* monsters with this have some way to hide, camouflage, etc until they X attack */ Xvoid m_sp_surprise(m) Xstruct monster *m; X{ X if (m->attacked) { X if (m_statusp(m,HOSTILE) && X (! Player.status[TRUESIGHT]) && X m_statusp(m,M_INVISIBLE)) { X m->monchar = Monsters[m->id].monchar; X if ((! Tacmode) && (! Player.status[ALERT])) { X switch(random_range(4)) { X case 0: X mprint("You are surprised by a sudden treacherous attack!"); X break; X case 1: X mprint("You are shocked out of your reverie by the scream of battle!"); X break; X case 2: X mprint("Suddenly, from out of the shadows, a surprise attack!"); X break; X case 3: X mprint("A shriek of hatred causes you to momentarily freeze up!"); X break; X } X strcpy(Str1,"You find yourself in close-combat with "); X if (m->uniqueness == COMMON) strcat(Str1,"a "); X strcat(Str1,m->monstring); X mprint(Str1); X morewait(); X m->actions++; X tacmode(m); X m->actions--; X m_status_reset(m,M_INVISIBLE); X } X else { X mprint("You alertly sense the presence of an attacker!"); X m_status_reset(m,M_INVISIBLE); X } X } X } X} X Xvoid m_sp_seductor(m) Xstruct monster *m; X{ X if (m_statusp(m,HOSTILE)) { X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," runs away screaming for help...."); X mprint(Str2); X m_vanish(m); X summon(-1,-1); X summon(-1,-1); X summon(-1,-1); X } X else if (distance(Player.x,Player.y,m->x,m->y) < 2) X m_seductor_talk(m); X X} X Xvoid m_demonlover_talk(m) Xstruct monster *m; X{ X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," beckons seductively..."); X mprint(Str2); X mprint("Flee? [yn] "); X if (ynq()=='y') X mprint("You feel fortunate...."); X else { X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," shows you a good time...."); X mprint(Str2); X mprint("You feel your life energies draining..."); X level_drain(random_range(3)+1,"a demon's kiss"); X } X m->talkf = M_TALK_EVIL; X m->meleef = M_MELEE_SPIRIT; X m->specialf = M_SP_DEMON; X if (m->monchar == 's') { X m->monchar = 'I'; X strcpy(m->monstring,"incubus"); X } X else { X m->monchar = 'S'; X strcpy(m->monstring,"succubus"); X } X if (m->uniqueness == COMMON) { X strcpy(Str2,"The "); X strcat(Str2,m->monstring); X } X else strcpy(Str2,m->monstring); X strcat(Str2," laughs insanely."); X mprint(Str2); X mprint("You now notice the fangs, claws, batwings..."); X} X Xvoid m_sp_demonlover(m) Xstruct monster *m; X{ X if (distance(Player.x,Player.y,m->x,m->y) < 2) X m_demonlover_talk(m); X} X Xvoid m_sp_eater(m) Xstruct monster *m; X{ X int i; X if (Player.rank[COLLEGE]) m_status_set(m,HOSTILE); X if (m_statusp(m,HOSTILE)) X if (los_p(m->x,m->y,Player.x,Player.y)) { X mprint("A strange numbing sensation comes over you..."); X Player.mana = Player.mana / 2; X enchant(-1); X Player.pow--; X if (--Player.pow < 1) p_death("The Eater of Magic"); X } X if (m->hp < 10) { X mprint("The Eater explodes in a burst of mana!"); X for(i=0;i<9;i++) X manastorm(m->x+Dirs[0][i],m->y+Dirs[0][i],100); X } X} X X Xvoid m_sp_dragonlord(m) Xstruct monster *m; X{ X static int constriction=0; X if (m_statusp(m,HOSTILE)) { X if (distance(m->x,m->y,Player.x,Player.y)<2) { X if (! Player.status[IMMOBILE]) { X mprint("A gust of wind from the Dragonlord's wings knocks you down!"); X p_damage(25,NORMAL_DAMAGE,"a gust of wind"); X Skipplayer=TRUE; X Player.status[IMMOBILE]+=2; X } X else if (! constriction) { X mprint("The Dragonlord grabs you with his tail!"); X constriction = 25; X Player.status[IMMOBILE]+=1; X } X else if (random_range(2)) { X mprint("The coils squeeze tighter and tighter..."); X p_damage(constriction,NORMAL_DAMAGE,"The Dragonlord"); X Player.status[IMMOBILE]+=1; X constriction *=2; X } X else { X mprint("The dragonlord hurls you to the ground!"); X p_damage(2*constriction,NORMAL_DAMAGE,"The Dragonlord"); X constriction = 0; X } X m_sp_spell(m); X } X else { X constriction = 0; X if (view_los_p(m->x,m->y,Player.x,Player.y)) { X if ((! Player.immunity[FEAR]) && (! Player.status[AFRAID])) { X mprint("You are awestruck at the sight of the Dragonlord."); X Player.status[AFRAID]+=5; X } X if (random_range(3)) { X m_sp_spell(m); X m_sp_spell(m); X } X } X } X } X else if (distance(m->x,m->y,Player.x,Player.y)<2) X mprint("You are extremely impressed at the sight of the Dragonlord."); X} X Xvoid m_sp_whirl(m) Xstruct monster *m; X{ X if (distance(m->x,m->y,Player.x,Player.y) < 2) { X mprint("The whirlwind swirls you up!"); X l_whirlwind(); X } X} X Xvoid m_sp_blackout(m) Xstruct monster *m; X{ X int r = Dungeon[Dlevel][m->x][m->y].roomnumber; X if (r>0) X if (r == Dungeon[Dlevel][Player.x][Player.y].roomnumber) X if (Leveldata[Dlevel].rooms[r].lighted) { X mprint("The room is plunged into darkness."); X darkenroom(r); X Leveldata[Dlevel].rooms[r].lighted = FALSE; X } X} END_OF_omonf.c if test 36011 -ne `wc -c <omonf.c`; then echo shar: \"omonf.c\" unpacked with wrong size! fi # end of overwriting check fi if test -f omove.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"omove.c\" else echo shar: Extracting \"omove.c\" \(15337 characters\) sed "s/^X//" >omove.c <<'END_OF_omove.c' X/* omega copyright (C) by Laurence Raphael Brothers, 1987 */ X/* omove.c */ X/* general functions for player moving -- traps, etc. also p_movefunction */ X X#include <strings.h> X#include "oglob.h" X X/* from oaux */ Xextern void gain_experience(),p_death(),p_damage(),p_drown(),damage_item(); X X/* from oeffect 1 or 2 */ Xextern void p_poison(),p_teleport(),sleep_player(); X X/* from oinv */ Xextern void conform_lost_object(); X X/* from oeffect (1 or 2)*/ Xextern void disintegrate(),identify(),level_drain(),augment(),cleanse(); Xextern void heal(),acquire(),enchant(),bless(),dispel(); X X/* from ocom */ Xextern void levelchange(); X X/* from outil */ Xextern int random_range(); X X/* from oscr */ Xextern void mprint(),menuclear(),menuprint(),xredraw(),printm(); Xextern void menu_item_print(),mnumprint(),dataprint(),morewait(); Xextern char ynq(),mgetc(),*msgscanstr(); X X X/* from osite.c */ Xextern void l_no_op(),l_druid(),l_temple(),l_armorer(),l_club(),l_gym(); Xextern void l_thieves_guild(),l_college(),l_healer(),l_statue_wake(); Xextern void l_sewer(),l_tavern(),l_merc_guild(),l_alchemist(),l_sorcerors(); Xextern void l_altar(),l_castle(),l_casino(),l_chaosstorm(),l_vault(); Xextern void l_arena(),l_citygate(),l_dpw(),l_library(),l_pawn_shop(); Xextern void l_condo(),l_cemetary(),l_residence(),l_garden(),l_maze(); Xextern void l_jail(),l_garden(),l_trifid(),l_portcullis(),l_portcullis_trap(); Xextern void l_warning(),l_adept(),l_final_abyss(),l_challenge(),l_guardian(); Xextern void l_brothel(); X Xvoid p_movefunction(); Xvoid l_water(),l_hedge(),l_lava(),l_lift(),l_magic_pool(),l_whirlwind(); Xvoid l_abyss(); Xvoid l_trap_dart(),l_trap_pit(),l_trap_door(),l_trap_snare(); Xvoid l_trap_blade(),l_trap_fire(),l_trap_disintegrate(),l_trap_teleport(); Xvoid l_trap_acid(),l_trap_manadrain(),l_trap_sleepgas(),l_trap_abyss(); X X/* various traps */ X Xvoid l_trap_dart() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (random_range(100) < Player.absorption) X mprint("A dart plinks off your armor"); X else { X mprint("You were hit by a dart!"); X p_damage(Dlevel,NORMAL_DAMAGE,"a dart trap"); X if (random_range(3)==1) { X mprint("It was poisoned!"); X p_poison(Dlevel); X } X } X} X Xvoid l_trap_pit() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (Player.itemweight < ((int) (Player.maxweight / 2))) X mprint("You nimbly dodge a pit trap."); X else { X mprint("You fell into a pit!"); X if (random_range(3) == 1) { X mprint("And were impaled by spikes!"); X p_damage(Dlevel*5,NORMAL_DAMAGE,"a spiked pit"); X } X else p_damage(Dlevel*2,NORMAL_DAMAGE,"a pit"); X Player.status[IMMOBILE] += 3; X } X} X Xvoid l_trap_door() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (random_range(100) < Player.agi) X mprint("You leap over a trap door."); X else { X mprint("You fell through a trap door!"); X p_damage(Dlevel*3,NORMAL_DAMAGE,"a trap door"); X levelchange(Dlevel+1,Dungeon[Dlevel][Player.x][Player.y].locchar); X } X} X Xvoid l_trap_snare() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (random_range(100) < Player.agi) X mprint("You agilely avoid a snare."); X else { X mprint("You were caught in a snare!"); X Player.status[IMMOBILE]+=Dlevel+10; X } X} X Xvoid l_trap_blade() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (random_range(30) < Player.agi+Player.level) X mprint("You duck under a scything blade!"); X else { X mprint("A heavy blade scythes across the room and hits you!"); X p_damage(random_range(Dlevel*3)+Dlevel-Player.absorption, X NORMAL_DAMAGE, X "a blade trap"); X } X} X Xvoid l_trap_fire() X{ X if (random_range(50) < Player.agi+Player.level) X mprint("You dodge a pillar of fire!"); X else { X mprint("You were blasted by a fire trap!"); X p_damage(random_range((Dlevel+1)*5),FLAME,"a fire trap"); X } X Dungeon[Dlevel][Player.x][Player.y].locchar = FIRE; X Dungeon[Dlevel][Player.x][Player.y].p_locf = L_FIRE; X} X Xvoid l_trap_teleport() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X mprint("You experience a momentary disorientation...."); X if (random_range(10000) > Dlevel*Dlevel) p_teleport(0); X else p_teleport(-1); X} X Xvoid l_trap_disintegrate() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X mprint("Oh, no! A disintegration trap!"); X disintegrate(Player.x,Player.y); X} X Xvoid l_trap_sleepgas() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X mprint("Hsssssssss...."); X morewait(); X mprint("You detect a strange odor...."); X sleep_player((Dlevel/5)+1); X} X X Xvoid l_trap_acid() X{ X int i,k,itemdamage; X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (Player.agi+Player.level < random_range(100)) { X mprint("You are drenched by a spray of acid!"); X p_damage(random_range(Dlevel*5),ACID,"an acid trap"); X if (! p_immune(ACID)) { X mprint("The acid seeps into your pack..."); X morewait(); X itemdamage = random_range(5); X for(i=k=0;((i<MAXITEMS) && (k<itemdamage));i++) X if (Player.possessions[i]!=NULL) { X k++; X damage_item(Player.possessions[i]); X } X } X } X else mprint("You somehow dodge a shower of hydroflouric acid!"); X} X Xvoid l_trap_abyss() X{ X int i,k,itemdamge; X Dungeon[Dlevel][Player.x][Player.y].locchar = ABYSS; X if (Player.dex + Player.level < random_range(100)) { X mprint("You stumble over a concealed entrance to the abyss!"); X l_abyss(); X } X else mprint("You gingerly step around a concealed entrance to the abyss!"); X} X Xvoid l_trap_manadrain() X{ X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X if (Player.mana==0) { X if (random_range(10)==3) { X mprint("That's strange.... You feel repowered!"); X mprint("The manadrain trap overloads -- positive feedback...."); X Dungeon[Dlevel][Player.x][Player.y].locchar = FLOOR; X Dungeon[Dlevel][Player.x][Player.y].p_locf = L_NO_OP; X Player.mana = calcmana(); X } X else mprint("You feel strangely unaffected by the manadrain trap."); X } X else { X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X mprint("A weird rainbow light seems to play over you...."); X mprint("You feel drained."); X while (Player.mana > 0) { X Player.mana--; X dataprint(); X } X dispel(-1); X } X} X X X/* various miscellaneous location functions */ Xvoid l_water() X{ X if ((Player.armor != NULL)) { X mprint("Your heavy armor drags you under the water!"); X p_drown(); X } X else if (Player.itemweight > ((int) (Player.maxweight / 2))) { X mprint("The weight of your pack drags you under water!"); X p_drown(); X } X else switch(random_range(24)) { X case 0:mprint("Splish. Splash!"); break; X case 1:mprint("I want my ducky!"); break; X case 2:mprint("So finally you take a bath!"); break; X case 3:mprint("You must be very thirsty!"); break; X } X} X X Xvoid l_hedge() X{ X mprint("You struggle in the brambly hedge... "); X switch(random_range(6)) { X case 0: mprint("You are stabbed by thorns!"); X p_damage(random_range(6),NORMAL_DAMAGE,"a hedge"); X mprint("The thorns were poisonous!"); X p_poison(random_range(12)); X break; X case 1: mprint("You are stabbed by thorns!"); X p_damage(random_range(12),NORMAL_DAMAGE,"a hedge"); X break; X case 2: mprint("You seem to have gotten stuck in the hedge."); X Player.status[IMMOBILE]+=random_range(10); X break; X case 3: if (Player.cloak != NULL) { X mprint("Your cloak was torn on the brambles!"); X conform_lost_objects(1,Player.cloak); X } X else mprint("Yikes! These thorns are scratchy!"); X break; X default: mprint("You make your way through unscathed."); break; X } X} X X X Xvoid l_lava() X{ X mprint("Very clever -- walking into a pool of lava..."); X if (strcmp(Player.name,"Saltheart Foamfollower")==0) { X mprint("Strangely enough, you don't seem terribly affected."); X p_damage(1,UNSTOPPABLE,"slow death in a pool of lava"); X } X else { X p_damage(random_range(75),FLAME,"incineration in a pool of lava"); X if (Player.hp> 0) p_drown(); X Player.status[IMMOBILE]+=2; X } X} X X Xvoid l_whirlwind() X{ X mprint("You've just entered a strange electrical disturbance!"); X p_damage(random_range(Dlevel*5),ELECTRICITY,"magical lightning"); X if (random_range(100) > Player.str*2 + Player.agi*2) { X mprint("A strange tornado-like wind picks you up and wafts you away!"); X p_teleport(0); X } X if (! p_immune(ELECTRICITY)) { X Player.status[IMMOBILE]+=2; X mprint("You are stunned by the discharges!"); X } X} X Xvoid l_fire() X{ X mprint("You boldly stride through the curtain of fire..."); X p_damage(random_range(100),FLAME,"self-immolation"); X} X Xvoid l_abyss() X{ X int i; X mprint("You enter the infinite abyss!"); X if (random_range(100)==13) { X mprint("As you fall you see before you what seems like"); X mprint("an infinite congerie of iridescent bubbles."); X mprint("You have met Yog Sothoth!!!"); X if (Player.alignment > -10) X p_death("the eater of souls"); X else { X mprint("The All-In-One must have taken pity on you."); X mprint("A transdimensional portal appears..."); X levelchange(Dlevel+1,FLOOR); X gain_experience(2000); X Player.alignment -= 50; X } X } X else if (Dlevel > 30) { X mprint("You fall forever, tumbling through an eerie void."); X while(Player.hp>0) { X Player.food--; X foodcheck(); X } X } X else { X i = 1; X mprint("You fall..."); X while(random_range(4)!=2) { X i++; X mprint("...and fall..."); X morewait(); X } X p_damage(i*5,NORMAL_DAMAGE,"fall through the abyss"); X mprint("Finally,you emerge through an interdimensional interstice..."); X if (Dlevel+i>NUMLEVELS-1) { X mprint("Unfortunately you emerged deep underground."); X mprint("You ened your existence with a muted popping sound..."); X p_death("warping into magma from the infinite abyss"); X } X else { X mprint("You built up some velocity during your fall, though...."); X levelchange(Dlevel+i,Dungeon[Dlevel][Player.x][Player.y].locchar); X gain_experience(i*i); X } X } X} X X X Xvoid l_lift() X{ X char response; X int levelnum; X Dungeon[Dlevel][Player.x][Player.y].locchar = FLOOR; X Dungeon[Dlevel][Player.x][Player.y].p_locf = L_NO_OP; X mprint("You walk onto a shimmering disk...."); X mprint("A glow surrounds you."); X mprint("You feel weightless.... You feel ghostly...."); X mprint("Go up, down, or neither [u,d,ESCAPE]"); X do response = mgetc(); X while ((response != 'u') && X (response != 'd') && X (response != ESCAPE)); X if (response != ESCAPE) { X mprint("How many levels?"); X levelnum = parsenum(); X if (levelnum > 6) { X mprint("The lift gives out partway..."); X levelnum = 6; X } X mprint("You rematerialize....."); X levelchange((response=='d' ? Dlevel+levelnum : Dlevel - levelnum),FLOOR); X } X} X X Xvoid l_magic_pool() X{ X int possibilities=random_range(100); X mprint("This pool seems to be enchanted...."); X if (possibilities == 0) { X mprint("Oh no! You encounter the DREADED AQUAE MORTIS..."); X if (random_range(100) < Player.level) { X mprint("The DREADED AQUAE MORTIS throttles you within inches...."); X mprint("but for some reason chooses to let you escape."); X gain_experience(500); X Player.hp = 1; X } X else p_death("the DREADED AQUAE MORTIS!"); X } X else if (possibilities < 25) X augment(0); X else if (possibilities < 30) X augment(1); X else if (possibilities < 60) X augment(-1); X else if (possibilities < 65) X cleanse(1); X else if (possibilities < 80) { X if (Player.primary != NULL) { X mprint("You drop your weapon in the pool! It's gone forever!"); X conform_lost_objects(1,Player.primary); X } X else mprint("You feel fortunate."); X } X else if (possibilities < 90) { X if (Player.primary != NULL) { X mprint("Your weapon leaves the pool with a new edge...."); X Player.primary->plus += random_range(3)+1; X calc_melee(); X } X else mprint("You feel unfortunate."); X } X else if (possibilities < 95) { X Player.hp = max(Player.hp+10,Player.maxhp); X mprint("You feel healthier after the dip..."); X } X else if (possibilities < 99) { X mprint("Oooh, a tainted pool..."); X p_poison(10); X } X else { X mprint("Wow! A pool of azoth!"); X heal(10); X cleanse(1); X Player.mana = calcmana()*3; X Player.str = (Player.maxstr++)*3; X } X mprint("The pool seems to have dried up."); X Dungeon[Dlevel][Player.x][Player.y].locchar = TRAP; X Dungeon[Dlevel][Player.x][Player.y].p_locf = L_TRAP_PIT; X} X X X X X X X X X X X X X Xvoid p_movefunction(movef) Xint movef; X{ X /* loc functs above traps should be activated whether levitating or not */ X if ((! Player.status[LEVITATING]) || X (movef > TRAP_BASE+NUMTRAPS)) X switch(movef) { X X /* miscellaneous */ X case L_NO_OP:l_no_op(); break; X case L_HEDGE:l_hedge(); break; X case L_WATER:l_water(); break; X case L_LIFT:l_lift(); break; X case L_LAVA:l_lava(); break; X case L_FIRE:l_fire(); break; X case L_MAGIC_POOL:l_magic_pool(); break; X case L_WHIRLWIND:l_whirlwind(); break; X case L_ABYSS:l_abyss(); break; X X case L_FINAL_ABYSS:l_final_abyss(); break; X case L_ADEPT:l_adept(); break; X case L_PORTCULLIS:l_portcullis(); break; X case L_PORTCULLIS_TRAP:l_portcullis_trap(); break; X case L_WARNING:l_warning(); break; X case L_TRIFID:l_trifid(); break; X case L_CHALLENGE:l_challenge(); break; X case L_GUARDIAN:l_guardian(); break; X X case L_TRAP_DART:l_trap_dart(); break; X case L_TRAP_PIT:l_trap_pit(); break; X case L_TRAP_DOOR:l_trap_door(); break; X case L_TRAP_SNARE:l_trap_snare(); break; X case L_TRAP_BLADE:l_trap_blade(); break; X case L_TRAP_FIRE:l_trap_fire(); break; X case L_TRAP_TELEPORT:l_trap_teleport(); break; X case L_TRAP_DISINTEGRATE:l_trap_disintegrate(); break; X case L_TRAP_SLEEP_GAS:l_trap_sleepgas(); break; X case L_TRAP_MANADRAIN:l_trap_manadrain(); break; X case L_TRAP_ACID:l_trap_acid(); break; X case L_TRAP_ABYSS:l_trap_abyss(); break; X X /*door functions */ X case L_BANK:l_bank(); break; X case L_RESIDENCE:l_residence();break; X case L_DRUID:l_druid(); break; X case L_TEMPLE:l_temple(); break; X case L_ARMORER:l_armorer(); break; X case L_CLUB:l_club(); break; X case L_GYM:l_gym(); break; X case L_THIEVES_GUILD:l_thieves_guild(); break; X case L_COLLEGE:l_college(); break; X case L_HEALER:l_healer(); break; X case L_STATUE_WAKE:l_statue_wake(); break; X case L_CASINO:l_casino(); break; X case L_SEWER:l_sewer(); break; X case L_TAVERN:l_tavern(); break; X case L_MERC_GUILD:l_merc_guild(); break; X case L_ALCHEMIST:l_alchemist(); break; X case L_SORCERORS:l_sorcerors(); break; X case L_CASTLE:l_castle(); break; X case L_JAIL:l_jail(); break; X case L_GARDEN:l_garden(); break; X case L_ARENA:l_arena(); break; X case L_CITYGATE:l_citygate(); break; X case L_CHAOSSTORM:l_chaosstorm();break; X case L_VAULT:l_vault(); break; X case L_DPW:l_dpw(); break; X case L_LIBRARY:l_library(); break; X case L_PAWN_SHOP:l_pawn_shop(); break; X case L_CEMETARY:l_cemetary(); break; X case L_CONDO:l_condo(); break; X case L_MAZE: l_maze(); break; X case L_ALTAR:l_altar(); break; X case L_BROTHEL:l_brothel(); break; X } X} X X X Xvoid l_no_op() X{ X} X X END_OF_omove.c if test 15337 -ne `wc -c <omove.c`; then echo shar: \"omove.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 7 \(of 15\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 15 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