]> granicus.if.org Git - nethack/commitdiff
revived unicorn horns (trunk only)
authornethack.rankin <nethack.rankin>
Sun, 1 Apr 2007 01:20:57 +0000 (01:20 +0000)
committernethack.rankin <nethack.rankin>
Sun, 1 Apr 2007 01:20:57 +0000 (01:20 +0000)
     Back in Nov'04, <Someone> pointed out that even with only 5%
chance for dropping a horn upon the death of a unicorn which has been
revived from corpse, it's still possible to produce a nearly unlimited
number of them for polypile fodder.  This bumps the chance for a horn up
to 50%, but flags the horn as coming from a revived corpse and makes such
horns be treated by polymoprh as if they're non-magic (which practically
guarantees that they'll poly into mundane tools instead of magic ones).

doc/fixes35.0
include/obj.h
src/mon.c
src/zap.c

index f3ee3c98ae3738c642ea0e7e86efbbcf4c46a123..14bb9fe1a0336782b37ac0cac5281f25bcb0e5b6 100644 (file)
@@ -206,6 +206,7 @@ charge for kicked shop-owned food if it gets used up taming a monster
 give better feedback when thrown shop-owned food gets used up taming a monster
 effect of negative AC on damage received was calculated differently than
        normal when deciding whether hero poly'd into pudding would split
+unicorn horn produced by revived monster will polymorph as if non-magic
 
 
 Platform- and/or Interface-Specific Fixes
index 2757b53fef1764e138c7f0224dbade04b1ec0bbf..548af127a72c950bdcb2fa9b32d2e0cff80e79c3 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)obj.h      3.5     2007/02/17      */
+/*     SCCS Id: @(#)obj.h      3.5     2007/03/30      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -85,6 +85,7 @@ struct obj {
        Bitfield(oerodeproof,1); /* erodeproof weapon/armor */
        Bitfield(olocked,1);    /* object is locked */
        Bitfield(obroken,1);    /* lock has been broken */
+#define degraded_horn obroken  /* unicorn horn will poly to non-magic */
        Bitfield(otrapped,1);   /* container is trapped */
                                /* or accidental tripped rolling boulder trap */
 #define opoisoned otrapped     /* object (weapon) is coated with poison */
index 42f0371027c325f4c943723e83d480e259bc3f63..2c70958e6ebe70c2351755d0aa6e274d9c653e55 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mon.c      3.5     2007/02/08      */
+/*     SCCS Id: @(#)mon.c      3.5     2007/03/30      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -191,12 +191,14 @@ unsigned corpseflags;
            case PM_WHITE_UNICORN:
            case PM_GRAY_UNICORN:
            case PM_BLACK_UNICORN:
-               if (mtmp->mrevived && rn2(20)) {
-                       if (canseemon(mtmp))
-                          pline("%s recently regrown horn crumbles to dust.",
-                               s_suffix(Monnam(mtmp)));
-               } else
-                       (void) mksobj_at(UNICORN_HORN, x, y, TRUE, FALSE);
+               if (mtmp->mrevived && rn2(2)) {
+                   if (canseemon(mtmp))
+                       pline("%s recently regrown horn crumbles to dust.",
+                             s_suffix(Monnam(mtmp)));
+               } else {
+                   obj = mksobj_at(UNICORN_HORN, x, y, TRUE, FALSE);
+                   if (obj && mtmp->mrevived) obj->degraded_horn = 1;
+               }
                goto default_1;
            case PM_LONG_WORM:
                (void) mksobj_at(WORM_TOOTH, x, y, TRUE, FALSE);
index 048aa936799cd09b08c523e20370718cd1e21cc3..1d9684fa1a21ffe9f25765abe3d13a650074f2eb 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)zap.c      3.5     2007/02/17      */
+/*     SCCS Id: @(#)zap.c      3.5     2007/03/30      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1283,6 +1283,9 @@ poly_obj(obj, id)
            change_luck(-1);    /* Sokoban guilt */
        if (id == STRANGE_OBJECT) { /* preserve symbol */
            int try_limit = 3;
+           unsigned magic_obj = objects[obj->otyp].oc_magic;
+
+           if (obj->otyp == UNICORN_HORN && obj->degraded_horn) magic_obj = 0;
            /* Try up to 3 times to make the magic-or-not status of
               the new item be the same as it was for the old one. */
            otmp = (struct obj *)0;
@@ -1290,7 +1293,7 @@ poly_obj(obj, id)
                if (otmp) delobj(otmp);
                otmp = mkobj(obj->oclass, FALSE);
            } while (--try_limit > 0 &&
-                 objects[obj->otyp].oc_magic != objects[otmp->otyp].oc_magic);
+                       objects[otmp->otyp].oc_magic != magic_obj);
        } else {
            /* literally replace obj with this new thing */
            otmp = mksobj(id, FALSE, FALSE);