diff options
author | Charles Otto <ottochar@gmail.com> | 2009-11-18 01:16:07 -0500 |
---|---|---|
committer | Charles Otto <ottochar@gmail.com> | 2009-11-18 01:16:52 -0500 |
commit | 52023552385eca155c504b9afea7bbe382ab161b (patch) | |
tree | 7d442d8cec80d211919817c860797173356fe2df /crawl-ref/source/mon-abil.cc | |
parent | 597572eaf871d45776ddccb38d3aef37ef23ae12 (diff) | |
download | crawl-ref-52023552385eca155c504b9afea7bbe382ab161b.tar.gz crawl-ref-52023552385eca155c504b9afea7bbe382ab161b.zip |
Tweak ballistomycete activation
When an active ballistomycete dies activate a number of other ballistos
equal to its count + 1, instead of just activating one other.
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; |