1 /* $OpenBSD: def.monst.h,v 1.5 2016/01/09 18:33:15 mestre Exp $*/ 2 /* $NetBSD: def.monst.h,v 1.3 1995/03/23 08:29:30 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 struct monst { 66 struct monst *nmon; 67 struct permonst *data; 68 unsigned m_id; 69 xchar mx,my; 70 xchar mdx,mdy; /* if mdispl then pos where last displayed */ 71 #define MTSZ 4 72 coord mtrack[MTSZ]; /* monster track */ 73 schar mhp,mhpmax; 74 char mappearance; /* nonzero for undetected 'M's and for '1's */ 75 Bitfield(mimic,1); /* undetected mimic */ 76 Bitfield(mdispl,1); /* mdx,mdy valid */ 77 Bitfield(minvis,1); /* invisible */ 78 Bitfield(cham,1); /* shape-changer */ 79 Bitfield(mhide,1); /* hides beneath objects */ 80 Bitfield(mundetected,1); /* not seen in present hiding place */ 81 Bitfield(mspeed,2); 82 Bitfield(msleep,1); 83 Bitfield(mfroz,1); 84 Bitfield(mconf,1); 85 Bitfield(mflee,1); /* fleeing */ 86 Bitfield(mfleetim,7); /* timeout for mflee */ 87 Bitfield(mcan,1); /* has been cancelled */ 88 Bitfield(mtame,1); /* implies peaceful */ 89 Bitfield(mpeaceful,1); /* does not attack unprovoked */ 90 Bitfield(isshk,1); /* is shopkeeper */ 91 Bitfield(isgd,1); /* is guard */ 92 Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ 93 Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ 94 Bitfield(mtrapped,1); /* trapped in a pit or bear trap */ 95 Bitfield(mnamelth,6); /* length of name (following mxlth) */ 96 #ifndef NOWORM 97 Bitfield(wormno,5); /* at most 31 worms on any level */ 98 #endif /* NOWORM */ 99 unsigned mtrapseen; /* bitmap of traps we've been trapped in */ 100 long mlstmv; /* prevent two moves at once */ 101 struct obj *minvent; 102 long mgold; 103 unsigned mxlth; /* length of following data */ 104 /* in order to prevent alignment problems mextra should 105 be (or follow) a long int */ 106 long mextra[1]; /* monster dependent info */ 107 }; 108 109 #define newmonst(xl) (struct monst *) alloc((unsigned)(xl) + sizeof(struct monst)) 110 111 extern struct monst *fmon; 112 extern struct monst *fallen_down; 113 struct monst *m_at(int, int); 114 115 /* these are in mspeed */ 116 #define MSLOW 1 /* slow monster */ 117 #define MFAST 2 /* speeded monster */ 118 119 #define NAME(mtmp) (((char *) mtmp->mextra) + mtmp->mxlth) 120 #define MREGEN "TVi1" 121 #define UNDEAD "ZVW " 122