Skip to content

Commit

Permalink
Remove the chance for totally random monsters from spectral mist (#10…
Browse files Browse the repository at this point in the history
…067).

There's still the chance for local monsters, which can include any from
the appropriate absdepth in Crypt/Tomb.
  • Loading branch information
wheals committed Nov 25, 2015
1 parent 43fb7cb commit 9cbb7ab
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 42 deletions.
10 changes: 0 additions & 10 deletions crawl-ref/source/cloud.cc
Expand Up @@ -507,16 +507,6 @@ static void _handle_spectral_cloud(const cloud_struct& cloud)
100, RANDOM_MONSTER,
0);

if (basetype == RANDOM_MONSTER && one_chance_in(4))
{
do
{
basetype = pick_random_zombie();
}
while (mons_class_flag(basetype, M_NO_GEN_DERIVED)
|| !monster_habitable_grid(basetype, grd(cloud.pos)));
}

monster* agent = monster_by_mid(cloud.source);
create_monster(mgen_data(MONS_SPECTRAL_THING,
(cloud.whose == KC_OTHER ?
Expand Down
29 changes: 24 additions & 5 deletions crawl-ref/source/dungeon.cc
Expand Up @@ -3533,28 +3533,47 @@ static void _place_aquatic_monsters()
false);
}

static vector<monster_type> _zombifiables()
{
vector<monster_type> z;
for (monster_type mcls = MONS_0; mcls < NUM_MONSTERS; ++mcls)
{
if (mons_species(mcls) != mcls
|| !mons_zombie_size(mcls)
|| mons_is_unique(mcls)
|| mons_class_holiness(mcls) != MH_NATURAL
|| mons_class_flag(mcls, M_NO_GEN_DERIVED))
{
continue;
}

z.push_back(mcls);
}
return z;
}

// For Crypt, adds a bunch of skeletons and zombies that do not respect
// absdepth (and thus tend to be varied and include several types that
// would not otherwise spawn there).
static void _place_assorted_zombies()
{
static const vector<monster_type> zombifiable = _zombifiables();
int num_zombies = random_range(6, 12, 3);
for (int i = 0; i < num_zombies; ++i)
{
bool skel = coinflip();
monster_type z_base;
do
{
z_base = pick_random_zombie();
z_base = zombifiable[random2(zombifiable.size())];
}
while (mons_class_flag(z_base, M_NO_GEN_DERIVED)
|| !(skel ? mons_skeleton(z_base) : mons_zombifiable(z_base)));
while (skel && !mons_skeleton(z_base));

mgen_data mg;
mg.cls = (skel ? MONS_SKELETON : MONS_ZOMBIE);
mg.base_type = z_base;
mg.behaviour = BEH_SLEEP;
mg.map_mask |= MMT_NO_MONS;
mg.behaviour = BEH_SLEEP;
mg.map_mask |= MMT_NO_MONS;
mg.preferred_grid_feature = DNGN_FLOOR;

place_monster(mg);
Expand Down
25 changes: 0 additions & 25 deletions crawl-ref/source/mon-place.cc
Expand Up @@ -1816,31 +1816,6 @@ static monster* _place_monster_aux(const mgen_data &mg, const monster *leader,
return mon;
}

monster_type pick_random_zombie()
{
static vector<monster_type> zombifiable;

if (zombifiable.empty())
{
for (monster_type mcls = MONS_0; mcls < NUM_MONSTERS; ++mcls)
{
if (mons_species(mcls) != mcls || mcls == MONS_PROGRAM_BUG)
continue;

if (!mons_zombie_size(mcls) || mons_is_unique(mcls))
continue;
if (mons_class_holiness(mcls) != MH_NATURAL)
continue;

zombifiable.push_back(mcls);
}

ASSERT(!zombifiable.empty());
}

return zombifiable[random2(zombifiable.size())];
}

// Check base monster class against zombie type and position if set.
static bool _good_zombie(monster_type base, monster_type cs,
const coord_def& pos)
Expand Down
2 changes: 0 additions & 2 deletions crawl-ref/source/mon-place.h
Expand Up @@ -49,8 +49,6 @@ const monster_type fixup_zombie_type(const monster_type cls,
* *********************************************************************** */
monster* place_monster(mgen_data mg, bool force_pos = false, bool dont_place = false);

monster_type pick_random_zombie();

/* ***********************************************************************
* Returns a monster class type of a zombie for generation
* on the player's current level.
Expand Down

0 comments on commit 9cbb7ab

Please sign in to comment.