From mipos3!intelca!amd!amdcad!ames!ucbcad!ucbvax!decvax!tektronix!tekgen!tekred!games-request Thu Jul 30 18:56:46 PDT 1987 Article 57 of comp.sources.games: Path: td2cad!mipos3!intelca!amd!amdcad!ames!ucbcad!ucbvax!decvax!tektronix!tekgen!tekred!games-request From: games-request@tekred.TEK.COM Newsgroups: comp.sources.games Subject: v02i002: nethack - display oriented dungeons & dragons, Part02/16 Message-ID: <1444@tekred.TEK.COM> Date: 28 Jul 87 17:20:35 GMT Sender: billr@tekred.TEK.COM Lines: 1668 Approved: billr@tekred.TEK.COM Submitted by: mike@genat.UUCP (Mike Stephenson) Comp.sources.games: Volume 2, Issue 2 Archive-name: nethack/Part02 #! /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 rumors.base <<'END_OF_rumors.base' X"Quit" is a four letter word. X"So when I die, the first thing I will see in Heaven is a score list?" X-- more -- X...and rings may protect your fingers. X...and sometimes a piercer drops by. XA Quasit is even faster than a jaguar! XA chameleon imitating a postman often delivers scrolls of fire. XA chameleon imitating a postman sometimes delivers scrolls of punishment. XA clove of garlic a day keeps your best friends away. XA cockatrice's corpse is guaranteed to be untainted! XA confused acid blob may attack. XA dead lizard is a good thing to turn undead. XA dragon is just a Snake that ate a scroll of fire. XA fading corridor enlightens your insight. XA glowing potion is too hot to drink. XA good amulet may protect you against guards. XA homunculus wouldnt want to hurt a wizard. XA jaguar shouldn't frighten you. XA long worm can be defined recursively. So how should you attack it? XA long worm hits with all of its length. XA magic vomit pump is a necessity for gourmands. XA monstrous mind is a toy for ever. XA nurse a day keeps the doctor away. XA potion of blindness makes you see invisible things. XA ring is just a wound wand. XA ring of adornment protects against Nymphs. XA ring of conflict is a bad thing if there is a nurse in the room. XA ring of extra ringfinger is useless if not enchanted. XA ring of stealth can be recognised by that it does not teleport you. XA rope may form a trail in a maze. XA rumour has it that rumours are just rumours. XA scroll of enchant amulet is only useful on your way back. XA smoky potion surely affects your vision. XA spear might hit a nurse. XA spear will hit an ettin. XA staff may recharge if you drop it for awhile. XA tin of smoked eel is a wonderful find. XA truly wise man never plays leapfrog with a unicorn. XA two-handed sword usually misses. XA unicorn can be tamed only by a fair maiden. XA visit to the Zoo is very educational; you meet interesting animals. XA wand of deaf is a more dangerous weapon than a wand of sheep. XA wand of vibration might bring the whole cave crashing about your ears. XA winner never quits. A quitter never wins. XA xan is a small animal. It doesn't reach higher than your leg. XAcid blobs should be attacked bare-handed. XAffairs with Nymphs are often very expensive. XAfraid of Mimics? Try to wear a ring of true seeing. XAfraid of falling piercers? Wear a helmet! XAfter being attacked by a Harpy you have a lot of arrows. XAll monsters are created evil, but some are more evil than others. XAlways attack a floating Eye from behind! XAlways be aware of the phase of the moon! XAlways read the info about a monster before dealing with it. XAlways sweep the floor before engraving important messages. XAmulets are hard to make. Even for a wand of wishing. XAn Umber hulk can be a confusing sight. XAn elven cloak is always the height of fashion. XAn elven cloak protects against magic. XAn ettin is hard to kill; an imp is hard to hit. See the difference? XAny small object that is accidentally dropped will hide under a larger object. XAre you blind? Catch a floating Eye! XAsking about monsters may be very useful. XAttack long worms from the rear - that is so much safer! XAttacking an eel when there is none usually is a fatal mistake! XBalrogs only appear on the deeper levels. XBe careful when eating bananas. Monsters might slip on the peels. XBe careful when eating salmon - your fingers might become greasy. XBe careful when the moon is in its last quarter. XBe careful when throwing a boomerang - you might hit the back of your head. XBe nice to a nurse: put away your weapon and take off your clothes. XBeing digested is a painfully slow process. XBetter go home and hit your kids. They are just little monsters! XBetter go home and play with your kids. They are just little monsters! XBetter leave the dungeon, otherwise you might get hurt badly. XBeware of dark rooms - they may be the Morgue. XBeware of death rays! XBeware of falling rocks, wear a helmet! XBeware of hungry dogs! XBeware of the minotaur. He's very horny! XBeware of the potion of Nitroglycerine - it's not for the weak of heart. XBeware of wands of instant disaster. XBeware: there's always a chance that your wand explodes as you try to zap it! XBeyond the 23-rd level lies a happy retirement in a room of your own. XBlank scrolls make more interesting reading. XBlind? Eat a carrot! XBooksellers never read scrolls; it might carry them too far away. XBooksellers never read scrolls; it might leave their shop unguarded. XChanging your suit without dropping your sword? You must be kidding! XCockatrices might turn themselves to stone faced with a mirror. XConsumption of home-made food is strictly forbidden in this dungeon. XDark gems are just coloured glass. XDark room? Just flash often with your camera. XDark room? Your chance to develop your photographs! XDark rooms are not *completely* dark: just wait and let your eyes adjust... XDead lizards protect against a cockatrice. XDeath is just around the next door. XDeath is life's way of telling you you've been fired. XDescend in order to meet more decent monsters. XDid you know worms had teeth? XDidn't you forget to pay? XDirect a direct hit on your direct opponent, directing in the right direction. XDo something big today: lift a boulder. XDo you want to visit hell? Dig a *very* deep hole. XDogs are attracted by the smell of tripe. XDogs do not eat when the moon is full. XDogs never step on cursed items. XDogs of ghosts aren't angry, just hungry. XDon't bother about money: only Leprechauns and shopkeepers are interested. XDon't create fireballs: they might turn against you. XDon't eat too much: you might start hiccoughing! XDon't forget! Large dogs are MUCH harder to kill than little dogs. XDon't play hack at your work, your boss might hit you! XDon't swim with weapons or armour: they might rust! XDon't tell a soul you found a secret door, otherwise it isn't secret anymore. XDon't throw gems. They are so precious! Besides, you might hit a roommate. XDrinking might affect your health. XDrop your vanity and get rid of your jewels! Pickpockets about! XDungeon expects every monster to do his duty. XDust is an armor of poor quality. XEat 10 cloves of garlic and keep all humans at a two-square distance. XEat a homunculus if you want to avoid sickness. XEating a Wraith is a rewarding experience! XEating a freezing sphere is like eating a yeti. XEating a killer bee is like eating a scorpion. XEating a tengu is like eating a Nymph. XEating unpaid Leprechauns may be advantageous. XEels hide under mud. Use a unicorn to clear the water and make them visible. XElven cloaks cannot rust. XEngrave your wishes with a wand of wishing. XEventually all wands of striking do strike. XEventually you will come to admire the swift elegance of a retreating nymph. XEver fought with an enchanted tooth? XEver heard hissing outside? I *knew* you hadn't! XEver seen a leocrotta dancing the tengu? XEver slept in the arms of a homunculus? XEver tamed a shopkeeper? XEver tried digging through a Vault Guard? XEver tried enchanting a rope? XEver tried to catch a flying boomerang? XEver tried to put a Troll into a large box? XEver wondered why one would want to dip something in a potion? XEvery dog should be a domesticated one. XEvery hand has only one finger to put a ring on. You've got only two hands. So? XEvery level contains a shop; only the entrance is often hidden. XEverybody should have tasted a scorpion at least once in his life. XExpensive cameras have penetrating flashlights. XFeeding the animals is strictly prohibited. The Management. XFeeling lousy? Why don't you drink a potion of tea? XFiery letters might deter monsters. XFirst Law of Hacking: leaving is much more difficult than entering. XFor any remedy there is a misery. XFourth Law of Hacking: you will find the exit at the entrance. XGems are the droppings of other inmates. XGems are the droppings of Umber Hulks. XGems do get a burden. XGenocide on shopkeepers is punishable. XGetting Hungry? Stop wearing rings! XGetting Hungry? Wear an amulet! XGhosts always empty the fridge. XGhosts are visible because they don't leave a trace. XGiant beetles make giant holes in giant trees! XGiving head to a long worm is like a long lasting reception. XGold is a heavy metal. XGood day for overcoming obstacles. Try a steeplechase. XGossip is the opiate of the depressed. XHackers do it with bugs. XHalf Moon tonight. (At least it's better than no Moon at all.) XHandle your flasks carefully - there might be a ghost inside! XHave a good meal today: eat a minotaur. XHey guys, you *WIELD* a dead lizard against a cocatrice! [David London] XHissing is a sound I hate. XHitting is the lingua franca in these regions. XHumans use walking canes when they grow old. XHunger is a confusing experience for a dog! XHungry dogs are unreliable. XHungry? There is an abundance of food on the next level. XHungry? Wear an amulet! XI doubt whether nurses are virgins. XI guess you have never hit a postman with an Amulet of Yendor yet... XI once knew a hacker who ate too fast and choked to death..... XI smell a maze of twisty little passages. XI wished, I never wished a wand of wishing. (Wishful thinking) XIf "nothing happens", something *has* happened anyway!! XIf a chameleon mimics a mace, it really mimics a Mimic mimicking a mace. XIf a shopkeeper kicks you out of his shop, he'll kick you out of the dungeon. XIf you are being punished, it's done with a deadly weapon. XIf you are the shopkeeper you can take things for free. XIf you are too cute some monsters might be tempted to embrace you. XIf you can't learn to do it well, learn to enjoy doing it badly. XIf you need a wand of digging, kindly ask the minotaur. XIf you see nurses you better start looking somewhere for a doctor. XIf you turn blind: don't expect your dog to be turned into a seeing-eye dog. XIf you want to feal great, you must eat something real big. XIf you want to float you'd better eat a floating eye. XIf you want to genocide nurses, genocide @'s. XIf you want to hit, use a dagger. XIf you want to rob a shop, train your dog. XIf you're afraid of trapdoors, just cover the floor with all you've got. XIf you're lost, try buying a map next time you're in a shop. XIf your ghost kills a player, it increases your score. XImportant mail? Be careful that it isn't stolen! XImprove your environment, using a wand of rearrangement. XIn a hurry? Try a ride on a fast moving quasit! XIn a way, a scorpion is like a snake. XIn need of a rest? Quaff a potion of sickness! XIn total, there are nine sorts of shops (sometimes). XIncrease mindpower: Tame your own ghost! XInside a shop you better take a look at the price tags before buying anything. XIt furthers one to see the great man. XIt is bad manners to use a wand in a shop. XIt is not always a good idea to whistle for your dog. XIt is said that Giant Rabbits can be tamed with carrots only. XIt is said that purple worms and trappers fill the same niche. XIt might be a good idea to offer the unicorn a ruby. XIt seems you keep overlooking a sign reading "No trespassing"! XIt would be peculiarly sad were your dog turned to stone. XIt's all a matter of life and death, so beware of the undead. XIt's bad luck to drown a postman. XIt's bad luck, being punished. XIt's easy to overlook a monster in a wood. XIt's not safe to Save. XJackals are intrinsically rotten. XJust below any trapdoor there may be another one. Just keep falling! XKeep a clear mind: quaff clear potions. XKeep your armors away from rust. XKeep your weaponry away from acids. XKicking the terminal doesn't hurt the monsters. XKill a unicorn and you kill your luck. XKiller bees keep appearing till you kill their queen. XLarge dogs make larger turds than little ones. XLatest news? Put 'rec.games.hack' in your .newsrc ! XLatest news? Put newsgroup 'netUNX.indoor.hackers-scroll' in your .newsrc! XLearn how to spell. Play Hack! XLeather armor cannot rust. XLeprechauns are the most skilled cutpurses in this dungeon. XLeprechauns hide their gold in a secret room. XLet your fingers do the walking on the yulkjhnb keys. XLet's face it: this time you're not going to win. XLet's have a party, drink a lot of booze. XLiquor sellers do not drink; they hate to see you twice. XLooking for a monster -- use a staff of monster summoning. XLooking pale? Quaff a red potion! XM.M.Vault cashiers teleport any amount of gold to the next local branch. XMany monsters make a murdering mob. XMeet yourself! Commit suicide and type "hack" XMeeting your own ghost decreases your luck considerably! XMemory flaw - core dumped. XMoney is the root of all evil. XMoney to invest? Take it to the local branch of the Magic Memory Vault! XMonsters come from nowhere to hit you everywhere. XMonsters sleep because you are boring, not because they ever get tired. XMost monsters can't swim. XMost monsters prefer minced meat. That's why they are hitting you! XMost rumors are just as misleading as this one. XMuch ado Nothing Happens. XMurder complaint? Mail to 'netnix!devil!gamble!freak!trap!lastwill!rip'. XNeed money? Sell your corpses to a tin factory. XNever ask a shopkeeper for a price list. XNever attack a guard. XNever drop a crysknife! No, never even unwield it, until... XNever eat with glowing hands! XNever fight a monster: you might get killed. XNever go into the dungeon at midnight. XNever kick a sleeping dog. XNever kiss an animal. It may cause kissing disease. XNever map the labyrinth. XNever mind the monsters hitting you: they just replace the charwomen. XNever ride a long worm. XNever step on a cursed engraving. XNever swim with a camera: there's nothing to take pictures of. XNever trust a random generator in magic fields. XNever use a wand of death. XNever use your best weapon to engrave a curse. XNever vomit on a door mat. XNo easy fighting with a heavy load! XNo level contains two shops. The maze is no level. So... XNo part of this fortune may be reproduced, stored in a retrieval system, ... XNo weapon is better than a crysknife. XNot all rumors are as misleading as this one. XNot even a spear will hit a Xorn. XNow what is it that cures digestion? XNurses are accustomed to touch naked persons: they don't harm them. XNurses prefer undressed hackers. XNymphs and nurses like beautiful rings. XNymphs are blondes. Are you a gentleman? XNymphs are very pleased when you call them by their real name: Lorelei. XOffering a unicorn a worthless piece of glass might prove to be fatal! XOld hackers never die: young ones do. XOld trees sometimes fall without a warning! XOnce your little dog will be a big dog, and you will be proud of it. XOne can even choke on a fortune cookie! XOne has to leave shops before closing time. XOne homunculus a day keeps the doctor away. XOne level further down somebody is getting killed, right now. XOne wand of concentration equals eight scrolls of create monster. XOnly Today! A dramatic price-cut on slightly used wands. XOnly a Nymph knows how to unlock chains. XOnly a dragon will never get a cold from a wand of cold. XOnly a real dummy would ever call his sword 'Elbereth'. XOnly a wizard can use a magic whistle. XOnly adventurers of evil alignment think of killing their dog. XOnly cave-women can catch a unicorn. And then only with a golden rope. XOnly chaotic evils kill sleeping monsters. XOnly david can find the zoo! XOnly real trappers escape traps. XOnly real wizards can write scrolls. XOnly wizards are able to zap a wand. XOpening a tin is difficult, especially when you are not so strong! XOpening a tin is difficult, especially when you attempt this bare handed! XOperation coded OVERKILL has started now. XOrcs and killer bees share their lifestyle. XOrcs do not procreate in dark rooms. XPLEASE ignore previous rumour. XPlain nymphs are harmless. XPlaying billiards pays when you are in a shop. XPolymorphing your dog probably makes you safer. XPraying will frighten Demons. XPunishment is a thing you call over yourself. So why complain? XPursue the monsters and you will be had indeed. XPut on a ring of teleportation: it will take you away from onslaught. XRays aren't boomerangs, of course, but still... XRead the manual before entering the cave - You might get killed otherwise. XReading Herbert will disgust you, but in one case it might be enlightening. XReading Tolkien might help you. XReading might change your vision. XReading might improve your scope. XRelying on a dog might turn you in a dog addict. XReward your doggie with a giant Bat. XRopes are made from the long, blond hairs of dead Nymphs. XRow (3x) that boat gently down the stream, Charon (4x), death is but a dream. XRunning is good for your legs. XRust monsters love water. There are potions they hate, however. XSavings do include amnesia. XScorpions often hide under tripe rations. XScrew up your courage! You've screwed up everything else. XScrolls of fire are useful against fog clouds. XSecond Law of Hacking: first in, first out. XSelling and rebuying a wand will recharge it. XShopkeepers accept creditcards, as long as you pay cash. XShopkeepers are vegetarians: they only eat Swedes. XShopkeepers can't read, so what use is engraving in a shop? XShopkeepers can't swim. XShopkeepers have incredible patience. XShopkeepers often have strange names. XShopkeepers sometimes die from old age. XSleeping may increase your strength. XSnakes are often found under worthless objects. XSome Balrogs don't attack if you offer them a ring. XSome mazes (especially small ones) have no solutions, says man 6 maze. XSome monsters can be tamed. I once saw a hacker with a tame Dragon! XSome potions are quite mind-expanding. XSome questions Sphynxes ask just *don't* have any answers. XSometimes "mu" is the answer. XSometimes monsters are more likely to fight each other than attack you. XSorry, no fortune this time. Better luck next cookie! XSpare your scrolls of make-edible until it's really necessary! XSpeed Kills (The Doors) XSpinach, carrot, and a melon - a meal fit for a nurse! XStay clear of the level of no return. XSuddenly the dungeon will collapse ... XSurprise your dog with an acid blob! XTainted meat is even more sickening than poison! XTake a long worm from the rear, according to its mate it's a lot more fun. XTame a troll and it will learn you fighting. XTaming a postman may cause a system security violation. XTaming is a gradual process of excercising and rewarding. XTelepathy is just a trick: once you know how to do it, it's easy. XTeleportation lessens your orientation. XThe "pray" command is not yet implemented. XThe Gods are angry with you... XThe Gods seem to be pleased with you... XThe Jackal only eats bad food. XThe Leprechaun Gold Tru$t is no division of the Magic Memory Vault. XThe Leprechauns hide their treasure in a small hidden room. XThe air is positively magic in here. Better wear a negative armor. XThe best equipment for your work is, of course, the most expensive. XThe emptiness of a ghost is too heavy to bear. XThe key to this game is that there are no keys. XThe longer the wand the better. XThe moon is not the only heavenly body to influence this game. XThe postman always rings twice. XThe proof of the quivering blob is in the eating thereof. XThe secret of wands of Nothing Happens: try again! XThe use of dynamite is dangerous. XThere are better information sources than fortune cookies. XThere are monsters of softening penetration. XThere are monsters of striking charity. XThere have been people like you in here; their ghosts seek revenge on you. XThere is a VIP-lounge on this level. Only first-class travellers admitted. XThere is a big treasure hidden in the zoo! XThere is a message concealed in each fortune cookie. XThere is a trap on this level! XThere is more magic in this cave than meets the eye. XThere is no business like throw business. XThere is no harm in praising a large dog. XThere is nothing like eating a Mimic. XThere seem to be monsters of touching benevolence. XThey say a gelatinous cube can paralyse you... XThey say that Elven cloaks absorb enchantments. XThey say that a dagger hits. XThey say that a dog avoids traps. XThey say that a dog can be trained to fetch objects. XThey say that a dog never steps on a cursed object. XThey say that a spear will hit a Dragon. XThey say that a spear will hit a Xorn. XThey say that a spear will hit a neo-otyugh. (Do YOU know what that is?) XThey say that a spear will hit an ettin. XThey say that a two-handed sword misses. XThey say that a unicorn might bring you luck. XThey say that an elven cloak may be worn over your armor. XThey say that an elven cloak protects against magic. XThey say that cavemen seldom find tins in the dungeon. XThey say that dead lizards protect against a cockatrice. XThey say that killing a shopkeeper brings bad luck. XThey say that monsters never step on a scare monster scroll. XThey say that only david can find the zoo! XThey say that shopkeepers often have a large amount of money in their purse. XThey say that the owner of the dungeon might change it slightly. XThey say that the use of dynamite is dangerous. XThey say that the walls in shops are made of extra hard material. XThey say that there is a big treasure hidden in the zoo! XThey say that there is a message concealed in each fortune cookie. XThey say that there is a trap on this level! XThey say that throwing food at a wild dog might tame him. XThey say that you can meet old friends in the caves. XThey say that you can't take your pick-axe into a shop. XThey say that you cannot trust scrolls of rumour. XThey say that you need a key in order to open locked doors. XThey say the Gods don't listen if you pray too much. XThey say the Gods get angry if you kill your dog. XThey say the Gods get angry if you pray too much. XThird Law of Hacking: the last blow counts most. XThis dungeon is restroom equipped (for your convenience). XThis fortune cookie is property of Fortune Cookies, Inc. XThis is not a fortune. XThis is the Leprechaun Law: every purse has a price. XThrowing food at a wild dog might tame him. XTin openers are rare indeed. XTired of irritating bats? Try a scroll of silence. XTo hit or not to hit, that is the question. XTo reach heaven, escape the dungeon while wearing a ring of levitation. XTranquillizers might get you killed. XTravel fast, use some magic speed! XTripe on its own is revolting, but with onions it's delicious! XTry hacking in the wee hours: you will have more room. XTry the fall back end run play against ghosts. XUlch, that meat was painted. XUnwanted mail? Sell it to the bookshop! XVampires hate garlic. XVault guards always make sure you aren't a shopkeeper. XVault guards never disturb their Lords. XVisitors are requested not to apply genocide to shopkeepers. XWARNING from H.M. Govt: Quaffing may be dangerous to your health. XWanna fly? Eat a bat. XWant a hint? Zap a wand of make invisible on your weapon! XWant fun? Throw a potion in a pool and go swimming! XWant to conserve your dead corpses? Go to the tin factory! XWanted: shopkeepers. Send a scroll of mail to: Mage of Yendor/Level 35/Dungeon. XWarning: end of file 'fortunes' reached. XWarning: people who eat dragons can go to hell!! XWatch your steps on staircases. XWear armor, going naked seems to offend public decency in here. XWhat a pity, you cannot read it! XWhat do you think is the use of dead lizards? XWhat do you think would be the use of a two handed sword called "Orcrist" ? XWhen a piercer drops in on you, you will be tempted to hit the ceiling! XWhen in a maze follow the right wall and you will never get lost. XWhen in a shop, do as shopkeepers do. XWhen punished, watch your steps on the stairs! XWhen you have a key, you don't have to wait for the guard. XWhen you have seen one killer bee, you have seen them all. XWhen your dog follows you through a trap door, don't hit it! XWhere do you think all those demons come from? From Hell, of course. XWhere do you think the hell is located? It must be deep, deep down. XWho should ever have thought one could live from eating fog clouds? XWhy a "2" for the postman? Well, how many times does he ring? XWhy should one ever throw an egg to a cockatrice? XWhy would anybody in his sane mind engrave "Elbereth" ? XWish for a master key and open the Magic Memory Vault! XWish for a pass-key and pass all obstacles! XWish for a skeleton-key and open all doors! XWishing too much may bring you too little. XWizards do not sleep. XYou are heading for head-stone for sure. XYou are just the kind of bad food some monsters like to digest. XYou can always wear an elven cloak. XYou can eat what your dog can eat. XYou can get a genuine Amulet of Yendor by doing the following: -- more -- XYou can't get rid of a cursed plate mail with a can-opener. XYou can't leave a shop through the back door: there ain't one! XYou cannot ride a long worm. XYou cannot trust scrolls of rumour. XYou die... XYou feel greedy and want more gold? Why don't you try digging? XYou feel like someone is pulling your leg. XYou have to outwit a Sphynx or pay her. XYou may get rich selling letters, but beware of being blackmailed! XYou may have a kick from kicking a little dog. XYou might choke on your food by eating fortune cookies. XYou might cut yourself on a long sword. XYou might trick a shopkeeper if you're invisible. XYou need a key in order to open locked doors. XYou offend Shai-Hulud by sheathing your crysknife without having drawn blood. XYou want to regain strength? Two levels ahead is a guesthouse! XYou'll need a spear if you want to attack a Dragon. XYou've got to know how to put out a yellow light. XYour dog can buy cheaper than you do. XZapping a wand of Nothing Happens doesn't harm you a bit. XZapping a wand of undead turning might bring your dog back to life. END_OF_rumors.base if test 25326 -ne `wc -c shk.c <<'END_OF_shk.c' X/* SCCS Id: @(#)shk.c 1.3 87/07/14 X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ X/* shk.c - version 1.0.3 */ X X#include "hack.h" X#ifdef QUEST Xint shlevel = 0; Xstruct monst *shopkeeper = 0; Xstruct obj *billobjs = 0; Xobfree(obj,merge) register struct obj *obj, *merge; { X free((char *) obj); X} Xinshop(){ return(0); } Xaddtobill(){} Xsubfrombill(){} Xsplitbill(){} Xdopay(){ return(0); } Xpaybill(){} Xdoinvbill(){ return(0); } Xshkdead(){} Xshkcatch(){ return(0); } Xshk_move(){ return(0); } Xreplshk(mtmp,mtmp2) struct monst *mtmp, *mtmp2; {} Xchar *shkname(){ return(""); } X X#else X#include "mfndpos.h" X#include "mkroom.h" X#include "eshk.h" X X#define ESHK(mon) ((struct eshk *)(&(mon->mextra[0]))) X#define NOTANGRY(mon) mon->mpeaceful X#define ANGRY(mon) !NOTANGRY(mon) X Xextern char plname[], *xname(); Xextern struct obj *o_on(), *bp_to_obj(); X X/* Descriptor of current shopkeeper. Note that the bill need not be X per-shopkeeper, since it is valid only when in a shop. */ Xstatic struct monst *shopkeeper = 0; Xstatic struct bill_x *bill; Xstatic int shlevel = 0; /* level of this shopkeeper */ X struct obj *billobjs; /* objects on bill with bp->useup */ X /* only accessed here and by save & restore */ Xstatic long int total; /* filled by addupbill() */ Xstatic long int followmsg; /* last time of follow message */ Xstatic setpaid(), findshk(), dopayobj(), getprice(), realhunger(); X X/* X invariants: obj->unpaid iff onbill(obj) [unless bp->useup] X obj->quan <= bp->bquan X */ X X Xchar shtypes[] = { /* 9 shoptypes: 8 specialized, 1 mixed */ X RING_SYM, WAND_SYM, X#ifdef SPELLS X SPBOOK_SYM, X#endif X WEAPON_SYM, FOOD_SYM, SCROLL_SYM, POTION_SYM, ARMOR_SYM, 0 X}; Xchar *shopnam[] = { X "engagement ring", "walking cane", X#ifdef SPELLS X "rare book", X#endif X "antique weapon", "delicatessen", "second hand book", X "liquor", "used armor", "assorted antiques" X}; X Xchar * Xshkname(mtmp) /* called in do_name.c */ Xregister struct monst *mtmp; X{ X return(ESHK(mtmp)->shknam); X} X Xshkdead(mtmp) /* called in mon.c */ Xregister struct monst *mtmp; X{ X register struct eshk *eshk = ESHK(mtmp); X X if(eshk->shoplevel == dlevel) X rooms[eshk->shoproom].rtype = 0; X if(mtmp == shopkeeper) { X setpaid(); X shopkeeper = 0; X bill = (struct bill_x *) -1000; /* dump core when referenced */ X } X} X Xreplshk(mtmp,mtmp2) Xregister struct monst *mtmp, *mtmp2; X{ X if(mtmp == shopkeeper) { X shopkeeper = mtmp2; X bill = &(ESHK(shopkeeper)->bill[0]); X } X} X Xstatic Xsetpaid(){ /* caller has checked that shopkeeper exists */ X /* either we paid or left the shop or he just died */ Xregister struct obj *obj; Xregister struct monst *mtmp; X for(obj = invent; obj; obj = obj->nobj) X obj->unpaid = 0; X for(obj = fobj; obj; obj = obj->nobj) X obj->unpaid = 0; X for(obj = fcobj; obj; obj = obj->nobj) X obj->unpaid = 0; X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) X for(obj = mtmp->minvent; obj; obj = obj->nobj) X obj->unpaid = 0; X for(mtmp = fallen_down; mtmp; mtmp = mtmp->nmon) X for(obj = mtmp->minvent; obj; obj = obj->nobj) X obj->unpaid = 0; X while(obj = billobjs){ X billobjs = obj->nobj; X free((char *) obj); X } X ESHK(shopkeeper)->billct = 0; X} X Xstatic Xaddupbill(){ /* delivers result in total */ X /* caller has checked that shopkeeper exists */ Xregister ct = ESHK(shopkeeper)->billct; Xregister struct bill_x *bp = bill; X total = 0; X while(ct--){ X total += bp->price * bp->bquan; X bp++; X } X} X Xinshop(){ Xregister roomno = inroom(u.ux,u.uy); X X /* Did we just leave a shop? */ X if(u.uinshop && X (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { X X /* This is part of the bugfix for shopkeepers not having their X * bill paid. As reported by ab@unido -dgk X * I made this standard due to the KOPS code below. -mrs X */ X if(shopkeeper) { X if(ESHK(shopkeeper)->billct) { X if(inroom(shopkeeper->mx, shopkeeper->my) X == u.uinshop - 1) /* ab@unido */ X pline("Somehow you escaped the shop without paying!"); X addupbill(); X pline("You stole for a total worth of %ld zorkmids.", X total); X ESHK(shopkeeper)->robbed += total; X#ifdef KOPS X /* Keystone Kops srt@ucla */ X pline("An alarm sounds throughout the dungeon!"); X pline("The Kops are after you!"); X#endif X setpaid(); X if((rooms[ESHK(shopkeeper)->shoproom].rtype == GENERAL) X == (rn2(3) == 0)) X ESHK(shopkeeper)->following = 1; X#ifdef KOPS X { X coord enexto(); X coord mm; X register int cnt = dlevel + rnd(3); X /* Create a swarm near the staircase */ X mm.x = xdnstair; X mm.y = ydnstair; X while(cnt--) { X mm = enexto(mm.x, mm.y); X (void) mkmon_at('K', mm.x, mm.y); X } X /* Create a swarm near the shopkeeper */ X cnt = dlevel + rnd(3); X mm.x = shopkeeper->mx; X mm.y = shopkeeper->my; X while(cnt--) { X mm = enexto(mm.x, mm.y); X (void) mkmon_at('K', mm.x, mm.y); X } X } X#endif X } X shopkeeper = 0; X shlevel = 0; X } X u.uinshop = 0; X } X X /* Did we just enter a zoo of some kind? */ X if(roomno >= 0) { X register int rt = rooms[roomno].rtype; X register struct monst *mtmp; X if(rt == ZOO) { X pline("Welcome to David's treasure zoo!"); X } else X if(rt == SWAMP) { X pline("It looks rather muddy down here."); X } else X if(rt == COURT) { X pline("You are in an opulant throne room!"); X } else X if(rt == MORGUE) { X if(midnight()) X pline("Go away! Go away!"); X else X pline("You get an uncanny feeling ..."); X } else X rt = 0; X if(rt != 0) { X rooms[roomno].rtype = 0; X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) X if(rt != ZOO || !rn2(3)) X mtmp->msleep = 0; X } X } X X /* Did we just enter a shop? */ X if(roomno >= 0 && rooms[roomno].rtype >= 8) { X if(shlevel != dlevel || !shopkeeper X || ESHK(shopkeeper)->shoproom != roomno) X findshk(roomno); X if(!shopkeeper) { X rooms[roomno].rtype = 0; X u.uinshop = 0; X } else if(!u.uinshop){ X if(!ESHK(shopkeeper)->visitct || X strncmp(ESHK(shopkeeper)->customer, plname, PL_NSIZ)){ X X /* He seems to be new here */ X ESHK(shopkeeper)->visitct = 0; X ESHK(shopkeeper)->following = 0; X (void) strncpy(ESHK(shopkeeper)->customer,plname,PL_NSIZ); X NOTANGRY(shopkeeper) = 1; X } X if(!ESHK(shopkeeper)->following) { X boolean box, pick; X X pline("Hello %s! Welcome%s to %s's %s shop!", X plname, X ESHK(shopkeeper)->visitct++ ? " again" : "", X shkname(shopkeeper), X shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8] ); X box = carrying(ICE_BOX); X pick = carrying(PICK_AXE); X if(box || pick) { X if(dochug(shopkeeper)) { X u.uinshop = 0; /* he died moving */ X return(0); X } X pline("Will you please leave your %s outside?", X (box && pick) ? "box and pick-axe" : X box ? "box" : "pick-axe"); X } X } X u.uinshop = roomno + 1; X } X } X return(u.uinshop); X} X Xstatic Xfindshk(roomno) Xregister roomno; X{ Xregister struct monst *mtmp; X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) X if(mtmp->isshk && ESHK(mtmp)->shoproom == roomno X && ESHK(mtmp)->shoplevel == dlevel) { X shopkeeper = mtmp; X bill = &(ESHK(shopkeeper)->bill[0]); X shlevel = dlevel; X if(ANGRY(shopkeeper) && X strncmp(ESHK(shopkeeper)->customer,plname,PL_NSIZ)) X NOTANGRY(shopkeeper) = 1; X /* billobjs = 0; -- this is wrong if we save in a shop */ X /* (and it is harmless to have too many things in billobjs) */ X return; X } X shopkeeper = 0; X shlevel = 0; X bill = (struct bill_x *) -1000; /* dump core when referenced */ X} X Xstatic struct bill_x * Xonbill(obj) register struct obj *obj; { Xregister struct bill_x *bp; X if(!shopkeeper) return(0); X for(bp = bill; bp < &bill[ESHK(shopkeeper)->billct]; bp++) X if(bp->bo_id == obj->o_id) { X if(!obj->unpaid) pline("onbill: paid obj on bill?"); X return(bp); X } X if(obj->unpaid) pline("onbill: unpaid obj not on bill?"); X return(0); X} X X/* called with two args on merge */ Xobfree(obj,merge) register struct obj *obj, *merge; { Xregister struct bill_x *bp = onbill(obj); Xregister struct bill_x *bpm; X if(bp) { X if(!merge){ X bp->useup = 1; X obj->unpaid = 0; /* only for doinvbill */ X obj->nobj = billobjs; X billobjs = obj; X return; X } X bpm = onbill(merge); X if(!bpm){ X /* this used to be a rename */ X impossible("obfree: not on bill??"); X return; X } else { X /* this was a merger */ X bpm->bquan += bp->bquan; X ESHK(shopkeeper)->billct--; X *bp = bill[ESHK(shopkeeper)->billct]; X } X } X free((char *) obj); X} X Xstatic Xpay(tmp,shkp) Xlong tmp; Xregister struct monst *shkp; X{ X long robbed = ESHK(shkp)->robbed; X X u.ugold -= tmp; X shkp->mgold += tmp; X flags.botl = 1; X if(robbed) { X robbed -= tmp; X if(robbed < 0) robbed = 0; X ESHK(shkp)->robbed = robbed; X } X} X Xdopay(){ Xlong ltmp; Xregister struct bill_x *bp; Xregister struct monst *shkp; Xint pass, tmp; X X multi = 0; X (void) inshop(); X for(shkp = fmon; shkp; shkp = shkp->nmon) X if(shkp->isshk && dist(shkp->mx,shkp->my) < 3) X break; X if(!shkp && u.uinshop && X inroom(shopkeeper->mx,shopkeeper->my) == ESHK(shopkeeper)->shoproom) X shkp = shopkeeper; X X if(!shkp) { X pline("There is nobody here to receive your payment."); X return(0); X } X ltmp = ESHK(shkp)->robbed; X if(shkp != shopkeeper && NOTANGRY(shkp)) { X if(!ltmp) { X pline("You do not owe %s anything.", monnam(shkp)); X } else X if(!u.ugold) { X pline("You have no money."); X } else { X long ugold = u.ugold; X X if(u.ugold > ltmp) { X pline("You give %s the %ld gold pieces %s asked for.", X monnam(shkp), ltmp, index("@CGHKLOQTVWZ&ehimt", shkp->data->mlet) X ? "he" : (index("nN", shkp->data->mlet) ? "she" : "it")); X pay(ltmp, shkp); X } else { X pline("You give %s all your gold.", monnam(shkp)); X pay(u.ugold, shkp); X } X if(ugold < ltmp/2) { X pline("Unfortunately, %s doesn't look satisfied.", X index("@CGHKLOQTVWZ&ehimt", shkp->data->mlet) X ? "he" : (index("nN", shkp->data->mlet) ? "she" : "it")); X } else { X ESHK(shkp)->robbed = 0; X ESHK(shkp)->following = 0; X if(ESHK(shkp)->shoplevel != dlevel) { X /* For convenience's sake, let him disappear */ X shkp->minvent = 0; /* %% */ X shkp->mgold = 0; X mondead(shkp); X } X } X } X return(1); X } X X if(!ESHK(shkp)->billct){ X pline("You do not owe %s anything.", monnam(shkp)); X if(!u.ugold){ X pline("Moreover, you have no money."); X return(1); X } X if(ESHK(shkp)->robbed){ X pline("But since %s shop has been robbed recently,", X index("@CGHKLOQTVWZ&ehimt", shkp->data->mlet) X ? "his" : (index("nN", shkp->data->mlet) ? "her" : "its")); X pline("you %srepay %s's expenses.", X (u.ugold < ESHK(shkp)->robbed) ? "partially " : "", X monnam(shkp)); X pay(min(u.ugold, ESHK(shkp)->robbed), shkp); X ESHK(shkp)->robbed = 0; X return(1); X } X if(ANGRY(shkp)){ X pline("But in order to appease %s,", X amonnam(shkp, "angry")); X if(u.ugold >= 1000){ X ltmp = 1000; X pline(" you give %s 1000 gold pieces.", X index("@CGHKLOQTVWZ&ehimt", shkp->data->mlet) X ? "him" : (index("nN", shkp->data->mlet) ? "her" : "it")); X } else { X ltmp = u.ugold; X pline(" you give %s all your money.", X index("@CGHKLOQTVWZ&ehimt", shkp->data->mlet) X ? "him" : (index("nN", shkp->data->mlet) ? "her" : "it")); X } X pay(ltmp, shkp); X if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ) X || rn2(3)){ X pline("%s calms down.", Monnam(shkp)); X NOTANGRY(shkp) = 1; X } else pline("%s is as angry as ever.", X Monnam(shkp)); X } X return(1); X } X if(shkp != shopkeeper) { X impossible("dopay: not to shopkeeper?"); X if(shopkeeper) setpaid(); X return(0); X } X for(pass = 0; pass <= 1; pass++) { X tmp = 0; X while(tmp < ESHK(shopkeeper)->billct) { X bp = &bill[tmp]; X if(!pass && !bp->useup) { X tmp++; X continue; X } X if(!dopayobj(bp)) return(1); X#ifdef MSDOS X *bp = bill[--ESHK(shopkeeper)->billct]; X#else X bill[tmp] = bill[--ESHK(shopkeeper)->billct]; X#endif /* MSDOS /**/ X } X } X pline("Thank you for shopping in %s's %s store!", X shkname(shopkeeper), X shopnam[rooms[ESHK(shopkeeper)->shoproom].rtype - 8]); X NOTANGRY(shopkeeper) = 1; X return(1); X} X X/* return 1 if paid successfully */ X/* 0 if not enough money */ X/* -1 if object could not be found (but was paid) */ Xstatic Xdopayobj(bp) register struct bill_x *bp; { Xregister struct obj *obj; Xlong ltmp; X X /* find the object on one of the lists */ X obj = bp_to_obj(bp); X X if(!obj) { X impossible("Shopkeeper administration out of order."); X setpaid(); /* be nice to the player */ X return(0); X } X X if(!obj->unpaid && !bp->useup){ X impossible("Paid object on bill??"); X return(1); X } X obj->unpaid = 0; X ltmp = bp->price * bp->bquan; X if(ANGRY(shopkeeper)) ltmp += ltmp/3; X if(u.ugold < ltmp){ X pline("You don't have gold enough to pay %s.", X doname(obj)); X obj->unpaid = 1; X return(0); X } X pay(ltmp, shopkeeper); X pline("You bought %s for %ld gold piece%s.", X doname(obj), ltmp, plur(ltmp)); X if(bp->useup) { X register struct obj *otmp = billobjs; X if(obj == billobjs) X billobjs = obj->nobj; X else { X while(otmp && otmp->nobj != obj) otmp = otmp->nobj; X if(otmp) otmp->nobj = obj->nobj; X else pline("Error in shopkeeper administration."); X } X free((char *) obj); X } X return(1); X} X X/* routine called after dying (or quitting) with nonempty bill */ Xpaybill(){ X if(shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct){ X addupbill(); X if(total > u.ugold){ X shopkeeper->mgold += u.ugold; X u.ugold = 0; X pline("%s comes and takes all your possessions.", X Monnam(shopkeeper)); X } else { X u.ugold -= total; X shopkeeper->mgold += total; X pline("%s comes and takes the %ld zorkmids you owed him.", X Monnam(shopkeeper), total); X } X setpaid(); /* in case we create bones */ X } X} X X/* find obj on one of the lists */ Xstruct obj * Xbp_to_obj(bp) Xregister struct bill_x *bp; X{ X register struct obj *obj; X register struct monst *mtmp; X register unsigned id = bp->bo_id; X X if(bp->useup) X obj = o_on(id, billobjs); X else if(!(obj = o_on(id, invent)) && X !(obj = o_on(id, fobj)) && X !(obj = o_on(id, fcobj))) { X for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) X if(obj = o_on(id, mtmp->minvent)) X break; X for(mtmp = fallen_down; mtmp; mtmp = mtmp->nmon) X if(obj = o_on(id, mtmp->minvent)) X break; X } X return(obj); X} X X/* called in hack.c when we pickup an object */ Xaddtobill(obj) register struct obj *obj; { Xregister struct bill_x *bp; X if(!inshop() || X (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) || X (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y) || X onbill(obj) /* perhaps we threw it away earlier */ X ) return; X if(ESHK(shopkeeper)->billct == BILLSZ){ X pline("You got that for free!"); X return; X } X#ifdef DGKMOD X /* To recognize objects the showkeeper is not interested in. -dgk X */ X if (obj->no_charge) { X obj->no_charge = 0; X return; X } X#endif X bp = &bill[ESHK(shopkeeper)->billct]; X bp->bo_id = obj->o_id; X bp->bquan = obj->quan; X bp->useup = 0; X bp->price = getprice(obj); X ESHK(shopkeeper)->billct++; X obj->unpaid = 1; X} X Xsplitbill(obj,otmp) register struct obj *obj, *otmp; { X /* otmp has been split off from obj */ Xregister struct bill_x *bp; Xregister int tmp; X bp = onbill(obj); X if(!bp) { X impossible("splitbill: not on bill?"); X return; X } X if(bp->bquan < otmp->quan) { X impossible("Negative quantity on bill??"); X } X if(bp->bquan == otmp->quan) { X impossible("Zero quantity on bill??"); X } X bp->bquan -= otmp->quan; X X /* addtobill(otmp); */ X if(ESHK(shopkeeper)->billct == BILLSZ) otmp->unpaid = 0; X else { X tmp = bp->price; X bp = &bill[ESHK(shopkeeper)->billct]; X bp->bo_id = otmp->o_id; X bp->bquan = otmp->quan; X bp->useup = 0; X bp->price = tmp; X ESHK(shopkeeper)->billct++; X } X} X Xsubfrombill(obj) register struct obj *obj; { Xlong ltmp; Xregister int tmp; Xregister struct obj *otmp; Xregister struct bill_x *bp; X if(!inshop() || (u.ux == ESHK(shopkeeper)->shk.x && u.uy == ESHK(shopkeeper)->shk.y) || X (u.ux == ESHK(shopkeeper)->shd.x && u.uy == ESHK(shopkeeper)->shd.y)) X return; X if((bp = onbill(obj)) != 0){ X obj->unpaid = 0; X if(bp->bquan > obj->quan){ X otmp = newobj(0); X *otmp = *obj; X bp->bo_id = otmp->o_id = flags.ident++; X otmp->quan = (bp->bquan -= obj->quan); X otmp->owt = 0; /* superfluous */ X otmp->onamelth = 0; X bp->useup = 1; X otmp->nobj = billobjs; X billobjs = otmp; X return; X } X ESHK(shopkeeper)->billct--; X *bp = bill[ESHK(shopkeeper)->billct]; X return; X } X if(obj->unpaid){ X pline("%s didn't notice.", Monnam(shopkeeper)); X obj->unpaid = 0; X return; /* %% */ X } X /* he dropped something of his own - probably wants to sell it */ X if(shopkeeper->msleep || shopkeeper->mfroz || X inroom(shopkeeper->mx,shopkeeper->my) != ESHK(shopkeeper)->shoproom) X return; X if(ESHK(shopkeeper)->billct == BILLSZ || X ((tmp = shtypes[rooms[ESHK(shopkeeper)->shoproom].rtype-8]) && tmp != obj->olet) X || index("_0", obj->olet)) { X pline("%s seems not interested.", Monnam(shopkeeper)); X#ifdef DGKMOD X obj->no_charge = 1; X#endif X return; X } X ltmp = getprice(obj) * obj->quan; X if(ANGRY(shopkeeper)) { X ltmp /= 3; X NOTANGRY(shopkeeper) = 1; X } else ltmp /= 2; X if(ESHK(shopkeeper)->robbed){ X if((ESHK(shopkeeper)->robbed -= ltmp) < 0) X ESHK(shopkeeper)->robbed = 0; Xpline("Thank you for your contribution to restock this recently plundered shop."); X return; X } X if(ltmp > shopkeeper->mgold) X ltmp = shopkeeper->mgold; X pay(-ltmp, shopkeeper); X if(!ltmp) { X pline("%s gladly accepts %s but cannot pay you at present.", X Monnam(shopkeeper), doname(obj)); X#ifdef DGKMOD X obj->no_charge = 1; X#endif X } else X pline("You sold %s and got %ld gold piece%s.", doname(obj), ltmp, X plur(ltmp)); X} X Xdoinvbill(mode) Xint mode; /* 0: deliver count 1: paged */ X{ X register struct bill_x *bp; X register struct obj *obj; X long totused, thisused; X char buf[BUFSZ]; X X if(mode == 0) { X register int cnt = 0; X X if(shopkeeper) X for(bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++) X if(bp->useup || X ((obj = bp_to_obj(bp)) && obj->quan < bp->bquan)) X cnt++; X return(cnt); X } X X if(!shopkeeper) { X impossible("doinvbill: no shopkeeper?"); X return(0); X } X X set_pager(0); X if(page_line("Unpaid articles already used up:") || page_line("")) X goto quit; X X totused = 0; X for(bp = bill; bp - bill < ESHK(shopkeeper)->billct; bp++) { X obj = bp_to_obj(bp); X if(!obj) { X impossible("Bad shopkeeper administration."); X goto quit; X } X if(bp->useup || bp->bquan > obj->quan) { X register int cnt, oquan, uquan; X X oquan = obj->quan; X uquan = (bp->useup ? bp->bquan : bp->bquan - oquan); X thisused = bp->price * uquan; X totused += thisused; X obj->quan = uquan; /* cheat doname */ X (void) sprintf(buf, "x - %s", doname(obj)); X obj->quan = oquan; /* restore value */ X for(cnt = 0; buf[cnt]; cnt++); X while(cnt < 50) X buf[cnt++] = ' '; X (void) sprintf(&buf[cnt], " %5ld zorkmids", thisused); X if(page_line(buf)) X goto quit; X } X } X (void) sprintf(buf, "Total:%50ld zorkmids", totused); X if(page_line("") || page_line(buf)) X goto quit; X set_pager(1); X return(0); Xquit: X set_pager(2); X return(0); X} X Xstatic Xgetprice(obj) register struct obj *obj; { Xregister int tmp, ac; X switch(obj->olet){ X case AMULET_SYM: X tmp = 10*rnd(500); X break; X case TOOL_SYM: X tmp = 10*rnd((obj->otyp == EXPENSIVE_CAMERA) ? 150 : X#ifdef MARKER X (obj->otyp == MAGIC_MARKER) ? 100 : X#endif X 30); X break; X case RING_SYM: X tmp = 10*rnd(100); X break; X case WAND_SYM: X tmp = 10*rnd(100); X break; X case SCROLL_SYM: X tmp = 10*rnd(50); X#ifdef MAIL X if(obj->otyp == SCR_MAIL) X tmp = rnd(5); X#endif X break; X case POTION_SYM: X tmp = 10*rnd(50); X break; X#ifdef SPELLS X case SPBOOK_SYM: X tmp = 10*rnd(200); X break; X#endif X case FOOD_SYM: X tmp = 10*rnd(5 + (2000/realhunger())); X break; X case GEM_SYM: X tmp = 10*rnd(20); X break; X case ARMOR_SYM: X ac = ARM_BONUS(obj); X if(ac <= -10) /* probably impossible */ X ac = -9; X tmp = 100 + ac*ac*rnd(10+ac); X break; X case WEAPON_SYM: X if(obj->otyp < BOOMERANG) X tmp = 5*rnd(10); X else if(obj->otyp == KATANA) X tmp = 10*rnd(200); X else if(obj->otyp == LONG_SWORD || X obj->otyp == TWO_HANDED_SWORD) X tmp = 10*rnd(150); X else tmp = 10*rnd(75); X break; X case CHAIN_SYM: X pline("Strange ..., carrying a chain?"); X case BALL_SYM: X tmp = 10; X break; X default: X tmp = 10000; X } X return(tmp); X} X Xstatic Xrealhunger(){ /* not completely foolproof */ Xregister tmp = u.uhunger; Xregister struct obj *otmp = invent; X while(otmp){ X if(otmp->olet == FOOD_SYM && !otmp->unpaid) X tmp += objects[otmp->otyp].nutrition; X otmp = otmp->nobj; X } X return((tmp <= 0) ? 1 : tmp); X} X Xshkcatch(obj) Xregister struct obj *obj; X{ X register struct monst *shkp = shopkeeper; X X if(u.uinshop && shkp && !shkp->mfroz && !shkp->msleep && X u.dx && u.dy && X inroom(u.ux+u.dx, u.uy+u.dy) + 1 == u.uinshop && X shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y && X u.ux == ESHK(shkp)->shd.x && u.uy == ESHK(shkp)->shd.y) { X pline("%s nimbly catches the %s.", Monnam(shkp), xname(obj)); X obj->nobj = shkp->minvent; X shkp->minvent = obj; X return(1); X } X return(0); X} X X/* X * shk_move: return 1: he moved 0: he didnt -1: let m_move do it X */ Xshk_move(shkp) Xregister struct monst *shkp; X{ X register struct monst *mtmp; X register struct permonst *mdat = shkp->data; X register xchar gx,gy,omx,omy,nx,ny,nix,niy; X register schar appr,i; X register int udist; X int z; X schar shkroom,chi,chcnt,cnt; X boolean uondoor, satdoor, avoid, badinv; X coord poss[9]; X long info[9]; X struct obj *ib = 0; X X omx = shkp->mx; X omy = shkp->my; X X if((udist = dist(omx,omy)) < 3) { X if(ANGRY(shkp)) { X (void) hitu(shkp, d(mdat->damn, mdat->damd)+1); X return(0); X } X if(ESHK(shkp)->following) { X if(strncmp(ESHK(shkp)->customer, plname, PL_NSIZ)){ X pline("Hello %s! I was looking for %s.", X plname, ESHK(shkp)->customer); X ESHK(shkp)->following = 0; X return(0); X } X if(!ESHK(shkp)->robbed) { /* impossible? */ X ESHK(shkp)->following = 0; X return(0); X } X if(moves > followmsg+4) { X pline("Hello %s! Didn't you forget to pay?", X plname); X followmsg = moves; X } X if(udist < 2) X return(0); X } X } X X shkroom = inroom(omx,omy); X appr = 1; X gx = ESHK(shkp)->shk.x; X gy = ESHK(shkp)->shk.y; X satdoor = (gx == omx && gy == omy); X if(ESHK(shkp)->following || ((z = holetime()) >= 0 && z*z <= udist)){ X gx = u.ux; X gy = u.uy; X if(shkroom < 0 || shkroom != inroom(u.ux,u.uy)) X if(udist > 4) X return(-1); /* leave it to m_move */ X } else if(ANGRY(shkp)) { X long saveBlind = Blind; X Blind = 0; X if(shkp->mcansee && !Invis && cansee(omx,omy)) { X gx = u.ux; X gy = u.uy; X } X Blind = saveBlind; X avoid = FALSE; X } else { X#define GDIST(x,y) ((x-gx)*(x-gx)+(y-gy)*(y-gy)) X if(Invis) X avoid = FALSE; X else { X uondoor = (u.ux == ESHK(shkp)->shd.x && X u.uy == ESHK(shkp)->shd.y); X if(uondoor) { X if(ESHK(shkp)->billct) X pline("Hello %s! Will you please pay before leaving?", X plname); X badinv = (carrying(PICK_AXE) || carrying(ICE_BOX)); X if(satdoor && badinv) X return(0); X avoid = !badinv; X } else { X avoid = (u.uinshop && dist(gx,gy) > 8); X badinv = FALSE; X } X X if(((!ESHK(shkp)->robbed && !ESHK(shkp)->billct) || avoid) X && GDIST(omx,omy) < 3){ X if(!badinv && !online(omx,omy)) X return(0); X if(satdoor) X appr = gx = gy = 0; X } X } X } X if(omx == gx && omy == gy) X return(0); X if(shkp->mconf) { X avoid = FALSE; X appr = 0; X } X nix = omx; X niy = omy; X cnt = mfndpos(shkp,poss,info,ALLOW_SSM); X if(avoid && uondoor) { /* perhaps we cannot avoid him */ X for(i=0; ishoproom X || ESHK(shkp)->following) { X#ifdef STUPID X /* cater for stupid compilers */ X register int zz; X#endif X if(uondoor && (ib = sobj_at(ICE_BOX, nx, ny))) { X nix = nx; niy = ny; chi = i; break; X } X if(avoid && (info[i] & NOTONL)) X continue; X if((!appr && !rn2(++chcnt)) || X#ifdef STUPID X (appr && (zz = GDIST(nix,niy)) && zz > GDIST(nx,ny)) X#else X (appr && GDIST(nx,ny) < GDIST(nix,niy)) X#endif X ) { X nix = nx; X niy = ny; X chi = i; X } X } X } X if(nix != omx || niy != omy){ X if(info[chi] & ALLOW_M){ X mtmp = m_at(nix,niy); X if(hitmm(shkp,mtmp) == 1 && rn2(3) && X hitmm(mtmp,shkp) == 2) return(2); X return(0); X } else if(info[chi] & ALLOW_U){ X (void) hitu(shkp, d(mdat->damn, mdat->damd)+1); X return(0); X } X shkp->mx = nix; X shkp->my = niy; X pmon(shkp); X if(ib) { X freeobj(ib); X mpickobj(shkp, ib); X } X return(1); X } X return(0); X} X#endif /* QUEST /**/ X Xonline(x,y) { X return(x==u.ux || y==u.uy || X (x-u.ux)*(x-u.ux) == (y-u.uy)*(y-u.uy)); X} X X/* Does this monster follow me downstairs? */ Xfollower(mtmp) Xregister struct monst *mtmp; X{ X return( mtmp->mtame || index("1TVWZi&, ", mtmp->data->mlet) || X (mtmp->isshk && ESHK(mtmp)->following) ); X} X X/* He is digging in the shop. */ Xshopdig(fall) Xregister int fall; X{ X if(!fall) { X if(u.utraptype == TT_PIT) X pline("\"Be careful, sir, or you might fall through the floor.\""); X else X pline("\"Please, do not damage the floor here.\""); X } else if(dist(shopkeeper->mx, shopkeeper->my) < 3) { X register struct obj *obj, *obj2; X X pline("%s grabs your backpack!", shkname(shopkeeper)); X for(obj = invent; obj; obj = obj2) { X obj2 = obj->nobj; X if(obj->owornmask) continue; X freeinv(obj); X obj->nobj = shopkeeper->minvent; X shopkeeper->minvent = obj; X if(obj->unpaid) X subfrombill(obj); X } X } X} END_OF_shk.c if test 25711 -ne `wc -c trap.h <<'END_OF_trap.h' X/* SCCS Id: @(#)trap.h 1.3 87/07/14 X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ X/* trap.h - version 1.0.2 */ X Xstruct trap { X struct trap *ntrap; X xchar tx,ty; X Bitfield(ttyp,5); X Bitfield(tseen,1); X Bitfield(once,1); X}; X Xextern struct trap *ftrap; Xstruct trap *t_at(); X#define newtrap() (struct trap *) alloc(sizeof(struct trap)) X X/* Standard Hack traps. */ X#define NO_TRAP 0 X#define BEAR_TRAP 1 X#define ARROW_TRAP 2 X#define DART_TRAP 3 X#define TRAPDOOR 4 X#define TELEP_TRAP 5 X#define PIT 6 X#define SLP_GAS_TRAP 7 X#define PIERC 8 X#define MIMIC 9 X X/* Defines below this line are automatically added by makedefs (-t option) */ X/* if you add any additional code below the next line, it will disappear. */ X/* DO NOT REMOVE THIS LINE */ X X#define MGTRP 10 X#define SQBRD 11 X#define WEB 12 X#define SPIKED_PIT 13 X#define LEVEL_TELEP 14 X#define ANTI_MAGIC 15 X#define RUST_TRAP 16 X X#define TRAPNUM 17 END_OF_trap.h if test 991 -ne `wc -c