Article View: net.sources.games
Article #863hack mods (3 of 6)
From: sshefter
Date: Mon, 30 Mar 1987 20:55
Date: Mon, 30 Mar 1987 20:55
200 lines
8359 bytes
8359 bytes
From yale!husc6!rutgers!sri-spam!sri-unix!hplabs!sdcrdcf!ucla-cs!srt Wed Nov 5 12:40:35 EST 1986
With increased adventurer traffic in the local dungeon, spots of poor
workmanship have begun to show. In addition to the well known spots of
collapsing floor, returning adventurers have begun to report floor defects
that sometimes result in an annoying squeak, often at inopportune times.
In addition to that, it appears that the Wizard of Yendor has taken to
sneaking out of his subterranean retreat and leaving behind certain magical
traps.
----
The following mods add two new trap types. The first is a squeaky board
trap that awakens nearby monsters. The second is a "magic" trap that
does various weird things.
Again, please note that the line numbers involved may be inaccurate. They
assume that you have installed the Kop & Rockmole mods.
In hack.trap.c
19c19,25
< " piercer",
< " mimic"
---
> #ifdef NEWTRAPS
> " magic trap",
> " squeaky board",
> " piercer",
> " mimic"
> #else NEWTRAPS
> " piercer",
> " mimic"
> #endif
131a138,160
> #ifdef NEWTRAPS
> case MGTRP:
> /* A magic trap. */
> domagictrap();
> break;
> case SQBRD: {
> #include "def.edog.h"
> register struct monst *mtmp = fmon;
> /* Stepped on a squeaky board. */
> pline("A board underfoot gives off a load squeak!");
> /* Wake up nearby monsters. */
> while(mtmp) {
> if(dist(mtmp->mx,mtmp->my) < u.ulevel*20) {
> if(mtmp->msleep)
> mtmp->msleep = 0;
> if(mtmp->mtame)
> EDOG(mtmp)->whistletime = moves;
> }
> mtmp = mtmp->nmon;
> }
> break; }
> #endif NEWTRAPS
>
136c165
< }
---
> }
137a167
>
220a251,271
> #ifdef NEWTRAPS
> case MGTRP:
> /* A magic trap. Monsters immune. */
> break;
> case SQBRD: {
> register struct monst *ztmp = fmon;
> /* Stepped on a squeaky board. */
> if (in_sight)
> pline("%s steps on a squeaky board.", monnam(mtmp));
> else
> pline("You hear a distant squeak.");
> /* Wake up nearby monsters. */
> while(ztmp) {
> if(dist2(mtmp->mx,mtmp->my,ztmp->mx,ztmp->my) < 40) {
> if(ztmp->msleep)
> ztmp->msleep = 0;
> }
> ztmp = ztmp->nmon;
> }
> break; }
> #endif NEWTRAPS
447a499,582
>
> #ifdef NEWTRAPS
>
> domagictrap()
> {
> register int fate = rnd(20);
>
> /* What happened to the poor sucker? */
>
> if (fate < 10) {
>
> /* Most of the time, it creates some monsters. */
> register int cnt = rnd(4);
> pline("You are momentarily blinded by a flash of light!");
> Blind += rn1(5,10);
> seeoff(0);
> while(cnt--)
> (void) makemon((struct permonst *) 0, u.ux, u.uy);
> }
> else
> switch (fate) {
>
> case 10:
> case 11:
> /* sometimes nothing happens */
> break;
> case 12:
> /* a flash of fire */
> {
> register int num = rnd(6);
> pline("A tower of flame bursts from the floor!");
> u.uhpmax--;
> losehp(num,"a burst of flame");
> break;
> }
>
> /* odd feelings */
> case 13: pline("A shiver runs up and down your spine!");
> break;
> case 14: pline("You hear distant howling.");
> break;
> case 15: pline("You suddenly yearn for your distant homeland.");
> break;
> case 16: pline("Your pack shakes violently!");
> break;
>
> /* very occasionally something nice happens. */
>
> case 19:
> /* tame nearby monsters */
> { register int i,j;
> register boolean confused = (Confusion != 0);
> register int bd = confused ? 5 : 1;
> register struct monst *mtmp;
>
> for(i = -bd; i <= bd; i++) for(j = -bd; j <= bd; j++)
> if(mtmp = m_at(u.ux+i, u.uy+j))
> (void) tamedog(mtmp, (struct obj *) 0);
> break;
> }
>
> case 20:
> /* uncurse stuff */
> { register struct obj *obj;
> register boolean confused = (Confusion != 0);
> for(obj = invent; obj ; obj = obj->nobj)
> if(obj->owornmask)
> obj->cursed = confused;
> if(Punished && !confused) {
> Punished = 0;
> freeobj(uchain);
> unpobj(uchain);
> free((char *) uchain);
> uball->spe = 0;
> uball->owornmask &= ~W_BALL;
> uchain = uball = (struct obj *) 0;
> }
> break;
> }
> default: break;
> }
> }
>
> #endif
In def.trap.h
23a24,35
>
>
> #ifdef NEWTRAPS
>
> #define PIERC 9
> #define MIMIC 10 /* used only in mklev.c */
> #define MGTRP 7
> #define SQBRD 8
> #define TRAPNUM 11 /* if not less than 32, change sizeof(ttyp) */
> /* see also mtrapseen (bit map) */
> #else NEWTRAPS
>
26,27c38,40
< #define TRAPNUM 9 /* if not less than 32, change sizeof(ttyp) */
< /* see also mtrapseen (bit map) */
---
> #define TRAPNUM 9
>
> #endif NEWTRAPS
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
Technical Details
Message-ID:
<2634@yale-celed.yale.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!sshefterReferences:
<2633@yale-celed.yale.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!yale!sshefter From: sshefter@yale.UUCP Newsgroups: net.sources.games Subject: hack mods (3 of 6) Message-ID: <2634@yale-celed.yale.UUCP> Date: Mon, 30-Mar-87 15:55:17 EST Article-I.D.: yale-cel.2634 Posted: Mon Mar 30 15:55:17 1987 Date-Received: Wed, 1-Apr-87 00:39:16 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: 200