Defines | Functions | Variables

mon.c File Reference

#include "hack.h"
#include "mfndpos.h"
#include "edog.h"
#include <ctype.h>
Include dependency graph for mon.c:

Defines

#define LEVEL_SPECIFIC_NOCORPSE(mdat)   (level.flags.graveyard && is_undead(mdat) && rn2(3))
#define KEEPTRAITS(mon)
#define mstoning(obj)
#define BREEDER_EGG   (!rn2(77))

Functions

STATIC_DCL boolean FDECL (restrap,(struct monst *))
STATIC_DCL long FDECL (mm_aggression,(struct monst *, struct monst *))
STATIC_DCL int NDECL (pick_animal)
STATIC_DCL int FDECL (select_newcham_form,(struct monst *))
STATIC_DCL void FDECL (kill_eggs,(struct obj *))
STATIC_DCL struct objFDECL (make_corpse,(struct monst *))
STATIC_DCL void FDECL (m_detach,(struct monst *, struct permonst *))
STATIC_DCL void FDECL (lifesaved_monster,(struct monst *))
void remove_monster (int x, int y)
int undead_to_corpse (int mndx)
int genus (int mndx, int mode)
int pm_to_cham (int mndx)
STATIC_OVL struct objmake_corpse (struct monst *mtmp)
int minliquid (struct monst *mtmp)
int mcalcmove (struct monst *mon)
void mcalcdistress ()
int movemon ()
int meatmetal (struct monst *mtmp)
int meatobj (struct monst *mtmp)
void mpickgold (struct monst *mtmp)
boolean mpickstuff (struct monst *mtmp, const char *str)
int curr_mon_load (struct monst *mtmp)
int max_mon_load (struct monst *mtmp)
boolean can_carry (struct monst *mtmp, struct obj *otmp)
int mfndpos (struct monst *mon, coord *poss, long *info, long flag)
STATIC_OVL long mm_aggression (struct monst *magr, struct monst *mdef)
boolean monnear (struct monst *mon, int x, int y)
void dmonsfree ()
void replmon (struct monst *mtmp, struct monst *mtmp2)
void relmon (struct monst *mon)
STATIC_OVL void m_detach (struct monst *mtmp, struct permonst *mptr)
struct objmlifesaver (struct monst *mon)
STATIC_OVL void lifesaved_monster (struct monst *mtmp)
void mondead (struct monst *mtmp)
boolean corpse_chance (struct monst *mon, struct monst *magr, boolean was_swallowed)
void cthulhu_dies (struct monst *mon)
void mondied (struct monst *mdef)
void mongone (struct monst *mdef)
void monstone (struct monst *mdef)
void monkilled (struct monst *mdef, const char *fltxt, int how)
void unstuck (struct monst *mtmp)
void killed (struct monst *mtmp)
void xkilled (struct monst *mtmp, int dest)
void mon_to_stone (struct monst *mtmp)
void mnexto (struct monst *mtmp)
boolean mnearto (struct monst *mtmp, xchar x, xchar y, boolean move_other)
void poisontell (int typ)
void poisoned (char *string, int typ, char *pname, int fatal) const
void m_respond (struct monst *mtmp)
void setmangry (struct monst *mtmp)
void wakeup (struct monst *mtmp)
void wake_nearby ()
void wake_nearto (int x, int y, int distance)
void seemimic (struct monst *mtmp)
void rescham ()
void restartcham ()
void restore_cham (struct monst *mon)
STATIC_OVL boolean restrap (struct monst *mtmp)
void mon_animal_list (boolean construct)
STATIC_OVL int pick_animal ()
STATIC_OVL int select_newcham_form (struct monst *mon)
int newcham (struct monst *mtmp, struct permonst *mdat, boolean polyspot, boolean msg)
int can_be_hatched (int mnum)
int egg_type_from_parent (int mnum, boolean force_ordinary)
boolean dead_species (int m_idx, boolean egg)
STATIC_OVL void kill_eggs (struct obj *obj_list)
void kill_genocided_monsters ()
void kill_monster_on_level (int mndx)
void golemeffects (struct monst *mon, int damtype, int dam)
boolean angry_guards (boolean silent)
void pacify_guards ()
void mimic_hit_msg (struct monst *mtmp, short otyp)

Variables

STATIC_VAR short cham_to_pm []
static const char * poiseff []
short * animal_list = 0
int animal_list_count

Define Documentation

#define BREEDER_EGG   (!rn2(77))
#define KEEPTRAITS (   mon )
Value:
((mon)->isshk || (mon)->mtame ||                \
                         ((mon)->data->geno & G_UNIQ) ||                \
                         is_reviver((mon)->data) ||                     \
                         /* normally leader the will be unique, */      \
                         /* but he might have been polymorphed  */      \
                         (mon)->m_id == quest_status.leader_m_id ||     \
                         /* special cancellation handling for these */  \
                         (dmgtype((mon)->data, AD_SEDU) ||              \
                          dmgtype((mon)->data, AD_SSEX)))

Referenced by make_corpse(), and monstone().

#define LEVEL_SPECIFIC_NOCORPSE (   mdat )    (level.flags.graveyard && is_undead(mdat) && rn2(3))

Referenced by corpse_chance(), and xkilled().

#define mstoning (   obj )
Value:
(ofood(obj) && \
                                        (touch_petrifies(&mons[(obj)->corpsenm]) || \
                                        (obj)->corpsenm == PM_MEDUSA))

Referenced by meatmetal().


Function Documentation

boolean angry_guards ( boolean  silent )
int can_be_hatched ( int  mnum )

References BREEDER_EGG, lays_eggs, little_to_big(), mons, NON_PM, PM_GARGOYLE, PM_KILLER_BEE, PM_QUEEN_BEE, PM_SCORPION, PM_SCORPIUS, and PM_WINGED_GARGOYLE.

Referenced by mksobj(), poly_obj(), and readobjnam().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean can_carry ( struct monst mtmp,
struct obj otmp 
)
boolean corpse_chance ( struct monst mon,
struct monst magr,
boolean  was_swallowed 
)
void cthulhu_dies ( struct monst mon )

Creates Cthulhu's death message and death cloud.

Parameters:
monCreates Cthulhu's death message and death cloud. Cthulhu's struct

References cansee, create_cthulhu_death_cloud(), distu, Monnam(), pline(), PM_CTHULHU, rn1, rnd(), and s_suffix().

Referenced by monkilled(), and xkilled().

Here is the call graph for this function:

Here is the caller graph for this function:

int curr_mon_load ( struct monst mtmp )

References BOULDER, obj::nobj, obj::otyp, obj::owt, and throws_rocks.

Referenced by can_carry(), domove(), m_move(), and mfndpos().

Here is the caller graph for this function:

boolean dead_species ( int  m_idx,
boolean  egg 
)

References big_to_little(), G_GENOD, LOW_PM, and mvitals::mvflags.

Referenced by carry_obj_effects(), create_object(), curse(), kill_eggs(), mksobj(), poly_obj(), readobjnam(), and revive_egg().

Here is the call graph for this function:

Here is the caller graph for this function:

void dmonsfree (  )

References dealloc_monst, fmon, iflags, monst::nmon, and instance_flags::purge_monsters.

Referenced by freedynamicdata(), makemaz(), movemon(), savebones(), and savelev().

Here is the caller graph for this function:

int egg_type_from_parent ( int  mnum,
boolean  force_ordinary 
)

References BREEDER_EGG, PM_GARGOYLE, PM_KILLER_BEE, PM_QUEEN_BEE, and PM_WINGED_GARGOYLE.

Referenced by dosit(), and polymon().

Here is the caller graph for this function:

STATIC_DCL int FDECL ( select_newcham_form  ,
(struct monst *)   
)
STATIC_DCL void FDECL ( lifesaved_monster  ,
(struct monst *)   
)
STATIC_DCL boolean FDECL ( restrap  ,
(struct monst *)   
)
STATIC_DCL long FDECL ( mm_aggression  ,
(struct monst *, struct monst *)   
)
STATIC_DCL void FDECL ( kill_eggs  ,
(struct obj *)   
)
STATIC_DCL struct obj* FDECL ( make_corpse  ,
(struct monst *)   
) [read]
STATIC_DCL void FDECL ( m_detach  ,
(struct monst *, struct permonst *)   
)
int genus ( int  mndx,
int  mode 
)
void golemeffects ( struct monst mon,
int  damtype,
int  dam 
)

References AD_COLD, AD_ELEC, AD_FIRE, cansee, mon_adjust_speed(), Monnam(), mons, MSLOW, pline(), PM_FLESH_GOLEM, and PM_IRON_GOLEM.

Referenced by damageum(), explode(), explum(), gulpum(), mdamagem(), passivemm(), and passiveum().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void kill_eggs ( struct obj obj_list )

References obj::cobj, CORPSE, obj::corpsenm, dead_species(), EGG, FALSE, Has_contents, kill_egg(), obj::nobj, NON_PM, otmp, obj::otyp, TIN, and TRUE.

Referenced by kill_genocided_monsters().

Here is the call graph for this function:

Here is the caller graph for this function:

void kill_genocided_monsters (  )

kill all members of genocided species

References dlevel_t::buriedobjlist, CHAM_MAX_INDX, CHAM_ORDINARY, monst::data, DEADMONSTER, FALSE, fmon, fobj, invent, kill_eggs(), level, monst::minvent, mondead(), monsndx(), newcham(), and monst::nmon.

Referenced by do_class_genocide(), do_genocide(), and goto_level().

Here is the call graph for this function:

Here is the caller graph for this function:

void kill_monster_on_level ( int  mndx )

Kills every member of the specified monster species on the current level.

Parameters:
mndxKills every member of the specified monster species on the current level. Monster index number

References monst::data, DEADMONSTER, fmon, mondead(), monsndx(), and monst::nmon.

Referenced by do_genocide().

Here is the call graph for this function:

Here is the caller graph for this function:

void killed ( struct monst mtmp )

References xkilled().

Referenced by buzz(), cancel_monst(), damageum(), dogaze(), domindblast(), doturn(), explode(), explum(), flash_hits_mon(), gazemu(), gulpum(), hmon_hitmon(), inside_gas_cloud(), kickdmg(), mattacku(), potionhit(), resist(), try_disarm(), and use_mirror().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void lifesaved_monster ( struct monst mtmp )

References AD_DISN, AMULET_OF_LIFE_SAVING, AT_BOOM, AT_EXPL, attacktype(), cansee, FALSE, G_GENOD, m_useup(), makeknown, mlifesaver(), mon_nam(), Monnam(), monsndx(), mvitals::mvflags, pline(), s_suffix(), wary_dog(), and WEBB_DISINT.

Referenced by monstone().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL void m_detach ( struct monst mtmp,
struct permonst mptr 
)

References del_light_source(), emits_light, FALSE, fill_pit(), iflags, LS_MONSTER, m_unleash(), newsym(), instance_flags::purge_monsters, relobj(), remove_monster(), shkgone(), unstuck(), and wormgone().

Referenced by mongone().

Here is the call graph for this function:

Here is the caller graph for this function:

void m_respond ( struct monst mtmp )

References aggravate(), AT_GAZE, flags, gazemu(), makemon(), Monnam(), mons, MS_SHRIEK, NATTK, NO_MM_FLAGS, pline(), PM_PURPLE_WORM, rn2(), flag::soundok, and stop_occupation().

Referenced by bhitm(), boomhit(), and dochug().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL struct obj* make_corpse ( struct monst mtmp ) [read]
int max_mon_load ( struct monst mtmp )

References MAX_CARR_CAP, MZ_HUMAN, strongmonst, and WT_HUMAN.

Referenced by can_carry(), and m_move().

Here is the caller graph for this function:

void mcalcdistress (  )

References monst::data, DEADMONSTER, FALSE, fmon, minliquid(), permonst::mmove, mon_regen(), newcham(), monst::nmon, rn2(), vision_full_recalc, vision_recalc(), and were_change().

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

int mcalcmove ( struct monst mon )

References monst::data, flags, MFAST, permonst::mmove, MSLOW, flag::mv, rn2(), and u.

Referenced by moveloop().

Here is the call graph for this function:

Here is the caller graph for this function:

int meatmetal ( struct monst mtmp )
int meatobj ( struct monst mtmp )
int mfndpos ( struct monst mon,
coord poss,
long *  info,
long  flag 
)
void mimic_hit_msg ( struct monst mtmp,
short  otyp 
)

References c_obj_colors, M_AP_FURNITURE, M_AP_MONSTER, M_AP_NOTHING, M_AP_OBJECT, monst::mappearance, objects, pline(), simple_typename(), SPE_EXTRA_HEALING, SPE_HEALING, and The().

Referenced by bhitm().

Here is the call graph for this function:

Here is the caller graph for this function:

int minliquid ( struct monst mtmp )
struct obj* mlifesaver ( struct monst mon ) [read]

References AMULET_OF_LIFE_SAVING, nonliving, otmp, obj::otyp, W_AMUL, and which_armor().

Referenced by buzz(), gulpum(), lifesaved_monster(), and mdamagem().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL long mm_aggression ( struct monst magr,
struct monst mdef 
)

References ALLOW_M, ALLOW_TM, mons, PM_PURPLE_WORM, and PM_SHRIEKER.

Referenced by mfndpos().

Here is the caller graph for this function:

boolean mnearto ( struct monst mtmp,
xchar  x,
xchar  y,
boolean  move_other 
)

References enexto(), FALSE, goodpos(), m_at, monst::mx, monst::my, remove_monster(), remove_worm(), rloc_to(), TRUE, nhcoord::x, and nhcoord::y.

Referenced by home_shk(), mon_arrive(), mv_bubble(), pay_for_damage(), shkcatch(), and tactics().

Here is the call graph for this function:

Here is the caller graph for this function:

void mnexto ( struct monst mtmp )

References enexto(), rloc_to(), u, you::ux, you::uy, nhcoord::x, and nhcoord::y.

Referenced by expels(), gd_move(), goto_level(), kick_monster(), m_move(), mon_arrive(), mv_bubble(), newgame(), next_to_u(), pay_for_damage(), paygd(), shopdig(), spoteffects(), tactics(), and use_magic_whistle().

Here is the call graph for this function:

Here is the caller graph for this function:

void mon_animal_list ( boolean  construct )

References animal_list, is_animal, LOW_PM, mons, and SPECIAL_PM.

Referenced by pick_animal().

Here is the caller graph for this function:

void mon_to_stone ( struct monst mtmp )

References a_monnam(), an(), canseemon, FALSE, Monnam(), mons, newcham(), pline(), PM_STONE_GOLEM, and S_GOLEM.

Referenced by mdamagem(), meatmetal(), minstapetrify(), and passiveum().

Here is the call graph for this function:

Here is the caller graph for this function:

void mondead ( struct monst mtmp )
void mondied ( struct monst mdef )

drop (perhaps) a cadaver and remove monster

References accessible(), corpse_chance(), FALSE, is_pool(), make_corpse(), and mondead().

Referenced by corpse_chance(), dog_hunger(), drop_boulder_on_monster(), grow_up(), mb_trapped(), mdamagem(), mintrap(), monkilled(), ohitmon(), and use_offensive().

Here is the call graph for this function:

Here is the caller graph for this function:

void mongone ( struct monst mdef )
void monkilled ( struct monst mdef,
const char *  fltxt,
int  how 
)
boolean monnear ( struct monst mon,
int  x,
int  y 
)

References dist2(), mons, and PM_GRID_BUG.

Referenced by distfleeck(), dochug(), dog_move(), fightm(), keepdogs(), mattacku(), passive(), pri_move(), quest_stat_check(), steal(), and thitmonst().

Here is the call graph for this function:

Here is the caller graph for this function:

void monstone ( struct monst mdef )
int movemon (  )
void mpickgold ( struct monst mtmp )

References add_to_minv(), cansee, delobj(), flags, g_at(), GOLD, Monnam(), newsym(), obj_extract_self(), objects, obj::otyp, pline(), obj::quan, and flag::verbose.

Referenced by gd_move(), and m_move().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean mpickstuff ( struct monst mtmp,
const char *  str 
)
STATIC_DCL int NDECL ( pick_animal   )
int newcham ( struct monst mtmp,
struct permonst mdat,
boolean  polyspot,
boolean  msg 
)
void pacify_guards (  )

References monst::data, DEADMONSTER, fmon, mons, monst::nmon, PM_WATCH_CAPTAIN, and PM_WATCHMAN.

Referenced by home_shk(), and make_happy_shk().

Here is the caller graph for this function:

STATIC_OVL int pick_animal (  )

References mon_animal_list(), rn2(), and TRUE.

Referenced by select_newcham_form().

Here is the call graph for this function:

Here is the caller graph for this function:

int pm_to_cham ( int  mndx )

References CHAM_CHAMELEON, CHAM_DOPPELGANGER, CHAM_ORDINARY, CHAM_SANDESTIN, PM_CHAMELEON, PM_DOPPELGANGER, and PM_SANDESTIN.

Referenced by makemon(), restartcham(), and restore_cham().

Here is the caller graph for this function:

void poisoned ( char *  string,
int  typ,
char *  pname,
int  fatal 
) const
void poisontell ( int  typ )

References pline().

Referenced by peffects().

Here is the call graph for this function:

Here is the caller graph for this function:

void relmon ( struct monst mon )

References fmon, mon, monst::nmon, and remove_monster().

Referenced by keepdogs(), migrate_to_level(), and replmon().

Here is the call graph for this function:

Here is the caller graph for this function:

void remove_monster ( int  x,
int  y 
)
void replmon ( struct monst mtmp,
struct monst mtmp2 
)

References dealloc_monst, del_light_source(), emits_light, fmon, LS_MONSTER, new_light_source(), obj::nobj, OBJ_MINVENT, otmp, place_wsegs(), relmon(), replshk(), u, you::ustuck, and obj::where.

Referenced by christen_monst(), clone_mon(), montraits(), and tamedog().

Here is the call graph for this function:

Here is the caller graph for this function:

void rescham (  )

References cansee, CHAM_ORDINARY, monst::data, DEADMONSTER, FALSE, fmon, if(), is_were, monst::m_ap_type, permonst::mlet, mons, monst::mx, monst::my, new_were(), newcham(), monst::nmon, S_HUMAN, and seemimic().

Referenced by eataccessory(), and Ring_on().

Here is the call graph for this function:

Here is the caller graph for this function:

void restartcham (  )

References cansee, monst::data, DEADMONSTER, fmon, permonst::mlet, monsndx(), monst::mx, monst::my, newsym(), monst::nmon, pm_to_cham(), S_MIMIC, and set_mimic_sym().

Referenced by Ring_off_or_gone().

Here is the call graph for this function:

Here is the caller graph for this function:

void restore_cham ( struct monst mon )

References CHAM_ORDINARY, FALSE, if(), is_human, is_were, mons, monsndx(), new_were(), newcham(), pm_to_cham(), and Protection_from_shape_changers.

Referenced by getlev().

Here is the call graph for this function:

Here is the caller graph for this function:

STATIC_OVL boolean restrap ( struct monst mtmp )

References cansee, distu, FALSE, levl, rn2(), ROOM, S_MIMIC, sensemon, set_mimic_sym(), TRUE, u, and you::ustuck.

Referenced by movemon().

Here is the call graph for this function:

Here is the caller graph for this function:

void seemimic ( struct monst mtmp )
STATIC_OVL int select_newcham_form ( struct monst mon )
void setmangry ( struct monst mtmp )
int undead_to_corpse ( int  mndx )
void unstuck ( struct monst mtmp )

References docrt(), placebc(), Punished, u, you::ustuck, you::uswldtim, you::ux, you::uy, and vision_full_recalc.

Referenced by dog_move(), expels(), m_detach(), monflee(), newcham(), slept_monst(), tamedog(), and u_teleport_mon().

Here is the call graph for this function:

Here is the caller graph for this function:

void wake_nearby (  )
void wake_nearto ( int  x,
int  y,
int  distance 
)

References DEADMONSTER, dist2(), fmon, monst::mx, monst::my, and monst::nmon.

Referenced by blow_up_landmine(), boulder_hits_pool(), destroy_drawbridge(), domonnoise(), doorlock(), explmu(), explode(), growl(), launch_obj(), mb_trapped(), mintrap(), openone(), whimper(), and yelp().

Here is the call graph for this function:

Here is the caller graph for this function:

void wakeup ( struct monst mtmp )
void xkilled ( struct monst mtmp,
int  dest 
)

Variable Documentation

short* animal_list = 0

Referenced by mon_animal_list().

STATIC_VAR short cham_to_pm[]
const char* poiseff[] [static]
Initial value:
 {

        " feel weaker", "r brain is on fire",
        "r judgement is impaired", "r muscles won't obey you",
        " feel very sick", " break out in hives"
}