summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 14:00:30 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 14:00:30 +0000
commitf051683f544f26da598a14007a8a1739226a2e5a (patch)
tree9b909a25321309e9fd642febe3f07ee956f65fa5 /crawl-ref/source/misc.cc
parentbdf8da41d22e79b08e42615bb2bdadc47d2906a4 (diff)
downloadcrawl-ref-f051683f544f26da598a14007a8a1739226a2e5a.tar.gz
crawl-ref-f051683f544f26da598a14007a8a1739226a2e5a.zip
Enable pathfinding for patrolling monsters who lost their patrol point.
Fixed patrol definitions in maps not actually working. Tested both by teleporting the minotaur in a labyrinth. About 50 turns later it arrived back in its lair. :) Since the minotaur proved to have a high magic resistance, it had plenty of time to loot the stash at the labyrinth entrance once I'd woken it before I finally managed to teleport it away (in wizmode you can force monsters not noticing you). This resulted in "A minotaur, wielding the demon trident "Suyn Oma", and wearing a heavily runed ring mail." o_O It had also picked up a scroll and a wand. Ouch... (but cool!) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5536 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc27
1 files changed, 25 insertions, 2 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index d024069bb8..40ffda768f 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1203,12 +1203,35 @@ void generate_random_blood_spatter_on_level()
{
int cx, cy;
int startprob;
- int max_cluster = 7 + random2(9);
+
+ // startprob is used to initialize the chance for neighbours being
+ // spattered, which will be decreased by 1 per recursion round.
+ // We then use one_chance_in(chance) to determine whether to spatter a
+ // given grid or not. Thus, startprob = 1 means that initially all
+ // surrounding grids will be spattered (3x3), and the _higher_ startprob
+ // the _lower_ the overall chance for spattering and the _smaller_ the
+ // bloodshed area.
+
+ const int max_cluster = 7 + random2(9);
+
+ // Lower chances for large bloodshed areas if we have many clusters,
+ // but increase chances if we have few.
+ // Chances for startprob are [1..3] for 7-9 clusters,
+ // ... [1..4] for 10-12 clusters, and
+ // ... [2..5] for 13-15 clusters.
+
+ int min_prob = 1;
+ int max_prob = 4;
+ if (max_cluster < 10)
+ max_prob--;
+ else if (max_cluster > 12)
+ min_prob++;
+
for (int i = 0; i < max_cluster; i++)
{
cx = 10 + random2(GXM - 10);
cy = 10 + random2(GYM - 10);
- startprob = 1 + random2(4);
+ startprob = min_prob + random2(max_prob);
if (allow_bleeding_on_square(cx, cy))
env.map[cx][cy].property = FPROP_BLOODY;