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