git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@814 c06c8d41-db1a-0410-9941-cceddc491573
Y3RBMQ7B6PFQRC6TH7PCIHHGA652AN3FTWTTYAOQHBSWOYDJ7XGQC
// wandering through a trap is OK if we're pretty healthy, or
// really stupid.
if (trap_at_xy(targ_x,targ_y) >= 0
&& mons_intel(monster->type) != I_PLANT)
// wandering through a trap is OK if we're pretty healthy,
// really stupid, or immune to the trap
const int which_trap = trap_at_xy(targ_x,targ_y);
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) )