cursed daggers thrown by monsters can go thru closed doors
based on a bugfix forwarded by <Someone>, check for closed doors and drop the missle before it. I re-arranged the pre checks a bit so m_throw no longer needs to trust the caller to ensure everything is OK beforehand.
This commit is contained in:
@@ -136,6 +136,7 @@ monsters that are frozen or sleeping cannot be grateful for untrapping
|
|||||||
grammar of blessed-detection eating warning messages when eating 1 of N objects
|
grammar of blessed-detection eating warning messages when eating 1 of N objects
|
||||||
message for charging for items lost in a cursed magic bag wasn't always shown
|
message for charging for items lost in a cursed magic bag wasn't always shown
|
||||||
dropping gold on an altar printed no message and didn't change gnostic conduct
|
dropping gold on an altar printed no message and didn't change gnostic conduct
|
||||||
|
don't allow cursed daggers thrown by monsters to go thru closed doors
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
@@ -302,21 +302,21 @@ m_throw(mon, x, y, dx, dy, range, obj)
|
|||||||
}
|
}
|
||||||
dx = rn2(3)-1;
|
dx = rn2(3)-1;
|
||||||
dy = rn2(3)-1;
|
dy = rn2(3)-1;
|
||||||
/* pre-check validity of new direction */
|
/* check validity of new direction */
|
||||||
if((!dx && !dy)
|
if (!dx && !dy) {
|
||||||
|| !isok(bhitpos.x+dx,bhitpos.y+dy)
|
|
||||||
/* missile hits the wall */
|
|
||||||
|| IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)) {
|
|
||||||
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
|
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* also need to pre-check for bars regardless of direction,
|
/* pre-check for doors, walls and boundaries.
|
||||||
but we know that isok() has already been verified;
|
Also need to pre-check for bars regardless of direction;
|
||||||
the random chance for small objects hitting bars is
|
the random chance for small objects hitting bars is
|
||||||
skipped when reaching them at point blank range */
|
skipped when reaching them at point blank range */
|
||||||
if ((levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS &&
|
if (!isok(bhitpos.x+dx,bhitpos.y+dy)
|
||||||
|
|| IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)
|
||||||
|
|| closed_door(bhitpos.x+dx, bhitpos.y+dy)
|
||||||
|
|| (levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS &&
|
||||||
hits_bars(&singleobj, bhitpos.x, bhitpos.y, 0, 0))) {
|
hits_bars(&singleobj, bhitpos.x, bhitpos.y, 0, 0))) {
|
||||||
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
|
(void) drop_throw(singleobj, 0, bhitpos.x, bhitpos.y);
|
||||||
return;
|
return;
|
||||||
@@ -447,6 +447,8 @@ m_throw(mon, x, y, dx, dy, range, obj)
|
|||||||
|| !isok(bhitpos.x+dx,bhitpos.y+dy)
|
|| !isok(bhitpos.x+dx,bhitpos.y+dy)
|
||||||
/* missile hits the wall */
|
/* missile hits the wall */
|
||||||
|| IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)
|
|| IS_ROCK(levl[bhitpos.x+dx][bhitpos.y+dy].typ)
|
||||||
|
/* missile hit closed door */
|
||||||
|
|| closed_door(bhitpos.x+dx, bhitpos.y+dy)
|
||||||
/* missile might hit iron bars */
|
/* missile might hit iron bars */
|
||||||
|| (levl[bhitpos.x+dx][bhitpos.y+dy].typ == IRONBARS &&
|
|| (levl[bhitpos.x+dx][bhitpos.y+dy].typ == IRONBARS &&
|
||||||
hits_bars(&singleobj, bhitpos.x, bhitpos.y, !rn2(2), 0))
|
hits_bars(&singleobj, bhitpos.x, bhitpos.y, !rn2(2), 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user