Path: utzoo!attcan!uunet!husc6!bbn!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games From: games@tekred.TEK.COM Newsgroups: comp.sources.games Subject: v05i039: omega2 - rogue like dungeon exploration (ver. 0.71), Part20/19 Message-ID: <2871@tekred.TEK.COM> Date: 27 Jul 88 21:35:27 GMT Sender: billr@tekred.TEK.COM Lines: 1137 Approved: billr@saab.CNA.TEK.COM Submitted by: "Laurence R. Brothers" Comp.sources.games: Volume 5, Issue 39 Archive-name: omega2/Part20 [This file got left out of the distribution. Sorry 'bout that. -br] #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'oaux3.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */ X X/* oaux3.c */ X X/* some functions called by ocom.c, also see oaux1.c, oaux2.c */ X/* This is a real grab bag file. It contains functions used by X oaux1 and o.c, as well as elsewhere. It is mainly here so oaux1.c X and oaux2 are not huge */ X X#include "oglob.h" X X/* check every ten minutes */ Xvoid tenminute_check() X{ X if (Time % 60 == 0) hourly_check(); X else { X if (Current_Environment == Current_Dungeon) wandercheck(); X minute_status_check(); X tenminute_status_check(); X if ((Player.status[DISEASED] < 1) && (Player.hp < Player.maxhp)) X Player.hp = min(Player.maxhp,Player.hp+Player.level+1); X if (Current_Environment != E_COUNTRYSIDE) X indoors_random_event(); X } X} X X X X/* hourly check is same as ten_minutely check except food is also X checked, and since time moves in hours out of doors, also X outdoors_random_event is possible */ X Xvoid hourly_check() X{ X Player.food--; X foodcheck(); X if (hour()==0) { /* midnight, a new day */ X moon_check(); X Date++; X } X torch_check(); X if (Current_Environment == Current_Dungeon) wandercheck(); X minute_status_check(); X tenminute_status_check(); X if ((Player.status[DISEASED] == 0) && (Player.hp < Player.maxhp)) X Player.hp = min(Player.maxhp,Player.hp+Player.level+1); X if (Current_Environment != E_COUNTRYSIDE) X indoors_random_event(); X} X X X X Xvoid indoors_random_event() X{ X pml ml; X pol ol; X switch(random_range(1000)) { X case 0: X print3("You feel an unexplainable elation."); X morewait(); X break; X case 1: X print3("You hear a distant rumbling."); X morewait(); X break; X case 2: X print3("You realize your fly is open."); X morewait(); X break; X case 3: X print3("You have a sudden craving for a pecan twirl."); X morewait(); X break; X case 4: X print3("A mysterious healing flux settles over the level."); X morewait(); X for (ml=Level->mlist;ml!=NULL;ml=ml->next) X if (ml->m->hp > 0) ml->m->hp = Monsters[ml->m->id].hp; X Player.hp = max(Player.hp,Player.maxhp); X break; X case 5: X print3("You discover an itch just where you can't scratch it."); X morewait(); X break; X case 6: X print3("A cosmic ray strikes!"); X p_damage(10,UNSTOPPABLE,"a cosmic ray"); X morewait(); X break; X case 7: X print3("You catch your second wind...."); X Player.hp = ++Player.maxhp; X Player.mana = max(Player.mana, calcmana()); X morewait(); X break; X case 8: X print3("You find some spare change in a hidden pocket."); X Player.cash += Player.level*Player.level+1; X morewait(); X break; X case 9: X print3("You feel strangely lucky."); X morewait(); X break; X case 10: X print3("You trip over something hidden in a shadow..."); X morewait(); X ol = ((pol) malloc(sizeof(oltype))); X ol->thing = create_object(difficulty()); X ol->next = Level->site[Player.x][Player.y].things; X Level->site[Player.x][Player.y].things = ol; X pickup(); X break; X case 11: X print3("A mysterious voice echoes all around you...."); X hint(); X morewait(); X break; X case 12: X if (Balance > 0) { X print3("You get word of the failure of your bank!"); X Balance = 0; X } X else print3("You feel lucky."); X break; X case 13: X if (Balance > 0) { X print3("You get word of a bank error in your favor!"); X Balance += 5000; X } X else print3("You feel unlucky."); X break; X } X showflags(); X} X X X Xvoid outdoors_random_event() X{ X int num,i,j; X pob ob; X X switch(random_range(300)) { X case 0: X switch(Country[Player.x][Player.y].current_terrain_type) { X case TUNDRA: X mprint("It begins to snow. Heavily."); X break; X case DESERT: X mprint("A sandstorm swirls around you."); X break; X default: X if ((Date > 75) && (Date < 330)) X mprint("You are drenched by a sudden downpour!"); X else mprint("It begins to snow. Heavily."); X } X mprint("Due to the inclement weather conditions, you have become lost."); X Precipitation+=random_range(12)+1; X setgamestatus(LOST); X break; X case 1: X mprint("You enter a field of brightly colored flowers..."); X mprint("Wow, man! These are some pretty poppies..."); X morewait(); X mprint("poppies..."); X morewait(); X mprint("poppies..."); X morewait(); X print3("You become somewhat disoriented..."); X setgamestatus(LOST); X break; X case 2: X mprint("You discover a sprig of athelas growing lonely in the wild."); X mprint("Using your herbalist lore you cook a cake of lembas...."); X ob = ((pob) malloc(sizeof(objtype))); X *ob = Objects[FOODID+1]; X gain_item(ob); X break; X case 3: X if (Precipitation > 0) { X mprint("You are struck by a bolt of lightning!"); X p_damage(random_range(25),ELECTRICITY,"a lightning strike"); X } X else mprint("You feel static cling"); X break; X case 4: X mprint("You find a fast-food establishment."); X l_commandant(); X break; X case 5: X mprint("A weird howling tornado hits from out of the West!"); X mprint("You've been caught in a chaos storm!"); X num = random_range(300); X if (num <10) { X mprint("Your cell-structure was disrupted!"); X p_damage(random_range(100),UNSTOPPABLE,"a chaos storm"); X } X else if (num < 20) { X mprint("The chaos storm warps your frame!"); X mprint("Your statistical entropy has been maximized."); X mprint("You feel average..."); X Player.str = Player.maxstr = Player.con = Player.maxcon = X Player.dex = Player.maxdex = Player.agi = Player.maxagi = X Player.iq = Player.maxiq = Player.pow = Player.maxpow = X ((Player.maxstr+Player.maxcon+Player.maxdex+Player.maxagi+ X Player.maxiq+Player.maxpow+12)/6); X } X else if (num < 30) { X mprint("Your entire body glows with an eerie flickering light."); X for(i=1;iplus++; X if (Player.possessions[i]->objchar == STICK) X Player.possessions[i]->charge+=10; X Player.possessions[i]->blessing+=10; X } X cleanse(1); X mprint("You feel filled with energy!"); X Player.maxpow += 5; X Player.pow += 5; X Player.mana = Player.maxmana = calcmana() * 5; X mprint("You also feel weaker. Paradoxical, no?"); X Player.con -= 5; X Player.maxcon -= 5; X if (Player.con < 3) X p_death("congestive heart failure"); X } X else if (num < 40) { X mprint("Your entire body glows black."); X dispel(-1); X dispel(-1); X Player.pow-=10; X Player.mana=0; X } X else if (num < 60) { X mprint("The storm deposits you in a strange place...."); X Player.x = random_range(WIDTH); X Player.y = random_range(LENGTH); X screencheck(Player.y); X } X else if (num < 70) { X mprint("A tendril of the storm condenses and falls into your hands."); X ob = ((pob) malloc(sizeof(objtype))); X make_artifact(ob,-1); X gain_item(ob); X } X else if (num < 80) { X if (gamestatusp(MOUNTED)) { X mprint("Your horse screams as he is transformed into an"); X mprint("imaginary unseen dead tortoise."); X mprint("You are on foot."); X resetgamestatus(MOUNTED); X } X else { X mprint("You notice you are riding a horse. Odd. Very odd...."); X mprint("Now that's a horse of a different color!"); X setgamestatus(MOUNTED); X } X } X else if (num < 90) { X mprint("You feel imbued with godlike power...."); X wish(1); X } X else if (num < 100) { X mprint("The chaos storm has wiped your memory!"); X mprint("You feel extraordinarily naive...."); X mprint("You can't remember a thing! Not even your name."); X Player.xp = 0; X Player.level = 0; X for (i=0;i 0) && X (Player.level/2 + random_range(20) > X hostile_magic + random_range(20))) { X if (Player.mana > hostile_magic * hostile_magic) { X mprint("Thinking fast, you defend youself with a counterspell!"); X Player.mana -= hostile_magic * hostile_magic; X dataprint(); X return(TRUE); X } X } X if (Player.level/4 + Player.status[PROTECTION] + random_range(20) > X hostile_magic + random_range(30)) { X mprint("You make your saving throw!"); X return(TRUE); X } X else return(FALSE); X} X X X X X Xvoid terrain_check(takestime) Xint takestime; X{ X if (! takestime) X switch(random_range(32)) { X case 0:print2("Boingg!"); break; X case 1:print2("Whooosh!"); break; X case 2:print2("Over hill, over dale...."); break; X case 3:print2("...able to leap over 7 leagues in a single bound...."); X break; X } X else if (gamestatusp(MOUNTED)) X switch(random_range(32)) { X case 0: X case 1:print2("Clippity Clop.");break; X case 2:print2("....my spurs go jingle jangle jingle....");break; X case 3:print2("....as I go riding merrily along....");break; X } X else switch(random_range(32)) { X case 0:print2("Trudge. Trudge."); break; X case 1:print2("The road goes ever onward...."); break; X } X switch(Country[Player.x][Player.y].current_terrain_type) { X case RIVER: X if ((Player.y < 6) && (Player.x > 20)) locprint("Star Lake."); X else if (Player.y < 41) { X if (Player.x < 10) locprint("Aerie River."); X else locprint("The Great Flood."); X } X else if (Player.x < 42) locprint("The Swamp Runs."); X else locprint("River Greenshriek."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X break; X case ROAD: X locprint("A well-maintained road."); X if (takestime) { X Time += 60; X hourly_check(); X } X break; X case PLAINS: X locprint("A rippling sea of grass."); X if (takestime) { X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case TUNDRA: X locprint("The Great Northern Wastes."); X if (takestime) { X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case FOREST: X if (Player.y < 10) locprint("The Deepwood."); X else if (Player.y < 18) locprint("The Forest of Erelon."); X else if (Player.y < 46) locprint("The Great Forest."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X } X } X break; X case JUNGLE: X locprint("Greenshriek Jungle."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case DESERT: X locprint("The Waste of Time."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case MOUNTAINS: X if ((Player.y < 9) && (Player.x < 12)) X locprint("The Magic Mountains"); X else if ((Player.y < 9) && (Player.y > 2) && (Player.x < 40)) X locprint("The Peaks of the Fist."); X else if (Player.x < 52) X locprint("The Rift Mountains."); X else locprint("Borderland Mountains."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case PASS: X locprint("A hidden pass."); X if (takestime) { X Time += 60; X hourly_check(); X } X break; X case CHAOS_SEA: X locprint("The Sea of Chaos."); X if (takestime) { X Time += 60; X hourly_check(); X } X l_chaos(); X mprint("You have entered the sea of chaos..."); X break; X case SWAMP: X locprint("The Loathly Swamp."); X if (takestime) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X if (! gamestatusp(MOUNTED)) { X Time += 60; X hourly_check(); X Time += 60; X hourly_check(); X } X } X break; X case CITY: X if (gamestatusp(LOST)) { X resetgamestatus(LOST); X mprint("Well, I guess you know where you are now...."); X } X locprint("Outside Rampart, the city."); X break; X case VILLAGE: X if (gamestatusp(LOST)) { X resetgamestatus(LOST); X mprint("The village guards let you know where you are...."); X } X locprint("Outside a small village."); X break; X case CAVES: X locprint("A deserted hillside."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You notice a concealed entrance into the hill."); X break; X case CASTLE: X locprint("Near a fortified castle."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("The castle is hewn from solid granite. The drawbridge is down."); X break; X case TEMPLE: X switch(Country[Player.x][Player.y].aux) { X case ODIN: locprint("A rough-hewn granite temple."); break; X case SET: locprint("A black pyramidal temple made of sandstone."); break; X case ATHENA: locprint("A classical marble-columned temple."); break; X case HECATE: locprint("A temple of ebony adorned with ivory."); break; X case DRUID: locprint("A temple formed of living trees."); break; X case DESTINY: locprint("A temple of some mysterious blue crystal."); break; X } X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You notice an entrance conveniently at hand."); X break; X case MAGIC_ISLE: X locprint("A strange island in the midst of the Sea of Chaos."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("There is a narrow causeway to the island from here."); X break; X case STARPEAK: X locprint("Star Peak."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("The top of the mountain seems to glow with a allochroous aura."); X break; X case DRAGONLAIR: X locprint("A rocky chasm."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("You are at a cave entrance from which you see the glint of gold."); X break; X case VOLCANO: X locprint("HellWell Volcano."); X if (takestime) { X Time += 60; X hourly_check(); X } X mprint("A shimmer of heat lightning plays about the crater rim."); X break; X default: X locprint("I haven't any idea where you are!!!"); X break; X } X outdoors_random_event(); X} X X X Xvoid countrysearch() X{ X int x,y; X Time+=60; X hourly_check(); X for (x=Player.x-1;x