summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc4
-rw-r--r--crawl-ref/source/externs.h6
-rw-r--r--crawl-ref/source/mon-util.cc6
-rw-r--r--crawl-ref/source/player.cc11
4 files changed, 15 insertions, 12 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index bc89d8d296..69db2e76e9 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -4215,13 +4215,13 @@ static int _affect_monster_enchantment(bolt &beam, monsters *mon)
if (beam.flavour == BEAM_POLYMORPH)
{
- if (mons_holiness( mon ) != MH_NATURAL)
+ if (!mon->can_mutate())
return (MON_UNAFFECTED);
if (check_mons_resist_magic( mon, beam.ench_power ))
return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
- if (monster_polymorph(mon, RANDOM_MONSTER))
+ if (mon->mutate())
beam.obvious_effect = true;
if (YOU_KILL(beam.thrower))
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index b9aa5700c5..27ca15cc87 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -149,7 +149,7 @@ public:
virtual void go_berserk(bool intentional) = 0;
virtual bool can_mutate() const = 0;
virtual bool can_safely_mutate() const = 0;
- virtual void mutate() = 0;
+ virtual bool mutate() = 0;
virtual int hurt(const actor *attacker, int amount) = 0;
virtual void heal(int amount, bool max_too = false) = 0;
virtual void banish(const std::string &who = "") = 0;
@@ -843,7 +843,7 @@ public:
void go_berserk(bool intentional);
bool can_mutate() const;
bool can_safely_mutate() const;
- void mutate();
+ bool mutate();
void banish(const std::string &who = "");
void blink();
void teleport(bool right_now = false, bool abyss_shift = false);
@@ -1167,7 +1167,7 @@ public:
void go_berserk(bool intentional);
bool can_mutate() const;
bool can_safely_mutate() const;
- void mutate();
+ bool mutate();
void banish(const std::string &who = "");
void expose_to_element(beam_type element, int strength = 0);
bool visible() const;
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 71a5207e36..4c98d801f6 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -5441,12 +5441,12 @@ bool monsters::can_safely_mutate() const
return (can_mutate());
}
-void monsters::mutate()
+bool monsters::mutate()
{
if (!can_mutate())
- return;
+ return false;
- monster_polymorph(this, RANDOM_MONSTER);
+ return (monster_polymorph(this, RANDOM_MONSTER));
}
bool monsters::is_icy() const
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 84ccd266c6..401ae4cde5 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6458,18 +6458,21 @@ bool player::can_safely_mutate() const
&& you.hunger_state == HS_ENGORGED)));
}
-void player::mutate()
+bool player::mutate()
{
if (!can_mutate())
- return;
+ return false;
if (one_chance_in(5))
{
if (::mutate(RANDOM_MUTATION))
+ {
learned_something_new(TUT_YOU_MUTATED);
+ return true;
+ }
}
- else
- give_bad_mutation();
+
+ return give_bad_mutation();
}
bool player::is_icy() const