1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.mkobj.c - version 1.0.3 */
3 /* $FreeBSD: src/games/hack/hack.mkobj.c,v 1.5 1999/11/16 10:26:37 marcel Exp $ */
4 /* $DragonFly: src/games/hack/hack.mkobj.c,v 1.4 2006/08/21 19:45:32 pavalos Exp $ */
8 char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%";
11 mkobj_at(int let, int x, int y)
13 struct obj *otmp = mkobj(let);
23 mksobj_at(int otyp, int x, int y)
25 struct obj *otmp = mksobj(otyp);
37 let = mkobjstr[rn2(sizeof(mkobjstr) - 1)];
42 ((let > 'Z') ? (let - 'a' + 'Z' - '@' +
55 char let = objects[otyp].oc_olet;
60 otmp->o_id = flags.ident++;
64 otmp->dknown = strchr("/=!?*", let) ? 0 : 1;
67 otmp->quan = (otmp->otyp <= ROCK) ? rn1(6, 6) : 1;
76 if (otmp->otyp >= CORPSE)
78 #ifdef NOT_YET_IMPLEMENTED
79 /* if tins are to be identified, need to adapt doname() etc */
80 if (otmp->otyp == TIN)
82 #endif /* NOT_YET_IMPLEMENTED */
83 /* fall into next case */
85 otmp->quan = rn2(6) ? 1 : 2;
105 if (otmp->otyp == WAN_WISHING)
109 (objects[otmp->otyp].bits & NODIR) ? 11 : 4);
112 if (objects[otmp->otyp].bits & SPEC) {
118 } else if (otmp->otyp == RIN_TELEPORTATION ||
119 otmp->otyp == RIN_AGGRAVATE_MONSTER ||
120 otmp->otyp == RIN_HUNGER || !rn2(9))
124 panic("impossible mkobj");
126 otmp->owt = weight(otmp);
133 return (('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z'));
137 weight(struct obj *obj)
139 int wt = objects[obj->otyp].oc_weight;
140 return (wt ? wt * obj->quan : (obj->quan + 1) / 2);
144 mkgold(long num, int x, int y)
147 long amount = (num ? num : 1 + (rnd(dlevel + 2) * rnd(30)));
149 if ((gold = g_at(x, y)) != NULL)
150 gold->amount += amount;
156 gold->amount = amount;
158 /* do sth with display? */