From 7896dbd29bda379c2fb31feeb3b16bda57039c00 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 11 Apr 2008 11:23:33 +0000 Subject: Fix 1937869: Have weapon swapping respect spells the character knows and allow wielding the appropriate items, e.g. arrows for Sticks to Snakes etc. Use the same rules for clicking on items in Tiles. Also add yet another minimap colour option, this time for plants (really zero xp monsters in general) since I became tired of plant-rich vaults showing up in bright red colours. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4195 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/direct.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'crawl-ref/source/direct.cc') diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 3b89368585..ac34d64f0a 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1098,9 +1098,9 @@ static void describe_oos_square(int x, int y) bool in_vlos(int x, int y) { - return in_los_bounds(x, y) - && (env.show(view2show(coord_def(x, y))) - || coord_def(x, y) == grid2view(you.pos())); + return (in_los_bounds(x, y) + && (env.show(view2show(coord_def(x, y))) + || coord_def(x, y) == grid2view(you.pos()))); } bool in_vlos(const coord_def &pos) @@ -1115,28 +1115,30 @@ bool in_los(int x, int y) static bool find_monster( int x, int y, int mode, int range = -1) { + // target the player for friendly and general spells if ((mode == TARG_FRIEND || mode == TARG_ANY) && x == you.x_pos && y == you.y_pos) { return (true); } - + // don't target out of range if (!_is_target_in_range(x, y, range)) return (false); - + const int targ_mon = mgrd[ x ][ y ]; - + // No monster or outside LOS. if (targ_mon == NON_MONSTER || !in_los(x,y)) return (false); - + // Unseen monsters in shallow water show a "strange disturbance" // (unless flying!) if (!player_monster_visible(&menv[targ_mon])) { // since you can't see the monster, assume it's not a friend - return (mode != TARG_FRIEND && grd[x][y] == DNGN_SHALLOW_WATER + return (mode != TARG_FRIEND + && grd[x][y] == DNGN_SHALLOW_WATER && !mons_flies(&menv[targ_mon])); } -- cgit v1.2.3-54-g00ecf