git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2933 c06c8d41-db1a-0410-9941-cceddc491573
CUB27EJDQG66FF2YCKOV4HU3LAJVJIHUJ5QYLURRDIEVGPK666DQC
NULVQ2A7ES5N3BBQAH6YKFST6UPVKD4KYYFFHYTUKSYLHXR4OYSAC
TMFNNWBMIPWM2FDC7I5R2RUKWNBS3GD3DX6VN452VYRPC3GU2HCQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
X5WLJCJVW55SXZVP7IKP7ADCJIGNKN4PKAXFECVR6TNK7XSMZR7QC
EGV2HM7SD7UQSWJGLR65NQJTUBAJ7WHLM67FMH4UFP7JRSFKREPAC
Q2XCGRT36NCRQKWNL53EAS3ADON5SJQ5GEMJMX5S3QAG553HFVFQC
3KAINFIXO7WNWGUGZB43EUNFRS2ZPBLQZDTY456QACMRHYIJ7WDAC
2BCJY2VAUXBEDHN7RN5T3DZ4Q2PNXKVZF7RYH5TY6M2CXGJAPZYAC
DH3YTI6VVI727SQXO4CXSDCSBG2UN3UAWLFULBGRLBVH22ACRXIAC
if (mnstr == NON_MONSTER) return 0;
if (mons_holiness(&menv[mnstr]) != MH_NATURAL) return 0;
if (check_mons_resist_magic( &menv[mnstr], pow )) return 0;
if (mnstr == NON_MONSTER)
return 0;
monsters& mon = menv[mnstr];
// Why shouldn't we be able to sleep friendly monsters? -- bwr
// if (mons_friendly( &menv[mnstr] )) return 0;
if (mons_holiness(&mon) != MH_NATURAL)
return 0;
if (check_mons_resist_magic( &mon, pow ))
return 0;
// works on friendlies too, so no check for that
}
}
}
static int drain_monsters(int x, int y, int pow, int garbage)
{
UNUSED( garbage );
if ( coord_def(x,y) == you.pos() )
drain_exp();
else
{
const int mnstr = mgrd[x][y];
if (mnstr == NON_MONSTER)
return 0;
monsters& mon = menv[mnstr];
if (mons_res_negative_energy(&mon) > 0)
simple_monster_message(&mon, " is unaffected.");
else
{
simple_monster_message(&mon, " is drained.");
if (random2(20) < pow/60)
{
mon.hit_dice--;
mon.experience = 0;
}
mon.max_hit_points -= 2 + random2(pow/50);
mon.hit_points -= 2 + random2(50);
if (mon.hit_points >= mon.max_hit_points)
mon.hit_points = mon.max_hit_points;
if (mon.hit_dice < 1)
mon.hit_points = 0;
if ( mon.hit_points <= 0 )
monster_die( &mon, KILL_YOU, 0 );