Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef MONDATA_H
00006 #define MONDATA_H
00007
00008 #define verysmall(ptr) ((ptr)->msize < MZ_SMALL)
00009 #define bigmonst(ptr) ((ptr)->msize >= MZ_LARGE)
00010 #define hugemonst(ptr) ((ptr)->msize >= MZ_HUGE)
00011
00012 #define pm_resistance(ptr,typ) (((ptr)->mresists & (typ)) != 0)
00013
00014 #define resists_fire(mon) (((mon)->mintrinsics & MR_FIRE) != 0)
00015 #define resists_cold(mon) (((mon)->mintrinsics & MR_COLD) != 0)
00016 #define resists_sleep(mon) (((mon)->mintrinsics & MR_SLEEP) != 0)
00017 #define resists_disint(mon) (((mon)->mintrinsics & MR_DISINT) != 0)
00018 #define resists_elec(mon) (((mon)->mintrinsics & MR_ELEC) != 0)
00019 #define resists_poison(mon) (((mon)->mintrinsics & MR_POISON) != 0)
00020 #define resists_acid(mon) (((mon)->mintrinsics & MR_ACID) != 0)
00021 #define resists_ston(mon) (((mon)->mintrinsics & MR_STONE) != 0)
00022
00023 #define is_lminion(mon) (is_minion((mon)->data) && \
00024 (mon)->data->maligntyp >= A_COALIGNED && \
00025 ((mon)->data != &mons[PM_ANGEL] || \
00026 EPRI(mon)->shralign > 0))
00027
00028 #define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L)
00029 #define is_floater(ptr) ((ptr)->mlet == S_EYE)
00030 #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L)
00031 #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L)
00032 #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L)
00033 #define amphibious(ptr) (((ptr)->mflags1 & (M1_AMPHIBIOUS | M1_BREATHLESS)) != 0L)
00034 #define passes_walls(ptr) (((ptr)->mflags1 & M1_WALLWALK) != 0L)
00035 #define amorphous(ptr) (((ptr)->mflags1 & M1_AMORPHOUS) != 0L)
00036 #define noncorporeal(ptr) ((ptr)->mlet == S_GHOST)
00037 #define tunnels(ptr) (((ptr)->mflags1 & M1_TUNNEL) != 0L)
00038 #define needspick(ptr) (((ptr)->mflags1 & M1_NEEDPICK) != 0L)
00039 #define hides_under(ptr) (((ptr)->mflags1 & M1_CONCEAL) != 0L)
00040 #define is_hider(ptr) (((ptr)->mflags1 & M1_HIDE) != 0L)
00041 #define haseyes(ptr) (((ptr)->mflags1 & M1_NOEYES) == 0L)
00042 #define eyecount(ptr) (!haseyes(ptr) ? 0 : \
00043 ((ptr) == &mons[PM_CYCLOPS] || \
00044 (ptr) == &mons[PM_FLOATING_EYE]) ? 1 : 2)
00045 #define nohands(ptr) (((ptr)->mflags1 & M1_NOHANDS) != 0L)
00046 #define nolimbs(ptr) (((ptr)->mflags1 & M1_NOLIMBS) == M1_NOLIMBS)
00047 #define notake(ptr) (((ptr)->mflags1 & M1_NOTAKE) != 0L)
00048 #define has_head(ptr) (((ptr)->mflags1 & M1_NOHEAD) == 0L)
00049 #define has_horns(ptr) (num_horns(ptr) > 0)
00050 #define is_whirly(ptr) ((ptr)->mlet == S_VORTEX || \
00051 (ptr) == &mons[PM_AIR_ELEMENTAL])
00052 #define flaming(ptr) ((ptr) == &mons[PM_FIRE_VORTEX] || \
00053 (ptr) == &mons[PM_FLAMING_SPHERE] || \
00054 (ptr) == &mons[PM_FIRE_ELEMENTAL] || \
00055 (ptr) == &mons[PM_SALAMANDER])
00056 #define is_silent(ptr) ((ptr)->msound == MS_SILENT)
00057 #define unsolid(ptr) (((ptr)->mflags1 & M1_UNSOLID) != 0L)
00058 #define mindless(ptr) (((ptr)->mflags1 & M1_MINDLESS) != 0L)
00059 #define humanoid(ptr) (((ptr)->mflags1 & M1_HUMANOID) != 0L)
00060 #define is_animal(ptr) (((ptr)->mflags1 & M1_ANIMAL) != 0L)
00061 #define slithy(ptr) (((ptr)->mflags1 & M1_SLITHY) != 0L)
00062 #define is_wooden(ptr) ((ptr) == &mons[PM_WOOD_GOLEM])
00063 #define thick_skinned(ptr) (((ptr)->mflags1 & M1_THICK_HIDE) != 0L)
00064 #define lays_eggs(ptr) (((ptr)->mflags1 & M1_OVIPAROUS) != 0L)
00065 #define regenerates(ptr) (((ptr)->mflags1 & M1_REGEN) != 0L)
00066 #define perceives(ptr) (((ptr)->mflags1 & M1_SEE_INVIS) != 0L)
00067 #define can_teleport(ptr) (((ptr)->mflags1 & M1_TPORT) != 0L)
00068 #define control_teleport(ptr) (((ptr)->mflags1 & M1_TPORT_CNTRL) != 0L)
00069 #define telepathic(ptr) ((ptr) == &mons[PM_FLOATING_EYE] || \
00070 (ptr) == &mons[PM_MIND_FLAYER] || \
00071 (ptr) == &mons[PM_MASTER_MIND_FLAYER])
00072 #define is_armed(ptr) attacktype(ptr, AT_WEAP)
00073 #define acidic(ptr) (((ptr)->mflags1 & M1_ACID) != 0L)
00074 #define poisonous(ptr) (((ptr)->mflags1 & M1_POIS) != 0L)
00075 #define carnivorous(ptr) (((ptr)->mflags1 & M1_CARNIVORE) != 0L)
00076 #define herbivorous(ptr) (((ptr)->mflags1 & M1_HERBIVORE) != 0L)
00077 #define metallivorous(ptr) (((ptr)->mflags1 & M1_METALLIVORE) != 0L)
00078 #define polyok(ptr) (((ptr)->mflags2 & M2_NOPOLY) == 0L)
00079 #define is_undead(ptr) (((ptr)->mflags2 & M2_UNDEAD) != 0L)
00080 #define is_were(ptr) (((ptr)->mflags2 & M2_WERE) != 0L)
00081 #define is_vampire(ptr) ((ptr)->mlet == S_VAMPIRE || \
00082 ((ptr)->mflags2 & M2_VAMPIRE) != 0)
00083
00084 #define is_vampiric(ptr) ((is_vampire(ptr)) || \
00085 (ptr) == &mons[PM_VAMPIRE_BAT])
00086 #define is_elf(ptr) (((ptr)->mflags2 & M2_ELF) != 0L)
00087 #define is_dwarf(ptr) (((ptr)->mflags2 & M2_DWARF) != 0L)
00088 #define is_gnome(ptr) (((ptr)->mflags2 & M2_GNOME) != 0L)
00089 #define is_orc(ptr) (((ptr)->mflags2 & M2_ORC) != 0L)
00090 #define is_human(ptr) (((ptr)->mflags2 & M2_HUMAN) != 0L)
00091 #define your_race(ptr) (((ptr)->mflags2 & urace.selfmask) != 0L)
00092 #define is_bat(ptr) ((ptr) == &mons[PM_BAT] || \
00093 (ptr) == &mons[PM_GIANT_BAT] || \
00094 (ptr) == &mons[PM_VAMPIRE_BAT])
00095 #define is_bird(ptr) ((ptr)->mlet == S_BAT && !is_bat(ptr))
00096 #define is_giant(ptr) (((ptr)->mflags2 & M2_GIANT) != 0L)
00097 #define is_golem(ptr) ((ptr)->mlet == S_GOLEM)
00098 #define is_domestic(ptr) (((ptr)->mflags2 & M2_DOMESTIC) != 0L)
00099 #define is_demon(ptr) (((ptr)->mflags2 & M2_DEMON) != 0L)
00100 #define is_mercenary(ptr) (((ptr)->mflags2 & M2_MERC) != 0L)
00101 #define is_male(ptr) (((ptr)->mflags2 & M2_MALE) != 0L)
00102 #define is_female(ptr) (((ptr)->mflags2 & M2_FEMALE) != 0L)
00103 #define is_neuter(ptr) (((ptr)->mflags2 & M2_NEUTER) != 0L)
00104 #define is_wanderer(ptr) (((ptr)->mflags2 & M2_WANDER) != 0L)
00105 #define always_hostile(ptr) (((ptr)->mflags2 & M2_HOSTILE) != 0L)
00106 #define always_peaceful(ptr) (((ptr)->mflags2 & M2_PEACEFUL) != 0L)
00107 #define race_hostile(ptr) (((ptr)->mflags2 & urace.hatemask) != 0L)
00108 #define race_peaceful(ptr) (((ptr)->mflags2 & urace.lovemask) != 0L)
00109 #define extra_nasty(ptr) (((ptr)->mflags2 & M2_NASTY) != 0L)
00110 #define strongmonst(ptr) (((ptr)->mflags2 & M2_STRONG) != 0L)
00111 #define can_breathe(ptr) attacktype(ptr, AT_BREA)
00112 #define cantwield(ptr) (nohands(ptr) || verysmall(ptr))
00113 #define could_twoweap(ptr) ((ptr)->mattk[1].aatyp == AT_WEAP)
00114 #define cantweararm(ptr) (breakarm(ptr) || sliparm(ptr))
00115 #define throws_rocks(ptr) (((ptr)->mflags2 & M2_ROCKTHROW) != 0L)
00116 #define type_is_pname(ptr) (((ptr)->mflags2 & M2_PNAME) != 0L)
00117 #define is_lord(ptr) (((ptr)->mflags2 & M2_LORD) != 0L)
00118 #define is_prince(ptr) (((ptr)->mflags2 & M2_PRINCE) != 0L)
00119 #define is_ndemon(ptr) (is_demon(ptr) && \
00120 (((ptr)->mflags2 & (M2_LORD|M2_PRINCE)) == 0L))
00121 #define is_dlord(ptr) (is_demon(ptr) && is_lord(ptr))
00122 #define is_dprince(ptr) (is_demon(ptr) && is_prince(ptr))
00123 #define is_minion(ptr) ((ptr)->mflags2 & M2_MINION)
00124 #define likes_gold(ptr) (((ptr)->mflags2 & M2_GREEDY) != 0L)
00125 #define likes_gems(ptr) (((ptr)->mflags2 & M2_JEWELS) != 0L)
00126 #define likes_objs(ptr) (((ptr)->mflags2 & M2_COLLECT) != 0L || \
00127 is_armed(ptr))
00128 #define likes_magic(ptr) (((ptr)->mflags2 & M2_MAGIC) != 0L)
00129 #define webmaker(ptr) ((ptr) == &mons[PM_CAVE_SPIDER] || \
00130 (ptr) == &mons[PM_GIANT_SPIDER])
00131 #define is_unicorn(ptr) ((ptr)->mlet == S_UNICORN && likes_gems(ptr))
00132 #define is_longworm(ptr) (((ptr) == &mons[PM_BABY_LONG_WORM]) || \
00133 ((ptr) == &mons[PM_LONG_WORM]) || \
00134 ((ptr) == &mons[PM_LONG_WORM_TAIL]))
00135 #define is_covetous(ptr) ((ptr->mflags3 & M3_COVETOUS))
00136 #define infravision(ptr) ((ptr->mflags3 & M3_INFRAVISION))
00137 #define infravisible(ptr) ((ptr->mflags3 & M3_INFRAVISIBLE))
00138 #define is_mplayer(ptr) (((ptr) >= &mons[PM_ARCHEOLOGIST]) && \
00139 ((ptr) <= &mons[PM_WIZARD]))
00140 #define is_rider(ptr) ((ptr) == &mons[PM_DEATH] || \
00141 (ptr) == &mons[PM_FAMINE] || \
00142 (ptr) == &mons[PM_PESTILENCE])
00143 #define is_guardian(ptr) (((ptr) == &mons[PM_VLAD_THE_IMPALER]) || \
00144 ((ptr) == &mons[PM_WIZARD_OF_YENDOR]) || \
00145 (ptr->msound == MS_NEMESIS) || \
00146 ((ptr) == &mons[PM_HIGH_PRIEST] && Is_sanctum(&u.uz)))
00147 #define is_placeholder(ptr) ((ptr) == &mons[PM_ORC] || \
00148 (ptr) == &mons[PM_GIANT] || \
00149 (ptr) == &mons[PM_ELF] || \
00150 (ptr) == &mons[PM_HUMAN])
00151
00152 #define is_reviver(ptr) (is_rider(ptr) || (ptr)->mlet == S_TROLL)
00153
00154
00155
00156 #define emits_light(ptr) (((ptr)->mlet == S_LIGHT || \
00157 (ptr) == &mons[PM_FLAMING_SPHERE] || \
00158 (ptr) == &mons[PM_SHOCKING_SPHERE] || \
00159 (!strcmp((ptr)->mname, "gold dragon")) || \
00160 (!strcmp((ptr)->mname, "baby gold dragon")) || \
00161 (ptr) == &mons[PM_FIRE_VORTEX]) ? 1 : \
00162 ((ptr) == &mons[PM_FIRE_ELEMENTAL]) ? 1 : 0)
00163
00164 #define likes_lava(ptr) (ptr == &mons[PM_FIRE_ELEMENTAL] || \
00165 ptr == &mons[PM_SALAMANDER])
00166 #define pm_invisible(ptr) ((ptr) == &mons[PM_STALKER] || \
00167 (ptr) == &mons[PM_BLACK_LIGHT])
00168
00169
00170 #define likes_fire(ptr) ((ptr) == &mons[PM_FIRE_VORTEX] || \
00171 (ptr) == &mons[PM_FLAMING_SPHERE] || \
00172 likes_lava(ptr))
00173
00174 #define touch_petrifies(ptr) ((ptr) == &mons[PM_COCKATRICE] || \
00175 (ptr) == &mons[PM_CHICKATRICE])
00176
00177 #ifdef WEBB_DISINT
00178 # define touch_disintegrates(ptr) ((ptr) == &mons[PM_DISINTEGRATOR] || \
00179 (ptr) == &mons[PM_ANTI_MATTER_VORTEX])
00180 #endif
00181
00182 #define is_mind_flayer(ptr) ((ptr) == &mons[PM_MIND_FLAYER] || \
00183 (ptr) == &mons[PM_MASTER_MIND_FLAYER])
00184
00185 #define nonliving(ptr) (is_golem(ptr) || is_undead(ptr) || \
00186 (ptr)->mlet == S_VORTEX || \
00187 (ptr) == &mons[PM_MANES])
00188
00189
00190
00191
00192 #define vegan(ptr) ((ptr)->mlet == S_BLOB || \
00193 (ptr)->mlet == S_JELLY || \
00194 (ptr)->mlet == S_FUNGUS || \
00195 (ptr)->mlet == S_VORTEX || \
00196 (ptr)->mlet == S_LIGHT || \
00197 ((ptr)->mlet == S_ELEMENTAL && \
00198 (ptr) != &mons[PM_STALKER]) || \
00199 ((ptr)->mlet == S_GOLEM && \
00200 (ptr) != &mons[PM_FLESH_GOLEM] && \
00201 (ptr) != &mons[PM_LEATHER_GOLEM]) || \
00202 noncorporeal(ptr))
00203 #define vegetarian(ptr) (vegan(ptr) || \
00204 ((ptr)->mlet == S_PUDDING && \
00205 (ptr) != &mons[PM_BLACK_PUDDING]))
00206
00207
00208 #define has_blood(ptr) (!vegetarian(ptr) && \
00209 (ptr)->mlet != S_GOLEM && \
00210 (!is_undead(ptr) || is_vampire(ptr)))
00211
00212 #define befriend_with_obj(ptr, obj) ((obj)->oclass == FOOD_CLASS && \
00213 is_domestic(ptr))
00214
00215 #endif