summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells2.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-27 09:22:30 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-06-27 09:22:30 +0000
commitd5bfb1f6cd095fabfa266b0c940e4ac132ee62b0 (patch)
treeac6ec30e0cd5ddbc7428182bcf2a4fa437386e04 /crawl-ref/source/spells2.cc
parent1179295c512c18b6be28732d10d64f607b7a40e3 (diff)
downloadcrawl-ref-d5bfb1f6cd095fabfa266b0c940e4ac132ee62b0.tar.gz
crawl-ref-d5bfb1f6cd095fabfa266b0c940e4ac132ee62b0.zip
Herd can now summon herds (i.e., identical-type monsters.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1666 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r--crawl-ref/source/spells2.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index d000f65117..6846b37892 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -1311,15 +1311,20 @@ void summon_animals(int pow)
int num_so_far = 0;
int power_left = pow + 1;
+ const bool varied = coinflip();
+ monster_type mon_chosen;
+
while ( power_left >= 0 && num_so_far < 8 )
{
// pick a random monster and subtract its cost
- monster_type mon_chosen = animals[random2(ARRAYSIZE(animals))];
+ if ( varied || num_so_far == 0 )
+ mon_chosen = animals[random2(ARRAYSIZE(animals))];
+
const int power_cost = mons_power(mon_chosen) * 3;
- // allow a certain degree of overuse, but not too much
- if ( power_cost >= power_left * 2 &&
- num_so_far > 0 ) // at least one monster, in any case
+ // Allow a certain degree of overuse, but not too much.
+ // Guarantee at least two summons.
+ if ( power_cost >= power_left * 2 && num_so_far >= 2 )
break;
power_left -= power_cost;