]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.shk.c
1 /* $NetBSD: hack.shk.c,v 1.4 1997/10/19 16:59:01 christos Exp $ */
4 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
9 __RCSID("$NetBSD: hack.shk.c,v 1.4 1997/10/19 16:59:01 christos Exp $");
17 static void setpaid
__P((void));
18 static void addupbill
__P((void));
19 static void findshk
__P((int));
20 static struct bill_x
*onbill
__P((struct obj
*));
21 static void pay
__P((long, struct monst
*));
22 static int dopayobj
__P((struct bill_x
*));
23 static int getprice
__P((struct obj
*));
24 static int realhunger
__P((void));
29 struct monst
*shopkeeper
= 0;
30 struct obj
*billobjs
= 0;
33 struct obj
*obj
, *merge
;
94 struct monst
*mtmp
, *mtmp2
;
104 #include "hack.mfndpos.h"
105 #include "def.mkroom.h"
106 #include "def.eshk.h"
108 #define ESHK(mon) ((struct eshk *)(&(mon->mextra[0])))
109 #define NOTANGRY(mon) mon->mpeaceful
110 #define ANGRY(mon) !NOTANGRY(mon)
113 * Descriptor of current shopkeeper. Note that the bill need not be
114 * per-shopkeeper, since it is valid only when in a shop.
116 static struct monst
*shopkeeper
= 0;
117 static struct bill_x
*bill
;
118 static int shlevel
= 0; /* level of this shopkeeper */
119 struct obj
*billobjs
; /* objects on bill with bp->useup */
120 /* only accessed here and by save & restore */
121 static long int total
; /* filled by addupbill() */
122 static long int followmsg
; /* last time of follow message */
125 invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
126 obj->quan <= bp->bquan
130 char shtypes
[] = { /* 8 shoptypes: 7 specialized, 1 mixed */
131 RING_SYM
, WAND_SYM
, WEAPON_SYM
, FOOD_SYM
, SCROLL_SYM
,
132 POTION_SYM
, ARMOR_SYM
, 0
135 static char *shopnam
[] = {
136 "engagement ring", "walking cane", "antique weapon",
137 "delicatessen", "second hand book", "liquor",
138 "used armor", "assorted antiques"
142 shkname(mtmp
) /* called in do_name.c */
145 return (ESHK(mtmp
)->shknam
);
149 shkdead(mtmp
) /* called in mon.c */
152 struct eshk
*eshk
= ESHK(mtmp
);
154 if (eshk
->shoplevel
== dlevel
)
155 rooms
[eshk
->shoproom
].rtype
= 0;
156 if (mtmp
== shopkeeper
) {
159 bill
= (struct bill_x
*) - 1000; /* dump core when
166 struct monst
*mtmp
, *mtmp2
;
168 if (mtmp
== shopkeeper
) {
170 bill
= &(ESHK(shopkeeper
)->bill
[0]);
176 { /* caller has checked that shopkeeper exists */
177 /* either we paid or left the shop or he just died */
180 for (obj
= invent
; obj
; obj
= obj
->nobj
)
182 for (obj
= fobj
; obj
; obj
= obj
->nobj
)
184 for (obj
= fcobj
; obj
; obj
= obj
->nobj
)
186 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
187 for (obj
= mtmp
->minvent
; obj
; obj
= obj
->nobj
)
189 for (mtmp
= fallen_down
; mtmp
; mtmp
= mtmp
->nmon
)
190 for (obj
= mtmp
->minvent
; obj
; obj
= obj
->nobj
)
192 while ((obj
= billobjs
) != NULL
) {
193 billobjs
= obj
->nobj
;
196 ESHK(shopkeeper
)->billct
= 0;
201 { /* delivers result in total */
202 /* caller has checked that shopkeeper exists */
203 int ct
= ESHK(shopkeeper
)->billct
;
204 struct bill_x
*bp
= bill
;
207 total
+= bp
->price
* bp
->bquan
;
215 int roomno
= inroom(u
.ux
, u
.uy
);
217 /* Did we just leave a shop? */
219 (u
.uinshop
!= roomno
+ 1 || shlevel
!= dlevel
|| !shopkeeper
)) {
221 if (ESHK(shopkeeper
)->billct
) {
222 if (inroom(shopkeeper
->mx
, shopkeeper
->my
)
223 == u
.uinshop
- 1) /* ab@unido */
224 pline("Somehow you escaped the shop without paying!");
226 pline("You stole for a total worth of %ld zorkmids.",
228 ESHK(shopkeeper
)->robbed
+= total
;
230 if ((rooms
[ESHK(shopkeeper
)->shoproom
].rtype
== GENERAL
)
232 ESHK(shopkeeper
)->following
= 1;
239 /* Did we just enter a zoo of some kind? */
241 int rt
= rooms
[roomno
].rtype
;
244 pline("Welcome to David's treasure zoo!");
245 } else if (rt
== SWAMP
) {
246 pline("It looks rather muddy down here.");
247 } else if (rt
== MORGUE
) {
249 pline("Go away! Go away!");
251 pline("You get an uncanny feeling ...");
255 rooms
[roomno
].rtype
= 0;
256 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
257 if (rt
!= ZOO
|| !rn2(3))
261 /* Did we just enter a shop? */
262 if (roomno
>= 0 && rooms
[roomno
].rtype
>= 8) {
263 if (shlevel
!= dlevel
|| !shopkeeper
264 || ESHK(shopkeeper
)->shoproom
!= roomno
)
267 rooms
[roomno
].rtype
= 0;
269 } else if (!u
.uinshop
) {
270 if (!ESHK(shopkeeper
)->visitct
||
271 strncmp(ESHK(shopkeeper
)->customer
, plname
, PL_NSIZ
)) {
273 /* He seems to be new here */
274 ESHK(shopkeeper
)->visitct
= 0;
275 ESHK(shopkeeper
)->following
= 0;
276 (void) strncpy(ESHK(shopkeeper
)->customer
, plname
, PL_NSIZ
);
277 NOTANGRY(shopkeeper
) = 1;
279 if (!ESHK(shopkeeper
)->following
) {
282 pline("Hello %s! Welcome%s to %s's %s shop!",
284 ESHK(shopkeeper
)->visitct
++ ? " again" : "",
286 shopnam
[rooms
[ESHK(shopkeeper
)->shoproom
].rtype
- 8]);
287 box
= carrying(ICE_BOX
);
288 pick
= carrying(PICK_AXE
);
290 if (dochug(shopkeeper
)) {
291 u
.uinshop
= 0; /* he died moving */
294 pline("Will you please leave your %s outside?",
295 (box
&& pick
) ? "box and pick-axe" :
296 box
? "box" : "pick-axe");
299 u
.uinshop
= roomno
+ 1;
310 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
311 if (mtmp
->isshk
&& ESHK(mtmp
)->shoproom
== roomno
312 && ESHK(mtmp
)->shoplevel
== dlevel
) {
314 bill
= &(ESHK(shopkeeper
)->bill
[0]);
316 if (ANGRY(shopkeeper
) &&
317 strncmp(ESHK(shopkeeper
)->customer
, plname
, PL_NSIZ
))
318 NOTANGRY(shopkeeper
) = 1;
320 * billobjs = 0; -- this is wrong if we save in a
324 * (and it is harmless to have too many things in
331 bill
= (struct bill_x
*) - 1000; /* dump core when referenced */
334 static struct bill_x
*
341 for (bp
= bill
; bp
< &bill
[ESHK(shopkeeper
)->billct
]; bp
++)
342 if (bp
->bo_id
== obj
->o_id
) {
344 pline("onbill: paid obj on bill?");
348 pline("onbill: unpaid obj not on bill?");
352 /* called with two args on merge */
355 struct obj
*obj
, *merge
;
357 struct bill_x
*bp
= onbill(obj
);
362 obj
->unpaid
= 0; /* only for doinvbill */
363 obj
->nobj
= billobjs
;
369 /* this used to be a rename */
370 impossible("obfree: not on bill??");
373 /* this was a merger */
374 bpm
->bquan
+= bp
->bquan
;
375 ESHK(shopkeeper
)->billct
--;
376 *bp
= bill
[ESHK(shopkeeper
)->billct
];
387 long robbed
= ESHK(shkp
)->robbed
;
396 ESHK(shkp
)->robbed
= robbed
;
410 for (shkp
= fmon
; shkp
; shkp
= shkp
->nmon
)
411 if (shkp
->isshk
&& dist(shkp
->mx
, shkp
->my
) < 3)
413 if (!shkp
&& u
.uinshop
&&
414 inroom(shopkeeper
->mx
, shopkeeper
->my
) == ESHK(shopkeeper
)->shoproom
)
418 pline("There is nobody here to receive your payment.");
421 ltmp
= ESHK(shkp
)->robbed
;
422 if (shkp
!= shopkeeper
&& NOTANGRY(shkp
)) {
424 pline("You do not owe %s anything.", monnam(shkp
));
425 } else if (!u
.ugold
) {
426 pline("You have no money.");
428 long ugold
= u
.ugold
;
430 if (u
.ugold
> ltmp
) {
431 pline("You give %s the %ld gold pieces he asked for.",
435 pline("You give %s all your gold.", monnam(shkp
));
438 if (ugold
< ltmp
/ 2) {
439 pline("Unfortunately, he doesn't look satisfied.");
441 ESHK(shkp
)->robbed
= 0;
442 ESHK(shkp
)->following
= 0;
443 if (ESHK(shkp
)->shoplevel
!= dlevel
) {
445 * For convenience's sake, let him
448 shkp
->minvent
= 0; /* %% */
456 if (!ESHK(shkp
)->billct
) {
457 pline("You do not owe %s anything.", monnam(shkp
));
459 pline("Moreover, you have no money.");
462 if (ESHK(shkp
)->robbed
) {
463 #define min(a,b) ((a<b)?a:b)
464 pline("But since his shop has been robbed recently,");
465 pline("you %srepay %s's expenses.",
466 (u
.ugold
< ESHK(shkp
)->robbed
) ? "partially " : "",
468 pay(min(u
.ugold
, ESHK(shkp
)->robbed
), shkp
);
469 ESHK(shkp
)->robbed
= 0;
473 pline("But in order to appease %s,",
474 amonnam(shkp
, "angry"));
475 if (u
.ugold
>= 1000) {
477 pline(" you give him 1000 gold pieces.");
480 pline(" you give him all your money.");
483 if (strncmp(ESHK(shkp
)->customer
, plname
, PL_NSIZ
)
485 pline("%s calms down.", Monnam(shkp
));
488 pline("%s is as angry as ever.",
493 if (shkp
!= shopkeeper
) {
494 impossible("dopay: not to shopkeeper?");
499 for (pass
= 0; pass
<= 1; pass
++) {
501 while (tmp
< ESHK(shopkeeper
)->billct
) {
503 if (!pass
&& !bp
->useup
) {
509 bill
[tmp
] = bill
[--ESHK(shopkeeper
)->billct
];
512 pline("Thank you for shopping in %s's %s store!",
514 shopnam
[rooms
[ESHK(shopkeeper
)->shoproom
].rtype
- 8]);
515 NOTANGRY(shopkeeper
) = 1;
519 /* return 1 if paid successfully */
520 /* 0 if not enough money */
521 /* -1 if object could not be found (but was paid) */
529 /* find the object on one of the lists */
533 impossible("Shopkeeper administration out of order.");
534 setpaid(); /* be nice to the player */
537 if (!obj
->unpaid
&& !bp
->useup
) {
538 impossible("Paid object on bill??");
542 ltmp
= bp
->price
* bp
->bquan
;
543 if (ANGRY(shopkeeper
))
545 if (u
.ugold
< ltmp
) {
546 pline("You don't have gold enough to pay %s.",
551 pay(ltmp
, shopkeeper
);
552 pline("You bought %s for %ld gold piece%s.",
553 doname(obj
), ltmp
, plur(ltmp
));
555 struct obj
*otmp
= billobjs
;
557 billobjs
= obj
->nobj
;
559 while (otmp
&& otmp
->nobj
!= obj
)
562 otmp
->nobj
= obj
->nobj
;
564 pline("Error in shopkeeper administration.");
571 /* routine called after dying (or quitting) with nonempty bill */
575 if (shlevel
== dlevel
&& shopkeeper
&& ESHK(shopkeeper
)->billct
) {
577 if (total
> u
.ugold
) {
578 shopkeeper
->mgold
+= u
.ugold
;
580 pline("%s comes and takes all your possessions.",
584 shopkeeper
->mgold
+= total
;
585 pline("%s comes and takes the %ld zorkmids you owed him.",
586 Monnam(shopkeeper
), total
);
588 setpaid(); /* in case we create bones */
592 /* find obj on one of the lists */
599 unsigned id
= bp
->bo_id
;
602 obj
= o_on(id
, billobjs
);
603 else if (!(obj
= o_on(id
, invent
)) &&
604 !(obj
= o_on(id
, fobj
)) &&
605 !(obj
= o_on(id
, fcobj
))) {
606 for (mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
607 if ((obj
= o_on(id
, mtmp
->minvent
)) != NULL
)
609 for (mtmp
= fallen_down
; mtmp
; mtmp
= mtmp
->nmon
)
610 if ((obj
= o_on(id
, mtmp
->minvent
)) != NULL
)
616 /* called in hack.c when we pickup an object */
623 (u
.ux
== ESHK(shopkeeper
)->shk
.x
&& u
.uy
== ESHK(shopkeeper
)->shk
.y
) ||
624 (u
.ux
== ESHK(shopkeeper
)->shd
.x
&& u
.uy
== ESHK(shopkeeper
)->shd
.y
) ||
625 onbill(obj
) /* perhaps we threw it away earlier */
628 if (ESHK(shopkeeper
)->billct
== BILLSZ
) {
629 pline("You got that for free!");
632 bp
= &bill
[ESHK(shopkeeper
)->billct
];
633 bp
->bo_id
= obj
->o_id
;
634 bp
->bquan
= obj
->quan
;
636 bp
->price
= getprice(obj
);
637 ESHK(shopkeeper
)->billct
++;
643 struct obj
*obj
, *otmp
;
645 /* otmp has been split off from obj */
650 impossible("splitbill: not on bill?");
653 if (bp
->bquan
< otmp
->quan
) {
654 impossible("Negative quantity on bill??");
656 if (bp
->bquan
== otmp
->quan
) {
657 impossible("Zero quantity on bill??");
659 bp
->bquan
-= otmp
->quan
;
661 /* addtobill(otmp); */
662 if (ESHK(shopkeeper
)->billct
== BILLSZ
)
666 bp
= &bill
[ESHK(shopkeeper
)->billct
];
667 bp
->bo_id
= otmp
->o_id
;
668 bp
->bquan
= otmp
->quan
;
671 ESHK(shopkeeper
)->billct
++;
683 if (!inshop() || (u
.ux
== ESHK(shopkeeper
)->shk
.x
&& u
.uy
== ESHK(shopkeeper
)->shk
.y
) ||
684 (u
.ux
== ESHK(shopkeeper
)->shd
.x
&& u
.uy
== ESHK(shopkeeper
)->shd
.y
))
686 if ((bp
= onbill(obj
)) != 0) {
688 if (bp
->bquan
> obj
->quan
) {
691 bp
->bo_id
= otmp
->o_id
= flags
.ident
++;
692 otmp
->quan
= (bp
->bquan
-= obj
->quan
);
693 otmp
->owt
= 0; /* superfluous */
696 otmp
->nobj
= billobjs
;
700 ESHK(shopkeeper
)->billct
--;
701 *bp
= bill
[ESHK(shopkeeper
)->billct
];
705 pline("%s didn't notice.", Monnam(shopkeeper
));
709 /* he dropped something of his own - probably wants to sell it */
710 if (shopkeeper
->msleep
|| shopkeeper
->mfroz
||
711 inroom(shopkeeper
->mx
, shopkeeper
->my
) != ESHK(shopkeeper
)->shoproom
)
713 if (ESHK(shopkeeper
)->billct
== BILLSZ
||
714 ((tmp
= shtypes
[rooms
[ESHK(shopkeeper
)->shoproom
].rtype
- 8]) && tmp
!= obj
->olet
)
715 || strchr("_0", obj
->olet
)) {
716 pline("%s seems not interested.", Monnam(shopkeeper
));
719 ltmp
= getprice(obj
) * obj
->quan
;
720 if (ANGRY(shopkeeper
)) {
722 NOTANGRY(shopkeeper
) = 1;
725 if (ESHK(shopkeeper
)->robbed
) {
726 if ((ESHK(shopkeeper
)->robbed
-= ltmp
) < 0)
727 ESHK(shopkeeper
)->robbed
= 0;
728 pline("Thank you for your contribution to restock this recently plundered shop.");
731 if (ltmp
> shopkeeper
->mgold
)
732 ltmp
= shopkeeper
->mgold
;
733 pay(-ltmp
, shopkeeper
);
735 pline("%s gladly accepts %s but cannot pay you at present.",
736 Monnam(shopkeeper
), doname(obj
));
738 pline("You sold %s and got %ld gold piece%s.", doname(obj
), ltmp
,
744 int mode
; /* 0: deliver count 1: paged */
748 long totused
, thisused
;
755 for (bp
= bill
; bp
- bill
< ESHK(shopkeeper
)->billct
; bp
++)
757 ((obj
= bp_to_obj(bp
)) && obj
->quan
< bp
->bquan
))
762 impossible("doinvbill: no shopkeeper?");
766 if (page_line("Unpaid articles already used up:") || page_line(""))
770 for (bp
= bill
; bp
- bill
< ESHK(shopkeeper
)->billct
; bp
++) {
773 impossible("Bad shopkeeper administration.");
776 if (bp
->useup
|| bp
->bquan
> obj
->quan
) {
777 int cnt
, oquan
, uquan
;
780 uquan
= (bp
->useup
? bp
->bquan
: bp
->bquan
- oquan
);
781 thisused
= bp
->price
* uquan
;
783 obj
->quan
= uquan
; /* cheat doname */
784 (void) sprintf(buf
, "x - %s", doname(obj
));
785 obj
->quan
= oquan
; /* restore value */
786 for (cnt
= 0; buf
[cnt
]; cnt
++);
789 (void) sprintf(&buf
[cnt
], " %5ld zorkmids", thisused
);
794 (void) sprintf(buf
, "Total:%50ld zorkmids", totused
);
795 if (page_line("") || page_line(buf
))
815 tmp
= 10 * rnd((obj
->otyp
== EXPENSIVE_CAMERA
) ? 150 : 30);
826 if (obj
->otyp
== SCR_MAIL
)
834 tmp
= 10 * rnd(5 + (2000 / realhunger()));
841 if (ac
<= -10) /* probably impossible */
843 tmp
= 100 + ac
* ac
* rnd(10 + ac
);
846 if (obj
->otyp
< BOOMERANG
)
848 else if (obj
->otyp
== LONG_SWORD
||
849 obj
->otyp
== TWO_HANDED_SWORD
)
855 pline("Strange ..., carrying a chain?");
867 { /* not completely foolproof */
869 struct obj
*otmp
= invent
;
871 if (otmp
->olet
== FOOD_SYM
&& !otmp
->unpaid
)
872 tmp
+= objects
[otmp
->otyp
].nutrition
;
875 return ((tmp
<= 0) ? 1 : tmp
);
882 struct monst
*shkp
= shopkeeper
;
884 if (u
.uinshop
&& shkp
&& !shkp
->mfroz
&& !shkp
->msleep
&&
886 inroom(u
.ux
+ u
.dx
, u
.uy
+ u
.dy
) + 1 == u
.uinshop
&&
887 shkp
->mx
== ESHK(shkp
)->shk
.x
&& shkp
->my
== ESHK(shkp
)->shk
.y
&&
888 u
.ux
== ESHK(shkp
)->shd
.x
&& u
.uy
== ESHK(shkp
)->shd
.y
) {
889 pline("%s nimbly catches the %s.", Monnam(shkp
), xname(obj
));
890 obj
->nobj
= shkp
->minvent
;
898 * shk_move: return 1: he moved 0: he didnt -1: let m_move do it
905 struct permonst
*mdat
= shkp
->data
;
906 xchar gx
, gy
, omx
, omy
, nx
, ny
, nix
, niy
;
910 schar shkroom
, chi
, chcnt
, cnt
;
911 boolean uondoor
= 0, satdoor
, avoid
= 0, badinv
;
919 if ((udist
= dist(omx
, omy
)) < 3) {
921 (void) hitu(shkp
, d(mdat
->damn
, mdat
->damd
) + 1);
924 if (ESHK(shkp
)->following
) {
925 if (strncmp(ESHK(shkp
)->customer
, plname
, PL_NSIZ
)) {
926 pline("Hello %s! I was looking for %s.",
927 plname
, ESHK(shkp
)->customer
);
928 ESHK(shkp
)->following
= 0;
931 if (!ESHK(shkp
)->robbed
) { /* impossible? */
932 ESHK(shkp
)->following
= 0;
935 if (moves
> followmsg
+ 4) {
936 pline("Hello %s! Didn't you forget to pay?",
944 shkroom
= inroom(omx
, omy
);
946 gx
= ESHK(shkp
)->shk
.x
;
947 gy
= ESHK(shkp
)->shk
.y
;
948 satdoor
= (gx
== omx
&& gy
== omy
);
949 if (ESHK(shkp
)->following
|| ((z
= holetime()) >= 0 && z
* z
<= udist
)) {
952 if (shkroom
< 0 || shkroom
!= inroom(u
.ux
, u
.uy
))
954 return (-1); /* leave it to m_move */
955 } else if (ANGRY(shkp
)) {
956 long saveBlind
= Blind
;
958 if (shkp
->mcansee
&& !Invis
&& cansee(omx
, omy
)) {
965 #define GDIST(x,y) ((x-gx)*(x-gx)+(y-gy)*(y-gy))
969 uondoor
= (u
.ux
== ESHK(shkp
)->shd
.x
&&
970 u
.uy
== ESHK(shkp
)->shd
.y
);
972 if (ESHK(shkp
)->billct
)
973 pline("Hello %s! Will you please pay before leaving?",
975 badinv
= (carrying(PICK_AXE
) || carrying(ICE_BOX
));
976 if (satdoor
&& badinv
)
980 avoid
= (u
.uinshop
&& dist(gx
, gy
) > 8);
984 if (((!ESHK(shkp
)->robbed
&& !ESHK(shkp
)->billct
) || avoid
)
985 && GDIST(omx
, omy
) < 3) {
986 if (!badinv
&& !online(omx
, omy
))
993 if (omx
== gx
&& omy
== gy
)
1001 cnt
= mfndpos(shkp
, poss
, info
, ALLOW_SSM
);
1002 if (avoid
&& uondoor
) { /* perhaps we cannot avoid him */
1003 for (i
= 0; i
< cnt
; i
++)
1004 if (!(info
[i
] & NOTONL
))
1012 for (i
= 0; i
< cnt
; i
++) {
1015 if (levl
[nx
][ny
].typ
== ROOM
1016 || shkroom
!= ESHK(shkp
)->shoproom
1017 || ESHK(shkp
)->following
) {
1019 /* cater for stupid compilers */
1022 if (uondoor
&& (ib
= sobj_at(ICE_BOX
, nx
, ny
))) {
1028 if (avoid
&& (info
[i
] & NOTONL
))
1030 if ((!appr
&& !rn2(++chcnt
)) ||
1032 (appr
&& (zz
= GDIST(nix
, niy
)) && zz
> GDIST(nx
, ny
))
1034 (appr
&& GDIST(nx
, ny
) < GDIST(nix
, niy
))
1043 if (nix
!= omx
|| niy
!= omy
) {
1044 if (info
[chi
] & ALLOW_M
) {
1045 mtmp
= m_at(nix
, niy
);
1046 if (hitmm(shkp
, mtmp
) == 1 && rn2(3) &&
1047 hitmm(mtmp
, shkp
) == 2)
1050 } else if (info
[chi
] & ALLOW_U
) {
1051 (void) hitu(shkp
, d(mdat
->damn
, mdat
->damd
) + 1);
1066 /* He is digging in the shop. */
1072 if (u
.utraptype
== TT_PIT
)
1073 pline("\"Be careful, sir, or you might fall through the floor.\"");
1075 pline("\"Please, do not damage the floor here.\"");
1076 } else if (dist(shopkeeper
->mx
, shopkeeper
->my
) < 3) {
1077 struct obj
*obj
, *obj2
;
1079 pline("%s grabs your backpack!", shkname(shopkeeper
));
1080 for (obj
= invent
; obj
; obj
= obj2
) {
1085 obj
->nobj
= shopkeeper
->minvent
;
1086 shopkeeper
->minvent
= obj
;
1097 return (x
== u
.ux
|| y
== u
.uy
||
1098 (x
- u
.ux
) * (x
- u
.ux
) == (y
- u
.uy
) * (y
- u
.uy
));
1101 /* Does this monster follow me downstairs? */
1106 return (mtmp
->mtame
|| strchr("1TVWZi&, ", mtmp
->data
->mlet
)
1108 || (mtmp
->isshk
&& ESHK(mtmp
)->following
)