summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorBrendan Hickey <brendan@bhickey.net>2009-11-08 02:39:21 -0500
committerJude Brown <bookofjude@users.sourceforge.net>2009-11-08 17:44:15 +1000
commit9255dd6cfa9e29b6c4b5802c04639576f25f7144 (patch)
treeb413b2e7f03307affc8059e94c7152efa69156fc /crawl-ref/source/fight.cc
parent7401f365d1f45720d380ff151667c8360001f6ec (diff)
downloadcrawl-ref-9255dd6cfa9e29b6c4b5802c04639576f25f7144.tar.gz
crawl-ref-9255dd6cfa9e29b6c4b5802c04639576f25f7144.zip
Patch to satisfy FR 2892713. Hunger on wielding VAMP weapons
They are now wieldable by mummies and ghouls, but no healing effect. Vampires get nourished per hit. Signed-off-by: Jude Brown <bookofjude@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 7f24fa9386..da36d867c9 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -771,10 +771,11 @@ static bool _vamp_wants_blood_from_monster(const monsters *mon)
}
// Should life protection protect from this?
-// Called when stabbing and for bite attacks.
+// Called when stabbing, for bite attacks, and vampires wielding vampiric weapons
// Returns true if blood was drawn.
static bool _player_vampire_draws_blood(const monsters* mon, const int damage,
- bool needs_bite_msg = false)
+ bool needs_bite_msg = false,
+ int reduction = 1)
{
ASSERT(you.species == SP_VAMPIRE);
@@ -826,6 +827,8 @@ static bool _player_vampire_draws_blood(const monsters* mon, const int damage,
// Bats get a rather less nutrition out of it.
if (player_in_bat_form())
food_value /= 2;
+
+ food_value /= reduction;
lessen_hunger(food_value, false);
}
@@ -1937,9 +1940,19 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
{
// No further effects.
}
+ else if (you.species == SP_VAMPIRE
+ && damage_brand == SPWPN_VAMPIRICISM
+ && you.equip[EQ_WEAPON] != -1
+ && _player_vampire_draws_blood(defender_as_monster(),
+ damage_done, false,
+ (mondied ? 1 : 10)))
+ {
+ // No further effects.
+ }
// Vampiric *weapon* effects for the killing blow.
else if (mondied && damage_brand == SPWPN_VAMPIRICISM
- && you.equip[EQ_WEAPON] != -1)
+ && you.equip[EQ_WEAPON] != -1
+ && you.is_undead == US_ALIVE)
{
if (defender->holiness() == MH_NATURAL
&& !defender->is_summoned()