summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-16 14:13:55 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-16 14:13:55 +0000
commit6738ceef646e7cefd453943524cffec775b4c1ab (patch)
tree5ba044fbca142bd87751ff7aab9e6ab2f9b2e51b /crawl-ref/source/monstuff.cc
parent92d4e997d64fe4037690f1a1b57648e2494c21c2 (diff)
downloadcrawl-ref-6738ceef646e7cefd453943524cffec775b4c1ab.tar.gz
crawl-ref-6738ceef646e7cefd453943524cffec775b4c1ab.zip
Fixed bug 1636467, sometimes monsters were getting no energy.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@851 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index afe2e6f91d..7d3c3d8fb3 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3582,11 +3582,19 @@ static void handle_monster_move(int i, monsters *monster)
return;
}
- monster->speed_increment += (monster->speed * you.time_taken) / 10;
+ int energy_gained = (monster->speed * you.time_taken) / 10;
+
+ // Slow monsters might get 0 here. Maybe we should factor in
+ // *how* slow it is...but a 10-to-1 move ratio seems more than
+ // enough.
+ if ( energy_gained == 0 && monster->speed != 0 )
+ energy_gained = 1;
+
+ monster->speed_increment += energy_gained;
if (you.slow > 0)
{
- monster->speed_increment += (monster->speed * you.time_taken) / 10;
+ monster->speed_increment += energy_gained;
}
// Handle enchantments and clouds on nonmoving monsters: