/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.read.c - version 1.0.3 */
extern struct monst
*makemon();
extern struct obj
*mkobj_at();
register struct obj
*scroll
;
register boolean confused
= (Confusion
!= 0);
register boolean known
= FALSE
;
extern struct obj
*some_armor();
scroll
= getobj("?", "read");
if(!scroll
->dknown
&& Blind
) {
pline("Being blind, you cannot read the formula on the scroll.");
pline("As you pronounce the formula on it, the scroll disappears.");
pline("As you read the scroll, it disappears.");
pline("Being confused, you mispronounce the magic words ... ");
{ register struct obj
*otmp
= some_armor();
strange_feeling(scroll
,"Your skin glows then fades.");
pline("Your %s glows silver for a moment.",
objects
[otmp
->otyp
].oc_name
);
if(otmp
->spe
> 3 && rn2(otmp
->spe
)) {
pline("Your %s glows violently green for a while, then evaporates.",
objects
[otmp
->otyp
].oc_name
);
pline("Your %s glows green for a moment.",
objects
[otmp
->otyp
].oc_name
);
register struct obj
*otmp
= some_armor();
strange_feeling(scroll
,"Your bones itch.");
pline("Your %s glows purple for a moment.",
objects
[otmp
->otyp
].oc_name
);
pline("Your armor turns to dust and falls to the floor!");
pline("Your helmet turns to dust and is blown away!");
pline("Your gloves vanish!");
strange_feeling(scroll
,"Your skin itches.");
case SCR_CONFUSE_MONSTER
:
pline("Your hands begin to glow purple.");
pline("Your hands begin to glow blue.");
register struct monst
*mtmp
;
for(mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
if(cansee(mtmp
->mx
,mtmp
->my
)) {
mtmp
->mflee
= mtmp
->mfroz
=
pline("You hear sad wailing in the distance.");
pline("You hear maniacal laughter in the distance.");
pline("You see strange patterns on this scroll.");
pline("This scroll seems to be blank.");
{ register struct obj
*obj
;
pline("You feel like you need some help.");
pline("You feel like someone is helping you.");
for(obj
= invent
; obj
; obj
= obj
->nobj
)
if(Punished
&& !confused
) {
uball
->owornmask
&= ~W_BALL
;
uchain
= uball
= (struct obj
*) 0;
if(!rn2(73)) cnt
+= rnd(4);
(void) makemon(confused
? PM_ACID_BLOB
:
(struct permonst
*) 0, u
.ux
, u
.uy
);
pline("Your %s glows silver for a moment.",
objects
[uwep
->otyp
].oc_name
);
if(!chwepon(scroll
, 1)) /* tests for !uwep */
pline("Your %s glows purple for a moment.",
objects
[uwep
->otyp
].oc_name
);
if(!chwepon(scroll
, -1)) /* tests for !uwep */
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);
{ extern char genocided
[], fut_geno
[];
register struct monst
*mtmp
, *mtmp2
;
pline("You have found a scroll of genocide!");
pline("What monster do you want to genocide (Type the letter)? ");
} while(strlen(buf
) != 1 || !monstersym(*buf
));
if(!index(fut_geno
, *buf
))
if(!index(genocided
, *buf
))
charcat(genocided
, *buf
);
pline("Such monsters do not exist in this world.");
for(mtmp
= fmon
; mtmp
; mtmp
= mtmp2
){
if(mtmp
->data
->mlet
== *buf
)
pline("Wiped out all %c's.", *buf
);
killer
= "scroll of genocide";
register int oux
= u
.ux
, ouy
= u
.uy
;
if(dist(oux
, ouy
) > 100) known
= TRUE
;
register int uroom
= inroom(u
.ux
, u
.uy
);
if(uroom
!= inroom(u
.ux
, u
.uy
)) known
= TRUE
;
/* Unfortunately this code has become slightly less elegant,
now that gold and traps no longer are of the same type. */
register struct trap
*ttmp
;
strange_feeling(scroll
, "Your toes stop itching.");
for(ttmp
= ftrap
; ttmp
; ttmp
= ttmp
->ntrap
)
if(ttmp
->tx
!= u
.ux
|| ttmp
->ty
!= u
.uy
)
/* only under me - no separate display required */
pline("Your toes itch!");
for(ttmp
= ftrap
; ttmp
; ttmp
= ttmp
->ntrap
)
at(ttmp
->tx
, ttmp
->ty
, '$');
pline("You feel very greedy!");
register struct gold
*gtmp
;
strange_feeling(scroll
, "You feel materially poor.");
for(gtmp
= fgold
; gtmp
; gtmp
= gtmp
->ngold
)
if(gtmp
->gx
!= u
.ux
|| gtmp
->gy
!= u
.uy
)
/* only under me - no separate display required */
pline("You notice some gold between your feet.");
for(gtmp
= fgold
; gtmp
; gtmp
= gtmp
->ngold
)
at(gtmp
->gx
, gtmp
->gy
, '$');
pline("You feel very greedy, and sense gold!");
{ register ct
= 0, ctu
= 0;
register struct obj
*obj
;
register char foodsym
= confused
? POTION_SYM
: FOOD_SYM
;
for(obj
= fobj
; obj
; obj
= obj
->nobj
)
if(obj
->olet
== FOOD_SYM
) {
if(obj
->ox
== u
.ux
&& obj
->oy
== u
.uy
) ctu
++;
strange_feeling(scroll
,"Your nose twitches.");
pline("You smell %s close nearby.",
confused
? "something" : "food");
for(obj
= fobj
; obj
; obj
= obj
->nobj
)
at(obj
->ox
, obj
->oy
, FOOD_SYM
);
pline("Your nose tingles and you smell %s!",
confused
? "something" : "food");
pline("You identify this as an identify scroll.");
pline("This is an identify scroll.");
objects
[SCR_IDENTIFY
].oc_name_known
= 1;
!ggetobj("identify", identify
, rn2(5) ? 1 : rn2(5))
{ register struct rm
*lev
;
register int num
, zx
, zy
;
pline("On this scroll %s a map!",
confused
? "was" : "is");
for(zy
= 0; zy
< ROWNO
; zy
++)
for(zx
= 0; zx
< COLNO
; zx
++) {
if(confused
&& rn2(7)) continue;
if((num
= lev
->typ
) == 0)
} else if(lev
->seen
) continue;
lev
->seen
= lev
->new = 1;
if(lev
->scrsym
== ' ' || !lev
->scrsym
)
for(zx
= 0; zx
< COLNO
; zx
++) for(zy
= 0; zy
< ROWNO
; zy
++)
pline("Thinking of Maud you forget everything else.");
register struct monst
*mtmp
;
pline("The scroll catches fire and you burn your hands.");
losehp(1, "scroll of fire");
pline("The scroll erupts in a tower of flame!");
pline("You are uninjured.");
losehp(num
, "scroll of fire");
for(mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
) {
if(dist(mtmp
->mx
,mtmp
->my
) < 3) {
if(index("FY", mtmp
->data
->mlet
))
mtmp
->mhp
-= 3*num
; /* this might well kill 'F's */
pline("You feel guilty.");
pline("You are being punished for your misbehaviour!");
pline("Your iron ball gets heavier.");
setworn(mkobj_at(CHAIN_SYM
, u
.ux
, u
.uy
), W_CHAIN
);
setworn(mkobj_at(BALL_SYM
, u
.ux
, u
.uy
), W_BALL
);
uball
->spe
= 1; /* special ball (see save) */
impossible("What weird language is this written in? (%u)",
if(!objects
[scroll
->otyp
].oc_name_known
) {
objects
[scroll
->otyp
].oc_name_known
= 1;
} else if(!objects
[scroll
->otyp
].oc_uname
)
identify(otmp
) /* also called by newmail() */
register struct obj
*otmp
;
objects
[otmp
->otyp
].oc_name_known
= 1;
otmp
->known
= otmp
->dknown
= 1;
/* first produce the text (provided he is not blind) */
if(u
.uswallow
|| !xdnstair
|| levl
[u
.ux
][u
.uy
].typ
== CORR
||
pline("It seems even darker in here than before.");
pline("It suddenly becomes dark in here.");
pline("%s's stomach is lit.", Monnam(u
.ustuck
));
pline("Nothing Happens.");
pline("The cave lights up around you, then fades.");
if(levl
[u
.ux
][u
.uy
].typ
== CORR
) {
pline("The corridor lights up around you, then fades.");
} else if(levl
[u
.ux
][u
.uy
].lit
) {
pline("The light here seems better now.");
pline("The room is lit.");
if(levl
[u
.ux
][u
.uy
].lit
== on
)
if(levl
[u
.ux
][u
.uy
].typ
== DOOR
) {
if(IS_ROOM(levl
[u
.ux
][u
.uy
+1].typ
)) zy
= u
.uy
+1;
else if(IS_ROOM(levl
[u
.ux
][u
.uy
-1].typ
)) zy
= u
.uy
-1;
if(IS_ROOM(levl
[u
.ux
+1][u
.uy
].typ
)) zx
= u
.ux
+1;
else if(IS_ROOM(levl
[u
.ux
-1][u
.uy
].typ
)) zx
= u
.ux
-1;
for(seelx
= u
.ux
; (num
= levl
[seelx
-1][zy
].typ
) != CORR
&& num
!= 0;
for(seehx
= u
.ux
; (num
= levl
[seehx
+1][zy
].typ
) != CORR
&& num
!= 0;
for(seely
= u
.uy
; (num
= levl
[zx
][seely
-1].typ
) != CORR
&& num
!= 0;
for(seehy
= u
.uy
; (num
= levl
[zx
][seehy
+1].typ
) != CORR
&& num
!= 0;
for(zy
= seely
; zy
<= seehy
; zy
++)
for(zx
= seelx
; zx
<= seehx
; zx
++) {
if(!Blind
&& dist(zx
,zy
) > 2)
if(on
) prl(zx
,zy
); else nosee(zx
,zy
);
/* Test whether we may genocide all monsters with symbol ch */
monstersym(ch
) /* arnold@ucsfcgl */
register struct permonst
*mp
;
extern struct permonst pm_eel
;
* can't genocide certain monsters
for (mp
= mons
; mp
< &mons
[CMNUM
+2]; mp
++)