diff options
-rw-r--r-- | crawl-ref/source/mon-abil.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/monster.cc | 2 |
2 files changed, 13 insertions, 11 deletions
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index 0927248da1..5f6209bbcf 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -317,9 +317,8 @@ static bool _do_merge(monsters *initial_slime, monsters *merge_to) // Slime creatures can split but not merge under these conditions. static bool _unoccupied_slime(monsters *thing) { - return (thing->asleep() - || mons_is_wandering(thing) - || thing->foe == MHITNOT); + return (thing->asleep() || mons_is_wandering(thing) + || thing->foe == MHITNOT); } // Slime creatures cannot split or merge under these conditions. @@ -403,7 +402,6 @@ static bool _slime_merge(monsters *thing) static bool _slime_split(monsters *thing) { if (!thing - || !_unoccupied_slime(thing) || _disabled_slime(thing) || thing->number <= 1) { @@ -412,13 +410,21 @@ static bool _slime_split(monsters *thing) int compass_idx[] = {0, 1, 2, 3, 4, 5, 6, 7}; std::random_shuffle(compass_idx, compass_idx + 8); - coord_def origin = thing->pos(); + const coord_def origin = thing->pos(); + + const actor* foe = thing->get_foe(); + const bool has_foe = (foe != NULL && thing->can_see(foe)); + const coord_def foe_pos = (has_foe ? foe->position : coord_def(0,0)); // Anywhere we can place an offspring? for (int i = 0; i < 8; ++i) { coord_def target = origin + Compass[compass_idx[i]]; + // Don't split if this increases the distance to the target. + if (has_foe && distance(target, foe_pos) > distance(origin,foe_pos)) + continue; + if (mons_class_can_pass(MONS_SLIME_CREATURE, env.grid(target)) && !actor_at(target)) { @@ -765,10 +771,8 @@ bool mon_special_ability(monsters *monster, bolt & beem) : static_cast<monster_type>( monster->type ); // Slime creatures can split while out of sight. - if ((!mons_near(monster) - || monster->asleep() - || monster->submerged()) - && monster->type != MONS_SLIME_CREATURE) + if ((!mons_near(monster) || monster->asleep() || monster->submerged()) + && monster->type != MONS_SLIME_CREATURE) { return (false); } diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 8e3cb130ee..a5a02be458 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -2210,9 +2210,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc, } if (type == MONS_BALLISTOMYCETE && desc != DESC_DBNAME) - { result += mon.number ? "active " : ""; - } // Done here to cover cases of undead versions of hydras. if (mons_species(nametype) == MONS_HYDRA |