more F move (trunk only)

Using F prefix when trying to move into a wall or closed door yielded
"you attack thin air".  Like the recently fixed F-vs-boulder case, give
more appropriate feedback.  Also like F-vs-boulder, initiate digging if
wielding a pick-axe.  (Also handles axes versus trees and closed doors).

     One thing which isn't handled but possibly should be:  F vs closed
door when not wielding a pick or other axe might attempt to force the door.
(Right now it gives "you harmlessly attack the door".)
This commit is contained in:
nethack.rankin
2007-07-19 08:20:20 +00:00
parent 16ad2bd0b8
commit aac603a446
4 changed files with 22 additions and 9 deletions

View File

@@ -1204,7 +1204,8 @@ domove()
/* remembered an 'I' && didn't use a move command */
(glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
struct obj *boulder = sobj_at(BOULDER, x, y);
boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL));
boolean explo = (Upolyd && attacktype(youmonst.data, AT_EXPL)),
solid = !accessible(x, y);
int glyph = glyph_at(x, y); /* might be monster */
char buf[BUFSZ];
@@ -1215,15 +1216,22 @@ domove()
(Hallucination && glyph_is_monster(glyph)))
boulder = sobj_at(STATUE, x, y);
/* force fight at boulder (or statue) while wielding pick:
start digging to break the boulder (or statue) */
if (boulder && context.forcefight && uwep && is_pick(uwep)) {
/* force fight at boulder/statue or wall/door while wielding
pick: start digging to break the boulder or wall */
if (context.forcefight &&
/* can we dig? */
uwep && dig_typ(uwep, x, y) &&
/* should we dig? */
!glyph_is_invisible(glyph) &&
!glyph_is_monster(glyph)) {
(void)use_pick_axe2(uwep);
return;
}
if (boulder)
Strcpy(buf, ansimpleoname(boulder));
else if (solid)
Strcpy(buf, the(defsyms[glyph_to_cmap(glyph)].explanation));
else if (!Underwater)
Strcpy(buf, "thin air");
else if (is_pool(x, y))
@@ -1231,7 +1239,8 @@ domove()
else /* Underwater, targetting non-water */
Sprintf(buf, "a vacant spot on the %s", surface(x,y));
You("%s%s %s.",
!boulder ? "" : !explo ? "harmlessly " : "futilely ",
!(boulder || solid) ? "" :
!explo ? "harmlessly " : "futilely ",
explo ? "explode at" : "attack",
buf);
unmap_object(x, y); /* known empty -- remove 'I' if present */