From ca54ca53590788e28c47f0ea7f6c072d65a640d9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 8 May 2008 21:31:51 +0000 Subject: Make vampires' spell (and ability) hunger dependent on their hunger state. Thirsty: 75% Very thirsty: 50% Near Bloodless: 25% Bloodless: None git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4933 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 6101429dc0..9ad4d186e8 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -6003,6 +6003,18 @@ void player::make_hungry(int hunger_increase, bool silent) ::lessen_hunger(-hunger_increase, silent); } +// For semi-undead species (Vampire!) reduce food cost for spells and abilities +// to 75% (hungry), 50% (very hungry), 25% (near starving), or zero (starving). +int calc_hunger(int food_cost) +{ + if (you.is_undead == US_SEMI_UNDEAD && you.hunger_state < HS_SATIATED) + { + food_cost *= you.hunger_state; + food_cost /= 4; + } + return (food_cost); +} + int player::holy_aura() const { return (duration[DUR_REPEL_UNDEAD]? piety : 0); @@ -6452,10 +6464,12 @@ bool player::can_mutate() const bool player::can_safely_mutate() const { - return (can_mutate() - && (!you.is_undead - || (you.is_undead == US_SEMI_UNDEAD - && you.hunger_state == HS_ENGORGED))); + if (!can_mutate()) + return false; + + return (!you.is_undead + || you.is_undead == US_SEMI_UNDEAD + && you.hunger_state == HS_ENGORGED); } bool player::mutate() -- cgit v1.2.3-54-g00ecf