summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-08 21:31:51 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-08 21:31:51 +0000
commitca54ca53590788e28c47f0ea7f6c072d65a640d9 (patch)
tree4bcfe3c14e06d51289054a5dde3e28d4fdf4abca /crawl-ref/source/player.cc
parent1b08247fbd1c4a95902188cd01e5510e8c2e79d3 (diff)
downloadcrawl-ref-ca54ca53590788e28c47f0ea7f6c072d65a640d9.tar.gz
crawl-ref-ca54ca53590788e28c47f0ea7f6c072d65a640d9.zip
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
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc22
1 files changed, 18 insertions, 4 deletions
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()