]> granicus.if.org Git - nethack/commitdiff
discovery of enchant weapon scrolls
authornethack.rankin <nethack.rankin>
Thu, 18 Apr 2002 02:26:09 +0000 (02:26 +0000)
committernethack.rankin <nethack.rankin>
Thu, 18 Apr 2002 02:26:09 +0000 (02:26 +0000)
     Eliminate or at least reduce one of the idiosyncratic differences
between enchant weapon and enchant armor:  make reading enchant weapon
discover that scroll if the effect is adequately discernible, instead
of always asking the player to supply a name for it.  If your weapon
is identified and its +/- enchantment value goes up, or you're wielding
a worm tooth and it transforms into a crysknife, you learn the scroll.
However for the negative effect of a cursed one, that's only applicable
when the scroll is already known to be cursed.

doc/fixes34.1
src/wield.c

index cf8da3bf52bae726b93bf210195732ac6fc92eca..bfe1c411816f9d2e2c3fa24bb517ea5bc4a72aa8 100644 (file)
@@ -82,6 +82,7 @@ undo xname FAKE_AMULET_OF_YENDOR AD_DRIN check, the_unique_obj checks this case
 axes should chop trees; picks shouldn't
 chance to aim grappling hook when skilled or better
 level limit of monsters like naga hatchlings should be high enough to grow up
+scroll of enchant weapon will become discovered when read in some cases
 
 
 Platform- and/or Interface-Specific Fixes
index c78d5374080c87e7ee6e3dcc09f3bd4c4a9731e7..f4774d438b14fc765759a80e3c20cb202685838d 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)wield.c    3.4     2001/12/23      */
+/*     SCCS Id: @(#)wield.c    3.4     2002/04/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -613,8 +613,9 @@ chwepon(otmp, amount)
 register struct obj *otmp;
 register int amount;
 {
-       register const char *color = hcolor((amount < 0) ? Black : blue);
-       register const char *xtime;
+       const char *color = hcolor((amount < 0) ? Black : blue);
+       const char *xtime;
+       int otyp = STRANGE_OBJECT;
 
        if(!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
                char buf[BUFSZ];
@@ -626,11 +627,14 @@ register int amount;
                return(0);
        }
 
+       if (otmp && otmp->oclass == SCROLL_CLASS) otyp = otmp->otyp;
+
        if(uwep->otyp == WORM_TOOTH && amount >= 0) {
                uwep->otyp = CRYSKNIFE;
                uwep->oerodeproof = 0;
                Your("weapon seems sharper now.");
                uwep->cursed = 0;
+               if (otyp != STRANGE_OBJECT) makeknown(otyp);
                return(1);
        }
 
@@ -638,6 +642,7 @@ register int amount;
                uwep->otyp = WORM_TOOTH;
                uwep->oerodeproof = 0;
                Your("weapon seems duller now.");
+               if (otyp != STRANGE_OBJECT && otmp->bknown) makeknown(otyp);
                return(1);
        }
 
@@ -656,9 +661,7 @@ register int amount;
            else
                Your("%s.", aobjnam(uwep, "evaporate"));
 
-           while(uwep)         /* let all of them disappear */
-                               /* note: uwep->quan = 1 is nogood if unpaid */
-               useup(uwep);
+           useupall(uwep);     /* let all of them disappear */
            return(1);
        }
        if (!Blind) {
@@ -666,6 +669,9 @@ register int amount;
            Your("%s %s for a %s.",
                 aobjnam(uwep, amount == 0 ? "violently glow" : "glow"),
                 color, xtime);
+           if (otyp != STRANGE_OBJECT && uwep->known &&
+                   (amount > 0 || (amount < 0 && otmp->bknown)))
+               makeknown(otyp);
        }
        uwep->spe += amount;
        if(amount > 0) uwep->cursed = 0;