Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!sshefter From: sshefter@yale.UUCP Newsgroups: net.sources.games Subject: hack mods (4 of 6) Message-ID: <2635@yale-celed.yale.UUCP> Date: Mon, 30-Mar-87 15:56:00 EST Article-I.D.: yale-cel.2635 Posted: Mon Mar 30 15:56:00 1987 Date-Received: Wed, 1-Apr-87 00:47:03 EST References: <2633@yale-celed.yale.UUCP> Reply-To: sshefter@yale-celed.UUCP (Bret A. Shefter) Distribution: world Organization: Yale University Computer Science Dept, New Haven CT Lines: 250 From yale!husc6!rutgers!sri-spam!sri-unix!hplabs!sdcrdcf!ucla-cs!srt Wed Nov 5 12:40:48 EST 1986 Recent seismic activity (no doubt related to the fate of Lumpoc the Tourist, may his soul rest in piece) has opened up a number of fountains throughout the local dungeon. Adventurers are cautioned that the water is known to well up through an area of intense magical activity, and that drinking from these fountains can have strange and sometimes deadly effects. ----- The following mods add fountains to hack. Note that there is a separate file "hack.fountain.c" at the end. You'll have to add that to the Makefile. Fountains use the symbol "{" and you'll want to modify the file 'data' accordingly. In hack.mklev.c 103a104,106 > #ifdef FOUNTAINS > if(rnd(10) == 10) mkfount(0,croom); > #endif FOUNTAINS 739a743,776 > > #ifdef FOUNTAINS > > mkfount(mazeflag,croom) > register struct mkroom *croom; > register mazeflag; > { > register xchar mx,my; > register int tryct = 0; > > do { > if(++tryct > 200) > return; > if(mazeflag){ > extern coord mazexy(); > coord mm; > mm = mazexy(); > mx = mm.x; > my = mm.y; > } else { > mx = somex(); > my = somey(); > } > } while(t_at(mx, my) || levl[mx][my].typ == STAIRS); > > /* Put a fountain at mx, my */ > > levl[mx][my].typ = FOUNTAIN; > levl[mx][my].scrsym = FOUNT_SYM; > > } > > #endif FOUNTAINS > In hack.potions.c 8a9,11 > #ifdef FOUNTAINS > extern int drinkfountain(); > #endif FOUNTAINS 13a17,29 > > #ifdef FOUNTAINS > > /* Is there something to drink here, i.e., a fountain? */ > if (levl[u.ux][u.uy].typ == FOUNTAIN) { > pline("Drink from the fountain? [ny] "); > if(readchar() == 'y') { > (void) drinkfountain(); > return; > } > } > > #endif FOUNTAINS The file hack.fountain.c: /* Code for drinking from fountains. */ /* Scott R. Turner, srt@ucla, 10/27/86 */ #include "hack.h" #define somex() ((rand()%(croom->hx-croom->lx+1))+croom->lx) #define somey() ((rand()%(croom->hy-croom->ly+1))+croom->ly) drinkfountain(){ /* What happens when you drink from a fountain? */ register int fate = rnd(30); if (fate < 10) { pline("The cool draught refreshes you."); lesshungry(rnd(10)); } else switch (fate) { case 20: /* Foul water */ pline("The water is foul! You gag and vomit."); morehungry(rnd(20)+10); break; case 21: /* Poisonous */ pline("The water is contaminated!"); if (Poison_resistance) { pline("Perhaps it is run off from the nearby orange farm."); losehp(rnd(4),"contaminated water"); break; } losestr(rn1(4,3)); losehp(rnd(10),"contaminated water"); break; case 22: /* Fountain of snakes! */ { register int num = rnd(6); pline("Good Lord! An endless stream of snakes pours forth!"); while(num-- > 0) (void) mkmon_at('S',u.ux,u.uy); break; } case 23: /* Water demon */ { register struct monst *mtmp; pline("You have unleashed a water demon!"); mtmp = mkmon_at('&',u.ux,u.uy); if (rnd(100)>97) { char buf[BUFSZ]; register struct obj *otmp; extern struct obj *readobjnam(), *addinv(); pline("He is grateful for his release. He grants you a wish!"); pline("You may wish for an object. What do you want? "); getlin(buf); if(buf[0] == '\033') buf[0] = 0; otmp = readobjnam(buf); otmp = addinv(otmp); prinv(otmp); mondied(mtmp); break; } } case 24: /* Curse an item... */ { register struct obj *obj; pline("The cool draught refreshes you."); morehungry(rnd(20)+10); for(obj = invent; obj ; obj = obj->nobj) if (rnd(5) == 5) { obj->cursed = 1; } break; } case 25: /* See invisible */ pline("The cool draught refreshes you."); See_invisible |= INTRINSIC; break; case 26: /* See Monsters */{ register struct monst *mtmp; if(!fmon) { pline("You feel oddly disturbed."); } else { cls(); for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) if(mtmp->mx > 0) at(mtmp->mx,mtmp->my,mtmp->data->mlet); prme(); pline("You sense the presence of monsters."); more(); docrt(); } break; } case 27: /* Find a gem in the sparkling waters. */ pline("You spot a gem in the sparkling waters!"); mkobj_at('*',u.ux,u.uy); break; case 28: /* Water Nymph */ { register struct monst *mtmp; pline("You have attracted a water nymph!"); mtmp = mkmon_at('N',u.ux,u.uy); mtmp->msleep = 0; break; } case 29: /* Scare */ { register struct monst *mtmp; pline("The cool draught refreshes you."); for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) mtmp->mflee = 1; } case 30: /* Gushing forth in this room */ { #include "def.mkroom.h" register int num = rnd(10); register xchar mx,my; register int tryct = 0; register int uroom = inroom(u.ux, u.uy); register struct mkroom *croom = &rooms[uroom]; pline("Water gushes forth from the overflowing fountain!"); while(num--) { do { if(++tryct > 200) return; mx = somex(); my = somey(); } while(t_at(mx, my) || levl[mx][my].typ == STAIRS); /* Put a pool at mx, my */ levl[mx][my].typ = POOL; atl(mx,my,POOL_SYM); } break; } } if (!rn2(5)) { pline("The fountain dries up!"); levl[u.ux][u.uy].typ = ROOM; } } Scott R. Turner ARPA: (now) srt@UCLA-LOCUS.ARPA (soon) srt@LOCUS.UCLA.EDU UUCP: ...!{cepu,ihnp4,trwspp,ucbvax}!ucla-cs!srt DRAGNET: ...!{channing,streisand,joe-friday}!srt@dragnet-relay.arpa