fix #1812 - ranged targetting of hidden hero (trunk only)

From a bug report, a hero who had
eaten a mimic corpse and was stuck mimicking gold was hit by an approaching
dragon's breath attack.  Make monsters usually fail to notice that you're
lined up for their ranged attack when/if you're hidden from them.
This commit is contained in:
nethack.rankin
2009-02-18 00:50:20 +00:00
parent 817976661f
commit dc8d285179
2 changed files with 12 additions and 3 deletions

View File

@@ -306,6 +306,8 @@ attempting to move direction 'u' as a grid bug performed #untrap command;
the other diagonals reported "unknown command" instead of "you can't"
mimic posing as statue or corpse now picks and maintains particular monst type
when levitating, don't show '>' as a likely direction for digging
poly'd or mimicking hero who was hidden from monsters would still be treated
as a normal target for their ranged attacks
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mthrowu.c 3.5 2007/12/17 */
/* SCCS Id: @(#)mthrowu.c 3.5 2009/02/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -753,9 +753,16 @@ boolean
lined_up(mtmp) /* is mtmp in position to use ranged attack? */
register struct monst *mtmp;
{
boolean ignore_boulders = (throws_rocks(mtmp->data) ||
m_carrying(mtmp, WAN_STRIKING));
boolean ignore_boulders;
/* hero concealment usually trumps monst awareness of being lined up */
if (Upolyd && rn2(25) &&
(u.uundetected || (youmonst.m_ap_type != M_AP_NOTHING &&
youmonst.m_ap_type != M_AP_MONSTER)))
return FALSE;
ignore_boulders = (throws_rocks(mtmp->data) ||
m_carrying(mtmp, WAN_STRIKING));
return linedup(mtmp->mux, mtmp->muy, mtmp->mx, mtmp->my,
ignore_boulders ? 1 : 2);
}