summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-abil.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-13 19:44:57 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-13 19:47:28 -0500
commitdfc417fb139ee880cccfcbca5c8c7ec94913da63 (patch)
tree3c8134ffa1f07c5135a6069c0e58821a26c8ec06 /crawl-ref/source/mon-abil.cc
parent693fc6950536238c4ce6155b67da539f0649e066 (diff)
downloadcrawl-ref-dfc417fb139ee880cccfcbca5c8c7ec94913da63.tar.gz
crawl-ref-dfc417fb139ee880cccfcbca5c8c7ec94913da63.zip
Change ballistomycete spawn mechanics (again)
When a spore pops or a ballistomycete is killed randomly select a single ballisto to activate instead of activating the entire level's worth. Along with this, only deactivate the ballisto that produced a spore instead of deactivating the entire level. Rationale: since inactive ballistos don't interrupt travel anymore it's nicer from an interface perspective to keep most of the ballistos on the level inactive.
Diffstat (limited to 'crawl-ref/source/mon-abil.cc')
-rw-r--r--crawl-ref/source/mon-abil.cc61
1 files changed, 20 insertions, 41 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index 3a258d469f..e51d95214e 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -1439,61 +1439,40 @@ void activate_ballistomycetes( monsters * monster, const coord_def & origin)
}
bool found_others = false;
- int seen_others = 0;
+ std::vector<monsters *> candidates;
for (monster_iterator mi; mi; ++mi)
{
if (mi->mindex() != monster->mindex()
&& mi->alive()
&& mi->type == MONS_BALLISTOMYCETE)
{
- mi->number++;
- found_others = true;
- // Change color and start the spore production timer if we
- // are moving from 0 to 1.
- if (mi->number == 1)
- {
- mi->colour = LIGHTRED;
- // Reset the spore production timer.
- mi->del_ench(ENCH_SPORE_PRODUCTION, false);
- mi->add_ench(ENCH_SPORE_PRODUCTION);
+ candidates.push_back(*mi);
- if (you.can_see(*mi))
- seen_others++;
- }
}
}
- if (you.see_cell(origin) && found_others)
- {
- mprf("You feel the ballistomycetes will spawn a replacement spore.");
- }
-}
-// Decrease the count on each ballistomycete on the level. To be called
-// after a new spore is created. If a ballistos count drops to 0 it changes
-// colorr (back to magenta) and stops producing spores.
-void deactivate_ballistos()
-{
- for (monster_iterator mi; mi; ++mi)
+ if (!candidates.empty())
{
- if (mi->alive()
- && mi->type == MONS_BALLISTOMYCETE)
- {
- // Decrease the count and maybe become inactive
- // again
- if (mi->number)
- {
- mi->number--;
- if (mi->number == 0)
- {
- mi->colour = MAGENTA;
- mi->del_ench(ENCH_SPORE_PRODUCTION);
- }
- }
+ monsters * spawner = candidates[random2(candidates.size())];
+ spawner->number++;
+ found_others = true;
+
+ // Change color and start the spore production timer if we
+ // are moving from 0 to 1.
+ if (spawner->number == 1)
+ {
+ spawner->colour = LIGHTRED;
+ // Reset the spore production timer.
+ spawner->del_ench(ENCH_SPORE_PRODUCTION, false);
+ spawner->add_ench(ENCH_SPORE_PRODUCTION);
}
}
-}
-
+ if (you.see_cell(origin) && found_others)
+ {
+ mprf("You feel the ballistomycetes will spawn a replacement spore.");
+ }
+}