diff options
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r-- | crawl-ref/source/mon-abil.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 6904c0c25f..c2acf0ef22 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -1439,9 +1439,8 @@ void ballisto_on_move(monsters * monster, const coord_def & position) } } -// Increase the count of every ballistomycete on the level (only if -// monster is of an appropriate type). If a ballisto has a count greater -// than 0 it changes color and starts producing spores. +// If 'monster' is a ballistomycete or spore activate some number of +// ballistomycetes on the level. void activate_ballistomycetes( monsters * monster, const coord_def & origin) { if (!monster || monster->type != MONS_BALLISTOMYCETE @@ -1464,10 +1463,26 @@ void activate_ballistomycetes( monsters * monster, const coord_def & origin) } } + if (candidates.empty()) + return; + + // If a spore or inactive ballisto died we will only activate one + // other ballisto. If it was an active ballisto we will distribute + // its count to others on the level. + int activation_count = 1; + if (monster ->type == MONS_BALLISTOMYCETE) + { + activation_count += monster->number; + } + + std::random_shuffle(candidates.begin(), candidates.end()); - if (!candidates.empty()) + int index = 0; + for (int i=0; i<activation_count; ++i) { - monsters * spawner = candidates[random2(candidates.size())]; + index = i % candidates.size(); + + monsters * spawner = candidates[index]; spawner->number++; found_others = true; |