summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 05:28:32 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-08 05:28:32 +0000
commit226ae1870c81e98670a2a79c436e26846f0698fb (patch)
treec57be972a005560b9169b5b84ee00f27d89d5989 /crawl-ref/source/spells2.cc
parente104efe7e42dbd793859761d7508f68f70bb1bca (diff)
downloadcrawl-ref-226ae1870c81e98670a2a79c436e26846f0698fb.tar.gz
crawl-ref-226ae1870c81e98670a2a79c436e26846f0698fb.zip
Clean up vampiric_drain() a bit.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5586 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc28
1 files changed, 12 insertions, 16 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index fb40b02738..5de9a1070b 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1256,39 +1256,35 @@ void drain_life(int pow)
mpr( "You feel life flooding into your body." );
inc_hp( hp_gain, false );
}
-} // end drain_life()
+}
-int vampiric_drain(int pow, const dist &vmove)
+bool vampiric_drain(int pow, const dist &vmove)
{
- int inflicted = 0;
- int mgr = 0;
- struct monsters *monster = 0; // NULL
-
- mgr = mgrd[you.x_pos + vmove.dx][you.y_pos + vmove.dy];
+ int mgr = mgrd[you.x_pos + vmove.dx][you.y_pos + vmove.dy];
if (mgr == NON_MONSTER)
{
mpr("There isn't anything there!");
- return -1;
+ return (false);
}
- monster = &menv[mgr];
+ monsters *monster = &menv[mgr];
if (mons_is_unholy(monster))
{
mpr("Aaaarggghhhhh!");
dec_hp(random2avg(39, 2) + 10, false, "vampiric drain backlash");
- return -1;
+ return (false);
}
if (mons_res_negative_energy(monster))
{
canned_msg(MSG_NOTHING_HAPPENS);
- return -1;
+ return (false);
}
// The practical maximum of this is about 25 (pow @ 100). -- bwr
- inflicted = 3 + random2avg( 9, 2 ) + random2(pow) / 7;
+ int inflicted = 3 + random2avg( 9, 2 ) + random2(pow) / 7;
if (inflicted >= monster->hit_points)
inflicted = monster->hit_points;
@@ -1299,7 +1295,7 @@ int vampiric_drain(int pow, const dist &vmove)
if (inflicted == 0)
{
canned_msg(MSG_NOTHING_HAPPENS);
- return -1;
+ return (false);
}
hurt_monster(monster, inflicted);
@@ -1314,8 +1310,8 @@ int vampiric_drain(int pow, const dist &vmove)
inc_hp(inflicted / 2, false);
- return 1;
-} // end vampiric_drain()
+ return (true);
+}
// Note: this function is currently only used for Freeze. -- bwr
char burn_freeze(int pow, beam_type flavour)
@@ -1420,7 +1416,7 @@ char burn_freeze(int pow, beam_type flavour)
}
return 1;
-} // end burn_freeze()
+}
void summon_animals(int pow)
{