]> granicus.if.org Git - nethack/commitdiff
enlightenment/status feedback about wielded weapons (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 11 Feb 2011 02:25:59 +0000 (02:25 +0000)
committernethack.rankin <nethack.rankin>
Fri, 11 Feb 2011 02:25:59 +0000 (02:25 +0000)
     I noticed "you were wielding two weapons at once" in end of game
disclosure from a newsgroup ascension post for the Spork variant and
thought we ought to show that too.  Well we already do.  This moves it
from an attribute entry for magical enlightenment to a status entry for
^X display since it's something the hero and the player should already
always know.  In the process I added feedback for being weaponless and
then went further and added some feedback about what weapon is wielded.
This is stuff that could/would be shown on the status line if there were
room, and fits with the post-3.4.3 ^X expansion of cryptic status stuff.

     The "new ^X output" entry in the new features section of fixes35.0
covers this too.

src/cmd.c
src/weapon.c

index a733663e4ca19e9d1e791539e62d7b339470908a..9dd418b82f30f86fb2527e20afdd09fb402acba7 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1571,6 +1571,28 @@ int final;
            /* last resort entry, guarantees Status section is non-empty */
            you_are("unencumbered", "");
        }
+       /* report being weaponless; distinguish whether gloves are worn */
+       if (!uwep) you_are(uarmg ? "empty handed" : /* gloves imply hands */
+                          /* no weapon and no gloves */
+                          humanoid(youmonst.data) ? "bare handed" :
+                          /* alternate phrasing for paws or lack of hands */
+                          "not wielding anything", "");
+       /* two-weaponing implies a weapon (not other odd stuff) in each hand */
+       else if (u.twoweap) you_are("wielding two weapons at once", "");
+       /* report most weapons by their skill class (so a katana will be
+          described as a long sword, for instance; mattock and hook are
+          exceptions), or wielded non-weapon item by its object class */
+       else {
+           const char *what = weapon_descr(uwep);
+
+           if (!strcmpi(what, "armor") || !strcmpi(what, "food") ||
+                   !strcmpi(what, "venom"))
+               Sprintf(buf, "wielding some %s", what);
+           else
+               Sprintf(buf, "wielding %s",
+                       (uwep->quan == 1L) ? an(what) : makeplural(what));
+           you_are(buf, "");
+       }
 }
 
 /* attributes: intrinsics and the like, other non-obvious capabilities */
@@ -1787,7 +1809,6 @@ int final;
        if (Fixed_abil) you_have("fixed abilities",from_what(FIXED_ABIL));
        if (Lifesaved)
                enl_msg("Your life ", "will be", "would have been", " saved","");
-       if (u.twoweap) you_are("wielding two weapons at once","");
 
        /*** Miscellany ***/
        if (Luck) {
index 2044aee4c64a640bd4e4c5c1d0e07561c483163d..f7586d6ce6190c9fae3be62a754c16f889fead7e 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 weapon.c        $Date$  $Revision$ */
-/*     SCCS Id: @(#)weapon.c   3.5     2009/01/20      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -113,8 +112,10 @@ struct obj *obj;
     /* assorted special cases */
     switch (skill) {
     case P_NONE:
-       /* not a weapon: use item class name; override "food" for corpses */
-       descr = (obj->otyp == CORPSE || obj->otyp == TIN || obj->otyp == EGG) ?
+       /* not a weapon: use item class name; override "food" for corpses,
+          tins, and eggs and "large rock" for statues and boulders */
+       descr = (obj->otyp == CORPSE || obj->otyp == TIN || obj->otyp == EGG ||
+                obj->otyp == STATUE || obj->otyp == BOULDER) ?
                OBJ_NAME(objects[obj->otyp]) :
                def_oc_syms[(int)obj->oclass].name;
        break;