summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-pick.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-03-18 08:45:07 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-03-18 08:45:07 +0100
commit46f5988d313eded33865737d0d4f7c5f65f15735 (patch)
treecfa4584925fb8c64db89e71a9a774bca81a50a3d /crawl-ref/source/mon-pick.cc
parent6254b95305ef39725194b13bc47472c0e0f55590 (diff)
downloadcrawl-ref-46f5988d313eded33865737d0d4f7c5f65f15735.tar.gz
crawl-ref-46f5988d313eded33865737d0d4f7c5f65f15735.zip
Two extra distributions: UP and DOWN triangles.
Unlike PEAK and SEMI, their peak is at one of ends of the range.
Diffstat (limited to 'crawl-ref/source/mon-pick.cc')
-rw-r--r--crawl-ref/source/mon-pick.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc
index 3e6fe8ae62..9b3033223f 100644
--- a/crawl-ref/source/mon-pick.cc
+++ b/crawl-ref/source/mon-pick.cc
@@ -20,6 +20,8 @@ enum distrib_type
SEMI, // 50% chance at range ends, 100% in the middle
PEAK, // 0% chance just outside range ends, 100% in the middle, range
// ends typically get ~20% or more
+ UP, // linearly from near-zero to 100% at the top
+ DOWN, // linearly from 100% at the bottom to near-zero
};
typedef struct
@@ -139,6 +141,14 @@ monster_type pick_monster(level_id place, mon_pick_vetoer veto)
rar = rar * (len - abs(pop->minr + pop->maxr - 2 * place.depth))
/ len;
break;
+
+ case UP:
+ rar = rar * (place.depth - pop->minr + 1) / (len + 1);
+ break;
+
+ case DOWN:
+ rar = rar * (pop->maxr - place.depth + 1) / (len + 1);
+ break;
}
ASSERT(rar > 0);