summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-13 06:07:38 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-13 06:07:38 +0000
commit884fcefad29a596466ac963ab0aedfc902185960 (patch)
tree122b4165ca564ec7c87c7e5ea755352bfd2d0492 /crawl-ref/source
parent60bb14c1852e8c3e25a23c4feb7bd9c5a277e36b (diff)
downloadcrawl-ref-884fcefad29a596466ac963ab0aedfc902185960.tar.gz
crawl-ref-884fcefad29a596466ac963ab0aedfc902185960.zip
Oops, overlooked that ench_countdown needs to be rescaled when a monster
gains or loses the slow or haste enchantments. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2452 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/mon-util.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 418e97357b..764de91b12 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3890,18 +3890,28 @@ void monsters::add_enchantment_effect(const mon_enchant &ench, bool quiet)
break;
case ENCH_HASTE:
+ {
+ int old_speed = speed;
if (speed >= 100)
speed = 100 + ((speed - 100) * 2);
else
speed *= 2;
+
+ ench_countdown = div_rand_round(ench_countdown * speed, old_speed);
break;
+ }
case ENCH_SLOW:
+ {
+ int old_speed = speed;
if (speed >= 100)
speed = 100 + ((speed - 100) / 2);
else
speed /= 2;
+
+ ench_countdown = div_rand_round(ench_countdown * speed, old_speed);
break;
+ }
case ENCH_SUBMERGED:
if (type == MONS_AIR_ELEMENTAL && mons_near(this) && !quiet)
@@ -3936,18 +3946,28 @@ void monsters::remove_enchantment_effect(const mon_enchant &me, bool quiet)
break;
case ENCH_HASTE:
+ {
+ int old_speed = speed;
if (speed >= 100)
speed = 100 + ((speed - 100) / 2);
else
speed /= 2;
+
+ ench_countdown = div_rand_round(ench_countdown * speed, old_speed);
break;
+ }
case ENCH_SLOW:
+ {
+ int old_speed = speed;
if (speed >= 100)
speed = 100 + ((speed - 100) * 2);
else
speed *= 2;
+
+ ench_countdown = div_rand_round(ench_countdown * speed, old_speed);
break;
+ }
case ENCH_PARALYSIS:
if (!quiet)