summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-27 06:13:56 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-27 06:13:56 +0000
commit7cd6bf781ce1325bef1063e475499eadc41639b1 (patch)
tree18aa00399d494ba3eee7f2500fb77188260ed69a /crawl-ref/source/monstuff.cc
parent2fc08be2baff198e606145987c13101450625784 (diff)
downloadcrawl-ref-7cd6bf781ce1325bef1063e475499eadc41639b1.tar.gz
crawl-ref-7cd6bf781ce1325bef1063e475499eadc41639b1.zip
Clean up routines for monsters' avoiding death again.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8806 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc57
1 files changed, 33 insertions, 24 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 368d6854c9..29d3ccb3bb 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -574,7 +574,7 @@ static bool _is_pet_kill(killer_type killer, int i)
// Elyvilon will occasionally (5% chance) protect the life of one of
// your allies.
-static bool _ely_protects_ally(monsters *monster)
+static bool _ely_protect_ally(monsters *monster)
{
if (you.religion != GOD_ELYVILON)
return (false);
@@ -603,7 +603,7 @@ static bool _ely_protects_ally(monsters *monster)
// Elyvilon retribution effect: Heal hostile monsters that were about to
// be killed by you or one of your friends.
-static bool _ely_heals_monster(monsters *monster, killer_type killer, int i)
+static bool _ely_heal_monster(monsters *monster, killer_type killer, int i)
{
if (you.religion == GOD_ELYVILON)
return (false);
@@ -654,7 +654,7 @@ static bool _ely_heals_monster(monsters *monster, killer_type killer, int i)
return (true);
}
-static bool _yred_enslaves_soul(monsters *monster, killer_type killer)
+static bool _yred_enslave_soul(monsters *monster, killer_type killer)
{
if (you.religion == GOD_YREDELEMNUL && mons_enslaved_body_and_soul(monster)
&& mons_near(monster) && killer != KILL_RESET
@@ -667,27 +667,9 @@ static bool _yred_enslaves_soul(monsters *monster, killer_type killer)
return (false);
}
-static bool _monster_avoided_death(monsters *monster, killer_type killer, int i)
+static bool _beogh_forcibly_convert_orc(monsters *monster, killer_type killer,
+ int i)
{
- if (monster->hit_points < -25
- || monster->hit_points < -monster->max_hit_points
- || monster->max_hit_points <= 0
- || monster->hit_dice < 1)
- {
- return (false);
- }
-
- // Elyvilon specials.
- if (_ely_protects_ally(monster))
- return (true);
- if (_ely_heals_monster(monster, killer, i))
- return (true);
-
- // Yredelemnul special.
- if (_yred_enslaves_soul(monster, killer))
- return (true);
-
- // Beogh special.
if (you.religion == GOD_BEOGH
&& mons_species(monster->type) == MONS_ORC
&& !mons_is_summoned(monster) && !mons_is_shapeshifter(monster)
@@ -732,6 +714,33 @@ static bool _monster_avoided_death(monsters *monster, killer_type killer, int i)
return (false);
}
+static bool _monster_avoided_death(monsters *monster, killer_type killer, int i)
+{
+ if (monster->hit_points < -25
+ || monster->hit_points < -monster->max_hit_points
+ || monster->max_hit_points <= 0
+ || monster->hit_dice < 1)
+ {
+ return (false);
+ }
+
+ // Elyvilon specials.
+ if (_ely_protect_ally(monster))
+ return (true);
+ if (_ely_heal_monster(monster, killer, i))
+ return (true);
+
+ // Yredelemnul special.
+ if (_yred_enslave_soul(monster, killer))
+ return (true);
+
+ // Beogh special.
+ if (_beogh_forcibly_convert_orc(monster, killer, i))
+ return (true);
+
+ return (false);
+}
+
static bool _slime_pit_unlock(bool silent)
{
unset_level_flags(LFLAG_NO_TELE_CONTROL, silent);
@@ -7776,7 +7785,7 @@ void mons_check_pool(monsters *monster, const coord_def &oldpos,
// Yredelemnul special, redux: It's the only one that can
// work on drowned monsters.
- if (!_yred_enslaves_soul(monster, killer))
+ if (!_yred_enslave_soul(monster, killer))
monster_die(monster, killer, killnum, true);
}
}