From d16ed1201876132b39d151da6877de997da67912 Mon Sep 17 00:00:00 2001 From: dolorous Date: Sat, 26 Apr 2008 03:05:13 +0000 Subject: 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 --- crawl-ref/source/player.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'crawl-ref/source/player.cc') 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)) -- cgit v1.2.3-54-g00ecf