1 /* NetHack 3.6 objclass.h $NHDT-Date: 1547255901 2019/01/12 01:18:21 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.20 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Pasi Kallinen, 2018. */
4 /* NetHack may be freely redistributed. See license for details. */
9 /* [misnamed] definition of a type of object; many objects are composites
10 (liquid potion inside glass bottle, metal arrowhead on wooden shaft)
11 and object definitions only specify one type on a best-fit basis */
12 enum obj_material_types {
13 LIQUID = 1, /* currently only for venom */
15 VEGGY = 3, /* foodstuffs */
16 FLESH = 4, /* ditto */
22 DRAGON_HIDE = 10, /* not leather! */
23 IRON = 11, /* Fe - includes steel */
24 METAL = 12, /* Sn, &c. */
25 COPPER = 13, /* Cu - includes brass */
28 PLATINUM = 16, /* Pt */
36 enum obj_armor_types {
38 ARM_SHIELD = 1, /* needed for special wear function */
47 short oc_name_idx; /* index of actual name */
48 short oc_descr_idx; /* description when name unknown */
49 char *oc_uname; /* called by user */
50 Bitfield(oc_name_known, 1); /* discovered */
51 Bitfield(oc_merge, 1); /* merge otherwise equal objects */
52 Bitfield(oc_uses_known, 1); /* obj->known affects full description;
53 otherwise, obj->dknown and obj->bknown
54 tell all, and obj->known should always
55 be set for proper merging behavior. */
56 Bitfield(oc_pre_discovered, 1); /* Already known at start of game;
57 won't be listed as a discovery. */
58 Bitfield(oc_magic, 1); /* inherently magical object */
59 Bitfield(oc_charged, 1); /* may have +n or (n) charges */
60 Bitfield(oc_unique, 1); /* special one-of-a-kind object */
61 Bitfield(oc_nowish, 1); /* cannot wish for this object */
64 #define oc_bimanual oc_big /* for weapons & tools used as weapons */
65 #define oc_bulky oc_big /* for armor */
66 Bitfield(oc_tough, 1); /* hard gems/rings */
69 #define NODIR 1 /* for wands/spells: non-directional */
70 #define IMMEDIATE 2 /* directional */
71 #define RAY 3 /* zap beams */
73 #define PIERCE 1 /* for weapons & tools used as weapons */
74 #define SLASH 2 /* (latter includes iron ball & chain) */
79 Bitfield(oc_material, 5); /* one of obj_material_types */
81 #define is_organic(otmp) (objects[otmp->otyp].oc_material <= WOOD)
82 #define is_metallic(otmp) \
83 (objects[otmp->otyp].oc_material >= IRON \
84 && objects[otmp->otyp].oc_material <= MITHRIL)
86 /* primary damage: fire/rust/--- */
87 /* is_flammable(otmp), is_rottable(otmp) in mkobj.c */
88 #define is_rustprone(otmp) (objects[otmp->otyp].oc_material == IRON)
90 /* secondary damage: rot/acid/acid */
91 #define is_corrodeable(otmp) \
92 (objects[otmp->otyp].oc_material == COPPER \
93 || objects[otmp->otyp].oc_material == IRON)
95 #define is_damageable(otmp) \
96 (is_rustprone(otmp) || is_flammable(otmp) || is_rottable(otmp) \
97 || is_corrodeable(otmp))
102 #define oc_skill oc_subtyp /* Skills of weapons, spellbooks, tools, gems */
103 #define oc_armcat oc_subtyp /* for armor (enum obj_armor_types) */
105 uchar oc_oprop; /* property (invis, &c.) conveyed */
106 char oc_class; /* object class (enum obj_class_types) */
107 schar oc_delay; /* delay when using such an object */
108 uchar oc_color; /* color of the object */
110 short oc_prob; /* probability, used in mkobj() */
111 unsigned short oc_weight; /* encumbrance (1 cn = 0.1 lb.) */
112 short oc_cost; /* base cost in shops */
113 /* Check the AD&D rules! The FIRST is small monster damage. */
114 /* for weapons, and tools, rocks, and gems useful as weapons */
115 schar oc_wsdam, oc_wldam; /* max small/large monster damage */
116 schar oc_oc1, oc_oc2;
117 #define oc_hitbon oc_oc1 /* weapons: "to hit" bonus */
119 #define a_ac oc_oc1 /* armor class, used in ARM_BONUS in do.c */
120 #define a_can oc_oc2 /* armor: used in mhitu.c */
121 #define oc_level oc_oc2 /* books: spell level */
123 unsigned short oc_nutrition; /* food value */
133 const char *oc_name; /* actual name */
134 const char *oc_descr; /* description when name unknown */
137 extern NEARDATA struct objclass objects[];
138 extern NEARDATA struct objdescr obj_descr[];
141 * All objects have a class. Make sure that all classes have a corresponding
144 enum obj_class_types {
145 RANDOM_CLASS = 0, /* used for generating random objects */
155 SPBOOK_CLASS = 10, /* actually SPELL-book */
167 #define ALLOW_COUNT (MAXOCLASSES + 1) /* Can be used in the object class */
168 #define ALL_CLASSES (MAXOCLASSES + 2) /* input to getobj(). */
169 #define ALLOW_NONE (MAXOCLASSES + 3)
171 #define BURNING_OIL (MAXOCLASSES + 1) /* Can be used as input to explode. */
172 #define MON_EXPLODE (MAXOCLASSES + 2) /* Exploding monster (e.g. gas spore) */
174 #if 0 /* moved to decl.h so that makedefs.c won't see them */
175 extern const struct class_sym
176 def_oc_syms[MAXOCLASSES]; /* default class symbols */
177 extern uchar oc_syms[MAXOCLASSES]; /* current class symbols */
180 /* Default definitions of all object-symbols (must match classes above). */
182 #define ILLOBJ_SYM ']' /* also used for mimics */
183 #define WEAPON_SYM ')'
184 #define ARMOR_SYM '['
186 #define AMULET_SYM '"'
189 #define POTION_SYM '!'
190 #define SCROLL_SYM '?'
191 #define SPBOOK_SYM '+'
197 #define CHAIN_SYM '_'
198 #define VENOM_SYM '.'
205 #define newfruit() (struct fruit *) alloc(sizeof(struct fruit))
206 #define dealloc_fruit(rind) free((genericptr_t)(rind))
208 #define OBJ_NAME(obj) (obj_descr[(obj).oc_name_idx].oc_name)
209 #define OBJ_DESCR(obj) (obj_descr[(obj).oc_descr_idx].oc_descr)
210 #endif /* OBJCLASS_H */