From decwrl!sun-barr!cs.utexas.edu!uunet!zephyr!tektronix!tekgen!tekred!saab!billr Thu Aug 3 07:42:02 PDT 1989 Article 646 of comp.sources.games: Path: decwrl!sun-barr!cs.utexas.edu!uunet!zephyr!tektronix!tekgen!tekred!saab!billr From: billr@saab.CNA.TEK.COM (Bill Randle) Newsgroups: comp.sources.games Subject: v07i034: omega3 - rogue like dungeon exploration (ver. 0.75), Part15/20 Message-ID: <4259@tekred.CNA.TEK.COM> Date: 14 Jul 89 13:32:59 GMT Sender: news@tekred.CNA.TEK.COM Lines: 1836 Approved: billr@saab.CNA.TEK.COM Submitted-by: "Laurence R. Brothers" Posting-number: Volume 7, Issue 34 Archive-name: omega3/Part15 Supersedes: omega2: Volume 5, Issue 12-29,38-40 #! /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 'oguild1.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */ X/* oguild1.c */ X/* L_ functions */ X X/* These functions implement the various guilds. */ X/* They are all l_ functions since they are basically activated*/ X/* at some site or other. */ X X#include "oglob.h" X X Xvoid l_merc_guild() X{ X pob newitem; X X print1("Legion of Destiny, Mercenary Guild, Inc."); X if (nighttime()) X print2("The barracks are under curfew right now."); X else { X print2("You enter Legion HQ, "); X if (Player.rank[LEGION] == COMMANDANT) { X nprint2("Your aide follows you to the staff room."); X morewait(); X clearmsg(); X } X if (Player.rank[LEGION] > 0) { X nprint2("and report to your commander."); X morewait(); X } X switch(Player.rank[LEGION]) { X case 0: X nprint2("and see the Recruiting Centurion."); X morewait(); X print2("Do you wish to join the Legion? [yn] "); X if (ynq2()=='y') { X clearmsg(); X if (Player.rank[ARENA]>0) { X print1("The Centurion checks your record, and gets angry:"); X print2("'The legion don't need any Arena Jocks. Git!'"); X } X else if (Player.rank[ORDER] > 0) { X print1("The Centurion checks your record, and is amused:"); X print2("'A paladin in the ranks? You must be joking.'"); X } X else if (Player.con < 12) { X print1("The Centurion looks you over, sadly."); X print2("You are too fragile to join the legion."); X } X else if (Player.str < 10) { X print1("The Centurion looks at you contemptuously."); X print2("Your strength is too low to pass the physical!"); X } X else { X print1("You are tested for strength and stamina..."); X morewait(); X nprint1(" and you pass!"); X print2("Commandant "); X nprint2(Commandant); X nprint2(" shakes your hand."); X morewait(); X print2("The Legion pays you a 500Au induction fee."); X morewait(); X print1("You are also issued a shortsword and leather."); X print2("You are now a Legionaire."); X morewait(); X clearmsg(); X newitem = ((pob) malloc(sizeof(objtype))); X *newitem = Objects[WEAPONID+1]; /* shortsword */ X gain_item(newitem); X newitem = ((pob) malloc(sizeof(objtype))); X *newitem = Objects[ARMORID+1]; /* leather */ X gain_item(newitem); X Player.cash += 500; X Player.rank[LEGION] = LEGIONAIRE; X Player.guildxp[LEGION] = 1; X Player.str++; Player.con++; X Player.maxstr++; Player.maxcon++; X } X } X break; X case COMMANDANT: X print1("You find the disposition of your forces satisfactory."); X break; X case COLONEL: X if ((Player.level > Commandantlevel) && X find_and_remove_item(CORPSEID+0,ML10+4)) { X print1("You liberated the Demon Emperor's Regalia!"); X morewait(); X clearmsg(); X print1("The Legion is assembled in salute to you!"); X print2("The Regalia is held high for all to see and admire."); X morewait(); X clearmsg(); X print1("Commandant "); X nprint1(Commandant); X nprint1(" promotes you to replace him,"); X print2("and announces his own overdue retirement."); X morewait(); X clearmsg(); X print1("You are the new Commandant of the Legion!"); X print2("The Emperor's Regalia is sold for a ridiculous sum."); X strcpy(Commandant,Player.name); X Commandantlevel = Player.level; X morewait(); X clearmsg(); X print1("You now know the Spell of Regeneration."); X Spells[S_REGENERATE].known = TRUE; X Player.rank[LEGION]=COMMANDANT; X Player.maxstr += 2; X Player.str += 2; X Player.maxcon += 2; X Player.con += 2; X print2("Your training is complete. You get top salary."); X Player.cash += 20000; X } X else if (Player.level <= Commandantlevel) { X clearmsg(); X print1("Your CO expresses satisfaction with your progress."); X print2("But your service record does not yet permit promotion."); X } X else { X clearmsg(); X print1("Why do you come empty handed?"); X print2("You must return with the Regalia of the Demon Emperor!"); X } X break; X case FORCE_LEADER: X clearmsg(); X print1("Your CO expresses satisfaction with your progress."); X if (Player.guildxp[LEGION] < 4000) X print2("But your service record does not yet permit promotion."); X else { X print2("You have been promoted to Legion Colonel!"); X morewait(); X print1("Your next promotion is contingent on the return of"); X print2("the Regalia of the Demon Emperor."); X morewait(); X print1("The Demon Emperor holds court at the base of a volcano"); X print2("to the far south, in the heart of a swamp."); X morewait(); X clearmsg(); X print1("You have been taught the spell of heroism!"); X Spells[S_HERO].known = TRUE; X Player.rank[LEGION]=COLONEL; X Player.maxstr++; X Player.str++; X Player.maxcon++; X Player.con++; X print2("You are given advanced training, and a raise."); X Player.cash += 10000; X } X break; X case CENTURION: X clearmsg(); X print1("Your CO expresses satisfaction with your progress."); X if (Player.guildxp[LEGION] < 1500) X print2("But your service record does not yet permit promotion."); X else { X print2("You are now a Legion Force-Leader!"); X Player.rank[LEGION]=FORCE_LEADER; X Player.maxstr++; X Player.str++; X morewait(); X clearmsg(); X print1("You receive more training, and bonus pay."); X Player.cash += 5000; X } X break; X case LEGIONAIRE: X clearmsg(); X print1("Your CO expresses satisfaction with your progress."); X if (Player.guildxp[LEGION] < 400) X print2("But your service record does not yet permit promotion."); X else { X print2("You are promoted to Legion Centurion!"); X morewait(); X clearmsg(); X print1("You get advanced training, and a higher salary."); X Player.rank[LEGION] = CENTURION; X Player.maxcon++; X Player.con++; X Player.cash += 2000; X } X break; X } X } X} X Xvoid l_castle() X{ X pob o; X if (Player.level < 3) { X print1("You can't possibly enter the castle, you nobody!"); X print2("Come back when you are famous."); X } X else { X print1("You are ushered into the castle."); X if (Player.rank[NOBILITY]"); X morewait(); X clearmsg(); X } X if (Player.rank[NOBILITY]==0) { X print1("Well, sirrah, wouldst embark on a quest? [yn] "); X if (ynq1() == 'y') { X print2("Splendid. Bring me the head of the Goblin King."); X Player.rank[NOBILITY]=COMMONER; X } X else { X print1("You scoundrel! Guards! Take this blackguard away!"); X morewait(); X p_damage(25,UNSTOPPABLE,"castle guards for lese majeste"); X send_to_jail(); X } X } X else if (Player.rank[NOBILITY]==COMMONER) { X if (find_and_remove_item(CORPSEID,ML3+5)) { X print1("Good job, sirrah! I promote you to the rank of esquire."); X Player.rank[NOBILITY]=ESQUIRE; X gain_experience(100); X print2("Now that you have proved yourself true, another quest!"); X morewait(); X print1("Bring to me a Holy Defender!"); X print2("One is said to be in the possession of the Great Wyrm"); X morewait(); X clearmsg(); X print1("in the depths of the sewers below the city."); X } X else print2("Do not return until you achieve the quest, caitiff!"); X } X else if (Player.rank[NOBILITY]==ESQUIRE) { X if (find_and_remove_item(WEAPONID+34,-1)) { X print1("My thanks, squire. In return, I dub thee knight!"); X Player.rank[NOBILITY]=KNIGHT; X gain_experience(1000); X print2("If thou wouldst please me further..."); X morewait(); X print1("Bring me a suit of dragonscale armor."); X print2("You might have to kill a dragon to get one...."); X } X else print2("Greetings, squire. My sword? What, you don't have it?"); X } X else if (Player.rank[NOBILITY]==KNIGHT) { X if (find_and_remove_item(ARMORID+12,-1)) { X print1("Thanks, good sir knight."); X print2("Here are letters patent to a peerage!"); X Player.rank[NOBILITY]=LORD; X gain_experience(10000); X morewait(); X print1("If you would do me a final service..."); X print2("I require the Orb of Mastery. If you would be so kind..."); X morewait(); X print1("By the way, you might find the Orb in the possession"); X print2("Of the Elemental Master on the Astral Plane"); X } X else print2("Your quest is not yet complete, sir knight."); X } X else if (Player.rank[NOBILITY]==LORD) { X if (find_item(&o,ARTIFACTID+0,-1)) { X print1("My sincerest thanks, my lord."); X print2("You have proved yourself a true paragon of chivalry"); X morewait(); X print1("I abdicate the Duchy in your favor...."); X print2("Oh, you can keep the Orb, by the way...."); X Player.rank[NOBILITY]=DUKE; X gain_experience(10000); X strcpy(Duke,Player.name); X } X else print2("I didn't really think you were up to the task...."); X } X } X} X X Xvoid l_arena() X{ X char response; X pob newitem; X int i,prize,monsterlevel; X print1("Rampart Coliseum"); X if (Player.rank[ARENA] == 0) { X print2("Enter the games, or Register as a Gladiator? [e,r,ESCAPE] "); X do response = mcigetc(); X while ((response != 'e') && (response != 'r') && (response != ESCAPE)); X } X else { X print2("Enter the games? [yn] "); X response = ynq2(); X if (response == 'y') response = 'e'; X else response = ESCAPE; X } X if (response == 'r') { X if (Player.rank[ARENA]>0) X print2("You're already a gladiator...."); X else if (Player.rank[ORDER]>0) X print2("We don't let Paladins into our Guild."); X else if (Player.rank[LEGION]>0) X print2("We don't train no stinkin' mercs!"); X else if (Player.str < 13) X print2("Yer too weak to train!"); X else if (Player.agi < 12) X print2("Too clumsy to be a gladiator!"); X else { X print1("Ok, yer now an Arena Trainee."); X print2("Here's a wooden sword, and a shield"); X morewait(); X clearmsg(); X newitem = ((pob) malloc(sizeof(objtype))); X *newitem = Objects[WEAPONID+17]; /* club */ X gain_item(newitem); X newitem = ((pob) malloc(sizeof(objtype))); X *newitem = Objects[SHIELDID+2]; /* shield */ X gain_item(newitem); X Player.rank[ARENA] = TRAINEE; X Arena_Opponent = 3; X morewait(); X clearmsg(); X print1("You've got 5000Au credit at the Gym."); X Gymcredit+=5000; X } X } X else if (response == 'e') { X print1("OK, we're arranging a match...."); X morewait(); X Arena_Monster = ((pmt) malloc(sizeof(montype))); X switch(Arena_Opponent) { X case 0: X *Arena_Monster = Monsters[ML1+9]; X break; X case 1: X *Arena_Monster = Monsters[ML0+0]; X break; X case 2: X *Arena_Monster = Monsters[ML1+21]; X break; X case 3: X *Arena_Monster = Monsters[ML1+6]; X break; X case 4: X *Arena_Monster = Monsters[ML1+0]; X break; X case 5: X *Arena_Monster = Monsters[ML2+4]; X break; X case 6: X *Arena_Monster = Monsters[ML2+0]; X break; X case 7: X *Arena_Monster = Monsters[ML3+0]; X break; X case 8: X *Arena_Monster = Monsters[ML2+11]; X break; X case 9: X *Arena_Monster = Monsters[ML4+0]; X break; X case 10: X *Arena_Monster = Monsters[ML5+5]; X break; X case 11: X *Arena_Monster = Monsters[ML6+4]; X break; X case 12: X *Arena_Monster = Monsters[ML6+5]; X break; X case 13: X *Arena_Monster = Monsters[ML8+2]; X break; X case 14: X *Arena_Monster = Monsters[ML8+4]; X break; X case 15: X *Arena_Monster = Monsters[ML9+0]; X break; X default: X if ((Player.rank[ARENA] < 5) && (Player.rank[ARENA] > 0)) { X strcpy(Str1,Champion); X strcat(Str1,", the arena champion"); X *Arena_Monster = Monsters[ML0+8]; X Arena_Monster->monstring = salloc(Str1); X strcpy(Str2,"The corpse of "); X strcat(Str2,Str1); X Arena_Monster->corpsestr = salloc(Str2); X Arena_Monster->level = 20; X Arena_Monster->hp = Championlevel*Championlevel*5; X Arena_Monster->hit = Championlevel*4; X Arena_Monster->ac = Championlevel*3; X Arena_Monster->dmg = 100+Championlevel*2; X Arena_Monster->xpv = Championlevel*Championlevel*5; X Arena_Monster->speed = 3; X Arena_Monster->meleestr = calloc(30,sizeof(char)); X strcpy(Arena_Monster->meleestr,""); X for(i=0;imeleestr,"L?R?"); X } X else { X do X *Arena_Monster = Monsters[random_range(ML9-ML0)+ML0]; X while ((Arena_Monster->uniqueness != COMMON) || X (Arena_Monster->dmg == 0)); X } X break; X } X X X X monsterlevel = Arena_Monster->level; X X if (Arena_Monster->level != 20) { X strcpy(Str1,nameprint()); X strcat(Str1," the "); X strcat(Str1,Arena_Monster->monstring); X Arena_Monster->monstring = salloc(Str1); X strcpy(Str2,"The corpse of "); X strcat(Str2,Str1); X Arena_Monster->corpsestr = salloc(Str2); X } X Arena_Monster->uniqueness = UNIQUE_MADE; X print1("You have a challenger: "); X print2(Arena_Monster->monstring); X Arena_Monster->attacked = TRUE; X m_status_set(Arena_Monster,HOSTILE); X morewait(); X clearmsg(); X print1("Let the battle begin...."); X change_environment(E_ARENA); X X time_clock(TRUE); X while (Current_Environment == E_ARENA) X time_clock(FALSE); X X if (! Arena_Victory) { X print1("The crowd boos your craven behavior!!!"); X print2("You are thrown out of the Gladiator's Guild!"); X morewait(); X clearmsg(); X if (Gymcredit > 0) print1("Your credit at the gym is cut off!"); X Gymcredit = 0; X Player.rank[ARENA] = -1; X } X else { X Arena_Opponent++; X if (monsterlevel == 20) { X print1("The crowd roars its approval!"); X if (Player.rank[ARENA]) { X print2("You are the new Arena Champion!"); X Championlevel = Player.level; X strcpy(Champion,Player.name); X Player.rank[ARENA] = 5; X morewait(); X print1("You are awarded the Champion's Spear: Victrix!"); X morewait(); X newitem = ((pob) malloc(sizeof(objtype))); X *newitem = Objects[WEAPONID+35]; X gain_item(newitem); X X } X else { X print1("As you are not an official gladiator,"); X nprint1("you are not made Champion."); X morewait(); X } X } X morewait(); X clearmsg(); X print1("Good fight! "); X nprint1("Your prize is: "); X prize = max(25,monsterlevel * 50); X if (Player.rank[ARENA] > 0) prize *= 2; X mnumprint(prize); X nprint1("Au."); X Player.cash+=prize; X if ((Player.rank[ARENA]<4) && X (Arena_Opponent>5) && X (Arena_Opponent % 3 == 0)) { X if (Player.rank[ARENA]>0) { X Player.rank[ARENA]++; X morewait(); X print1("You've been promoted to a stronger class!"); X print2("You are also entitled to additional training."); X Gymcredit+=Arena_Opponent*1000; X } X } X } X xredraw(); X } X else clearmsg(); X} X END_OF_FILE if test 14566 -ne `wc -c <'oguild1.c'`; then echo shar: \"'oguild1.c'\" unpacked with wrong size! fi # end of 'oguild1.c' fi if test -f 'ohelp5.txt' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ohelp5.txt'\" else echo shar: Extracting \"'ohelp5.txt'\" \(4670 characters\) sed "s/^X//" >'ohelp5.txt' <<'END_OF_FILE' XCOMBAT X====== XAs in most rogue-like games, you attack an adjacent monster by Xattempting to move onto it. X XAt this time, your current real statistics on to-hit, damage, defense, Xand armor protection are always displayed. It is felt that the Xcharacter would know (or quickly discover) how well any weapon, armor, Xetc. actually work. By comparing different weapons, armor, and shield Xcombinations, you can decide what martial configuration is best for Xyour character. Keep in mind that cost of equipment does not Xnecessarily indicate how good it is (though it is a good rule of Xthumb). X XThe 'F' command allows you to select precisely which actions you will Xtake in a combat round -- parry high, thrust low, etc. You have Xseveral maneuver points for use in each combat round, depending on Xlevel, status as a gladiator, etc. At the beginning of the game, your Xcombat options are already set for you, but as you progress, and Xpossibly gain more maneuvers, the preset options will not be Xautomatically updated, so remember to do it yourself periodically, as Xyou may be losing the chance at more maneuvers if you do not. X XThe following are your combat options: X XATTACK: Punch, Cut, Strike, Shoot, or Thrust (depending on weapon) -- 1 pt. XBLOCK: Prepare to block or parry enemy attack -- 1 pt. XRIPOSTE: BLOCK/ATTACK (thrusting weapons only) -- 2 pts. XLUNGE: More chance to hit than usual, does more damage -- 2 pts. X XKeep on selecting maneuvers until you have no maneuver points left. XIt does absolutely no good to have points left over. X XFollowing the choice of the maneuver, you must select a line for the Xaction: L (low), C (center), or H (high). Some monster will tend to Xattack in a given line (short/small monsters, for example, will Xtend to attack low), so this choice is meaningful. If you block or Xriposte low, when the attack is high, you will have wasted the effect Xof the block. On the other hand, if you block low twice, and the Xattack is low, you will defend doubly. If you don't block or riposte Xat all, it will be particularly easy for monsters to hit you. X XKeep on selecting maneuvers until you have no maneuver points left. XHitting the BACKSPACE or DELETE key will erase your current choices Xand let you start over. When you are satisfied, confirm your Xchoice with the RETURN key. Once a choice is selected, it stays in Xeffect until you change it; you need not reset it for each attack. XSelecting combat maneuvers takes no time. X XIf you are in VERBOSE mode (settable with the 'O' command) you'll see Xjust what the monster is doing, whether the blocks are effective, Xand so on. Otherwise you'll just be told whether you hit or miss. X XIf you select VERBOSE mode, you will be able to see just where your Xopponent attacks. Some monsters may show a particular sequence or Xlocation which they attack in; you can use this information to your Xadvantage by setting your own attacks and blocks accordingly. X XYou can try multiple identical maneuvers if you like. If you don't try Xany BLOCKS at all, it will be easier than usual for your opponent to Xhit. Even if you don't get the location correct, a BLOCK still does Xsome good. A RIPOSTE attacks in the same line as its block, if you got Xthe line right. I.e., if you are attacked high, a high riposte will Xget a free attack back. If you are attacked high three times, a high Xriposte will get three free attacks back. Each block or riposte is Xgood for your entire move; no matter how many monsters attack you you Xwill be able to block or riposte each one. Naturally, each attack can Xonly be used against one monster. X XHeavy edged weapons and smashing weapons do CUTTING or STRIKING Xdamage. Your strength affects this, so if it is high you will do Xmuch more damage, and if low, much less. X XLight edged weapons, missile weapons, and pointed weapons do THRUSTING Xor SHOOTING attacks, whose chance to hit is greatly affected by your Xdexterity. Note that you can't use a missile weapon very well in Xordinary combat (i.e. when you move adjacent to a monster) -- you Xwould be using a crossbow as a club, for instance. Instead, Xuse the 'f' command to fire missiles when at long range, and change Xto a melee weapon for close combat. X XA note on weapons use: A weapon is not prepared for combat unless Xit is in the "weapon hand" slot in your inventory. Anywhere else Xmeans you are just carrying it around.... Two-handed weapons will Xautomatically take both hand slots, so remember to have both Xhands free if you want to wield such a weapon. X XShields, of course, will only have effect in the "shield" slot, Xwhile armor is only considered to be worn if it is in the "armor" Xslot. END_OF_FILE if test 4670 -ne `wc -c <'ohelp5.txt'`; then echo shar: \"'ohelp5.txt'\" unpacked with wrong size! fi # end of 'ohelp5.txt' fi if test -f 'oitemf3.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oitemf3.c'\" else echo shar: Extracting \"'oitemf3.c'\" \(15789 characters\) sed "s/^X//" >'oitemf3.c' <<'END_OF_FILE' X/* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */ X/* oitemf3.c */ X X/* mostly artifact and stick functions */ X X#include "oglob.h" X X/* amulet of the planes */ Xvoid i_planes(o) Xpob o; X{ X if (Player.mana < 1) print1("The amulet spits some multicolored sparks."); X else { X print1("You focus mana into the amulet...."); X Player.mana = max(0,Player.mana-100); X dataprint(); X morewait(); X strategic_teleport(1); X } X} X X X/* the sceptre of high magic */ Xvoid i_sceptre(o) Xpob o; X{ X if (HiMagicUse == Date) X print1("The Sceptre makes a sort of dull 'thut' noise."); X else { X HiMagicUse = Date; X print1("With a shriek of tearing aether, a magic portal appears!"); X print2("Step through? [yn] "); X if (ynq()=='y') change_environment(E_COURT); X } X print1("The sceptre seems to subside. You hear a high whine, as of"); X print2("capacitors beginning to recharge."); X} X X X/* the star gem */ Xvoid i_stargem(o) Xpob o; X{ X if (StarGemUse == Date) { X print1("The Star Gem glints weakly as if to say:"); X print2("'You have used me overmuch.'"); X print3("and it vanishes a puff of regret."); X dispose_lost_objects(1,o); X } X else { X StarGemUse = Date; X if (o->blessing < 1) { X print1("The Star Gem shines brightly and emits a musical tone."); X print2("You see a dark cloud roil away from it."); X morewait(); X o->blessing = 10; X } X print1("The star gem flares with golden light!"); X morewait(); X if (Player.status[ILLUMINATION] < 1000) { X print1("Interesting, you seem to be permanently accompanied"); X print2("by a friendly lambent glow...."); X morewait(); X Player.status[ILLUMINATION] = 1500; X } X print1("You suddenly find yourself whisked away by some unknown force!"); X morewait(); X setgamestatus(COMPLETED_ASTRAL); X change_environment(E_COUNTRYSIDE); X Player.x = 61; X Player.y = 3; X screencheck(3); X drawvision(Player.x,Player.y); X locprint("Star Peak"); X print2("The Star Gem's brilliance seems to fade."); X } X} X X X/* wand of fear */ Xvoid i_fear(o) Xpob o; X{ X int x=Player.x,y=Player.y; X Objects[o->id].known = 1; X o->known = max(1,o->known); X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X inflict_fear(x,y); X} X X X Xvoid i_juggernaut(o) Xpob o; X{ X int d,x=Player.x,y=Player.y; X print1("You activate the Juggernaut of Karnak!"); X if (! o->known) { X print2("Uh, oh, it's coming this way!"); X p_death("The Juggernaut of Karnak"); X } X else { X d = getdir(); X if (d == ABORT) X print2("You deactivate the Juggernaut before it escapes."); X else { X print2("Vroom!"); X while (inbounds(x+Dirs[0][d],y+Dirs[1][d])) { X x+=Dirs[0][d]; X y+=Dirs[1][d]; X Level->site[x][y].locchar = FLOOR; X Level->site[x][y].p_locf = L_NO_OP; X if (Level->site[x][y].creature != NULL) { X mprint("You hear a distant scream...."); X m_death(Level->site[x][y].creature); X } X } X gain_experience(1000); X } X } X dispose_lost_objects(1,o); X} X X Xvoid i_symbol(o) Xpob o; X{ X int i; X if (! o->known) X print1("Nothing seems to happen."); X /* if o->charge != 17, then symbol was stolen from own high priest! */ X else if ((o->aux != Player.patron) || (o->charge != 17)){ X print1("You invoke the deity..."); X print2("...who for some reason seems rather annoyed at you..."); X print3("You are enveloped in Godsfire!"); X morewait(); X for(;Player.hp>1;Player.hp--) { X dataprint(); X morewait(); X for(i=0;inumber, X Player.possessions[i]); X Player.mana = 0; X } X } X else if (SymbolUseHour == hour()) { X print1("Your deity frowns upon this profligate use of power..."); X print2("Shazam! A bolt of Godsfire! Your symbol shatters!"); X dispose_lost_objects(1,o); X Player.hp = 1; X dataprint(); X } X else { X print1("A mystic flow of theurgic energy courses through your body!"); X SymbolUseHour = hour(); X cleanse(1); X heal(10); X Player.mana = max(Player.mana,calcmana()); X } X} X X X Xvoid i_crystal(o) Xpob o; X{ X if (!o->known) print1("You can't figure out how to activate this orb."); X else { X print1("You gaze into your crystal ball."); X if (ViewHour == hour()) print2("All you get is Gilligan's Island reruns."); X else if ((o->blessing<0) || (Player.iq+Player.level < random_range(30))) { X ViewHour = hour(); X print2("Weird interference patterns from the crystal fog your mind...."); X amnesia(); X } X else { X ViewHour = hour(); X print2("You sense the presence of life..."); X mondet(1); X morewait(); X print2("You sense the presence of objects..."); X objdet(1); X morewait(); X print2("You begin to see visions of things beyond your ken...."); X hint(); X } X } X} X Xvoid i_antioch(o) Xpob o; X{ X int x=Player.x,y=Player.y; X int count; X if (!o->known){ X print1("Ka-Boom!"); X print2("You seem to have annihilated yourself."); X p_death("The Holy Hand-Grenade of Antioch"); X } X else { X print1("Bring out the Holy Hand-Grenade of Antioch!"); X setspot(&x,&y); X print2("Ok, you pull the pin....."); X morewait(); X print1("What do you count up to? "); X count = parsenum(); X if ((count < 3)&&(Level->site[x][y].creature!=NULL)) { X print1("`Three shall be the number of thy counting...."); X print2("And the number of thy counting shall be three.'"); X print3("Your target picks up the grenade and throws it back!"); X morewait(); X clearmsg(); X print1("Ka-Boom!"); X p_death("The Holy Hand-Grenade of Antioch"); X } X else if (count>3) { X print1("`Three shall be the number of thy counting."); X print2("And the number of thy counting shall be three.'"); X morewait(); X clearmsg(); X print1("Ka-Boom!"); X p_death("The Holy Hand-Grenade of Antioch"); X } X else { X print1("Ka-Boom!"); X gain_experience(1000); X Level->site[x][y].locchar = TRAP; X Level->site[x][y].p_locf = L_TRAP_DOOR; X if (Level->site[x][y].creature != NULL) { X m_death(Level->site[x][y].creature); X print2("You are covered with gore."); X } X Level->site[x][y].things = NULL; X } X } X dispose_lost_objects(1,o); X} X Xvoid i_kolwynia(o) Xpob o; X{ X int i; X if (! o->known) { X print1("You destroy youself with a mana storm. How sad."); X p_death("Kolwynia, The Key That Was Lost"); X } X else { X gain_experience(5000); X print1("You seem to have gained complete mastery of magic."); X Player.pow = Player.maxpow = 2*Player.maxpow; X for(i=0;iknown) { X ZapHour = hour(); X print1("You blast the staff backwards...."); X dispel(-1); X } X else { X ZapHour = hour(); X print1("Zap with white or black end [wb] "); X do response = mcigetc(); while ((response != 'w') && (response != 'b')); X print2("The staff discharges!"); X if (response == 'w') enchant(o->blessing*2+1); X else dispel(o->blessing); X } X} X Xvoid i_helm(o) Xpob o; X{ X if (HelmHour == hour()) X print1("The helm doesn't seem to have recharged yet."); X else if (! o->known) { X HelmHour = hour(); X print1("You put the helm on backwards...."); X p_teleport(-1); X } X else { X HelmHour = hour(); X print1("Your environment fades.... and rematerializes."); X p_teleport(o->blessing); X } X} X X Xvoid i_death(o) Xpob o; X{ X clearmsg(); X print1("Bad move..."); X p_death("The Potion of Death"); X} X Xvoid i_life(o) Xpob o; X{ X clearmsg(); X print1("Good move."); X Player.hp = Player.maxhp = 2 * Player.maxhp; X dispose_lost_objects(1,o); X} X X X X/* f = fire, w = water, e = earth, a = air, m = mastery */ Xint orbcheck(element) Xchar element; X{ X char response; X print1("The orb begins to glow with increasing intensity!"); X print2("You have the feeling you need to do something more...."); X morewait(); X print1("Burn it in fire [f] "); X print2("Douse it with water [w] "); X morewait(); X print1("Smash it against the earth [e] "); X print2("Toss is through the air [a] "); X morewait(); X print1("Mix the above actions, doing them in sequence [m] "); X do { X print2("Which one [f,w,e,a,m] "); X response = mcigetc(); X } while ((response != 'f') && X (response != 'w') && X (response != 'e') && X (response != 'a') && X (response != 'm')); X return(response == element); X} X X/* orb functions */ Xvoid i_orbfire(o) Xpob o; X{ X if (! orbcheck('f')) { X print1("Bad choice!"); X print2("The Orb of Fire blasts you!"); X fball(Player.x,Player.y,Player.x,Player.y,250); X o->known = 1; X } X else { X print1("The Orb of Fire flares a brilliant red!"); X Spells[S_FIREBOLT].known = TRUE; X gain_experience(10000); X Player.immunity[FLAME]+=100; X print2("You feel fiery!"); X o->plus = 100; X o->blessing = 100; X i_firebolt(o); X } X *o = Objects[ARTIFACTID+5]; X} X X Xvoid i_orbwater(o) Xpob o; X{ X if (! orbcheck('w')) { X print1("A serious mistake!"); X print2("The Orb of Water blasts you!"); X heal(-250); X o->known = 1; X } X else { X print1("The Orb of Water pulses a deep green!"); X Spells[S_DISRUPT].known = TRUE; X Player.immunity[POISON]+=100; X gain_experience(10000); X print2("You feel wet!"); X o->plus = 100; X o->blessing = 100; X i_disrupt(o); X } X *o = Objects[ARTIFACTID+5]; X} X X X X X X Xvoid i_orbearth(o) Xpob o; X{ X int i; X if (! orbcheck('e')) { X print1("What a maroon!"); X print2("The Orb of Earth blasts you!"); X Player.con -= 10; X if (Player.con < 3) X p_death("congestive heart failure"); X else { X print3("Your possessions disintegrate!"); X for (i=0;inumber, X Player.possessions[i]); X for (i=0;iknown = 1; X } X } X else { X print1("The Orb of Earth emanates a brownish aura!"); X Spells[S_DISINTEGRATE].known = TRUE; X gain_experience(10000); X Player.immunity[NEGENERGY]+=100; X print2("You feel earthy!"); X o->plus = 100; X o->blessing = 100; X i_disintegrate(o); X } X *o = Objects[ARTIFACTID+5]; X} X X Xvoid i_orbair(o) Xpob o; X{ X if (! orbcheck('a')) { X print1("You lose!"); X print2("The Orb of Air blasts you!"); X lball(Player.x,Player.y,Player.x,Player.y,100); X o->known = 1; X } X else { X print1("The Orb of Air flashes blue!"); X Spells[S_LBALL].known = TRUE; /* lball */ X gain_experience(10000); X print2("You feel airy!"); X Player.immunity[ELECTRICITY]+=100; X o->plus = 100; X o->blessing = 100; X i_invisible(o); X i_lbolt(o); X } X *o = Objects[ARTIFACTID+5]; X} X X Xvoid i_orbmastery(o) Xpob o; X{ X X if (! orbcheck('m')) { X print1("A fatal error!"); X print2("The Orb of Mastery blasts you to cinders!"); X p_death("playing with the Orb of Mastery"); X o->known = 1; X } X else if ((find_and_remove_item(ARTIFACTID+1,-1)) && X (find_and_remove_item(ARTIFACTID+2,-1)) && X (find_and_remove_item(ARTIFACTID+3,-1)) && X (find_and_remove_item(ARTIFACTID+4,-1))) { X print1("The Orb of Mastery radiates rainbow colors!"); X print2("You feel godlike."); X Player.iq = Player.maxiq = 2 * Player.maxiq; X Player.pow = Player.maxpow = 2 * Player.maxpow; X Player.str = Player.maxstr = 2 * Player.maxstr; X Player.dex = Player.maxdex = 2 * Player.maxdex; X Player.con = Player.maxcon = 2 * Player.maxcon; X Player.agi = Player.maxagi = 2 * Player.maxagi; X dataprint(); X morewait(); X print1("You have been imbued with a cosmic power...."); X morewait(); X wish(1); X morewait(); X clearmsg(); X print2("You feel much more experienced."); X gain_experience(20000); X *o = Objects[ARTIFACTID+5]; X } X else { X print1("The Orb of Mastery's power is unbalanced!"); X print2("The Orb of Mastery blasts you to cinders!"); X p_death("playing with the Orb of Mastery"); X } X} X X Xvoid i_orbdead(o) Xpob o; X{ X int i; X print1("The burnt-out orb drains all your energy!"); X for(i=0;iplus = 0; X if (Player.possessions[i]->usef > 100) X Player.possessions[i]->usef = I_NOTHING; X } X } X print3("A storm of mundanity surounds you!"); X level_drain(Player.level-1,"a Burnt-out Orb"); X Player.mana = 0; X Player.pow -= 10; X} X X X Xvoid i_dispel(o) Xpob o; X{ X dispel((o->blessing > -1) ? o->blessing+random_range(3): o->blessing); X} X X X/* stick functions * / X X X/* wand of apportation */ Xvoid i_apport(o) Xpob o; X{ X o->known = max(1,o->known); X Objects[o->id].known = 1; X apport(o->blessing); X} X X/* staff of firebolts */ Xvoid i_firebolt(o) Xpob o; X{ X int x=Player.x,y=Player.y; X o->known = max(1,o->known); X Objects[o->id].known = 1; X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X fbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75); X} X X Xvoid i_disintegrate(o) Xpob o; X{ X int x=Player.x,y=Player.y; X o->known = max(1,o->known); X Objects[o->id].known = 1; X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X disintegrate(x,y); X} X Xvoid i_disrupt(o) Xpob o; X{ X int x=Player.x,y=Player.y; X o->known = max(1,o->known); X Objects[o->id].known = 1; X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X disrupt(x,y,100); X} X X X/* staff of lightning bolts */ Xvoid i_lbolt(o) Xpob o; X{ X int x=Player.x,y=Player.y; X o->known = max(1,o->known); X Objects[o->id].known = 1; X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X lbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75); X} X X/* wand of magic missiles */ Xvoid i_missile(o) Xpob o; X{ X int x=Player.x,y=Player.y; X o->known = max(1,o->known); X Objects[o->id].known = 1; X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X nbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,20); X} X X/* wand of fire balls */ Xvoid i_fireball(o) Xpob o; X{ X int x=Player.x,y=Player.y; X Objects[o->id].known = 1; X o->known = max(1,o->known); X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X fball(Player.x,Player.y,x,y,35); X} X X X/* wand of snowballs */ Xvoid i_snowball(o) Xpob o; X{ X int x=Player.x,y=Player.y; X Objects[o->id].known = 1; X o->known = max(1,o->known); X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X snowball(Player.x,Player.y,x,y,20); X} X X/* wand of lightning balls */ Xvoid i_lball(o) Xpob o; X{ X int x=Player.x,y=Player.y; X Objects[o->id].known = 1; X o->known = max(1,o->known); X setspot(&x,&y); X if (o->blessing < 0) { X x = Player.x; X y = Player.y; X } X lball(Player.x,Player.y,x,y,50); X} X X/* staff of sleep */ Xvoid i_sleep_other(o) Xpob o; X{ X Objects[o->id].known = 1; X o->known = max(1,o->known); X sleep_monster(o->blessing); X} X X/* rod of summoning */ X/* rod of summoning now always summons as if cursed */ Xvoid i_summon(o) Xpob o; X{ X Objects[o->id].known = 1; X o->known = max(1,o->known); X summon(-1,-1); X} X Xvoid i_hide(o) Xpob o; X{ X int x=Player.x,y=Player.y; X Objects[o->id].known = 1; X o->known = max(1,o->known); X setspot(&x,&y); X hide(x,y); X} X Xvoid i_polymorph(o) Xpob o; X{ X Objects[o->id].known = 1; X o->known = max(1,o->known); X polymorph(o->blessing); X} END_OF_FILE if test 15789 -ne `wc -c <'oitemf3.c'`; then echo shar: \"'oitemf3.c'\" unpacked with wrong size! fi # end of 'oitemf3.c' fi if test -f 'olev.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'olev.c'\" else echo shar: Extracting \"'olev.c'\" \(15982 characters\) sed "s/^X//" >'olev.c' <<'END_OF_FILE' X/* omega copyright (c) 1987,1988,1989 by Laurence Raphael Brothers */ X/* olev.c */ X X#include "oglob.h" X X/* Functions dealing with dungeon and country levels aside from actual Xlevel structure generation */ X X X/* monsters for tactical encounters */ Xvoid make_country_monsters(terrain) Xchar terrain; X{ X pml tml,ml=NULL; X static int plains[10] = X {BUNNY,BUNNY,BLACKSNAKE,HAWK,IMPALA,WOLF,LION,BRIGAND,RANDOM}; X static int forest[10] = X {BUNNY,QUAIL,HAWK,BADGER,DEER,DEER,WOLF,BEAR,BRIGAND,RANDOM}; X static int jungle[10] = X {ANTEATER,PARROT,MAMBA,ANT,ANT,HYENA,HYENA,ELEPHANT,LION,RANDOM}; X static int river[10] = X {QUAIL,TROUT,TROUT,MANOWAR,BASS,BASS,CROC,CROC,BRIGAND,RANDOM}; X static int swamp[10] = X {BASS,BASS,CROC,CROC,BOGTHING,ANT,ANT,RANDOM,RANDOM,RANDOM}; X static int desert[10] = X {HAWK,HAWK,CAMEL,CAMEL,HYENA,HYENA,LION,LION,RANDOM,RANDOM}; X static int tundra[10] = X {WOLF,WOLF,BEAR,BEAR,DEER,DEER,RANDOM,RANDOM,RANDOM,RANDOM}; X static int mountain[10] = X {BUNNY,SHEEP,WOLF,WOLF,HAWK,HAWK,HAWK,RANDOM,RANDOM,RANDOM}; X int *monsters,i,nummonsters; X X nummonsters = (random_range(5)+1) * (random_range(3)+1); X X switch(terrain) { X case PLAINS: monsters = plains; break; X case FOREST: monsters = forest; break; X case JUNGLE: monsters = jungle; break; X case RIVER: monsters = river; break; X case SWAMP: monsters = swamp; break; X case MOUNTAINS: case PASS: case VOLCANO: monsters = mountain; break; X case DESERT: monsters = desert; break; X case TUNDRA: monsters = tundra; break; X default: monsters = NULL; X } X for(i=0;im = ((pmt) malloc(sizeof(montype))); X if (monsters == NULL) tml->m = X m_create(random_range(WIDTH),random_range(LENGTH),TRUE,difficulty()); X else { X tml->m = make_creature(*(monsters+random_range(10))); X tml->m->x = random_range(WIDTH); X tml->m->y = random_range(LENGTH); X } X Level->site[tml->m->x][tml->m->y].creature = tml->m; X tml->m->sense = WIDTH; X if (m_statusp(tml->m,ONLYSWIM)) { X Level->site[tml->m->x][tml->m->y].locchar = WATER; X Level->site[tml->m->x][tml->m->y].p_locf = L_WATER; X } X X tml->next = ml; X ml = tml; X } X Level->mlist = ml; X} X X X X/* monstertype is more or less Current_Dungeon */ X/* The caves and sewers get harder as you penetrate them; the castle Xis completely random, but also gets harder as it is explored; Xthe astral and the volcano just stay hard... */ Xvoid populate_level(monstertype) Xint monstertype; X{ X pml head,tml; X int i,j,k,monsterid,nummonsters=(random_range(difficulty()/3)+1)*3+8; X X if (monstertype == E_CASTLE) nummonsters += 10; X else if (monstertype == E_ASTRAL) nummonsters += 10; X else if (monstertype == E_VOLCANO) nummonsters += 20; X X head = tml = ((pml) malloc(sizeof(mltype))); X X for(k=0;kdepth*10+random_range(100) > 150) X monsterid = ML3+7; /* Goblin Shaman*/ X else if (Level->depth*10+random_range(100) > 100) X monsterid = ML2+9; /* Goblin Chieftain */ X else if (random_range(100) > 50) monsterid = ML1+6; /* Goblin */ X else monsterid = -1; /* IE, random monster */ X break; X case E_SEWERS: X if (! random_range(3)) monsterid = -1; X else switch(random_range(Level->depth+3)) { X case 0: monsterid = ML1+3; break; /* sewer rat */ X case 1: monsterid = ML1+4; break; /* aggravator fungus */ X case 2: monsterid = ML1+5; break; /* blipper rat */ X case 3: monsterid = ML2+1; break; /* night gaunt */ X case 4: monsterid = ML2+5; break; /* transparent nasty */ X case 5: monsterid = ML2+8; break; /* murk fungus */ X case 6: monsterid = ML3+1; break; /* catoblepas */ X case 7: monsterid = ML3+3; break; /* acid cloud */ X case 8: monsterid = ML4+3; break; /* denebian slime devil */ X case 9: monsterid = ML4+8; break; /* giant crocodile */ X case 10: monsterid = ML5+1; break; /* tesla monster */ X case 11: monsterid = ML5+7; break; /* shadow spirit */ X case 12: monsterid = ML5+8; break; /* bogthing */ X case 13: monsterid = ML6+2; break; /* water elemental */ X case 14: monsterid = ML6+6; break; /* triton */ X case 15: monsterid = ML7+3; break; /* ROUS */ X default: monsterid = -1; break; X } X break; X case E_ASTRAL: X if (random_range(2)) /* random astral creatures */ X switch(random_range(12)) { X case 0: monsterid = ML3+14; break; /* thought form */ X case 1: monsterid = ML4+11; break; /* astral fuzzy */ X case 2: monsterid = ML4+15; break; /* ban sidhe */ X case 3: monsterid = ML4+16; break; /* astral grue */ X case 4: monsterid = ML5+7; break; /* shadow spirit */ X case 5: monsterid = ML5+9; break; /* astral vampire */ X case 6: monsterid = ML5+11; break; /* manaburst */ X case 7: monsterid = ML6+9; break; /* rakshasa */ X case 8: monsterid = ML7+4; break; /* illusory fiend */ X case 9: monsterid = ML7+9; break; /* mirror master */ X case 10: monsterid = ML7+10; break; /* elder etheric grue */ X case 11: monsterid = ML8+8; break; /* shadow slayer */ X } X else if (random_range(2) && (Level->depth == 1)) /* plane of earth */ X monsterid = ML6+3; /* earth elemental */ X else if (random_range(2) && (Level->depth == 2)) /* plane of air */ X monsterid = ML6+1; /* air elemental */ X else if (random_range(2) && (Level->depth == 3)) /* plane of water */ X monsterid = ML6+2; /* water elemental */ X else if (random_range(2) && (Level->depth == 4)) /* plane of fire */ X monsterid = ML6+0; /* fire elemental */ X else if (random_range(2) && (Level->depth == 5)) /* deep astral */ X switch (random_range(12)) { X case 0:monsterid = ML2+1; break; /* night gaunt */ X case 1:monsterid = ML4+12; break; /* servant of law */ X case 2:monsterid = ML4+13; break; /* servant of chaos */ X case 3:monsterid = ML5+4; break; /* lesser frost demon */ X case 4:monsterid = ML5+12; break; /* outer circle demon */ X case 5:monsterid = ML6+10; break; /* demon serpent */ X case 6:monsterid = ML6+11; break; /* angel */ X case 7:monsterid = ML7+14; break; /* inner circle demon */ X case 8:monsterid = ML8+5; break; /* frost demon lord */ X case 9:monsterid = ML8+11; break; /* high angel */ X case 10:monsterid = ML9+7; break; /* prime circle demon */ X case 11:monsterid = ML9+6; break; /* archangel */ X } X else monsterid = -1; X break; X case E_VOLCANO: X if (random_range(2)) { X do monsterid = random_range(ML10-ML4)+ML4; X while (Monsters[monsterid].uniqueness != COMMON); X } X else switch(random_range(Level->depth/2+2)) { /* evil & fire creatures */ X case 0: monsterid = ML4+5; break; X case 1: monsterid = ML4+6; break; X case 2: monsterid = ML5+0; break; X case 3: monsterid = ML5+4; break; X case 4: monsterid = ML5+5; break; X case 5: monsterid = ML5+10; break; X case 6: monsterid = ML6+0; break; X case 7: monsterid = ML6+5; break; X case 8: monsterid = ML6+9; break; X case 9: monsterid = ML6+10; break; X case 10: monsterid = ML7+1; break; X case 11: monsterid = ML7+6; break; X case 12: monsterid = ML7+11; break; X case 13: monsterid = ML7+12; break; X case 14: monsterid = ML7+14; break; X case 15: monsterid = ML7+3; break; X case 16: monsterid = ML8+3; break; X case 17: monsterid = ML8+5; break; X case 18: monsterid = ML8+8; break; X case 19: monsterid = ML7+3; break; X case 20: monsterid = ML9+5; break; X case 21: monsterid = ML9+7; break; X default: monsterid = -1; break; X } X break; X case E_CASTLE: X if (random_range(4)==1) { X if (difficulty() < 5) X monsterid = ML2+7; X else if (difficulty() < 6) X monsterid = ML5+6; X else if (difficulty() < 8) X monsterid = ML6+0; X else monsterid = ML9+4; X } X else monsterid = -1; X break; X X default: monsterid = -1; break; X } X X if (monsterid > -1) X Level->site[i][j].creature = make_creature(monsterid); X else Level->site[i][j].creature = m_create(i,j,TRUE,difficulty()); X X X Level->site[i][j].creature->x = i; X Level->site[i][j].creature->y = j; X X if (m_statusp(Level->site[i][j].creature,ONLYSWIM)) { X Level->site[i][j].locchar = WATER; X Level->site[i][j].p_locf = L_WATER; X } X X tml->next = ((pml) malloc(sizeof(mltype))); X tml->next->m = Level->site[i][j].creature; X tml = tml->next; X } X X if (Level->mlist==NULL) { X tml->next = NULL; X Level->mlist = head->next; X } X else { X tml->next = Level->mlist; X Level->mlist = head->next; X } X} X X X X/* Add a wandering monster possibly */ Xvoid wandercheck() X{ X int x,y; X pml tml; X if (random_range(MaxDungeonLevels) < difficulty()) { X findspace(&x,&y,-1); X tml = ((pml) malloc(sizeof(mltype))); X tml->next = Level->mlist; X tml->m = Level->site[x][y].creature = m_create(x,y,WANDERING,difficulty()); X Level->mlist = tml; X } X} X X X X/* call make_creature and place created monster on Level->mlist and Level */ Xvoid make_site_monster(i,j,mid) Xint i,j,mid; X{ X pml ml = ((pml) malloc(sizeof(mltype))); X pmt m; X if (mid > -1) Level->site[i][j].creature = (m = make_creature(mid)); X else Level->site[i][j].creature = (m = m_create(i,j,WANDERING,difficulty())); X m->x = i; X m->y = j; X ml->m = m; X ml->next = Level->mlist; X Level->mlist = ml; X} X X X/* make and return an appropriate monster for the level and depth*/ X/* called by populate_level, doesn't actually add to mlist for some reason*/ X/* eventually to be more intelligent */ Xpmt m_create(x,y,kind,level) Xint x,y,kind,level; X{ X pmt newmonster; X int monster_range; X int mid; X X switch(level) { X case 0:monster_range = ML1; break; X case 1:monster_range = ML2; break; X case 2:monster_range = ML3; break; X case 3:monster_range = ML4; break; X case 4:monster_range = ML5; break; X case 5:monster_range = ML6; break; X case 6:monster_range = ML7; break; X case 7:monster_range = ML8; break; X case 8:monster_range = ML9; break; X case 9:monster_range = ML10; break; X default:monster_range = NUMMONSTERS; break; X } X X do X mid = random_range(monster_range); X while (Monsters[mid].uniqueness != COMMON); X newmonster = make_creature(mid); X X /* no duplicates of unique monsters */ X if (kind == WANDERING) m_status_set(newmonster,WANDERING); X newmonster->x = x; X newmonster->y = y; X return(newmonster); X} X X X X/* make creature # mid, totally random if mid == -1 */ X/* make creature allocates space for the creature */ Xpmt make_creature(mid) Xint mid; X{ X pmt newmonster = ((pmt) malloc(sizeof(montype))); X pob ob; X int i,treasures; X X if (mid == -1) mid = random_range(ML9); X *newmonster = Monsters[mid]; X if ((mid == ML6+11) || (mid == ML8+11) || (mid == ML9+6)) { X /* aux1 field of an angel is its deity */ X newmonster->aux1 = random_range(6)+1; X newmonster->corpsestr = salloc(Monsters[mid].corpsestr); X strcpy(Str3,Monsters[mid].monstring); X switch(newmonster->aux1) { X case ODIN: strcat(Str3," of Odin"); break; X case SET: strcat(Str3," of Set"); break; X case HECATE: strcat(Str3," of Hecate"); break; X case ATHENA: strcat(Str3," of Athena"); break; X case DESTINY: strcat(Str3," of Destiny"); break; X case DRUID: strcat(Str3," of the Balance"); break; X } X newmonster->monstring = salloc(Str3); X } X else if (mid == ML0+7) { X /* generic 0th level human */ X newmonster->monstring = salloc(mantype()); X strcpy(Str1,"dead "); X strcat(Str1,newmonster->monstring); X newmonster->corpsestr = salloc(Str1); X } X else if (newmonster->monchar == '!') { X /* the nymph/satyr and incubus/succubus */ X if (Player.preference == 'f') { X newmonster->monchar = 'n'; X newmonster->monstring = salloc("nymph"); X newmonster->corpsestr = salloc("dead nymph"); X } X else { X newmonster->monchar = 's'; X newmonster->monstring = salloc("satyr"); X newmonster->corpsestr = salloc("dead satyr"); X } X if (newmonster->id == ML4+6) { X if (Player.preference == 'f') X newmonster->corpsestr = salloc("dead succubus"); X else newmonster->corpsestr = salloc("dead incubus"); X } X } X if (mid == NPC) X make_log_npc(newmonster); X else { X if (newmonster->sleep < random_range(100)) X m_status_set(newmonster,AWAKE); X if (newmonster->startthing > -1) { X ob = ((pob) malloc(sizeof(objtype))); X *ob = Objects[newmonster->startthing]; X m_pickup(newmonster,ob); X } X treasures = random_range(newmonster->treasure); X for(i=0;ilevel))); X while (ob->uniqueness != 0); X m_pickup(newmonster,ob); X } X } X newmonster->click = (Tick + 1) % 50; X return(newmonster); X} X X X X X/* drop treasures randomly onto level */ Xvoid stock_level() X{ X int i,j,k,numtreasures=2*random_range(difficulty()/4)+4; X X /* put cash anywhere, including walls, put other treasures only on floor */ X for (k=0;ksite[i][j].locchar != FLOOR); X make_site_treasure(i,j,difficulty()); X i = random_range(WIDTH); X j = random_range(LENGTH); X Level->site[i][j].things = ((pol) malloc(sizeof(oltype))); X Level->site[i][j].things->thing = ((pob) malloc(sizeof(objtype))); X make_cash(Level->site[i][j].things->thing,difficulty()); X Level->site[i][j].things->next = NULL; X /* caves have more random cash strewn around */ X if (Current_Dungeon == E_CAVES) { X i = random_range(WIDTH); X j = random_range(LENGTH); X Level->site[i][j].things = ((pol) malloc(sizeof(oltype))); X Level->site[i][j].things->thing = ((pob) malloc(sizeof(objtype))); X make_cash(Level->site[i][j].things->thing,difficulty()); X Level->site[i][j].things->next = NULL; X i = random_range(WIDTH); X j = random_range(LENGTH); X Level->site[i][j].things = ((pol) malloc(sizeof(oltype))); X Level->site[i][j].things->thing = ((pob) malloc(sizeof(objtype))); X make_cash(Level->site[i][j].things->thing,difficulty()); X Level->site[i][j].things->next = NULL; X } X } X} X X X/* make a new object (of at most level itemlevel) at site i,j on level*/ Xvoid make_site_treasure(i,j,itemlevel) Xint i,j,itemlevel; X{ X pol tmp = ((pol) malloc(sizeof(oltype))); X tmp->thing = ((pob) create_object(itemlevel)); X tmp->next = Level->site[i][j].things; X Level->site[i][j].things = tmp; X} X X/* make a specific new object at site i,j on level*/ Xvoid make_specific_treasure(i,j,itemid) Xint i,j,itemid; X{ X pol tmp = ((pol) malloc(sizeof(oltype))); X tmp->thing = ((pob) malloc(sizeof(objtype))); X *(tmp->thing) = Objects[itemid]; X tmp->next = Level->site[i][j].things; X Level->site[i][j].things = tmp; X} X X X X#ifndef MSDOS X/* returns a "level of difficulty" based on current environment X and depth in dungeon. Is somewhat arbitrary. value between 1 and 10. X May not actually represent real difficulty, but instead level X of items, monsters encountered. */ Xint difficulty() X{ X int depth = 1; X if (Level != NULL) depth = Level->depth; X switch(Current_Environment) { X case E_COUNTRYSIDE: return(7); break; X case E_CITY: return(3); break; X case E_VILLAGE: return(1); break; X case E_TACTICAL_MAP: return(7); break; X case E_SEWERS: return(depth/6)+3;break; X case E_CASTLE: return(depth/4)+4;break; X case E_CAVES: return(depth/3)+1;break; X case E_VOLCANO: return(depth/4)+5;break; X case E_ASTRAL: return(8);break; X case E_ARENA: return(5);break; X case E_HOVEL: return(3);break; X case E_MANSION: return(7);break; X case E_HOUSE: return(5);break; X case E_DLAIR: return(9);break; X case E_ABYSS: return(10);break; X case E_STARPEAK: return(9);break; X case E_CIRCLE: return(8);break; X case E_MAGIC_ISLE: return(8);break; X case E_TEMPLE: return(8);break; X default: return(3); break; X } X} X#endif END_OF_FILE if test 15982 -ne `wc -c <'olev.c'`; then echo shar: \"'olev.c'\" unpacked with wrong size! fi # end of 'olev.c' fi echo shar: End of archive 15 \(of 20\). cp /dev/null ark15isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 20 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