home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume16 / nethck31 / part70 < prev    next >
Encoding:
Internet Message Format  |  1993-02-05  |  57.5 KB

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v16i078:  nethack31 - display oriented dungeons & dragons (Ver. 3.1), Part70/108
  5. Message-ID: <4441@master.CNA.TEK.COM>
  6. Date: 5 Feb 93 19:19:31 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1947
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1629
  11.  
  12. Submitted-by: izchak@linc.cis.upenn.edu (Izchak Miller)
  13. Posting-number: Volume 16, Issue 78
  14. Archive-name: nethack31/Part70
  15. Supersedes: nethack3p9: Volume 10, Issue 46-107
  16. Environment: Amiga, Atari, Mac, MS-DOS, OS2, Unix, VMS, X11
  17.  
  18.     [This really was posted before, but apparently never left our site.]
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 70 (of 108)."
  27. # Contents:  src/potion.c sys/unix/Makefile.src
  28. # Wrapped by billr@saab on Wed Jan 27 16:09:14 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'src/potion.c' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'src/potion.c'\"
  32. else
  33. echo shar: Extracting \"'src/potion.c'\" \(30380 characters\)
  34. sed "s/^X//" >'src/potion.c' <<'END_OF_FILE'
  35. X/*    SCCS Id: @(#)potion.c    3.1    92/12/10          */
  36. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  37. X/* NetHack may be freely redistributed.  See license for details. */
  38. X
  39. X#include "hack.h"
  40. X
  41. X#ifdef OVLB
  42. Xstatic void NDECL(ghost_from_bottle);
  43. Xstatic boolean FDECL(neutralizes, (struct obj *,struct obj *));
  44. X
  45. Xstatic int NEARDATA nothing, NEARDATA unkn;
  46. X#endif /* OVLB */
  47. X
  48. Xextern boolean notonhead;    /* for long worms */
  49. X#ifdef OVLB
  50. Xboolean notonhead = FALSE;
  51. X#endif /* OVLB */
  52. X
  53. X#ifdef OVLB
  54. X
  55. Xstatic const char NEARDATA beverages[] = { POTION_CLASS, 0 };
  56. X
  57. Xvoid
  58. Xmake_confused(xtime,talk)
  59. Xlong xtime;
  60. Xboolean talk;
  61. X{
  62. X    long old = HConfusion;
  63. X
  64. X    if (!xtime && old) {
  65. X        if (talk) {
  66. X            if (Hallucination) You("feel less trippy now.");
  67. X            else           You("feel less confused now.");
  68. X        }
  69. X        flags.botl = 1;
  70. X    }
  71. X    if (xtime && !old)
  72. X        flags.botl = 1;
  73. X    HConfusion = xtime;
  74. X}
  75. X
  76. Xvoid
  77. Xmake_stunned(xtime,talk)
  78. Xlong xtime;
  79. Xboolean talk;
  80. X{
  81. X    long old = HStun;
  82. X
  83. X    if (!xtime && old) {
  84. X        if (talk) {
  85. X            if (Hallucination) You("feel less wobbly now.");
  86. X            else           You("feel a bit steadier now.");
  87. X        }
  88. X        flags.botl = 1;
  89. X    }
  90. X    if (xtime && !old) {
  91. X        if (talk)
  92. X            You("stagger....");
  93. X        flags.botl = 1;
  94. X    }
  95. X    HStun = xtime;
  96. X}
  97. X
  98. Xvoid
  99. Xmake_sick(xtime, talk)
  100. Xlong xtime;
  101. Xboolean talk;
  102. X{
  103. X    long old = Sick;
  104. X
  105. X#ifdef POLYSELF
  106. X    if (xtime && u.usym == S_FUNGUS) return;
  107. X#endif
  108. X    if (!xtime && old) {
  109. X        if (talk) pline("What a relief!");
  110. X        flags.botl = 1;
  111. X    }
  112. X    if (!old && xtime) {
  113. X        You("feel deathly sick.");
  114. X        flags.botl = 1;
  115. X    }
  116. X    Sick = xtime;
  117. X}
  118. X
  119. Xvoid
  120. Xmake_vomiting(xtime, talk)
  121. Xlong xtime;
  122. Xboolean talk;
  123. X{
  124. X    long old = Vomiting;
  125. X
  126. X    if(!xtime && old)
  127. X        if(talk) You("feel much less nauseous now.");
  128. X
  129. X    Vomiting = xtime;
  130. X}
  131. X
  132. X
  133. Xvoid
  134. Xmake_blinded(xtime, talk)
  135. Xlong xtime;
  136. Xboolean talk;
  137. X{
  138. X    long old = Blinded;
  139. X    boolean changed = 0;
  140. X
  141. X    if (u.usleep) talk = FALSE;
  142. X
  143. X    if (!xtime && old && !Blindfolded
  144. X#ifdef POLYSELF
  145. X        && haseyes(uasmon)
  146. X#endif
  147. X        ) {
  148. X        if (talk) {
  149. X        if (Hallucination)
  150. X            pline("Far out!  Everything is all cosmic again!");
  151. X        else           You("can see again.");
  152. X        }
  153. X        changed = TRUE;
  154. X    }
  155. X    if (xtime && !old && !Blindfolded
  156. X#ifdef POLYSELF
  157. X        && haseyes(uasmon)
  158. X#endif
  159. X        ) {
  160. X        if (talk) {
  161. X        if (Hallucination) pline("Oh, bummer!  Everything is dark!  Help!");
  162. X        else           pline("A cloud of darkness falls upon you.");
  163. X        }
  164. X        changed = TRUE;
  165. X
  166. X        /* Before the hero goes blind, set the ball&chain variables. */
  167. X        if (Punished) set_bc(0);
  168. X    }
  169. X    Blinded = xtime;
  170. X    if (changed) {
  171. X        flags.botl = 1;
  172. X        vision_full_recalc = 1;
  173. X        if (Telepat) see_monsters();
  174. X    }
  175. X}
  176. X
  177. Xvoid
  178. Xmake_hallucinated(xtime, talk, mask)
  179. Xlong xtime;    /* nonzero if this is an attempt to turn on hallucination */
  180. Xboolean talk;
  181. Xlong mask;    /* nonzero if resistance status should change by mask */
  182. X{
  183. X    boolean changed = 0;
  184. X#ifdef LINT
  185. X    const char *message = 0;
  186. X#else
  187. X    const char *message;
  188. X#endif
  189. X
  190. X    if (!xtime)
  191. X        message = "Everything looks SO boring now.";
  192. X    else
  193. X        message = "Oh wow!  Everything seems so cosmic!";
  194. X
  195. X    if (mask) {
  196. X        if (HHallucination) changed = TRUE;
  197. X
  198. X        if (!xtime) HHalluc_resistance |= mask;
  199. X        else HHalluc_resistance &= ~mask;
  200. X    } else {
  201. X        if (!HHalluc_resistance && (!!HHallucination != !!xtime))
  202. X        changed = TRUE;
  203. X        HHallucination = xtime;
  204. X    }
  205. X
  206. X    if (changed) {
  207. X        if (u.uswallow) {
  208. X        swallowed(0);    /* redraw swallow display */
  209. X        } else {
  210. X        /* The see_* routines should be called *before* the pline. */
  211. X        see_monsters();
  212. X        see_objects();
  213. X        }
  214. X        flags.botl = 1;
  215. X        if (!Blind && talk) pline(message);
  216. X    }
  217. X}
  218. X
  219. Xstatic void
  220. Xghost_from_bottle()
  221. X{
  222. X    struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy);
  223. X
  224. X    if (!mtmp) {
  225. X        pline("This bottle turns out to be empty.");
  226. X        return;
  227. X    }
  228. X    if (Blind) {
  229. X        pline("As you open the bottle, something emerges.");
  230. X        return;
  231. X    }
  232. X    pline("As you open the bottle, an enormous %s emerges!",
  233. X        Hallucination ? rndmonnam() : (const char *)"ghost");
  234. X    if(flags.verbose)
  235. X        You("are frightened to death, and unable to move.");
  236. X    nomul(-3);
  237. X    nomovemsg = "You regain your composure.";
  238. X}
  239. X
  240. Xint
  241. Xdodrink() {
  242. X    register struct obj *otmp;
  243. X    const char *potion_descr;
  244. X
  245. X    if (Strangled) {
  246. X        pline("If you can't breathe air, how can you drink liquid?");
  247. X        return 0;
  248. X    }
  249. X    /* Is there a fountain to drink from here? */
  250. X    if (IS_FOUNTAIN(levl[u.ux][u.uy].typ) && !Levitation) {
  251. X        if(yn("Drink from the fountain?") == 'y') {
  252. X            drinkfountain();
  253. X            return 1;
  254. X        }
  255. X    }
  256. X#ifdef SINKS
  257. X    /* Or a kitchen sink? */
  258. X    if (IS_SINK(levl[u.ux][u.uy].typ)) {
  259. X        if (yn("Drink from the sink?") == 'y') {
  260. X            drinksink();
  261. X            return 1;
  262. X        }
  263. X    }
  264. X#endif
  265. X
  266. X    otmp = getobj(beverages, "drink");
  267. X    if(!otmp) return(0);
  268. X#ifndef NO_SIGNAL
  269. X    otmp->in_use = TRUE;        /* you've opened the stopper */
  270. X#endif
  271. X    potion_descr = OBJ_DESCR(objects[otmp->otyp]);
  272. X    if (potion_descr && !strcmp(potion_descr, "milky") && !rn2(13)) {
  273. X        ghost_from_bottle();
  274. X        useup(otmp);
  275. X        return(1);
  276. X    } else if (potion_descr && !strcmp(potion_descr, "smoky") && !rn2(13)) {
  277. X        djinni_from_bottle(otmp);
  278. X        useup(otmp);
  279. X        return(1);
  280. X    }
  281. X    return dopotion(otmp);
  282. X}
  283. X
  284. Xint
  285. Xdopotion(otmp)
  286. Xregister struct obj *otmp;
  287. X{
  288. X    int retval;
  289. X
  290. X    nothing = unkn = 0;
  291. X    if((retval = peffects(otmp)) >= 0) return(retval);
  292. X
  293. X    if(nothing) {
  294. X        unkn++;
  295. X        You("have a %s feeling for a moment, then it passes.",
  296. X          Hallucination ? "normal" : "peculiar");
  297. X    }
  298. X    if(otmp->dknown && !objects[otmp->otyp].oc_name_known) {
  299. X        if(!unkn) {
  300. X            makeknown(otmp->otyp);
  301. X            more_experienced(0,10);
  302. X        } else if(!objects[otmp->otyp].oc_uname)
  303. X            docall(otmp);
  304. X    }
  305. X    useup(otmp);
  306. X    return(1);
  307. X}
  308. X
  309. Xint
  310. Xpeffects(otmp)
  311. X    register struct obj    *otmp;
  312. X{
  313. X    register int i, ii, isdone;
  314. X
  315. X    switch(otmp->otyp){
  316. X    case POT_RESTORE_ABILITY:
  317. X    case SPE_RESTORE_ABILITY:
  318. X        unkn++;
  319. X        if(otmp->cursed) {
  320. X            pline("Ulch!  This makes you feel mediocre!");
  321. X            break;
  322. X        } else {
  323. X            pline("Wow!  This makes you feel %s!",
  324. X              (otmp->blessed) ? "great" : "good");
  325. X            i = rn2(A_MAX);        /* start at a random point */
  326. X            for(isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
  327. X            if(ABASE(i) < AMAX(i)) {
  328. X                ABASE(i) = AMAX(i);
  329. X                /* only first found if not blessed */
  330. X                isdone = !(otmp->blessed);
  331. X                flags.botl = 1;
  332. X            }
  333. X            if(++i >= A_MAX) i = 0;
  334. X            }
  335. X            if((ABASE(A_STR) == AMAX(A_STR)) && (u.uhs >= 3))
  336. X            losestr(1);        /* kludge - mrs */
  337. X        }
  338. X        break;
  339. X    case POT_HALLUCINATION:
  340. X        if (Hallucination || HHalluc_resistance) nothing++;
  341. X        make_hallucinated(HHallucination +
  342. X              rn1(200, 600 - 300*bcsign(otmp)), TRUE, 0L);
  343. X        break;
  344. X    case POT_WATER:
  345. X        if(!otmp->blessed && !otmp->cursed) {
  346. X            pline("This tastes like %swater.",
  347. X                  otmp->spe == -1 ? "impure " : "");
  348. X            lesshungry(rnd(otmp->spe == -1 ? 3 : 10));
  349. X            break;
  350. X        }
  351. X        unkn++;
  352. X        if(
  353. X#ifdef POLYSELF
  354. X           is_undead(uasmon) || is_demon(uasmon) ||
  355. X#endif
  356. X                u.ualign.type == A_CHAOTIC) {
  357. X            if(otmp->blessed) {
  358. X            pline("This burns like acid!");
  359. X            exercise(A_CON, FALSE);
  360. X#ifdef POLYSELF
  361. X            if (u.ulycn != -1) {
  362. X                Your("affinity to %s disappears!",
  363. X                     makeplural(mons[u.ulycn].mname));
  364. X                if(uasmon == &mons[u.ulycn] && !Polymorph_control)
  365. X                    rehumanize();
  366. X                u.ulycn = -1;
  367. X            }
  368. X#endif
  369. X            losehp(d(2,6), "potion of holy water", KILLED_BY_AN);
  370. X            } else if(otmp->cursed) {
  371. X            You("feel quite proud of yourself.");
  372. X            healup(d(2,6),0,0,0);
  373. X            exercise(A_CON, TRUE);
  374. X            }
  375. X        } else
  376. X            if(otmp->blessed) {
  377. X            You("feel full of awe.");
  378. X            make_sick(0L,TRUE);
  379. X            exercise(A_WIS, TRUE);
  380. X            exercise(A_CON, TRUE);
  381. X#ifdef POLYSELF
  382. X            if (u.ulycn != -1) {
  383. X                You("feel purified.");
  384. X                if(uasmon == &mons[u.ulycn] && !Polymorph_control)
  385. X                    rehumanize();
  386. X                u.ulycn = -1;
  387. X            }
  388. X#endif
  389. X            /* make_confused(0L,TRUE); */
  390. X            } else {
  391. X            if(u.ualign.type == A_LAWFUL) {
  392. X                pline("This burns like acid!");
  393. X                losehp(d(2,6), "potion of unholy water",
  394. X                KILLED_BY_AN);
  395. X            } else
  396. X                You("feel full of dread.");
  397. X            exercise(A_CON, FALSE);
  398. X            }
  399. X        break;
  400. X    case POT_BOOZE:
  401. X        unkn++;
  402. X        pline("Ooph!  This tastes like %s!",
  403. X              Hallucination ? "furniture polish" : "liquid fire");
  404. X        if (!otmp->blessed) make_confused(HConfusion + d(3,8),FALSE);
  405. X        /* the whiskey makes us feel better */
  406. X        if(u.uhp < u.uhpmax) losehp(-1, "", 0); /* can't kill you */
  407. X        lesshungry(10 * (2 + bcsign(otmp)));
  408. X        exercise(A_WIS, FALSE);
  409. X        if(otmp->cursed) {
  410. X            You("pass out.");
  411. X            multi = -rnd(15);
  412. X            nomovemsg = "You awake with a headache.";
  413. X        }
  414. X        break;
  415. X    case POT_ENLIGHTENMENT:
  416. X        if(otmp->cursed) {
  417. X            unkn++;
  418. X            You("have an uneasy feeling...");
  419. X        } else {
  420. X            if (otmp->blessed) {
  421. X                (void) adjattrib(A_INT, 1, FALSE);
  422. X                (void) adjattrib(A_WIS, 1, FALSE);
  423. X            }
  424. X            You("feel self-knowledgeable...");
  425. X            display_nhwindow(WIN_MESSAGE, FALSE);
  426. X            enlightenment(FALSE);
  427. X            pline("The feeling subsides.");
  428. X        }
  429. X        exercise(A_WIS, !otmp->cursed);
  430. X        break;
  431. X    case POT_INVISIBILITY:
  432. X    case SPE_INVISIBILITY:
  433. X        if(Invisible || See_invisible) nothing++;
  434. X        else {
  435. X             if(!Blind)
  436. X               pline(Hallucination ?
  437. X             "Far out, man!  You can see right through yourself!" :
  438. X             "Gee!  All of a sudden, you can't see yourself.");
  439. X             else
  440. X               You("feel rather airy."), unkn++;
  441. X        }
  442. X        if (otmp->blessed && !(HInvis & FROMOUTSIDE)) {
  443. X            nothing = 0;
  444. X            if(yn("Do you want the invisibility to be permanent?")
  445. X                == 'n')
  446. X                HInvis += rn1(15,31);
  447. X            else HInvis |= FROMOUTSIDE;
  448. X        } else HInvis += rn1(15,31);
  449. X        newsym(u.ux,u.uy);    /* update position */
  450. X        if(otmp->cursed) {
  451. X            pline("For some reason, you feel your presence is known.");
  452. X            aggravate();
  453. X        }
  454. X        break;
  455. X    case POT_SEE_INVISIBLE:
  456. X        /* tastes like fruit juice in Rogue */
  457. X    case POT_FRUIT_JUICE:
  458. X        unkn++;
  459. X        if(otmp->cursed)
  460. X            pline("Yecch!  This tastes %s.",
  461. X              Hallucination ? "overripe" : "rotten"
  462. X             );
  463. X        else pline (Hallucination ?
  464. X#ifdef TUTTI_FRUTTI
  465. X           "This tastes like 10%% real %s juice all-natural beverage." :
  466. X           "This tastes like %s juice.", pl_fruit
  467. X#else
  468. X           "This tastes like 10%% real fruit juice all-natural beverage." :
  469. X           "This tastes like fruit juice."
  470. X#endif
  471. X                );
  472. X        if (otmp->otyp == POT_FRUIT_JUICE) {
  473. X            lesshungry(10 * (2 + bcsign(otmp)));
  474. X            break;
  475. X        }
  476. X        if (!otmp->cursed) {
  477. X            /* Tell them they can see again immediately, which
  478. X             * will help them identify the potion...
  479. X             */
  480. X            make_blinded(0L,TRUE);
  481. X        }
  482. X        if (otmp->blessed)
  483. X            HSee_invisible |= FROMOUTSIDE;
  484. X        else
  485. X            HSee_invisible += rn1(100,750);
  486. X        set_mimic_blocking(); /* do special mimic handling */
  487. X        see_monsters();    /* see invisible monsters */
  488. X        newsym(u.ux,u.uy); /* see yourself! */
  489. X        break;
  490. X    case POT_PARALYSIS:
  491. X        if(Levitation || Is_waterlevel(&u.uz))
  492. X            You("are motionlessly suspended.");
  493. X        else
  494. X            Your("%s are frozen to the floor!",
  495. X                makeplural(body_part(FOOT)));
  496. X        nomul(-(rn1(10, 25 - 12*bcsign(otmp))));
  497. X        exercise(A_DEX, FALSE);
  498. X        break;
  499. X    case POT_MONSTER_DETECTION:
  500. X    case SPE_DETECT_MONSTERS:
  501. X        if (monster_detect(otmp, 0))
  502. X            return(1);        /* nothing detected */
  503. X        exercise(A_WIS, TRUE);
  504. X        break;
  505. X    case POT_OBJECT_DETECTION:
  506. X    case SPE_DETECT_TREASURE:
  507. X        if (object_detect(otmp, 0))
  508. X            return(1);        /* nothing detected */
  509. X        exercise(A_WIS, TRUE);
  510. X        break;
  511. X    case POT_SICKNESS:
  512. X        pline("Yecch!  This stuff tastes like poison.");
  513. X        if (otmp->blessed) {
  514. X#ifdef TUTTI_FRUTTI
  515. X        pline("(But in fact it was mildly stale %s juice.)", pl_fruit);
  516. X#else
  517. X        pline("(But in fact it was mildly stale orange juice.)");
  518. X#endif
  519. X            if (pl_character[0] != 'H')
  520. X                losehp(1, "mildly contaminated potion",
  521. X                    KILLED_BY_AN);
  522. X        } else {
  523. X            if(Poison_resistance)
  524. X#ifdef TUTTI_FRUTTI
  525. X    pline("(But in fact it was biologically contaminated %s juice.)",pl_fruit);
  526. X#else
  527. X    pline("(But in fact it was biologically contaminated orange juice.)");
  528. X#endif
  529. X            if (pl_character[0] == 'H')
  530. X            pline("Fortunately, you have been immunized.");
  531. X            else {
  532. X            int typ = rn2(A_MAX);
  533. X            poisontell(typ);
  534. X            (void) adjattrib(typ,
  535. X                    Poison_resistance ? -1 : -rn1(4,3),
  536. X                    TRUE);
  537. X            if(!Poison_resistance)
  538. X                losehp(rnd(10)+5*!!(otmp->cursed),
  539. X                       "contaminated potion", KILLED_BY_AN);
  540. X            exercise(A_CON, FALSE);
  541. X            }
  542. X        }
  543. X        if(Hallucination) {
  544. X            You("are shocked back to your senses!");
  545. X            make_hallucinated(0L,FALSE,0L);
  546. X        }
  547. X        break;
  548. X    case POT_CONFUSION:
  549. X        if(!Confusion)
  550. X            if (Hallucination) {
  551. X            pline("What a trippy feeling!");
  552. X            unkn++;
  553. X            } else
  554. X            pline("Huh, What?  Where am I?");
  555. X        else    nothing++;
  556. X        make_confused(HConfusion + rn1(7,16-8*bcsign(otmp)),FALSE);
  557. X        break;
  558. X    case POT_GAIN_ABILITY:
  559. X        if(otmp->cursed) {
  560. X            pline("Ulch!  That potion tasted foul!");
  561. X            unkn++;
  562. X        } else {      /* If blessed, increase all; if not, try up to */
  563. X            int itmp; /* 6 times to find one which can be increased. */
  564. X            i = -1;        /* increment to 0 */
  565. X            for (ii = A_MAX; ii > 0; ii--) {
  566. X            i = (otmp->blessed ? i + 1 : rn2(A_MAX));
  567. X            /* only give "your X is already as high as it can get"
  568. X               message on last attempt (except blessed potions) */
  569. X            itmp = (otmp->blessed || ii == 1) ? 0 : -1;
  570. X            if (adjattrib(i, 1, itmp) && !otmp->blessed)
  571. X                break;
  572. X            }
  573. X        }
  574. X        break;
  575. X    case POT_SPEED:
  576. X        if(Wounded_legs && !otmp->cursed) {
  577. X            heal_legs();
  578. X            unkn++;
  579. X            break;
  580. X        }        /* and fall through */
  581. X    case SPE_HASTE_SELF:
  582. X        if(!(Fast & ~INTRINSIC)) /* wwf@doe.carleton.ca */
  583. X            You("are suddenly moving %sfaster.",
  584. X                Fast ? "" : "much ");
  585. X        else {
  586. X            Your("%s get new energy.",
  587. X                makeplural(body_part(LEG)));
  588. X            unkn++;
  589. X        }
  590. X        exercise(A_DEX, TRUE);
  591. X        Fast += rn1(10,100+60*bcsign(otmp));
  592. X        break;
  593. X    case POT_BLINDNESS:
  594. X        if(Blind) nothing++;
  595. X        make_blinded(Blinded + rn1(200, 250-125*bcsign(otmp)), TRUE);
  596. X        break;
  597. X    case POT_GAIN_LEVEL:
  598. X        if (otmp->cursed) {
  599. X            unkn++;
  600. X            /* they went up a level */
  601. X            if((ledger_no(&u.uz) == 1 && u.uhave.amulet) ||
  602. X                              Can_rise_up(&u.uz)) {
  603. X                const char *riseup = "rise up, through the ceiling!";
  604. X                if(ledger_no(&u.uz) == 1) {
  605. X                    You(riseup);
  606. X                goto_level(&earth_level, FALSE, FALSE, FALSE);
  607. X                } else {
  608. X                    register int newlev = depth(&u.uz)-1;
  609. X                d_level newlevel;
  610. X
  611. X                get_level(&newlevel, newlev);
  612. X                if(on_level(&newlevel, &u.uz)) {
  613. X                    pline("It tasted bad.");
  614. X                    break;
  615. X                } else You(riseup);
  616. X                goto_level(&newlevel, FALSE, FALSE, FALSE);
  617. X                }
  618. X            }
  619. X            else You("have an uneasy feeling.");
  620. X            break;
  621. X        }
  622. X        pluslvl();
  623. X        if (otmp->blessed)
  624. X            /* blessed potions place you at a random spot in the
  625. X             * middle of the new level instead of the low point
  626. X             */
  627. X            u.uexp = rndexp();
  628. X        break;
  629. X    case POT_HEALING:
  630. X        You("begin to feel better.");
  631. X        healup(d(5,2) + 5 * bcsign(otmp),
  632. X               1, !!(otmp->blessed), !(otmp->cursed));
  633. X        exercise(A_STR, TRUE);
  634. X        break;
  635. X    case POT_EXTRA_HEALING:
  636. X        You("feel much better.");
  637. X        healup(d(5,4) + 5 * bcsign(otmp),
  638. X               2+3*!!(otmp->blessed), !(otmp->cursed), 1);
  639. X        make_hallucinated(0L,TRUE,0L);
  640. X        exercise(A_STR, TRUE);
  641. X        exercise(A_CON, TRUE);
  642. X        break;
  643. X    case POT_LEVITATION:
  644. X    case SPE_LEVITATION:
  645. X        if(!Levitation) {
  646. X            /* kludge to ensure proper operation of float_up() */
  647. X            HLevitation = 1;
  648. X            float_up();
  649. X            /* reverse kludge */
  650. X            HLevitation = 0;
  651. X            if (otmp->cursed && !Is_waterlevel(&u.uz)) {
  652. X    if((u.ux != xupstair || u.uy != yupstair)
  653. X       && (u.ux != sstairs.sx || u.uy != sstairs.sy || !sstairs.up)
  654. X       && (!xupladder || u.ux != xupladder || u.uy != yupladder)
  655. X    ) {
  656. X                    You("hit your %s on the ceiling.",
  657. X                        body_part(HEAD));
  658. X                    losehp(uarmh ? 1 : rnd(10),
  659. X                        "colliding with the ceiling",
  660. X                        KILLED_BY);
  661. X                } else (void) doup();
  662. X            }
  663. X        } else
  664. X            nothing++;
  665. X        if (otmp->blessed) {
  666. X            char buf[BUFSZ];
  667. X            int lmoves;
  668. X
  669. X            makeknown(POT_LEVITATION);
  670. X            do {
  671. X    getlin("How many moves do you wish to levitate for? [1-300]", buf);
  672. X                lmoves = (!*buf || *buf=='\033') ? 0 : atoi(buf);
  673. X            } while (lmoves < 1 || lmoves > 300);
  674. X            HLevitation += lmoves;
  675. X        } else HLevitation += rnd(150);
  676. X        u.uprops[LEVITATION].p_tofn = float_down;
  677. X        break;
  678. X    case POT_GAIN_ENERGY:            /* M. Stephenson */
  679. X        {    register int     num;
  680. X            if(otmp->cursed)
  681. X                You("feel lackluster.");
  682. X            else
  683. X                pline("Magical energies course through your body.");
  684. X            num = rnd(5) + 5 * otmp->blessed + 1;
  685. X            u.uenmax += (otmp->cursed) ? -num : num;
  686. X            u.uen += (otmp->cursed) ? -num : num;
  687. X            if(u.uenmax <= 0) u.uenmax = 0;
  688. X            if(u.uen <= 0) u.uen = 0;
  689. X            flags.botl = 1;
  690. X            exercise(A_WIS, TRUE);
  691. X        }
  692. X        break;
  693. X    default:
  694. X        impossible("What a funny potion! (%u)", otmp->otyp);
  695. X        return(0);
  696. X    }
  697. X    return(-1);
  698. X}
  699. X
  700. Xvoid
  701. Xhealup(nhp, nxtra, curesick, cureblind)
  702. X    int    nhp, nxtra;
  703. X    register boolean curesick, cureblind;
  704. X{
  705. X#ifdef POLYSELF
  706. X    if (u.mtimedone && nhp) {
  707. X        u.mh += nhp;
  708. X        if (u.mh > u.mhmax) u.mh = (u.mhmax += nxtra);
  709. X    }
  710. X#endif
  711. X    if(nhp)    {
  712. X        u.uhp += nhp;
  713. X        if(u.uhp > u.uhpmax)    u.uhp = (u.uhpmax += nxtra);
  714. X    }
  715. X    if(cureblind)    make_blinded(0L,TRUE);
  716. X    if(curesick)    make_sick(0L,TRUE);
  717. X    flags.botl = 1;
  718. X    return;
  719. X}
  720. X
  721. Xvoid
  722. Xstrange_feeling(obj,txt)
  723. Xregister struct obj *obj;
  724. Xregister const char *txt;
  725. X{
  726. X    if(flags.beginner)
  727. X        You("have a %s feeling for a moment, then it passes.",
  728. X        Hallucination ? "normal" : "strange");
  729. X    else
  730. X        pline(txt);
  731. X
  732. X    if(!obj)    /* e.g., crystal ball finds no traps */
  733. X        return;
  734. X
  735. X    if(obj->dknown && !objects[obj->otyp].oc_name_known &&
  736. X                        !objects[obj->otyp].oc_uname)
  737. X        docall(obj);
  738. X    useup(obj);
  739. X}
  740. X
  741. Xconst char *bottlenames[] = {
  742. X    "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
  743. X};
  744. X
  745. Xvoid
  746. Xpotionhit(mon, obj)
  747. Xregister struct monst *mon;
  748. Xregister struct obj *obj;
  749. X{
  750. X    register const char *botlnam = bottlenames[rn2(SIZE(bottlenames))];
  751. X    boolean distance, isyou = (mon == &youmonst);
  752. X
  753. X    if(isyou) {
  754. X        distance = 0;
  755. X        pline("The %s crashes on your %s and breaks into shards.",
  756. X            botlnam, body_part(HEAD));
  757. X        losehp(rnd(2), "thrown potion", KILLED_BY_AN);
  758. X    } else {
  759. X        distance = distu(mon->mx,mon->my);
  760. X        if (!cansee(mon->mx,mon->my)) pline("Crash!");
  761. X        else {
  762. X            char *mnam = mon_nam(mon);
  763. X            char buf[BUFSZ];
  764. X
  765. X            if(has_head(mon->data)) {
  766. X            Sprintf(buf, "%s %s",
  767. X                s_suffix(mnam),
  768. X                (notonhead ? "body" : "head"));
  769. X            } else {
  770. X            Strcpy(buf, mnam);
  771. X            }
  772. X            pline("The %s crashes on %s and breaks into shards.",
  773. X               botlnam, buf);
  774. X        }
  775. X        if(rn2(5) && mon->mhp > 1)
  776. X            mon->mhp--;
  777. X    }
  778. X
  779. X    if (cansee(mon->mx,mon->my))
  780. X        pline("%s evaporates.", The(xname(obj)));
  781. X
  782. X    if (!isyou) switch (obj->otyp) {
  783. X
  784. X    case POT_RESTORE_ABILITY:
  785. X    case POT_GAIN_ABILITY:
  786. X    case POT_HEALING:
  787. X    case POT_EXTRA_HEALING:
  788. X        if(mon->mhp < mon->mhpmax) {
  789. X            mon->mhp = mon->mhpmax;
  790. X            if (canseemon(mon))
  791. X            pline("%s looks sound and hale again.", Monnam(mon));
  792. X        }
  793. X        break;
  794. X    case POT_SICKNESS:
  795. X        if((mon->mhpmax > 3) && !resist(mon, POTION_CLASS, 0, NOTELL))
  796. X            mon->mhpmax /= 2;
  797. X        if((mon->mhp > 2) && !resist(mon, POTION_CLASS, 0, NOTELL))
  798. X            mon->mhp /= 2;
  799. X        if (mon->mhp > mon->mhpmax) mon->mhp = mon->mhpmax;
  800. X        if (canseemon(mon))
  801. X            pline("%s looks rather ill.", Monnam(mon));
  802. X        break;
  803. X    case POT_CONFUSION:
  804. X    case POT_BOOZE:
  805. X        if(!resist(mon, POTION_CLASS, 0, NOTELL))  mon->mconf = TRUE;
  806. X        break;
  807. X    case POT_INVISIBILITY:
  808. X        mon->minvis = TRUE;
  809. X        newsym(mon->mx,mon->my);
  810. X        break;
  811. X    case POT_PARALYSIS:
  812. X        if (mon->mcanmove) {
  813. X            mon->mcanmove = 0;
  814. X            /* really should be rnd(5) for consistency with players
  815. X             * breathing potions, but...
  816. X             */
  817. X            mon->mfrozen = rnd(25);
  818. X        }
  819. X        break;
  820. X    case POT_SPEED:
  821. X        if (mon->mspeed == MSLOW) mon->mspeed = 0;
  822. X        else mon->mspeed = MFAST;
  823. X        break;
  824. X    case POT_BLINDNESS:
  825. X        if(haseyes(mon->data)) {
  826. X            register int btmp = 64 + rn2(32) +
  827. X            rn2(32) * !resist(mon, POTION_CLASS, 0, NOTELL);
  828. X            mon->mblinded |= btmp;
  829. X            mon->mcansee = 0;
  830. X        }
  831. X        break;
  832. X    case POT_WATER:
  833. X        if (is_undead(mon->data) || is_demon(mon->data)) {
  834. X            if (obj->blessed) {
  835. X                pline("%s shrieks in pain!", Monnam(mon));
  836. X                mon->mhp -= d(2,6);
  837. X                if (mon->mhp <1) killed(mon);
  838. X            } else if (obj->cursed) {
  839. X                if (canseemon(mon))
  840. X                    pline("%s looks healthier.", Monnam(mon));
  841. X                mon->mhp += d(2,6);
  842. X                if (mon->mhp > mon->mhpmax)
  843. X                    mon->mhp = mon->mhpmax;
  844. X            }
  845. X        } else if(mon->data == &mons[PM_GREMLIN]) {
  846. X            struct monst *mtmp2 = clone_mon(mon);
  847. X
  848. X            if (mtmp2) {
  849. X                mtmp2->mhpmax = (mon->mhpmax /= 2);
  850. X                if (canseemon(mon))
  851. X                    pline("%s multiplies.", Monnam(mon));
  852. X            }
  853. X        }
  854. X        break;
  855. X/*
  856. X    case POT_GAIN_LEVEL:
  857. X    case POT_LEVITATION:
  858. X    case POT_FRUIT_JUICE:
  859. X    case POT_MONSTER_DETECTION:
  860. X    case POT_OBJECT_DETECTION:
  861. X        break;
  862. X*/
  863. X    }
  864. X    /* Note: potionbreathe() does its own docall() */
  865. X    if (distance==0 || ((distance < 3) && rn2(5)))
  866. X        potionbreathe(obj);
  867. X    else if (obj->dknown && !objects[obj->otyp].oc_name_known &&
  868. X           !objects[obj->otyp].oc_uname && cansee(mon->mx,mon->my))
  869. X        docall(obj);
  870. X    if(*u.ushops && obj->unpaid) {
  871. X            register struct monst *shkp =
  872. X            shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
  873. X
  874. X        if(!shkp)
  875. X            obj->unpaid = 0;
  876. X        else {
  877. X            (void)stolen_value(obj, u.ux, u.uy,
  878. X                 (boolean)shkp->mpeaceful, FALSE);
  879. X            subfrombill(obj, shkp);
  880. X        }
  881. X    }
  882. X    obfree(obj, (struct obj *)0);
  883. X}
  884. X
  885. Xvoid
  886. Xpotionbreathe(obj)
  887. Xregister struct obj *obj;
  888. X{
  889. X    register int i, ii, isdone;
  890. X
  891. X    switch(obj->otyp) {
  892. X    case POT_RESTORE_ABILITY:
  893. X    case POT_GAIN_ABILITY:
  894. X        if(obj->cursed) {
  895. X            pline("Ulch!  That potion smells terrible!");
  896. X            break;
  897. X        } else {
  898. X            i = rn2(A_MAX);        /* start at a random point */
  899. X            for(isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
  900. X            if(ABASE(i) < AMAX(i)) {
  901. X                ABASE(i)++;
  902. X                /* only first found if not blessed */
  903. X                isdone = !(obj->blessed);
  904. X                flags.botl = 1;
  905. X            }
  906. X            if(++i >= A_MAX) i = 0;
  907. X            }
  908. X        }
  909. X        break;
  910. X    case POT_HEALING:
  911. X    case POT_EXTRA_HEALING:
  912. X        if(u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
  913. X        exercise(A_STR, TRUE);
  914. X        break;
  915. X    case POT_SICKNESS:
  916. X        if (pl_character[0] != 'H') {
  917. X            if(u.uhp <= 5) u.uhp = 1; else u.uhp -= 5;
  918. X            flags.botl = 1;
  919. X            exercise(A_CON, FALSE);
  920. X        }
  921. X        break;
  922. X    case POT_HALLUCINATION:
  923. X        You("have a vision for a moment.");
  924. X        break;
  925. X    case POT_CONFUSION:
  926. X    case POT_BOOZE:
  927. X        if(!Confusion)
  928. X            You("feel somewhat dizzy.");
  929. X        make_confused(HConfusion + rnd(5),FALSE);
  930. X        break;
  931. X    case POT_INVISIBILITY:
  932. X        if (!See_invisible && !Invis)
  933. X            pline("For an instant you could see through yourself!");
  934. X        break;
  935. X    case POT_PARALYSIS:
  936. X        pline("Something seems to be holding you.");
  937. X        nomul(-rnd(5));
  938. X        exercise(A_DEX, FALSE);
  939. X        break;
  940. X    case POT_SPEED:
  941. X        Fast += rnd(5);
  942. X        Your("knees seem more flexible now.");
  943. X        exercise(A_DEX, TRUE);
  944. X        break;
  945. X    case POT_BLINDNESS:
  946. X        if (!Blind && !u.usleep) pline("It suddenly gets dark.");
  947. X        make_blinded(Blinded + rnd(5),FALSE);
  948. X        break;
  949. X    case POT_WATER:
  950. X#ifdef POLYSELF
  951. X        if(u.umonnum == PM_GREMLIN) {
  952. X            struct monst *mtmp;
  953. X            if(mtmp = cloneu()) {
  954. X            mtmp->mhpmax = (u.mhmax /= 2);
  955. X            You("multiply.");
  956. X            }
  957. X        }
  958. X#endif
  959. X/*
  960. X    case POT_GAIN_LEVEL:
  961. X    case POT_LEVITATION:
  962. X    case POT_FRUIT_JUICE:
  963. X    case POT_MONSTER_DETECTION:
  964. X    case POT_OBJECT_DETECTION:
  965. X*/
  966. X        break;
  967. X    }
  968. X    /* note: no obfree() */
  969. X    if (obj->dknown && !objects[obj->otyp].oc_name_known &&
  970. X                        !objects[obj->otyp].oc_uname)
  971. X        docall(obj);
  972. X}
  973. X
  974. Xstatic boolean
  975. Xneutralizes(o1, o2)
  976. Xregister struct obj *o1, *o2;
  977. X{
  978. X    switch (o1->otyp) {
  979. X        case POT_SICKNESS:
  980. X        case POT_HALLUCINATION:
  981. X        case POT_BLINDNESS:
  982. X        case POT_CONFUSION:
  983. X            if (o2->otyp == POT_HEALING ||
  984. X                o2->otyp == POT_EXTRA_HEALING)
  985. X                return TRUE;
  986. X        case POT_HEALING:
  987. X        case POT_EXTRA_HEALING:
  988. X        case UNICORN_HORN:
  989. X            if (o2->otyp == POT_SICKNESS ||
  990. X                o2->otyp == POT_HALLUCINATION ||
  991. X                o2->otyp == POT_BLINDNESS ||
  992. X                o2->otyp == POT_CONFUSION)
  993. X                return TRUE;
  994. X    }
  995. X
  996. X    return FALSE;
  997. X}
  998. X
  999. Xboolean
  1000. Xget_wet(obj)
  1001. Xregister struct obj *obj;
  1002. X/* returns TRUE if something happened (potion should be used up) */
  1003. X{
  1004. X        if(snuff_lit(obj)) return(TRUE);
  1005. X
  1006. X    if (obj->greased) {
  1007. X        grease_protect(obj,NULL,FALSE);
  1008. X        return(FALSE);
  1009. X    }
  1010. X    switch (obj->oclass) {
  1011. X        case WEAPON_CLASS:
  1012. X        if (!obj->oerodeproof && is_rustprone(obj) &&
  1013. X            (obj->oeroded < MAX_ERODE) && !rn2(10)) {
  1014. X            Your("%s some%s.", aobjnam(obj, "rust"),
  1015. X                 obj->oeroded ? " more" : "what");
  1016. X            obj->oeroded++;
  1017. X            return TRUE;
  1018. X        } else break;
  1019. X        case POTION_CLASS:
  1020. X        if (obj->otyp == POT_WATER) return FALSE;
  1021. X        Your("%s.", aobjnam(obj,"dilute"));
  1022. X        if (obj->spe == -1) {
  1023. X            obj->spe = 0;
  1024. X            obj->blessed = obj->cursed = FALSE;
  1025. X            obj->otyp = POT_WATER;
  1026. X        } else obj->spe--;
  1027. X        return TRUE;
  1028. X        case SCROLL_CLASS:
  1029. X        if (obj->otyp != SCR_BLANK_PAPER
  1030. X#ifdef MAIL
  1031. X            && obj->otyp != SCR_MAIL
  1032. X#endif
  1033. X            ) {
  1034. X            if (!Blind) {
  1035. X                boolean oq1 = obj->quan == 1L;
  1036. X                pline("The scroll%s fade%s.",
  1037. X                    oq1 ? "" : "s",
  1038. X                    oq1 ? "s" : "");
  1039. X            }
  1040. X            if(obj->unpaid) {
  1041. X                subfrombill(obj, shop_keeper(*u.ushops));
  1042. X                You("erase it, you pay for it.");
  1043. X                bill_dummy_object(obj);
  1044. X            }
  1045. X            obj->otyp = SCR_BLANK_PAPER;
  1046. X            return TRUE;
  1047. X        } else break;
  1048. X        case SPBOOK_CLASS:
  1049. X        if (obj->otyp != SPE_BLANK_PAPER) {
  1050. X
  1051. X            if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
  1052. X    pline("%s suddenly heats up; steam rises and it remains dry.",
  1053. X                The(xname(obj)));
  1054. X            } else {
  1055. X                if (!Blind) {
  1056. X                    boolean oq1 = obj->quan == 1L;
  1057. X                    pline("The spellbook%s fade%s.",
  1058. X                    oq1 ? "" : "s", oq1 ? "s" : "");
  1059. X                }
  1060. X                if(obj->unpaid) {
  1061. X                    subfrombill(obj, shop_keeper(*u.ushops));
  1062. X                    You("erase it, you pay for it.");
  1063. X                    bill_dummy_object(obj);
  1064. X                }
  1065. X                obj->otyp = SPE_BLANK_PAPER;
  1066. X            }
  1067. X            return TRUE;
  1068. X        }
  1069. X    }
  1070. X    Your("%s wet.", aobjnam(obj,"get"));
  1071. X    return FALSE;
  1072. X}
  1073. X
  1074. Xint
  1075. Xdodip()
  1076. X{
  1077. X    register struct obj *potion, *obj;
  1078. X    const char *tmp;
  1079. X    uchar here;
  1080. X    char allow_all[2];
  1081. X    char c;
  1082. X
  1083. X    allow_all[0] = ALL_CLASSES; allow_all[1] = '\0';
  1084. X    if(!(obj = getobj(allow_all, "dip")))
  1085. X        return(0);
  1086. X
  1087. X    here = levl[u.ux][u.uy].typ;
  1088. X    /* Is there a fountain to dip into here? */
  1089. X    if (IS_FOUNTAIN(here)) {
  1090. X        if(yn("Dip it into the fountain?") == 'y') {
  1091. X            dipfountain(obj);
  1092. X            return(1);
  1093. X        }
  1094. X    }
  1095. X        if (is_pool(u.ux,u.uy)) {
  1096. X        c = (here == POOL) ? yn("Dip it into the pool?")
  1097. X                   : yn("Dip it into the moat?");
  1098. X        if(c == 'y') {
  1099. X            (void) get_wet(obj);
  1100. X            return(1);
  1101. X        }
  1102. X    }
  1103. X
  1104. X    if(!(potion = getobj(beverages, "dip into")))
  1105. X        return(0);
  1106. X    if (potion == obj && potion->quan == 1L) {
  1107. X        pline("That is a potion bottle, not a Klein bottle!");
  1108. X        return 0;
  1109. X    }
  1110. X    if(potion->otyp == POT_WATER) {
  1111. X        if (potion->blessed) {
  1112. X            if (obj->cursed) {
  1113. X                if (!Blind)
  1114. X                    Your("%s %s.",
  1115. X                      aobjnam(obj, "softly glow"),
  1116. X                      Hallucination ? hcolor() : amber);
  1117. X                uncurse(obj);
  1118. X                obj->bknown=1;
  1119. X    poof:
  1120. X                if(!(objects[potion->otyp].oc_name_known) &&
  1121. X                   !(objects[potion->otyp].oc_uname))
  1122. X                    docall(potion);
  1123. X                useup(potion);
  1124. X                return(1);
  1125. X            } else if(!obj->blessed) {
  1126. X                if (!Blind) {
  1127. X                    tmp = Hallucination ? hcolor() : light_blue;
  1128. X                    Your("%s with a%s %s aura.",
  1129. X                      aobjnam(obj, "softly glow"),
  1130. X                      index(vowels, *tmp) ? "n" : "", tmp);
  1131. X                }
  1132. X                bless(obj);
  1133. X                obj->bknown=1;
  1134. X                goto poof;
  1135. X            }
  1136. X        } else if (potion->cursed) {
  1137. X            if (obj->blessed) {
  1138. X                if (!Blind)
  1139. X                    Your("%s %s.", aobjnam(obj, "glow"),
  1140. X                     Hallucination ? hcolor() : (const char *)"brown");
  1141. X                unbless(obj);
  1142. X                obj->bknown=1;
  1143. X                goto poof;
  1144. X            } else if(!obj->cursed) {
  1145. X                if (!Blind) {
  1146. X                    tmp = Hallucination ? hcolor() : Black;
  1147. X                    Your("%s with a%s %s aura.",
  1148. X                      aobjnam(obj, "glow"),
  1149. X                      index(vowels, *tmp) ? "n" : "", tmp);
  1150. X                }
  1151. X                curse(obj);
  1152. X                obj->bknown=1;
  1153. X                goto poof;
  1154. X            }
  1155. X        } else
  1156. X            if (get_wet(obj))
  1157. X                goto poof;
  1158. X    }
  1159. X    else if(obj->oclass == POTION_CLASS && obj->otyp != potion->otyp) {
  1160. X        /* Mixing potions is dangerous... */
  1161. X        pline("The potions mix...");
  1162. X        if (obj->cursed || !rn2(10)) {
  1163. X            pline("BOOM!  They explode!");
  1164. X            exercise(A_STR, FALSE);
  1165. X            potionbreathe(obj);
  1166. X            useup(obj);
  1167. X            useup(potion);
  1168. X            losehp(rnd(10), "alchemic blast", KILLED_BY_AN);
  1169. X            return(1);
  1170. X        }
  1171. X
  1172. X        obj->blessed = obj->cursed = obj->bknown = 0;
  1173. X        if (Blind) obj->dknown = 0;
  1174. X
  1175. X        switch (neutralizes(obj, potion) ||
  1176. X            obj->spe == -1 /* diluted */ ? 1 : rnd(8)) {
  1177. X            case 1:
  1178. X                obj->otyp = POT_WATER;
  1179. X                obj->blessed = obj->cursed = 0;
  1180. X                break;
  1181. X            case 2:
  1182. X            case 3:
  1183. X                obj->otyp = POT_SICKNESS;
  1184. X                break;
  1185. X            case 4:
  1186. X                {
  1187. X                  struct obj *otmp;
  1188. X                  otmp = mkobj(POTION_CLASS,FALSE);
  1189. X                  obj->otyp = otmp->otyp;
  1190. X                  obfree(otmp, (struct obj *)0);
  1191. X                }
  1192. X                break;
  1193. X            default:
  1194. X                if (!Blind)
  1195. X                pline("The mixture glows brightly and evaporates.");
  1196. X                useup(obj);
  1197. X                useup(potion);
  1198. X                return(1);
  1199. X        }
  1200. X
  1201. X        if (obj->otyp == POT_WATER) {
  1202. X            obj->spe = 0; /* in case it was diluted before */
  1203. X            pline("The mixture bubbles violently%s.",
  1204. X                Blind ? "" : ", then clears");
  1205. X        } else {
  1206. X            obj->spe--; /* diluted */
  1207. X            if (!Blind) {
  1208. X                pline("The mixture looks %s.",
  1209. X                    OBJ_DESCR(objects[obj->otyp]));
  1210. X                obj->dknown = TRUE;
  1211. X            }
  1212. X        }
  1213. X
  1214. X        useup(potion);
  1215. X        return(1);
  1216. X    }
  1217. X
  1218. X    if(obj->oclass == WEAPON_CLASS && obj->otyp <= SHURIKEN) {
  1219. X        if(potion->otyp == POT_SICKNESS && !obj->opoisoned) {
  1220. X        char buf[BUFSZ];
  1221. X        Strcpy(buf, The(xname(potion)));
  1222. X        pline("%s form%s a coating on %s.",
  1223. X            buf, potion->quan == 1L ? "s" : "", the(xname(obj)));
  1224. X        obj->opoisoned = TRUE;
  1225. X        goto poof;
  1226. X        } else if(obj->opoisoned &&
  1227. X              (potion->otyp == POT_HEALING ||
  1228. X               potion->otyp == POT_EXTRA_HEALING)) {
  1229. X        pline("A coating wears off %s.", the(xname(obj)));
  1230. X        obj->opoisoned = 0;
  1231. X        goto poof;
  1232. X        }
  1233. X    }
  1234. X
  1235. X    if(obj->otyp == UNICORN_HORN && neutralizes(obj, potion)) {
  1236. X        /* with multiple merged potions, we should split off one and
  1237. X           just clear it, but clearing them all together is easier */
  1238. X        boolean more_than_one = potion->quan > 1L;
  1239. X        pline("The potion%s clear%s.",
  1240. X            more_than_one ? "s" : "",
  1241. X            more_than_one ? "" : "s");
  1242. X        potion->otyp = POT_WATER;
  1243. X        potion->blessed = 0;
  1244. X        potion->cursed = 0;
  1245. X        potion->spe = 0;
  1246. X        return(1);
  1247. X    }
  1248. X
  1249. X    pline("Interesting...");
  1250. X    return(1);
  1251. X}
  1252. X
  1253. X
  1254. Xvoid
  1255. Xdjinni_from_bottle(obj)
  1256. Xregister struct obj *obj;
  1257. X{
  1258. X    register struct monst *mtmp;
  1259. X
  1260. X    if(!(mtmp = makemon(&mons[PM_DJINNI], u.ux, u.uy))){
  1261. X        pline("It turns out to be empty.");
  1262. X        return;
  1263. X    }
  1264. X
  1265. X    if (!Blind) {
  1266. X        pline("In a cloud of smoke, %s emerges!", a_monnam(mtmp));
  1267. X        pline("%s speaks.", Monnam(mtmp));
  1268. X    } else {
  1269. X        You("smell acrid fumes.");
  1270. X        pline("Something speaks.");
  1271. X    }
  1272. X
  1273. X    switch (obj->blessed ? 0 : obj->cursed ? 4 : rn2(5)) {
  1274. X    case 0 : verbalize("I am in your debt.  I will grant one wish!");
  1275. X        makewish();
  1276. X        mongone(mtmp);
  1277. X        break;
  1278. X    case 1 : verbalize("Thank you for freeing me!");
  1279. X        (void) tamedog(mtmp, (struct obj *)0);
  1280. X        break;
  1281. X    case 2 : verbalize("You freed me!");
  1282. X        mtmp->mpeaceful = TRUE;
  1283. X        set_malign(mtmp);
  1284. X        break;
  1285. X    case 3 : verbalize("It is about time!");
  1286. X        pline("%s vanishes.", Monnam(mtmp));
  1287. X        mongone(mtmp);
  1288. X        break;
  1289. X    default: verbalize("You disturbed me, fool!");
  1290. X        break;
  1291. X    }
  1292. X}
  1293. X
  1294. X#endif /* OVLB */
  1295. X
  1296. X/*potion.c*/
  1297. END_OF_FILE
  1298. if test 30380 -ne `wc -c <'src/potion.c'`; then
  1299.     echo shar: \"'src/potion.c'\" unpacked with wrong size!
  1300. fi
  1301. # end of 'src/potion.c'
  1302. fi
  1303. if test -f 'sys/unix/Makefile.src' -a "${1}" != "-c" ; then 
  1304.   echo shar: Will not clobber existing file \"'sys/unix/Makefile.src'\"
  1305. else
  1306. echo shar: Extracting \"'sys/unix/Makefile.src'\" \(23795 characters\)
  1307. sed "s/^X//" >'sys/unix/Makefile.src' <<'END_OF_FILE'
  1308. X#    NetHack Makefile.
  1309. X#    SCCS Id: @(#)Makefile.src    3.1    93/01/25
  1310. X
  1311. X# This makefile replaces the previous Makefile.unix, Makefile.xenix,
  1312. X# Makefile.3B2, Makefile.att, and Makefile.tos.
  1313. X# Set SYSTEM to one of:
  1314. X#    'Sysunix'    -- generic UNIX
  1315. X#    'Sys3B2'    -- AT&T 3B2, 3B5, etc.
  1316. X#    'Sysatt'    -- AT&T UNIXPC, 7300, 3B1
  1317. X#    'SysV-AT'    -- Microport 286 UNIX (put -DDUMB in CFLAGS)
  1318. X#    'Systos'    -- Atari
  1319. XSYSTEM = Sysunix
  1320. X
  1321. X#
  1322. X# Make sure that your bourne shell is specified here, as you have to spawn
  1323. X# some of the commands (eg. depend) in bourne shell for them to work.
  1324. X#
  1325. X# For Systos users compiling on the ST, you'll either need a bourne shell
  1326. X# clone or you'll need to do make depend, etc. by hand. In either case,
  1327. X# the line below probably needs changing
  1328. XSHELL=/bin/sh
  1329. X
  1330. X# Pick the SYSSRC and SYSOBJ lines corresponding to your desired operating
  1331. X# system.
  1332. X#
  1333. X# for UNIX systems
  1334. XSYSSRC = ../sys/unix/ioctl.c ../sys/unix/unixmain.c ../sys/unix/unixtty.c \
  1335. X    ../sys/unix/unixunix.c
  1336. XSYSOBJ = ioctl.o unixmain.o unixtty.o unixunix.o
  1337. X#
  1338. X# for Systos
  1339. X# SYSSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
  1340. X#    ../sys/share/pctty.c ../sys/share/pcunix.c
  1341. X# SYSOBJ = tos.o pcmain.o pcsys.o pctty.o pcunix.o
  1342. X
  1343. X
  1344. X# if you are using gcc as your compiler:
  1345. X#    uncomment the CC definition below if it's not in your environment
  1346. X#    if you get setcgtty() warnings during execution, you are feeding gcc
  1347. X#        a non-ANSI <sys/ioctl.h> -- either run fixincludes on it or use
  1348. X#        -traditional in CFLAGS
  1349. X# CC = gcc
  1350. X#
  1351. X#    For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following:
  1352. X#
  1353. X# CC = gcc -ansi -D_BULL_SOURCE -D_XOPEN_SOURCE -D_POSIX_SOURCE
  1354. X# 
  1355. X#    If you are using GCC 2.2.2 or higher on a DPX/2, just use:
  1356. X#
  1357. X# CC = gcc -ansi
  1358. X#
  1359. X# if you're debugging and want gcc to check as much as possible, use:
  1360. X# CC = gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
  1361. X
  1362. X# flags may have to be changed as required
  1363. X# flags for 286 Xenix:
  1364. X# CFLAGS = -Ml2t16 -O -LARGE -I../include
  1365. X# LFLAGS = -Ml -F 4000 -SEG 512
  1366. X
  1367. X# flags for 286 Microport SysV-AT
  1368. X# CFLAGS = -DDUMB -Ml -I../include
  1369. X# LFLAGS = -Ml
  1370. X
  1371. X# flags for Atari gcc
  1372. X# CFLAGS = -O -I../include
  1373. X# LFLAGS = -s
  1374. X
  1375. X# flags for AIX 3.1 cc on IBM RS/6000 to define
  1376. X# a suitable subset of standard libraries
  1377. X# (note that there is more info regarding the "-qchars=signed"
  1378. X# switch in file Install.unx note 8)
  1379. X# CFLAGS = -D_NO_PROTO -D_XOPEN_SOURCE -O -I../include -qchars=signed
  1380. X
  1381. X# flags for A/UX 2.01 using native cc or c89
  1382. X# gcc predefines AUX so that's not needed there
  1383. X# Remember to use -lcurses for WINLIB below !
  1384. X# CFLAGS = -ZS -D_POSIX_SOURCE -O -I../include -DAUX
  1385. X
  1386. X# flags for debugging:
  1387. X# CFLAGS = -g -I../include
  1388. X
  1389. XCFLAGS = -g -I../include
  1390. XLFLAGS =
  1391. X
  1392. X
  1393. X# Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
  1394. X# combination of windowing systems.  Also set windowing systems in config.h.
  1395. X#
  1396. X# files for a straight tty port using no native windowing system
  1397. XWINTTYSRC = ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
  1398. X    ../win/tty/wintty.c
  1399. XWINTTYOBJ = getline.o termcap.o topl.o wintty.o
  1400. X#
  1401. X# files for an X11 port
  1402. XWINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
  1403. X    ../win/X11/winmap.c  ../win/X11/winmenu.c ../win/X11/winmesg.c \
  1404. X    ../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \
  1405. X    ../win/X11/winval.c
  1406. XWINX11OBJ = Window.o dialogs.o winX.o winmap.o winmenu.o winmesg.o \
  1407. X    winmisc.o winstat.o wintext.o winval.o
  1408. X#
  1409. X# 
  1410. XWINSRC = $(WINTTYSRC)
  1411. XWINOBJ = $(WINTTYOBJ)
  1412. X
  1413. X# on some systems the termcap library is in -ltermcap or -lcurses
  1414. X# on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead
  1415. X# Sysatt uses shared library in lieu of this option
  1416. X# Systos needs -lcurses16 if you use -mshort
  1417. X# AIX 3.1 on RS/6000 likes -lcurses if TERMINFO defined in config.h
  1418. X# and -ltermcap otherwise
  1419. X#
  1420. X# libraries for tty ports
  1421. X# WINTTYLIB = -ltermcap
  1422. X# WINTTYLIB = -lcurses
  1423. X# WINTTYLIB = -lcurses16
  1424. XWINTTYLIB = -ltermlib
  1425. X#
  1426. X# libraries for X11
  1427. XWINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
  1428. X# WINX11LIB = -lXaw -lXmu -lXt -lX11
  1429. X#
  1430. X#
  1431. XWINLIB = $(WINTTYLIB)
  1432. X
  1433. X# any other strange libraries your system needs (for Sysunix only -- the more
  1434. X# specialized targets should already be right)
  1435. X#
  1436. X# on HP-UX, the malloc(3x) routines in libmalloc.a seem to align things
  1437. X# better than the malloc(3) ones in libc.a
  1438. X# LIBS = -lmalloc
  1439. X#
  1440. X# DPX/2's also use the malloc(3x) routines.  In addition, if you are building
  1441. X# for X11, you must include libinet.a.
  1442. X# LIBS = -lmalloc -linet
  1443. XLIBS =
  1444. X
  1445. X# make NetHack
  1446. XGAME     = nethack
  1447. X
  1448. X# if you defined RANDOM in unixconf.h/tosconf.h since your system did not come
  1449. X# with a reasonable random number generator
  1450. X# RANDOBJ = random.o
  1451. XRANDOBJ =
  1452. X
  1453. X
  1454. X
  1455. X# ----------------------------------------
  1456. X#
  1457. X# Nothing below this line should have to be changed.
  1458. X#
  1459. X# Other things that have to be reconfigured are in config.h,
  1460. X# {unixconf.h, pcconf.h, tosconf.h}, and possibly system.h
  1461. X
  1462. XMAKEDEFS = ../util/makedefs
  1463. X
  1464. X# all .c that are part of the main NetHack program and are not operating- or
  1465. X# windowing-system specific
  1466. XHACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c\
  1467. X       botl.c cmd.c dbridge.c decl.c detect.c display.c do.c do_name.c\
  1468. X       do_wear.c dog.c dogmove.c dokick.c dothrow.c drawing.c dungeon.c\
  1469. X       eat.c end.c engrave.c exper.c explode.c extralev.c files.c\
  1470. X       fountain.c hack.c hacklib.c invent.c lock.c mail.c makemon.c\
  1471. X       mcastu.c mhitm.c mhitu.c minion.c mklev.c mkmap.c mkmaze.c\
  1472. X       mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c mplayer.c\
  1473. X       mthrowu.c muse.c music.c o_init.c objects.c objnam.c options.c\
  1474. X       pager.c pickup.c pline.c polyself.c potion.c pray.c priest.c\
  1475. X       quest.c questpgr.c read.c rect.c restore.c rip.c rnd.c rumors.c\
  1476. X       save.c shk.c shknam.c sit.c sounds.c sp_lev.c spell.c steal.c\
  1477. X       timeout.c topten.c track.c trap.c u_init.c uhitm.c vault.c\
  1478. X       version.c vision.c weapon.c were.c wield.c windows.c wizard.c\
  1479. X       worm.c worn.c write.c zap.c
  1480. X
  1481. X# all operating-system-dependent .c (for dependencies and such)
  1482. XSYSCSRC = ../sys/atari/tos.c ../sys/share/pcmain.c ../sys/share/pcsys.c \
  1483. X    ../sys/share/pctty.c ../sys/share/pcunix.c ../sys/share/random.c \
  1484. X    ../sys/unix/ioctl.c ../sys/unix/unixmain.c ../sys/unix/unixtty.c \
  1485. X    ../sys/unix/unixunix.c
  1486. X
  1487. X# all windowing-system-dependent .c (for dependencies and such)
  1488. XWINCSRC = $(WINTTYSRC) $(WINX11SRC)
  1489. X
  1490. X# .c files for this version (for date.h)
  1491. XVERSOURCES = $(HACKCSRC) $(SYSSRC) $(WINSRC) monstr.c vis_tab.c
  1492. X
  1493. X# .c files for all UNIX versions (for lint and tags)
  1494. XCSOURCES = $(HACKCSRC) $(SYSSRC) $(WINCSRC) monstr.c vis_tab.c
  1495. X
  1496. X
  1497. X# all .h files except date.h, onames.h, pm.h, and vis_tab.h which would
  1498. X# cause dependency loops if run through "make depend"
  1499. X# and dgn_comp.h, dgn_file.h, lev_comp.h, special level & dungeon files.
  1500. X#
  1501. XHACKINCL = align.h amiconf.h artifact.h artilist.h attrib.h color.h config.h\
  1502. X       coord.h decl.h def_os2.h display.h dungeon.h edog.h emin.h engrave.h\
  1503. X       epri.h eshk.h extern.h flag.h func_tab.h global.h hack.h lev.h\
  1504. X       macconf.h mfndpos.h micro.h mkroom.h monattk.h mondata.h monflag.h\
  1505. X       monst.h monsym.h obj.h objclass.h os2conf.h patchlevel.h pcconf.h\
  1506. X       permonst.h prop.h rect.h rm.h sp_lev.h spell.h system.h termcap.h\
  1507. X       tosconf.h tradstdc.h trampoli.h trap.h unixconf.h vault.h vision.h\
  1508. X       vmsconf.h wintty.h winX.h winprocs.h wintype.h you.h youprop.h
  1509. X
  1510. XHSOURCES = $(HACKINCL) date.h onames.h pm.h vis_tab.h\
  1511. X        lev_comp.h dgn_comp.h dgn_file.h
  1512. X
  1513. X# the following .o's _must_ be made before any others (for makedefs)
  1514. XFIRSTOBJ = monst.o objects.o
  1515. X
  1516. XHOBJ = $(FIRSTOBJ) allmain.o alloc.o apply.o artifact.o attrib.o ball.o\
  1517. X    bones.o botl.o cmd.o dbridge.o decl.o detect.o display.o do.o\
  1518. X    do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o drawing.o\
  1519. X    dungeon.o eat.o end.o engrave.o exper.o explode.o extralev.o\
  1520. X    files.o fountain.o hack.o hacklib.o invent.o lock.o mail.o\
  1521. X    makemon.o mcastu.o mhitm.o mhitu.o minion.o mklev.o mkmap.o\
  1522. X    mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o monstr.o\
  1523. X    mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o\
  1524. X    pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o\
  1525. X    quest.o questpgr.o read.o rect.o restore.o rip.o rnd.o rumors.o\
  1526. X    save.o shk.o shknam.o sit.o sounds.o sp_lev.o spell.o steal.o\
  1527. X    timeout.o topten.o track.o trap.o u_init.o uhitm.o vault.o\
  1528. X    vision.o vis_tab.o weapon.o were.o wield.o windows.o wizard.o\
  1529. X    worm.o worn.o write.o zap.o\
  1530. X    $(RANDOBJ) $(SYSOBJ) $(WINOBJ) version.o
  1531. X# the .o files from the HACKCSRC, SYSSRC, and WINSRC lists
  1532. X
  1533. X$(GAME):    $(SYSTEM)
  1534. X    @echo "$(GAME) is up to date."
  1535. X
  1536. XSysunix:    $(HOBJ) Makefile
  1537. X    @echo "Loading ..."
  1538. X    @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) $(LIBS)
  1539. X    @touch Sysunix
  1540. X
  1541. XSys3B2:    $(HOBJ) Makefile
  1542. X    @echo "Loading ..."
  1543. X    @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB) -lmalloc
  1544. X    @touch Sys3B2
  1545. X
  1546. XSysatt:    $(HOBJ) Makefile
  1547. X    @echo "Loading ..."
  1548. X    @$(LD) $(LFLAGS) /lib/crt0s.o /lib/shlib.ifile -o $(GAME) $(HOBJ)
  1549. X    @touch Sysatt
  1550. X
  1551. XSystos:    $(HOBJ) Makefile
  1552. X    @echo "Loading ..."
  1553. X    @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB)
  1554. X    @touch Systos
  1555. X
  1556. XSysV-AT:    DUMB.Setup $(HOBJ) Makefile
  1557. X    @echo "Loading ..."
  1558. X    @$(CC) $(LFLAGS) -o $(GAME) $(HOBJ) $(WINLIB)
  1559. X    @touch SysV-AT
  1560. X
  1561. XDUMB.Setup:    ../include/extern.h
  1562. X    cp ../include/extern.h ../include/extern.h.BAK 
  1563. X    cat ../include/extern.h | \
  1564. X        sed -e '/^E\ int\ /!b' \
  1565. X            -e '/[^;/     ]$$/N' \
  1566. X            -e '/[(][*]occupation[)]/b' \
  1567. X            -e '/[(][*]afternmv[)]/b' \
  1568. X            -e '/float_down/b' \
  1569. X            -e '/done1/b' \
  1570. X            -e '/identify/b' \
  1571. X            -e '/Hear_again/b' \
  1572. X            -e '/hangup/b' \
  1573. X            -e 's/^\(.*\)$$/\/\* \1 \/\*\*\//' | \
  1574. X        sed -e '/^E\ void\ /!b' \
  1575. X            -e '/[^;/     ]$$/N' \
  1576. X            -e 's/^\(.*\)$$/\/\* \1 \/\*\*\//' \
  1577. X                >../include/extern.DUMB 
  1578. X    cp ../include/extern.DUMB ../include/extern.h 
  1579. X    @touch DUMB.Setup
  1580. X
  1581. Xall:    $(GAME)
  1582. X
  1583. X
  1584. X#    dependencies for makedefs and its outputs, which the util
  1585. X#    Makefile is responsible for keeping up to date
  1586. X#
  1587. X
  1588. X# special rules, to force update of makedefs, real dependencies should be
  1589. X# below in the 'make depend' output.
  1590. Xmonst.o:
  1591. X    $(CC) $(CFLAGS) -c monst.c
  1592. X    @rm -f $(MAKEDEFS)
  1593. X
  1594. Xobjects.o:
  1595. X    $(CC) $(CFLAGS) -c objects.c
  1596. X    @rm -f $(MAKEDEFS)
  1597. X
  1598. X$(MAKEDEFS): ../util/makedefs.c  ../include/artilist.h
  1599. X    @( cd ../util ; $(MAKE) makedefs)
  1600. X
  1601. X../include/onames.h: $(MAKEDEFS)
  1602. X    @( cd ../util ; $(MAKE) ../include/onames.h )
  1603. X../include/pm.h: $(MAKEDEFS)
  1604. X    @( cd ../util ; $(MAKE) ../include/pm.h )
  1605. Xmonstr.c: $(MAKEDEFS)
  1606. X    @( cd ../util ; $(MAKE) ../src/monstr.c )
  1607. X../include/vis_tab.h: $(MAKEDEFS)
  1608. X    @( cd ../util ; $(MAKE) ../include/vis_tab.h )
  1609. Xvis_tab.c: $(MAKEDEFS)
  1610. X    @( cd ../util ; $(MAKE) ../src/vis_tab.c )
  1611. X
  1612. X#    date.h should be remade any time any of the source or include code
  1613. X#    is modified.  Unfortunately, this would make the contents of this
  1614. X#    file far more complex.  Since "hack.h" depends on most of the include
  1615. X#    files, we kludge around this by making date.h dependent on hack.h,
  1616. X#    even though it doesn't include this file.
  1617. X#
  1618. X#    hack.h depends on makedefs' output, so we know makedefs will be
  1619. X#    up to date before being executed
  1620. X../include/date.h:    $(VERSOURCES) ../include/hack.h
  1621. X    ( cd ../util ; $(MAKE) ../include/date.h )
  1622. X
  1623. X
  1624. Xlint:
  1625. X# lint cannot have -p here because (i) capitals are meaningful:
  1626. X# [Ww]izard, (ii) identifiers may coincide in the first six places:
  1627. X# doweararm() versus dowearring().
  1628. X# _flsbuf comes from <stdio.h>, a bug in the system libraries.
  1629. X    @echo lint -axbh -DLINT ...
  1630. X    @lint -axbh -I../include -DLINT $(CSOURCES) | sed '/_flsbuf/d'
  1631. X
  1632. X
  1633. Xtags: $(CSOURCES)
  1634. X    @echo ctags -tw ...
  1635. X    @ctags -tw $(CSOURCES)
  1636. X    @( cd ../include ; ctags -tw $(HSOURCES) )
  1637. X    @( cd ../util ; $(MAKE) tags )
  1638. X
  1639. Xclean:
  1640. X    rm -f *.o
  1641. X
  1642. Xspotless: clean
  1643. X    rm -f a.out core $(GAME) Sys*
  1644. X    rm -f ../include/date.h ../include/onames.h ../include/pm.h
  1645. X    rm -f monstr.c ../include/vis_tab.h vis_tab.c
  1646. X
  1647. X
  1648. Xdepend:
  1649. X# For the moment we are lazy and disregard /usr/include files because
  1650. X# the sources contain them conditionally. Perhaps we should use cpp.
  1651. X#        ( /bin/grep '^#[     ]*include' $$i | sed -n \
  1652. X#            -e 's,<\(.*\)>,"/usr/include/\1",' \
  1653. X#
  1654. X# extern.h is ignored, even though its declared function types may affect the
  1655. X# compilation of all the .c files, since extern.h changes every time the
  1656. X# type of an external function does, and we would spend all our time recompiling
  1657. X# if we did not ignore it.  the risk is minimal, as lint should pick up any
  1658. X# calls to the modified function that were not modified accordingly.
  1659. X#
  1660. X# patchlev.h is the name MS-DOS uses to refer to patchlevel.h after it gets
  1661. X# through truncating the name, but it does not really exist
  1662. X#
  1663. X# theory of operation:
  1664. X#    for each file
  1665. X#        for each include line
  1666. X#            pick out filename from within ""
  1667. X#            delete unwanted names
  1668. X#            prepend ../include/
  1669. X#            squirrel away in hold space
  1670. X#        at end of file
  1671. X#            pick up hold space
  1672. X#            change newlines to spaces
  1673. X#            prepend file:
  1674. X#            change .c to .o
  1675. X#            add command if necessary
  1676. X#
  1677. X    for i in ${SYSCSRC} ${WINCSRC}; do \
  1678. X        ( echo '#include ""' | cat - $$i | \
  1679. X        /bin/grep '^#[     ]*include[     ]*"' | sed -n \
  1680. X            -e 's/[^"]*"\([^"]*\)".*/\1/' \
  1681. X            -e 's/patchlev.h//' \
  1682. X            -e 's/.*\.h/..\/include\/&/' \
  1683. X            -e H \
  1684. X            -e '$$g' -e '$$s/\n/ /g' \
  1685. X            -e '$$s;.*;'$$i': '$$i'&;' \
  1686. X            -e '$$s;\.\./[^/]*/[^/]*/\([^.]*\)\.c;\1.o;' \
  1687. X            -e '$$s;.*;&\
  1688. X        $$(CC) $$(CFLAGS) -c '$$i';p' \
  1689. X            >> makedep); done
  1690. X    for i in ${HACKCSRC}; do \
  1691. X        ( /bin/grep '^#[     ]*include[     ]*"' $$i | sed -n \
  1692. X            -e 's/[^"]*"\([^"]*\)".*/\1/' \
  1693. X            -e 's/patchlev.h//' \
  1694. X            -e 's/.*\.h/..\/include\/&/' \
  1695. X            -e H \
  1696. X            -e '$$g' -e '$$s/\n/ /g' \
  1697. X            -e '$$s/.*/'$$i': &/' \
  1698. X            -e '$$s/\.c:/.o:/p' \
  1699. X            >> makedep); done
  1700. X    for i in ${HACKINCL}; do \
  1701. X        ( /bin/grep '^#[     ]*include[     ]*"' ../include/$$i | sed -n \
  1702. X            -e 's/[^"]*"\([^"]*\)".*/\1/' \
  1703. X            -e 's/extern.h//' \
  1704. X            -e 's/.*\.h/..\/include\/&/' \
  1705. X            -e H \
  1706. X            -e '$$g' -e '$$s/\n/ /g' \
  1707. X            -e '$$s/.*/..\/include\/'$$i': &\
  1708. X        touch ..\/include\/'$$i/p \
  1709. X            >> makedep); done
  1710. X    @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
  1711. X    @echo '$$r makedep' >>eddep
  1712. X    @echo 'w' >>eddep
  1713. X    @cp Makefile Makefile.bak
  1714. X    ed - Makefile < eddep
  1715. X    @rm -f eddep makedep
  1716. X    @echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
  1717. X    @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
  1718. X    @echo '# see make depend above' >> Makefile
  1719. X    - diff Makefile.bak Makefile
  1720. X    @rm -f Makefile.bak
  1721. X
  1722. X# DO NOT DELETE THIS LINE
  1723. X
  1724. Xtos.o: ../sys/atari/tos.c  ../include/hack.h ../include/termcap.h
  1725. X    $(CC) $(CFLAGS) -c ../sys/atari/tos.c
  1726. Xpcmain.o: ../sys/share/pcmain.c  ../include/hack.h
  1727. X    $(CC) $(CFLAGS) -c ../sys/share/pcmain.c
  1728. Xpcsys.o: ../sys/share/pcsys.c  ../include/hack.h ../include/wintty.h
  1729. X    $(CC) $(CFLAGS) -c ../sys/share/pcsys.c
  1730. Xpctty.o: ../sys/share/pctty.c  ../include/hack.h ../include/wintty.h
  1731. X    $(CC) $(CFLAGS) -c ../sys/share/pctty.c
  1732. Xpcunix.o: ../sys/share/pcunix.c  ../include/hack.h
  1733. X    $(CC) $(CFLAGS) -c ../sys/share/pcunix.c
  1734. Xrandom.o: ../sys/share/random.c  ../include/hack.h
  1735. X    $(CC) $(CFLAGS) -c ../sys/share/random.c
  1736. Xioctl.o: ../sys/unix/ioctl.c  ../include/hack.h ../include/termcap.h
  1737. X    $(CC) $(CFLAGS) -c ../sys/unix/ioctl.c
  1738. Xunixmain.o: ../sys/unix/unixmain.c  ../include/hack.h
  1739. X    $(CC) $(CFLAGS) -c ../sys/unix/unixmain.c
  1740. Xunixtty.o: ../sys/unix/unixtty.c  ../include/hack.h ../include/wintty.h
  1741. X    $(CC) $(CFLAGS) -c ../sys/unix/unixtty.c
  1742. Xunixunix.o: ../sys/unix/unixunix.c  ../include/hack.h
  1743. X    $(CC) $(CFLAGS) -c ../sys/unix/unixunix.c
  1744. Xgetline.o: ../win/tty/getline.c  ../include/hack.h ../include/wintty.h ../include/func_tab.h
  1745. X    $(CC) $(CFLAGS) -c ../win/tty/getline.c
  1746. Xtermcap.o: ../win/tty/termcap.c  ../include/hack.h ../include/wintty.h ../include/termcap.h
  1747. X    $(CC) $(CFLAGS) -c ../win/tty/termcap.c
  1748. Xtopl.o: ../win/tty/topl.c  ../include/hack.h ../include/termcap.h ../include/wintty.h
  1749. X    $(CC) $(CFLAGS) -c ../win/tty/topl.c
  1750. Xwintty.o: ../win/tty/wintty.c  ../include/hack.h ../include/termcap.h ../include/wintty.h
  1751. X    $(CC) $(CFLAGS) -c ../win/tty/wintty.c
  1752. XWindow.o: ../win/X11/Window.c  ../include/WindowP.h
  1753. X    $(CC) $(CFLAGS) -c ../win/X11/Window.c
  1754. Xdialogs.o: ../win/X11/dialogs.c  ../include/config.h
  1755. X    $(CC) $(CFLAGS) -c ../win/X11/dialogs.c
  1756. XwinX.o: ../win/X11/winX.c  ../include/hack.h ../include/winX.h \
  1757. X        ../win/X11/nh72icon ../win/X11/nh56icon ../win/X11/nh32icon
  1758. X    $(CC) $(CFLAGS) -c ../win/X11/winX.c
  1759. Xwinmap.o: ../win/X11/winmap.c  ../include/Window.h ../include/hack.h ../include/winX.h
  1760. X    $(CC) $(CFLAGS) -c ../win/X11/winmap.c
  1761. Xwinmenu.o: ../win/X11/winmenu.c  ../include/hack.h ../include/winX.h
  1762. X    $(CC) $(CFLAGS) -c ../win/X11/winmenu.c
  1763. Xwinmesg.o: ../win/X11/winmesg.c  ../include/Window.h ../include/hack.h ../include/winX.h
  1764. X    $(CC) $(CFLAGS) -c ../win/X11/winmesg.c
  1765. Xwinmisc.o: ../win/X11/winmisc.c  ../include/hack.h ../include/func_tab.h ../include/winX.h
  1766. X    $(CC) $(CFLAGS) -c ../win/X11/winmisc.c
  1767. Xwinstat.o: ../win/X11/winstat.c  ../include/hack.h ../include/winX.h
  1768. X    $(CC) $(CFLAGS) -c ../win/X11/winstat.c
  1769. Xwintext.o: ../win/X11/wintext.c  ../include/hack.h ../include/winX.h
  1770. X    $(CC) $(CFLAGS) -c ../win/X11/wintext.c
  1771. Xwinval.o: ../win/X11/winval.c  ../include/config.h
  1772. X    $(CC) $(CFLAGS) -c ../win/X11/winval.c
  1773. Xallmain.o:  ../include/hack.h
  1774. Xalloc.o:  ../include/config.h
  1775. Xapply.o:  ../include/hack.h ../include/edog.h
  1776. Xartifact.o:  ../include/hack.h ../include/artifact.h ../include/artilist.h
  1777. Xattrib.o:  ../include/hack.h ../include/artifact.h
  1778. Xball.o:  ../include/hack.h
  1779. Xbones.o:  ../include/hack.h ../include/lev.h
  1780. Xbotl.o:  ../include/hack.h
  1781. Xcmd.o:  ../include/hack.h ../include/func_tab.h
  1782. Xdbridge.o:  ../include/hack.h
  1783. Xdecl.o:  ../include/hack.h ../include/quest.h
  1784. Xdetect.o:  ../include/hack.h ../include/artifact.h
  1785. Xdisplay.o:  ../include/hack.h
  1786. Xdo.o:  ../include/hack.h ../include/lev.h
  1787. Xdo_name.o:  ../include/hack.h
  1788. Xdo_wear.o:  ../include/hack.h
  1789. Xdog.o:  ../include/hack.h ../include/edog.h
  1790. Xdogmove.o:  ../include/hack.h ../include/mfndpos.h ../include/edog.h
  1791. Xdokick.o:  ../include/hack.h ../include/eshk.h
  1792. Xdothrow.o:  ../include/hack.h
  1793. Xdrawing.o:  ../include/hack.h ../include/termcap.h
  1794. Xdungeon.o:  ../include/hack.h ../include/dgn_file.h
  1795. Xeat.o:  ../include/hack.h
  1796. Xend.o:  ../include/hack.h ../include/eshk.h
  1797. Xengrave.o:  ../include/hack.h ../include/lev.h
  1798. Xexper.o:  ../include/hack.h
  1799. Xexplode.o:  ../include/hack.h
  1800. Xextralev.o:  ../include/hack.h
  1801. Xfiles.o:  ../include/hack.h
  1802. Xfountain.o:  ../include/hack.h
  1803. Xhack.o:  ../include/hack.h
  1804. Xhacklib.o:  ../include/hack.h
  1805. Xinvent.o:  ../include/hack.h ../include/artifact.h
  1806. Xlock.o:  ../include/hack.h
  1807. Xmail.o:  ../include/hack.h ../include/mail.h
  1808. Xmakemon.o:  ../include/hack.h ../include/epri.h ../include/emin.h
  1809. Xmcastu.o:  ../include/hack.h
  1810. Xmhitm.o:  ../include/hack.h ../include/artifact.h ../include/edog.h
  1811. Xmhitu.o:  ../include/hack.h ../include/artifact.h ../include/edog.h
  1812. Xminion.o:  ../include/hack.h ../include/emin.h ../include/epri.h
  1813. Xmklev.o:  ../include/hack.h
  1814. Xmkmap.o:  ../include/hack.h ../include/sp_lev.h
  1815. Xmkmaze.o:  ../include/hack.h ../include/sp_lev.h
  1816. Xmkobj.o:  ../include/hack.h ../include/artifact.h ../include/prop.h
  1817. Xmkroom.o:  ../include/hack.h
  1818. Xmon.o:  ../include/hack.h ../include/mfndpos.h ../include/edog.h
  1819. Xmondata.o:  ../include/hack.h ../include/eshk.h ../include/epri.h
  1820. Xmonmove.o:  ../include/hack.h ../include/mfndpos.h ../include/artifact.h
  1821. Xmonst.o:  ../include/config.h ../include/permonst.h ../include/monsym.h ../include/eshk.h \
  1822. X        ../include/vault.h ../include/epri.h ../include/color.h
  1823. Xmplayer.o:  ../include/hack.h
  1824. Xmthrowu.o:  ../include/hack.h
  1825. Xmuse.o:  ../include/hack.h
  1826. Xmusic.o:  ../include/hack.h
  1827. Xo_init.o:  ../include/hack.h
  1828. Xobjects.o:  ../include/config.h ../include/obj.h ../include/objclass.h ../include/prop.h ../include/color.h objects.c
  1829. Xobjnam.o:  ../include/hack.h
  1830. Xoptions.o:  ../include/hack.h ../include/termcap.h
  1831. Xpager.o:  ../include/hack.h
  1832. Xpickup.o:  ../include/hack.h
  1833. Xpline.o:  ../include/hack.h ../include/epri.h
  1834. Xpolyself.o:  ../include/hack.h
  1835. Xpotion.o:  ../include/hack.h
  1836. Xpray.o:  ../include/hack.h ../include/epri.h
  1837. Xpriest.o:  ../include/hack.h ../include/mfndpos.h ../include/eshk.h ../include/epri.h ../include/emin.h
  1838. Xquest.o:  ../include/hack.h ../include/quest.h ../include/qtext.h
  1839. Xquestpgr.o:  ../include/hack.h ../include/qtext.h
  1840. Xread.o:  ../include/hack.h
  1841. Xrect.o:  ../include/hack.h
  1842. Xrestore.o:  ../include/hack.h ../include/lev.h ../include/termcap.h ../include/quest.h
  1843. Xrip.o:  ../include/hack.h
  1844. Xrnd.o:  ../include/hack.h
  1845. Xrumors.o:  ../include/hack.h
  1846. Xsave.o:  ../include/hack.h ../include/lev.h ../include/quest.h
  1847. Xshk.o:  ../include/hack.h ../include/eshk.h
  1848. Xshknam.o:  ../include/hack.h ../include/eshk.h
  1849. Xsit.o:  ../include/hack.h ../include/artifact.h
  1850. Xsounds.o:  ../include/hack.h ../include/edog.h ../include/eshk.h
  1851. Xsp_lev.o:  ../include/hack.h ../include/sp_lev.h ../include/rect.h
  1852. Xspell.o:  ../include/hack.h
  1853. Xsteal.o:  ../include/hack.h
  1854. Xtimeout.o:  ../include/hack.h
  1855. Xtopten.o:  ../include/hack.h
  1856. Xtrack.o:  ../include/hack.h
  1857. Xtrap.o:  ../include/hack.h
  1858. Xu_init.o:  ../include/hack.h
  1859. Xuhitm.o:  ../include/hack.h
  1860. Xvault.o:  ../include/hack.h ../include/vault.h
  1861. Xversion.o:  ../include/hack.h ../include/date.h  ../include/patchlevel.h
  1862. Xvision.o:  ../include/hack.h ../include/vis_tab.h
  1863. Xweapon.o:  ../include/hack.h
  1864. Xwere.o:  ../include/hack.h
  1865. Xwield.o:  ../include/hack.h
  1866. Xwindows.o:  ../include/hack.h ../include/wintty.h
  1867. Xwizard.o:  ../include/hack.h ../include/qtext.h
  1868. Xworm.o:  ../include/hack.h ../include/lev.h
  1869. Xworn.o:  ../include/hack.h
  1870. Xwrite.o:  ../include/hack.h
  1871. Xzap.o:  ../include/hack.h
  1872. X../include/amiconf.h:  ../include/micro.h ../include/pcconf.h
  1873. X    touch ../include/amiconf.h
  1874. X../include/config.h:  ../include/tradstdc.h ../include/global.h
  1875. X    touch ../include/config.h
  1876. X../include/decl.h:  ../include/quest.h ../include/spell.h ../include/color.h ../include/obj.h \
  1877. X        ../include/you.h ../include/onames.h ../include/pm.h
  1878. X    touch ../include/decl.h
  1879. X../include/display.h:  ../include/vision.h ../include/mondata.h
  1880. X    touch ../include/display.h
  1881. X../include/dungeon.h:  ../include/align.h
  1882. X    touch ../include/dungeon.h
  1883. X../include/emin.h:  ../include/dungeon.h
  1884. X    touch ../include/emin.h
  1885. X../include/epri.h:  ../include/dungeon.h ../include/align.h
  1886. X    touch ../include/epri.h
  1887. X../include/eshk.h:  ../include/dungeon.h
  1888. X    touch ../include/eshk.h
  1889. X../include/global.h:  ../include/coord.h ../include/vmsconf.h ../include/unixconf.h \
  1890. X        ../include/os2conf.h ../include/pcconf.h ../include/tosconf.h \
  1891. X        ../include/amiconf.h ../include/macconf.h
  1892. X    touch ../include/global.h
  1893. X../include/hack.h:  ../include/config.h ../include/dungeon.h ../include/monsym.h \
  1894. X        ../include/mkroom.h ../include/objclass.h ../include/decl.h \
  1895. X        ../include/trap.h ../include/flag.h ../include/rm.h ../include/vision.h \
  1896. X        ../include/display.h ../include/wintype.h ../include/engrave.h \
  1897. X        ../include/rect.h  ../include/winprocs.h ../include/wintty.h ../include/trampoli.h
  1898. X    touch ../include/hack.h
  1899. X../include/macconf.h:  ../include/system.h
  1900. X    touch ../include/macconf.h
  1901. X../include/mondata.h:  ../include/align.h
  1902. X    touch ../include/mondata.h
  1903. X../include/monst.h:  ../include/align.h
  1904. X    touch ../include/monst.h
  1905. X../include/os2conf.h:  ../include/pcconf.h
  1906. X    touch ../include/os2conf.h
  1907. X../include/pcconf.h:  ../include/micro.h ../include/system.h
  1908. X    touch ../include/pcconf.h
  1909. X../include/permonst.h:  ../include/monattk.h ../include/monflag.h ../include/align.h
  1910. X    touch ../include/permonst.h
  1911. X../include/rm.h:  ../include/align.h
  1912. X    touch ../include/rm.h
  1913. X../include/sp_lev.h:  ../include/align.h
  1914. X    touch ../include/sp_lev.h
  1915. X../include/tosconf.h:  ../include/micro.h ../include/pcconf.h
  1916. X    touch ../include/tosconf.h
  1917. X../include/unixconf.h:  ../include/system.h
  1918. X    touch ../include/unixconf.h
  1919. X../include/vault.h:  ../include/dungeon.h
  1920. X    touch ../include/vault.h
  1921. X../include/vmsconf.h:  ../include/system.h
  1922. X    touch ../include/vmsconf.h
  1923. X../include/you.h:  ../include/align.h ../include/attrib.h ../include/monst.h ../include/youprop.h
  1924. X    touch ../include/you.h
  1925. X../include/youprop.h:  ../include/prop.h ../include/permonst.h ../include/mondata.h ../include/pm.h
  1926. X    touch ../include/youprop.h
  1927. X# DEPENDENCIES MUST END AT END OF FILE
  1928. X# IF YOU PUT STUFF HERE IT WILL GO AWAY
  1929. X# see make depend above
  1930. END_OF_FILE
  1931. if test 23795 -ne `wc -c <'sys/unix/Makefile.src'`; then
  1932.     echo shar: \"'sys/unix/Makefile.src'\" unpacked with wrong size!
  1933. fi
  1934. # end of 'sys/unix/Makefile.src'
  1935. fi
  1936. echo shar: End of archive 70 \(of 108\).
  1937. cp /dev/null ark70isdone
  1938. MISSING=""
  1939. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 \
  1940. 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 \
  1941. 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 \
  1942. 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 \
  1943. 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 \
  1944. 101 102 103 104 105 106 107 108 ; do
  1945.     if test ! -f ark${I}isdone ; then
  1946.     MISSING="${MISSING} ${I}"
  1947.     fi
  1948. done
  1949. if test "${MISSING}" = "" ; then
  1950.     echo You have unpacked all 108 archives.
  1951.     echo "Now execute 'rebuild.sh'"
  1952.     rm -f ark10[0-8]isdone ark[1-9]isdone ark[1-9][0-9]isdone
  1953. else
  1954.     echo You still need to unpack the following archives:
  1955.     echo "        " ${MISSING}
  1956. fi
  1957. ##  End of shell archive.
  1958. exit 0
  1959.