summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-26 03:05:13 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-26 03:05:13 +0000
commitd16ed1201876132b39d151da6877de997da67912 (patch)
tree30e5d1df643776b9486d0dd0ea0ef123da68e003 /crawl-ref/source/player.cc
parent537e2fe2876ff141f926d946f1c9ed2fba85c714 (diff)
downloadcrawl-ref-d16ed1201876132b39d151da6877de997da67912.tar.gz
crawl-ref-d16ed1201876132b39d151da6877de997da67912.zip
Generalize the routines to determine whether you or a monster can mutate
or mutate safely by moving them to the actor interface. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4650 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 4687203d10..84ccd266c6 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6445,8 +6445,24 @@ bool player::haloed() const
return (halo_radius());
}
+bool player::can_mutate() const
+{
+ return true;
+}
+
+bool player::can_safely_mutate() const
+{
+ return (can_mutate()
+ && (!you.is_undead
+ || (you.is_undead == US_SEMI_UNDEAD
+ && you.hunger_state == HS_ENGORGED)));
+}
+
void player::mutate()
{
+ if (!can_mutate())
+ return;
+
if (one_chance_in(5))
{
if (::mutate(RANDOM_MUTATION))