summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-11 00:47:15 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-11 00:47:58 -0500
commit21cc906692321fd60c3fa6ab4780ce1fa0f083c6 (patch)
tree0936f66d5b2420dbc242d8b0d3afe153b62dc63c /crawl-ref/source/monster.cc
parent4bf7a0a7ff66c0eb13674d4467dcee5c1301a359 (diff)
downloadcrawl-ref-21cc906692321fd60c3fa6ab4780ce1fa0f083c6.tar.gz
crawl-ref-21cc906692321fd60c3fa6ab4780ce1fa0f083c6.zip
Change ballistomycete spore spawning mechanics
Make spore production use a timer instead of a chance per turn. Give ballistomycetes 2 basic states, for now differentiated by glyph color. They start out magenta and have a slow spawn rate (1 per ~1500 turns), when a ballisto dies any others on the level become active, changing color to light red and spawning spores quickly (1 per ~150 turns)
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc36
1 files changed, 25 insertions, 11 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index ab8dc0dba3..1c46b41f98 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4976,42 +4976,50 @@ void monsters::apply_enchantment(const mon_enchant &me)
break;
case ENCH_SPORE_PRODUCTION:
- // Very low chance of actually making a spore on each turn.
- if(one_chance_in(5000))
+
+ // Reduce the timer, if that means we lose the enchantment then
+ // spawn a spore and re-add the enchantment
+ if(decay_enchantment(me))
{
+ // Search for an open adjacent square to place a spore on
int idx[] = {0, 1, 2, 3, 4, 5, 6, 7};
std::random_shuffle(idx, idx + 8);
for (unsigned i = 0; i < 8; ++i)
{
coord_def adjacent = this->pos() + Compass[idx[i]];
+
if (mons_class_can_pass(MONS_GIANT_SPORE, env.grid(adjacent))
- && !actor_at(adjacent))
+ && !actor_at(adjacent))
{
beh_type created_behavior = BEH_HOSTILE;
if (this->attitude == ATT_FRIENDLY)
- created_behavior = BEH_FRIENDLY;
+ created_behavior = BEH_FRIENDLY;
int rc = create_monster(mgen_data(MONS_GIANT_SPORE,
- created_behavior,
- 0,
- 0,
- adjacent,
- MHITNOT,
- MG_FORCE_PLACE));
+ created_behavior,
+ 0,
+ 0,
+ adjacent,
+ MHITNOT,
+ MG_FORCE_PLACE));
if (rc != -1)
{
env.mons[rc].behaviour = BEH_WANDER;
if (observe_cell(adjacent) && observe_cell(pos()))
- mpr("A nearby fungus spawns a giant spore.");
+ mpr("A nearby fungus spawns a giant spore.");
}
break;
}
}
+ // Re=add the enchantment (this resets the spore production
+ // timer).
+ this->add_ench(ENCH_SPORE_PRODUCTION);
}
+
break;
case ENCH_GLOWING_SHAPESHIFTER: // This ench never runs out!
@@ -6030,6 +6038,12 @@ int mon_enchant::calc_duration(const monsters *mons,
// of this function is excessive for toadstools. -cao
return (2 * FRESHEST_CORPSE + random2(10))
* speed_to_duration(mons->speed) * mons->speed / 10;
+ case ENCH_SPORE_PRODUCTION:
+ // The duration of the spore production timer depends on the color
+ // of the fungus
+ cturn = mons->colour == LIGHTRED ? 150 : 1500;
+ break;
+
case ENCH_ABJ:
if (deg >= 6)
cturn = 1000 / _mod_speed(10, mons->speed);