diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 06:53:52 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-29 06:53:52 +0000 |
commit | 8cffb32e8c61a88ce23b389c5d1e4255e21e59d9 (patch) | |
tree | fee921f947ec465a58a91b65fa53dc21ad8fbecd /crawl-ref/source/monstuff.cc | |
parent | dcf9fc82a633b9541eae069e209088bcaa557cc8 (diff) | |
download | crawl-ref-8cffb32e8c61a88ce23b389c5d1e4255e21e59d9.tar.gz crawl-ref-8cffb32e8c61a88ce23b389c5d1e4255e21e59d9.zip |
Only place a newly created monster (summons) on a sanctuary square if it
is friendly.
Only allow friendly and neutral-good monsters to blink or teleport onto
a sanctuary square.
Don't allow corpses on sanctuary squares to be rotted or animated.
Restrict monster cantrip messages to self-buff types if the player is
in sanctuary.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6211 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r-- | crawl-ref/source/monstuff.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 2c9ddee6fd..c40052035e 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1647,7 +1647,9 @@ bool monster_blink(monsters *monster) losight(env.show, grd, monster->x, monster->y, true); if (!random_near_space(monster->x, monster->y, nx, ny, - false, true)) + false, true, + !mons_friendly(monster) + && !mons_good_neutral(monster))) { return (false); } @@ -1675,7 +1677,7 @@ bool monster_blink(monsters *monster) // allow_adjacent: allow target to be adjacent to origin. // restrict_LOS: restrict target to be within PLAYER line of sight. bool random_near_space(int ox, int oy, int &tx, int &ty, bool allow_adjacent, - bool restrict_LOS) + bool restrict_LOS, bool forbid_sanctuary) { // This might involve ray tracing (via num_feats_between()), so // cache results to avoid duplicating ray traces. @@ -1718,7 +1720,8 @@ bool random_near_space(int ox, int oy, int &tx, int &ty, bool allow_adjacent, || grd[tx][ty] < DNGN_SHALLOW_WATER || mgrd[tx][ty] != NON_MONSTER || tx == you.x_pos && ty == you.y_pos - || !allow_adjacent && distance(ox, oy, tx, ty) <= 2) + || !allow_adjacent && distance(ox, oy, tx, ty) <= 2 + || forbid_sanctuary && is_sanctuary(tx, ty)) { continue; } |