fix github issue #493 - hero item knowledge
Issue was about being asked what to call a previously seen potion which has been picked up and thrown by an unseen monster. Hero shouldn't remember what the item description was. This is a much more general change than just fixing that. Any item picked up by an unseen non-tame monster will have all its *known flags cleared since the hero can't see what that monster does to it. Same if an item is picked up while seen but then used when unseen. Unseen pets are excluded from the pick up case--but not the use case--because they pick up and drop stuff continually and players would just slaughter them if they caused item information to be forgotten. Fixes #493
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mthrowu.c $NHDT-Date: 1613258169 2021/02/13 23:16:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.112 $ */
|
||||
/* NetHack 3.7 mthrowu.c $NHDT-Date: 1620329778 2021/05/06 19:36:18 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.113 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Pasi Kallinen, 2016. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -292,6 +292,8 @@ ohitmon(
|
||||
g.notonhead = (g.bhitpos.x != mtmp->mx || g.bhitpos.y != mtmp->my);
|
||||
ismimic = M_AP_TYPE(mtmp) && M_AP_TYPE(mtmp) != M_AP_MONSTER;
|
||||
vis = cansee(g.bhitpos.x, g.bhitpos.y);
|
||||
if (vis)
|
||||
otmp->dknown = 1;
|
||||
|
||||
tmp = 5 + find_mac(mtmp) + omon_adj(mtmp, otmp, FALSE);
|
||||
/* High level monsters will be more likely to hit */
|
||||
@@ -318,8 +320,6 @@ ohitmon(
|
||||
if (ismimic)
|
||||
seemimic(mtmp);
|
||||
mtmp->msleeping = 0;
|
||||
if (vis)
|
||||
otmp->dknown = 1;
|
||||
/* probably thrown by a monster rather than 'other', but the
|
||||
distinction only matters when hitting the hero */
|
||||
potionhit(mtmp, otmp, POTHIT_OTHER_THROW);
|
||||
@@ -504,6 +504,8 @@ m_throw(
|
||||
}
|
||||
|
||||
singleobj->owornmask = 0; /* threw one of multiple weapons in hand? */
|
||||
if (!canseemon(mon))
|
||||
singleobj->dknown = 0;
|
||||
|
||||
if ((singleobj->cursed || singleobj->greased) && (dx || dy) && !rn2(7)) {
|
||||
if (canseemon(mon) && flags.verbose) {
|
||||
@@ -537,6 +539,9 @@ m_throw(
|
||||
while (range-- > 0) { /* Actually the loop is always exited by break */
|
||||
g.bhitpos.x += dx;
|
||||
g.bhitpos.y += dy;
|
||||
if (cansee(g.bhitpos.x, g.bhitpos.y))
|
||||
singleobj->dknown = 1;
|
||||
|
||||
mtmp = m_at(g.bhitpos.x, g.bhitpos.y);
|
||||
if (mtmp && shade_miss(mon, mtmp, singleobj, TRUE, TRUE)) {
|
||||
/* if mtmp is a shade and missile passes harmlessly through it,
|
||||
@@ -570,11 +575,10 @@ m_throw(
|
||||
break;
|
||||
}
|
||||
if (singleobj->oclass == POTION_CLASS) {
|
||||
if (!Blind)
|
||||
singleobj->dknown = 1;
|
||||
potionhit(&g.youmonst, singleobj, POTHIT_MONST_THROW);
|
||||
break;
|
||||
}
|
||||
|
||||
oldumort = u.umortality;
|
||||
switch (singleobj->otyp) {
|
||||
int dam, hitv;
|
||||
@@ -585,7 +589,7 @@ m_throw(
|
||||
hitu = 0;
|
||||
break;
|
||||
}
|
||||
/* fall through */
|
||||
/*FALLTHRU*/
|
||||
case CREAM_PIE:
|
||||
case BLINDING_VENOM:
|
||||
hitu = thitu(8, 0, &singleobj, (char *) 0);
|
||||
@@ -657,6 +661,7 @@ m_throw(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!range || MT_FLIGHTCHECK(FALSE)) { /* end of path or blocked */
|
||||
if (singleobj) { /* hits_bars might have destroyed it */
|
||||
/* note: pline(The(missile)) rather than pline_The(missile)
|
||||
|
||||
Reference in New Issue
Block a user