more drawbridge destruction - MUSE WAN_STRING

A zap from a wand of striking shouldn't hit a drawbridge if it is
just passing over the span's spot when the bridge is closed.  This
change matches the 3.7 behavior when the zap is performed by the hero.
It does hit if passing over that same spot when the bridge is open or
if it hits the portcullis spot whether open or closed.

Also, simplify the handling for the wand's destruction.  It still
ends the zap early if that happens even though logically the rest of
the zap range should still be targetted.
This commit is contained in:
PatR
2023-12-12 16:07:36 -08:00
parent 39a9833f78
commit 8b5e9eadb1

View File

@@ -1652,26 +1652,21 @@ mbhit(
}
ltyp = levl[gb.bhitpos.x][gb.bhitpos.y].typ;
dbx = x, dby = y;
if (otyp == WAN_STRIKING && find_drawbridge(&dbx, &dby)) {
if (otyp == WAN_STRIKING
/* if levl[x][y].typ is DRAWBRIDGE_UP then the zap is passing
over the moat in front of a closed drawbridge and doesn't
hit any part of the bridge's mechanism */
&& ltyp != DRAWBRIDGE_UP && find_drawbridge(&dbx, &dby)) {
/* this might kill mon and destroy obj; mon will remain
accessible even if dead but obj could be deleted */
destroy_drawbridge(dbx, dby);
for (otmp = mon->minvent; otmp; otmp = otmp->nobj)
if (otmp == obj)
break;
if (!otmp) {
for (otmp = gl.level.objects[x][y]; otmp;
otmp = otmp->nexthere)
if (otmp == obj)
break;
}
/* if otmp is Null, mon isn't carrying obj anymore and didn't
just drop it here; assume that it was destroyed and stop
the zap; not really correct behavior but we can't continue
without the responsible object because fhitm (mbhitm) and
fhito (bhito) will want it at forthcoming spots in zap path */
if (!otmp) {
obj = NULL;
if (!get_obj_location(obj, &dbx, &dbx, /* reuse <dbx,dby> */
CONTAINED_TOO | BURIED_TOO)) {
/* couldn't find obj, so assume that it has been destroyed
and end the zap; not really correct behavior but we can't
continue without the wand because fhitm (mbhitm) and fhito
(bhito) would want it at forthcoming spots in zap path */
/*obj = NULL;*/
break;
}
} else if (IS_DOOR(ltyp) || ltyp == SDOOR) {
@@ -1701,10 +1696,6 @@ mbhit(
break;
}
}
/* 'obj' was set of Null when it couldn't be found, but isn't used again;
however, someday that might change, so we want it set to Null; give it
a fake use to pacify potential "set but not used"-type warnings */
nhUse(obj);
}
/* Perform an offensive action for a monster. Must be called immediately