xref: /openbsd/games/hack/def.objclass.h (revision d25013f2)
1 /*	$OpenBSD: def.objclass.h,v 1.4 2003/03/16 21:22:35 camield Exp $*/
2 /*	$NetBSD: def.objclass.h,v 1.3 1995/03/23 08:29:34 cgd Exp $*/
3 
4 /*
5  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
6  * Amsterdam
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are
11  * met:
12  *
13  * - Redistributions of source code must retain the above copyright notice,
14  * this list of conditions and the following disclaimer.
15  *
16  * - Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  *
20  * - Neither the name of the Stichting Centrum voor Wiskunde en
21  * Informatica, nor the names of its contributors may be used to endorse or
22  * promote products derived from this software without specific prior
23  * written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
26  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
28  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
29  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 /*
39  * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
40  * All rights reserved.
41  *
42  * Redistribution and use in source and binary forms, with or without
43  * modification, are permitted provided that the following conditions
44  * are met:
45  * 1. Redistributions of source code must retain the above copyright
46  *    notice, this list of conditions and the following disclaimer.
47  * 2. Redistributions in binary form must reproduce the above copyright
48  *    notice, this list of conditions and the following disclaimer in the
49  *    documentation and/or other materials provided with the distribution.
50  * 3. The name of the author may not be used to endorse or promote products
51  *    derived from this software without specific prior written permission.
52  *
53  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
54  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
55  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
56  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
57  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
58  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
59  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
60  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
61  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
62  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63  */
64 
65 /* definition of a class of objects */
66 
67 struct objclass {
68 	char *oc_name;		/* actual name */
69 	char *oc_descr;		/* description when name unknown */
70 	char *oc_uname;		/* called by user */
71 	Bitfield(oc_name_known,1);
72 	Bitfield(oc_merge,1);	/* merge otherwise equal objects */
73 	char oc_olet;
74 	schar oc_prob;		/* probability for mkobj() */
75 	schar oc_delay;		/* delay when using such an object */
76 	uchar oc_weight;
77 	schar oc_oc1, oc_oc2;
78 	int oc_oi;
79 #define	nutrition	oc_oi	/* for foods */
80 #define	a_ac		oc_oc1	/* for armors - only used in ARM_BONUS */
81 #define ARM_BONUS(obj)	((10 - objects[obj->otyp].a_ac) + obj->spe)
82 #define	a_can		oc_oc2	/* for armors */
83 #define bits		oc_oc1	/* for wands and rings */
84 				/* wands */
85 #define		NODIR		1
86 #define		IMMEDIATE	2
87 #define		RAY		4
88 				/* rings */
89 #define		SPEC		1	/* +n is meaningful */
90 #define	wldam		oc_oc1	/* for weapons and PICK_AXE */
91 #define	wsdam		oc_oc2	/* for weapons and PICK_AXE */
92 #define	g_val		oc_oi	/* for gems: value on exit */
93 };
94 
95 extern struct objclass objects[];
96 
97 /* definitions of all object-symbols */
98 
99 #define	ILLOBJ_SYM	'\\'
100 #define	AMULET_SYM	'"'
101 #define	FOOD_SYM	'%'
102 #define	WEAPON_SYM	')'
103 #define	TOOL_SYM	'('
104 #define	BALL_SYM	'0'
105 #define	CHAIN_SYM	'_'
106 #define	ROCK_SYM	'`'
107 #define	ARMOR_SYM	'['
108 #define	POTION_SYM	'!'
109 #define	SCROLL_SYM	'?'
110 #define	WAND_SYM	'/'
111 #define	RING_SYM	'='
112 #define	GEM_SYM		'*'
113 /* Other places with explicit knowledge of object symbols:
114  * ....shk.c:	char shtypes[] = "=/)%?![";
115  * mklev.c:	"=/)%?![<>"
116  * hack.mkobj.c:	char mkobjstr[] = "))[[!!!!????%%%%/=**";
117  * hack.apply.c:   otmp = getobj("0#%", "put in");
118  * hack.eat.c:     otmp = getobj("%", "eat");
119  * hack.invent.c:	   if(index("!%?[)=*(0/\"", sym)){
120  * hack.invent.c:    || index("%?!*",otmp->olet))){
121  */
122