]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hack/hack.mkobj.c
2 * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
6 static char rcsid
[] = "$NetBSD: hack.mkobj.c,v 1.3 1995/03/23 08:30:47 cgd Exp $";
11 char mkobjstr
[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%";
12 struct obj
*mkobj(), *mksobj();
18 register struct obj
*otmp
= mkobj(let
);
29 register struct obj
*otmp
= mksobj(otyp
);
39 let
= mkobjstr
[rn2(sizeof(mkobjstr
) - 1)];
43 CORPSE
+ ((let
> 'Z') ? (let
-'a'+'Z'-'@'+1) : (let
-'@'))
56 register struct obj
*otmp
;
57 char let
= objects
[otyp
].oc_olet
;
62 otmp
->o_id
= flags
.ident
++;
66 otmp
->dknown
= index("/=!?*", let
) ? 0 : 1;
69 otmp
->quan
= (otmp
->otyp
<= ROCK
) ? rn1(6,6) : 1;
70 if(!rn2(11)) otmp
->spe
= rnd(3);
77 if(otmp
->otyp
>= CORPSE
) break;
78 #ifdef NOT_YET_IMPLEMENTED
79 /* if tins are to be identified, need to adapt doname() etc */
82 #endif NOT_YET_IMPLEMENTED
83 /* fall into next case */
85 otmp
->quan
= rn2(6) ? 1 : 2;
95 if(!rn2(8)) otmp
->cursed
= 1;
96 if(!rn2(10)) otmp
->spe
= rnd(3);
103 if(otmp
->otyp
== WAN_WISHING
) otmp
->spe
= 3; else
105 (objects
[otmp
->otyp
].bits
& NODIR
) ? 11 : 4);
108 if(objects
[otmp
->otyp
].bits
& SPEC
) {
112 } else otmp
->spe
= rnd(2);
113 } else if(otmp
->otyp
== RIN_TELEPORTATION
||
114 otmp
->otyp
== RIN_AGGRAVATE_MONSTER
||
115 otmp
->otyp
== RIN_HUNGER
|| !rn2(9))
119 panic("impossible mkobj");
121 otmp
->owt
= weight(otmp
);
126 return(('@' <= c
&& c
<= 'Z') || ('a' <= c
&& c
<= 'z'));
130 register struct obj
*obj
;
132 register int wt
= objects
[obj
->otyp
].oc_weight
;
133 return(wt
? wt
*obj
->quan
: (obj
->quan
+ 1)/2);
139 register struct gold
*gold
;
140 register long amount
= (num
? num
: 1 + (rnd(dlevel
+2) * rnd(30)));
143 gold
->amount
+= amount
;
149 gold
->amount
= amount
;
151 /* do sth with display? */