summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-10-06 17:28:51 +0200
committerRobert Vollmert <rvollmert@gmx.net>2009-10-06 17:28:51 +0200
commit558cf63b8da431fcd7053c79830aa0063c524d46 (patch)
tree43aa9e96e73cf634e3538107a3a188050b31eb38 /crawl-ref/source/mon-util.cc
parent98a1e903da70af439ccc66120fd721401bd5b6e3 (diff)
downloadcrawl-ref-558cf63b8da431fcd7053c79830aa0063c524d46.tar.gz
crawl-ref-558cf63b8da431fcd7053c79830aa0063c524d46.zip
Clean up ms_low_hitpoint_cast.
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc36
1 files changed, 8 insertions, 28 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 18f1da6d63..bdd26457cb 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2933,7 +2933,6 @@ bool ms_useful_fleeing_out_of_sight( const monsters *mon, spell_type monspell )
bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell )
{
- bool ret = false;
bool targ_adj = false;
bool targ_sanct = false;
@@ -2955,43 +2954,24 @@ bool ms_low_hitpoint_cast( const monsters *mon, spell_type monspell )
switch (monspell)
{
case SPELL_TELEPORT_OTHER:
- ret = !targ_sanct;
- break;
-
+ return !targ_sanct;
case SPELL_TELEPORT_SELF:
// Don't cast again if already about to teleport.
- if (mon->has_ench(ENCH_TP))
- return (false);
- // intentional fall-through
+ return !mon->has_ench(ENCH_TP);
case SPELL_MINOR_HEALING:
case SPELL_MAJOR_HEALING:
- ret = true;
- break;
-
+ return true;
case SPELL_BLINK_OTHER:
- if (targ_sanct)
- return (false);
- // intentional fall-through
+ return !targ_sanct && targ_adj;
case SPELL_BLINK:
- if (targ_adj)
- ret = true;
- break;
-
+ return targ_adj;
case SPELL_TOMB_OF_DOROKLOHE:
- ret = true;
- break;
-
+ return true;
case SPELL_NO_SPELL:
- ret = false;
- break;
-
+ return false;
default:
- if (!targ_adj && spell_typematch(monspell, SPTYP_SUMMONING))
- ret = true;
- break;
+ return !targ_adj && spell_typematch(monspell, SPTYP_SUMMONING);
}
-
- return (ret);
}
// Spells for a quick get-away.