From 37ba8b3ae6c9c7f6b39e372c4dd8f305f69923be Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Wed, 11 Nov 2009 22:31:41 -0500 Subject: Give giant spores a chance of spawning ballistos while wandering Give giant spores a chance of creating a ballistomycete when they move while wandering. This ability is on a timer, so they can't create more than 1 ballisto per 20 turns. Numbers may need tweaking. --- crawl-ref/source/mon-abil.cc | 35 +++++++++++++++++++++++++++++++++++ crawl-ref/source/mon-abil.h | 2 ++ crawl-ref/source/mon-act.cc | 4 ++++ crawl-ref/source/monster.cc | 25 ++++++++++++++----------- crawl-ref/source/view.cc | 2 +- 5 files changed, 56 insertions(+), 12 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 73d0547f6c..3c93b540a2 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -1435,4 +1435,39 @@ void mon_nearby_ability(monsters *monster) } } +// When giant spores move (while wandering) maybe place a spore on the +// square they move off of. +void ballisto_on_move(monsters * monster, const coord_def & position) +{ + if (monster->type == MONS_GIANT_SPORE + && monster->behaviour == BEH_WANDER) + { + // The number field is used as a cooldown timer for this behavior. + if (monster->number <= 0) + { + if (one_chance_in(4)) + { + int rc = create_monster(mgen_data(MONS_BALLISTOMYCETE, + SAME_ATTITUDE(monster), + 0, + 0, + position, + MHITNOT, + MG_FORCE_PLACE)); + + if (rc != -1 && you.can_see(&env.mons[rc])) + { + mprf("A ballistomycete grows in the wake of the spore."); + } + monster->number = 20; + } + } + else + { + monster->number--; + } + + } +} + diff --git a/crawl-ref/source/mon-abil.h b/crawl-ref/source/mon-abil.h index 527f71dc3e..7addf706ec 100644 --- a/crawl-ref/source/mon-abil.h +++ b/crawl-ref/source/mon-abil.h @@ -16,4 +16,6 @@ void mon_nearby_ability(monsters *monster); bool ugly_thing_mutate(monsters *ugly, bool proximity = false); bool slime_split_merge(monsters *thing); +void ballisto_on_move(monsters * monster, const coord_def & pos); + #endif diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index e0b9dfbe94..3c57266252 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -3112,10 +3112,14 @@ static bool _do_move_monster(monsters *monster, const coord_def& delta) } mgrd(monster->pos()) = NON_MONSTER; + coord_def old_pos = monster->pos(); + monster->set_position(f); mgrd(monster->pos()) = monster_index(monster); + ballisto_on_move(monster, old_pos); + monster->check_redraw(monster->pos() - delta); monster->apply_location_effects(monster->pos() - delta); diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 1c46b41f98..77c9753884 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2154,6 +2154,11 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, result += cardinals[mon.number]; } + if (mon.type == MONS_BALLISTOMYCETE && desc != DESC_DBNAME) + { + result += mon.colour == LIGHTRED ? "Active " : ""; + } + // Done here to cover cases of undead versions of hydras. if (mons_species(nametype) == MONS_HYDRA && mon.number > 0 && desc != DESC_DBNAME) @@ -4992,25 +4997,23 @@ void monsters::apply_enchantment(const mon_enchant &me) if (mons_class_can_pass(MONS_GIANT_SPORE, env.grid(adjacent)) && !actor_at(adjacent)) { - beh_type created_behavior = BEH_HOSTILE; - - if (this->attitude == ATT_FRIENDLY) - created_behavior = BEH_FRIENDLY; + beh_type created_behavior = SAME_ATTITUDE(this); 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; + env.mons[rc].number = 10; if (observe_cell(adjacent) && observe_cell(pos())) - mpr("A nearby fungus spawns a giant spore."); + mpr("A nearby fungus spawns a giant spore."); } break; } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index c0a55da171..fc9c6cf271 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -135,13 +135,13 @@ void monster_grid_updates() handle_monster_shouts(monster); } + fedhas_neutralise(monster); if (!monster->visible_to(&you)) continue; good_god_follower_attitude_change(monster); beogh_follower_convert(monster); slime_convert(monster); - fedhas_neutralise(monster); } } } -- cgit v1.2.3-54-g00ecf