git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1312 c06c8d41-db1a-0410-9941-cceddc491573
T2AYVN57EFJQLFUFLAZDXKDAFDGTDLQIEQWQZNYFWJZBYSTYH4QQC
ZCNA74GZB3323BWZO3UTFG2BNYNQRZOKZDKCCMXIUAO5UKOU3NCQC
NNG27Y5ZQAZX6UD7F7M4F6KEZBEDFXPEEC3LFUSX4ESKT7K6UJQAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
Y3RBMQ7B6PFQRC6TH7PCIHHGA652AN3FTWTTYAOQHBSWOYDJ7XGQC
static bool handle_special_ability(struct monsters *monster, bolt & beem);
static bool handle_pickup(struct monsters *monster);
static void handle_behaviour(struct monsters *monster);
static void mons_in_cloud(struct monsters *monster);
static void monster_move(struct monsters *monster);
static bool plant_spit(struct monsters *monster, struct bolt &pbolt);
static bool handle_special_ability(monsters *monster, bolt & beem);
static bool handle_pickup(monsters *monster);
static void handle_behaviour(monsters *monster);
static void mons_in_cloud(monsters *monster);
static void monster_move(monsters *monster);
static bool plant_spit(monsters *monster, bolt &pbolt);
static void monster_move(struct monsters *monster)
static bool is_trap_safe(const monsters *monster, const trap_struct &trap)
{
// Dumb monsters don't care at all.
if (mons_intel(monster->type) == I_PLANT)
return (true);
// Healthy monsters don't mind a little pain. XXX: Smart humanoids
// with low hp should probably not try to go through high-damage
// traps.
if (monster->hit_points >= monster->max_hit_points / 2)
return (true);
// Monsters are not afraid of non-mechanical traps. XXX: If we add
// any non-mechanical traps that can damage monsters, must add
// check here.
const bool mechanical = trap_category(trap.type) == DNGN_TRAP_MECHANICAL;
// Friendly monsters don't enjoy Zot trap perks, handle accordingly.
if (mons_friendly(monster))
return (mechanical? mons_flies(monster) : trap.type != TRAP_ZOT);
else
return (!mechanical || mons_flies(monster));
}
static void monster_move(monsters *monster)
if ( which_trap >= 0 &&
mons_intel(monster->type) != I_PLANT &&
monster->hit_points < monster->max_hit_points / 2 &&
(!mons_flies(monster) ||
trap_category(env.trap[which_trap].type) != DNGN_TRAP_MECHANICAL) )
if (which_trap >= 0 &&
!is_trap_safe(monster, env.trap[which_trap]))