summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/delay.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-23 18:07:07 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-23 18:07:07 +0000
commit216ea74607c26d1706b43aa8fccb11e553a962e8 (patch)
tree075936bf53296061a9f5a9bf3e9abd6b69aad461 /crawl-ref/source/delay.cc
parentc4f8ee4f6aecbef73857e7fc9e3af5112c07412d (diff)
downloadcrawl-ref-216ea74607c26d1706b43aa8fccb11e553a962e8.tar.gz
crawl-ref-216ea74607c26d1706b43aa8fccb11e553a962e8.zip
Clean up monster pacifying a bit: don't allow it to work for stationary
monsters, or for monsters that aren't holy, natural, undead, or demonic. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6085 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/delay.cc')
-rw-r--r--crawl-ref/source/delay.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 3353a88f9d..2755730b45 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -57,11 +57,12 @@ static void _handle_macro_delay();
static void _finish_delay(const delay_queue_item &delay);
// Monsters cannot be affected in these states.
-// (All results of Recite, plus friendly + stupid;
+// (All results of Recite, plus stationary and friendly + stupid;
// note that berserk monsters are also hasted.)
static bool _recite_mons_useless(const monsters *mon)
{
return (mons_intel(mon->type) < I_NORMAL
+ || mons_is_stationary(mon)
|| mons_is_fleeing(mon)
|| mons_is_sleeping(mon)
|| mons_wont_attack(mon)
@@ -91,31 +92,29 @@ static int _recite_to_monsters(int x, int y, int pow, int unused)
int resist;
const mon_holy_type holiness = mons_holiness(mons);
+
if (holiness == MH_HOLY)
- {
- resist = 7 - random2(you.skills[SK_INVOCATIONS]);
- if (resist < 0)
- resist = 0;
- }
+ resist = std::max(0, 7 - random2(you.skills[SK_INVOCATIONS]));
else
{
resist = mons_resist_magic(mons);
- // much lower chances at influencing undead/demons
if (holiness == MH_UNDEAD)
pow -= 2 + random2(3);
else if (holiness == MH_DEMONIC)
pow -= 3 + random2(5);
+ else if (holiness != MH_NATURAL)
+ return (0);
}
pow -= resist;
if (pow > 0)
- pow = random2avg(pow,2);
+ pow = random2avg(pow, 2);
if (pow <= 0) // Uh oh...
{
- if (one_chance_in(resist+1))
+ if (one_chance_in(resist + 1))
return (0); // nothing happens, whew!
if (!one_chance_in(4) &&