mirror fixes (trunk only)

From some notes I made prior to release of 3.4.3, about applying a
carried mirror in the direction of a monster:

 invisible player applying mirror toward monster which can't see invisible
   should have no effect (monster can't see hero's equipment);
 similarly when inside engulfer regardless of whether it can see invisible;
 applying mirror at worm tail shouldn't work but does;
 applying mirror toward unseen monster that can see invisible (so should be
   able to see its own image) doesn't work because bhit() won't target it;
 mirror shouldn't work when target is only visible via infravision.

The fourth one is iffy since it assumes that invisible monsters produce
invisible reflections rather than no reflections.  The reverse of that is
probably more reasonable but isn't as interesting.  The fifth one may be
contradictory; it fails to extend that logic to "infravisible monsters
produce infravisible reflections."
This commit is contained in:
nethack.rankin
2007-05-12 02:01:18 +00:00
parent 24f3e005f1
commit 5ca566f0f2
3 changed files with 81 additions and 57 deletions

View File

@@ -2994,37 +2994,39 @@ struct obj **pobj; /* object tossed/used, set to NULL
if (mtmp && !(in_skip && M_IN_WATER(mtmp->data))) {
notonhead = (bhitpos.x != mtmp->mx ||
bhitpos.y != mtmp->my);
if (weapon != FLASHED_LIGHT) {
if(weapon != ZAPPED_WAND) {
if(weapon != INVIS_BEAM) tmp_at(DISP_END, 0);
if (cansee(bhitpos.x,bhitpos.y) && !canspotmon(mtmp)) {
if (weapon != INVIS_BEAM) {
map_invisible(bhitpos.x, bhitpos.y);
return(mtmp);
}
} else
return(mtmp);
}
if (weapon != INVIS_BEAM) {
(*fhitm)(mtmp, obj);
range -= 3;
}
} else {
/* FLASHED_LIGHT hitting invisible monster
should pass through instead of stop so
we call flash_hits_mon() directly rather
than returning mtmp back to caller. That
allows the flash to keep on going. Note
that we use mtmp->minvis not canspotmon()
because it makes no difference whether
the hero can see the monster or not.*/
if (weapon == FLASHED_LIGHT) {
/* FLASHED_LIGHT hitting invisible monster should
pass through instead of stop so we call
flash_hits_mon() directly rather than returning
mtmp back to caller. That allows the flash to
keep on going. Note that we use mtmp->minvis
not canspotmon() because it makes no difference
whether the hero can see the monster or not. */
if (mtmp->minvis) {
obj->ox = u.ux, obj->oy = u.uy;
(void) flash_hits_mon(mtmp, obj);
} else {
tmp_at(DISP_END, 0);
return(mtmp); /* caller will call flash_hits_mon */
return mtmp; /* caller will call flash_hits_mon */
}
} else if (weapon == INVIS_BEAM) {
/* Like FLASHED_LIGHT, INVIS_BEAM should continue
through invisible targets; unlike it, we aren't
prepared for multiple hits so just get first one
that's either visible or could see its invisible
self. [No tmp_at() cleanup is needed here.] */
if (!mtmp->minvis || perceives(mtmp->data))
return mtmp;
} else if (weapon != ZAPPED_WAND) {
/* THROWN_WEAPON, KICKED_WEAPON */
tmp_at(DISP_END, 0);
if (cansee(bhitpos.x, bhitpos.y) && !canspotmon(mtmp))
map_invisible(bhitpos.x, bhitpos.y);
return mtmp;
} else {
/* ZAPPED_WAND */
(*fhitm)(mtmp, obj);
range -= 3;
}
} else {
if (weapon == ZAPPED_WAND && obj->otyp == WAN_PROBING &&