/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.steal.c - version 1.0.3 */
long /* actually returns something that fits in an int */
return( (u
.ugold
< 100) ? u
.ugold
:
(u
.ugold
> 10000) ? rnd(10000) : rnd((int) u
.ugold
) );
stealgold(mtmp
) register struct monst
*mtmp
; {
register struct gold
*gold
= g_at(u
.ux
, u
.uy
);
if(gold
&& ( !u
.ugold
|| gold
->amount
> u
.ugold
|| !rn2(5))) {
mtmp
->mgold
+= gold
->amount
;
if(Invisible
) newsym(u
.ux
, u
.uy
);
pline("%s quickly snatches some gold from between your feet!",
if(!u
.ugold
|| !rn2(5)) {
u
.ugold
-= (tmp
= somegold());
pline("Your purse feels lighter.");
/* steal armor after he finishes taking it off */
unsigned stealoid
; /* object to be stolen */
unsigned stealmid
; /* monster doing the stealing */
register struct monst
*mtmp
;
register struct obj
*otmp
;
for(otmp
= invent
; otmp
; otmp
= otmp
->nobj
)
if(otmp
->o_id
== stealoid
) {
for(mtmp
= fmon
; mtmp
; mtmp
= mtmp
->nmon
)
if(mtmp
->m_id
== stealmid
) {
if(dist(mtmp
->mx
,mtmp
->my
) < 3) {
pline("%s steals %s!", Monnam(mtmp
), doname(otmp
));
/* returns 1 when something was stolen */
/* (or at least, when N should flee now) */
/* avoid stealing the object stealoid */
register struct obj
*otmp
;
pline("Somebody tries to rob you, but finds nothing to steal.");
pline("%s tries to rob you, but she finds nothing to steal!",
return(1); /* let her flee */
for(otmp
= invent
; otmp
; otmp
= otmp
->nobj
) if(otmp
!= uarm2
)
tmp
+= ((otmp
->owornmask
& (W_ARMOR
| W_RING
)) ? 5 : 1);
for(otmp
= invent
; otmp
; otmp
= otmp
->nobj
) if(otmp
!= uarm2
)
if((tmp
-= ((otmp
->owornmask
& (W_ARMOR
| W_RING
)) ? 5 : 1))
impossible("Steal fails!");
if(otmp
->o_id
== stealoid
)
if((otmp
->owornmask
& (W_ARMOR
| W_RING
))){
if(multi
< 0 || otmp
== uarms
){
setworn((struct obj
*) 0, otmp
->owornmask
& W_ARMOR
);
{ int curssv
= otmp
->cursed
;
pline("%s seduces you and %s off your %s.",
Amonnam(mtmp
, Blind
? "gentle" : "beautiful"),
otmp
->cursed
? "helps you to take"
(otmp
== uarmg
) ? "gloves" :
(otmp
== uarmh
) ? "helmet" : "armor");
extern int (*afternmv
)();
impossible("Tried to steal a strange worn thing.");
setuwep((struct obj
*) 0);
if(otmp
->olet
== CHAIN_SYM
) {
impossible("How come you are carrying that chain?");
if(Punished
&& otmp
== uball
){
uchain
= (struct obj
*) 0;
uball
= (struct obj
*) 0; /* superfluous */
pline("%s stole %s.", named
? "She" : Monnam(mtmp
), doname(otmp
));
return((multi
< 0) ? 0 : 1);
register struct monst
*mtmp
;
register struct obj
*otmp
;
otmp
->nobj
= mtmp
->minvent
;
register struct monst
*mtmp
;
register struct obj
*otmp
;
for(otmp
= invent
; otmp
; otmp
= otmp
->nobj
) {
if(otmp
->olet
== AMULET_SYM
) {
/* might be an imitation one */
if(otmp
== uwep
) setuwep((struct obj
*) 0);
pline("%s stole %s!", Monnam(mtmp
), doname(otmp
));
/* release the objects the killed animal has stolen */
register struct monst
*mtmp
;
register struct obj
*otmp
, *otmp2
;
for(otmp
= mtmp
->minvent
; otmp
; otmp
= otmp2
){
if(show
& cansee(mtmp
->mx
,mtmp
->my
))
atl(otmp
->ox
,otmp
->oy
,otmp
->olet
);
mtmp
->minvent
= (struct obj
*) 0;
if(mtmp
->mgold
|| mtmp
->data
->mlet
== 'L') {
tmp
= (mtmp
->mgold
> 10000) ? 10000 : mtmp
->mgold
;
mkgold((long)(tmp
+ d(dlevel
,30)), mtmp
->mx
, mtmp
->my
);
if(show
& cansee(mtmp
->mx
,mtmp
->my
))
atl(mtmp
->mx
,mtmp
->my
,'$');