be chosen according to the destination. And yes, this does mean that occasionally an elf summoner will cross the Orc/Elf border etc, which could make things harder. On the other hand, that's just one staircase out of (at least!) seven, and monsters entering the level through the upstairs will likewise be a bit easier.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2030 c06c8d41-db1a-0410-9941-cceddc491573
WDEFQ6YABDQIGJXW5KT3OGR3EO6FZHXZELIRVIXQ4XDYTVOV5V6AC
UZ6N6HOUPGVSPC5NQROEEDWMEGJA5XUWUY2AKH5QG65AZ25PVXDAC
4UXFU3FZOCBSLDQ4S7MJKAE2H7VUHCNRDQMIY6NJ3PHYXWNGISDQC
6TYCKF4JX27PXCMWXDWKMZPQNF7EF5RF6MAPS573TW6VDTPBK3CAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
XAFFD52IHN6FWFR2TT5F2KCUS7HAVCBI5CWTFMKPQG77GGTGAHLAC
mon_type = MONS_DANCING_WEAPON;
}
// respect destination level for staircases
if (proximity == PROX_NEAR_STAIRS)
{
while(++tries <= 320)
{
px = 5 + random2(GXM - 10);
py = 5 + random2(GYM - 10);
if (mgrd[px][py] != NON_MONSTER
|| (px == you.x_pos && py == you.y_pos))
{
continue;
}
// Is the monster happy where we want to put it?
unsigned char grid_wanted = monster_habitat(mon_type);
if (!grid_compatible(grid_wanted, grd[px][py], true))
continue;
// Is the grid verboten?
if (!unforbidden( coord_def(px, py), mmask ))
continue;
// don't generate monsters on top of teleport traps
int trap = trap_at_xy(px, py);
if (trap >= 0)
{
if (env.trap[trap].type == TRAP_TELEPORT)
continue;
}
// check whether there's a stair
// and whether it leads to another branch
pval = near_stairs(px, py, 1, stair_gfx, place.branch);
// no monsters spawned in the Temple
if (branches[place.branch].id == BRANCH_ECUMENICAL_TEMPLE)
continue;
// found a position near the stairs!
if (pval > 0)
break;
}
if (tries > 320)
{ // give up and try somewhere else
proximity = PROX_AWAY_FROM_PLAYER;
}
else
{
if ( stair_gfx == '>' ) // deeper level
lev_mons++;
else if (stair_gfx == '<') // higher level
{
// monsters don't come from outside the dungeon
if (lev_mons <= 0)
{
proximity = PROX_AWAY_FROM_PLAYER;
// or maybe allow 1st level monsters, having visited the
// surface, to re-enter the dungeon
// in that case lev_mons stays as it is
}
else
lev_mons--;
}
// mprf("branch := %d, level := %d",
// branches[place.branch].id, lev_mons+1);
}
} // end proximity check
if (mon_type == RANDOM_MONSTER)
{
mon_type = pick_random_monster(level_id::current(), lev_mons,
if (branches[place.branch].id == BRANCH_HALL_OF_BLADES)
mon_type = MONS_DANCING_WEAPON;
else
{
// now pick a monster of the given branch and level
mon_type = pick_random_monster(place, lev_mons,
// Monsters that can't move shouldn't be taking the stairs -- bwr
if (proximity == PROX_NEAR_STAIRS && mons_class_is_stationary( mon_type ))
proximity = PROX_AWAY_FROM_PLAYER;
if (proximity == PROX_NEAR_STAIRS)
{
// for some cases disallow monsters on stairs
if (mons_class_is_stationary( mon_type )
|| pval == 2 && (mons_speed(mon_type) == 0
|| grd[px][py] == DNGN_LAVA || grd[px][py] == DNGN_DEEP_WATER))
{
proximity = PROX_AWAY_FROM_PLAYER;
}
}