Difference between revisions of "User:Ogmobot/Midas Touch Patch"

From NetHackWiki
Jump to navigation Jump to search
(Created page with " diff --git a/include/artilist.h b/include/artilist.h index d2a8c447..f487df63 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -221,6 +221,10 @@...")
 
m (Update with new version of artifact)
Line 1: Line 1:
    diff --git a/include/artilist.h b/include/artilist.h
+
diff --git a/include/artilist.h b/include/artilist.h
    index d2a8c447..f487df63 100644
+
index d2a8c447..f487df63 100644
    --- a/include/artilist.h
+
--- a/include/artilist.h
    +++ b/include/artilist.h
+
+++ b/include/artilist.h
    @@ -221,6 +221,10 @@ STATIC_OVL NEARDATA struct artifact artilist[] = {
+
@@ -221,6 +221,10 @@ STATIC_OVL NEARDATA struct artifact artilist[] = {
        A("Luck Blade", BROADSWORD, (SPFX_RESTR | SPFX_LUCK | SPFX_INTEL), 0, 0,
+
      A("Luck Blade", BROADSWORD, (SPFX_RESTR | SPFX_LUCK | SPFX_INTEL), 0, 0,
          PHYS(5,6), NO_DFNS, NO_CARY, 0, A_CHAOTIC, PM_CONVICT, NON_PM, 3000L,
+
        PHYS(5,6), NO_DFNS, NO_CARY, 0, A_CHAOTIC, PM_CONVICT, NON_PM, 3000L,
          NO_COLOR),
+
        NO_COLOR),
    +    /* Golden gauntlets that turn wielded items into gold. These belong to Croesus.
+
+    /* Golden gauntlets that turn wielded items into gold. These belong to Croesus.
    +    */
+
+    */
    +    A("Midas Touch", GAUNTLETS, (SPFX_NOGEN | SPFX_RESTR), 0, 0, NO_ATTK, NO_DFNS,
+
+    A("Midas Touch", GAUNTLETS, (SPFX_NOGEN | SPFX_RESTR), 0, 0, NO_ATTK, NO_DFNS,
    +      NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 5000L, NO_COLOR),
+
+      NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 5000L, NO_COLOR),
   
+
 
        /*
+
      /*
          *      The artifacts for the quest dungeon, all self-willed.
+
      *      The artifacts for the quest dungeon, all self-willed.
    diff --git a/include/extern.h b/include/extern.h
+
diff --git a/include/extern.h b/include/extern.h
    index 13ce605c..787bf329 100644
+
index 13ce605c..787bf329 100644
    --- a/include/extern.h
+
--- a/include/extern.h
    +++ b/include/extern.h
+
+++ b/include/extern.h
    @@ -104,6 +104,7 @@ E void FDECL(retouch_equipment, (int));
+
@@ -104,6 +104,7 @@ E void FDECL(retouch_equipment, (int));
    E void NDECL(mkot_trap_warn);
+
  E void NDECL(mkot_trap_warn);
    E boolean FDECL(is_magic_key, (struct monst *, struct obj *));
+
  E boolean FDECL(is_magic_key, (struct monst *, struct obj *));
    E struct obj *FDECL(has_magic_key, (struct monst *));
+
  E struct obj *FDECL(has_magic_key, (struct monst *));
    +E boolean FDECL(turn_to_gold, (struct obj *, struct monst *));
+
+E boolean FDECL(turn_to_gold, (struct obj *, struct monst *));
   
+
 
    /* ### attrib.c ### */
+
  /* ### attrib.c ### */
   
+
 
    diff --git a/src/artifact.c b/src/artifact.c
+
diff --git a/src/artifact.c b/src/artifact.c
    index 1f9ebdd0..078eaadd 100644
+
index 1f9ebdd0..078eaadd 100644
    --- a/src/artifact.c
+
--- a/src/artifact.c
    +++ b/src/artifact.c
+
+++ b/src/artifact.c
    @@ -15,6 +15,8 @@
+
@@ -15,6 +15,8 @@
      */
+
  */
   
+
 
    extern boolean notonhead; /* for long worms */
+
  extern boolean notonhead; /* for long worms */
    +extern const int matprices[];
+
+extern const int matprices[];
    +extern const int matdensities[];
+
+extern const int matdensities[];
   
+
 
    #define get_artifact(o) \
+
  #define get_artifact(o) \
        (((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0)
+
      (((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0)
    @@ -2802,4 +2804,27 @@ struct monst *mon; /* if null, hero assumed */
+
@@ -2802,4 +2804,27 @@ struct monst *mon; /* if null, hero assumed */
        return (struct obj *) 0;
+
      return (struct obj *) 0;
    }
+
  }
   
+
 
    +boolean
+
+boolean
    +turn_to_gold(obj, mon)
+
+turn_to_gold(obj, mon)
    +struct obj *obj;
+
+struct obj *obj;
    +struct monst *mon; /* if null, hero assumed */
+
+struct monst *mon; /* if null, hero assumed */
    +{
+
+{
    +    if (obj && (obj->material != GOLD) && valid_obj_material(obj, GOLD)
+
+    if (obj && (obj->material != GOLD) && valid_obj_material(obj, GOLD)
    +        && !obj->oartifact) {
+
+        && !obj->oartifact) {
    +        if ((mon && canseemon(mon)) || (!mon && !Blind))
+
+        if ((mon && canseemon(mon)) || (!mon && !Blind))
    +            pline("%s to gold!", Tobjnam(obj, "turn"));
+
+            pline("%s to gold!", Tobjnam(obj, "turn"));
    +        else if ((obj == uwep || obj == uswapwep)
+
+        else if ((obj == uwep || obj == uswapwep)
    +                && (matdensities[obj->material] != matdensities[GOLD]))
+
+                && (matdensities[obj->material] != matdensities[GOLD]))
    +            pline("%s %s.", Tobjnam(obj, "feel"),
+
+            pline("%s %s.", Tobjnam(obj, "feel"),
    +                  matdensities[obj->material] > matdensities[GOLD]
+
+                  matdensities[obj->material] > matdensities[GOLD]
    +                  ? "lighter" : "heavier");
+
+                  ? "lighter" : "heavier");
    +        if (!mon && matprices[obj->material] > matprices[GOLD])
+
+        if (!mon && matprices[obj->material] > matprices[GOLD])
    +            costly_alteration(obj, COST_DEGRD);
+
+            costly_alteration(obj, COST_DEGRD);
    +        set_material(obj, GOLD);
+
+        set_material(obj, GOLD);
    +        return TRUE;
+
+        return TRUE;
    +    } else {
+
+    } else {
    +        return FALSE;
+
+        return FALSE;
    +    }
+
+    }
    +}
+
+}
    +
+
+
    /*artifact.c*/
+
  /*artifact.c*/
    diff --git a/src/do_name.c b/src/do_name.c
+
diff --git a/src/do_name.c b/src/do_name.c
    index 8e037c37..2eea2482 100644
+
index 8e037c37..2eea2482 100644
    --- a/src/do_name.c
+
--- a/src/do_name.c
    +++ b/src/do_name.c
+
+++ b/src/do_name.c
    @@ -1350,6 +1350,9 @@ const char *name;
+
@@ -1350,6 +1350,9 @@ const char *name;
            case ART_IRON_BALL_OF_LIBERATION:
+
          case ART_IRON_BALL_OF_LIBERATION:
                set_material(obj, IRON);
+
              set_material(obj, IRON);
                break;
+
              break;
    +        case ART_MIDAS_TOUCH:
+
+        case ART_MIDAS_TOUCH:
    +            set_material(obj, GOLD);
+
+            set_material(obj, GOLD);
    +            break;
+
+            break;
            default:
+
          default:
                /* prevent any wishes for materials on an artifact */
+
              /* prevent any wishes for materials on an artifact */
                set_material(obj, objects[obj->otyp].oc_material);
+
              set_material(obj, objects[obj->otyp].oc_material);
    diff --git a/src/do_wear.c b/src/do_wear.c
+
diff --git a/src/do_wear.c b/src/do_wear.c
    index da2274a5..803150a0 100644
+
index da2274a5..803150a0 100644
    --- a/src/do_wear.c
+
--- a/src/do_wear.c
    +++ b/src/do_wear.c
+
+++ b/src/do_wear.c
    @@ -610,6 +610,15 @@ Gloves_on(VOID_ARGS)
+
@@ -610,6 +610,15 @@ Gloves_on(VOID_ARGS)
        if (uarmg->greased)
+
      if (uarmg->greased)
            Glib |= FROMOUTSIDE;
+
          Glib |= FROMOUTSIDE;
        uarmg->known = 1; /* gloves' +/- evident because of status line AC */
+
      uarmg->known = 1; /* gloves' +/- evident because of status line AC */
    +
+
+
    +    if (uarmg->oartifact == ART_MIDAS_TOUCH) {
+
+    if (uarmg->oartifact == ART_MIDAS_TOUCH) {
    +        if (uwep) {
+
+        if (uwep) {
    +            turn_to_gold(uwep, 0);
+
+            turn_to_gold(uwep, 0);
    +        }
+
+        }
    +        if (uswapwep && u.twoweap) {
+
+        if (uswapwep && u.twoweap) {
    +            turn_to_gold(uswapwep, 0);
+
+            turn_to_gold(uswapwep, 0);
    +        }
+
+        }
    +    }
+
+    }
        return 0;
+
      return 0;
    }
+
  }
   
+
 
    diff --git a/src/makemon.c b/src/makemon.c
+
diff --git a/src/makemon.c b/src/makemon.c
    index ea2c0bbe..8fbbad1b 100644
+
index ea2c0bbe..8fbbad1b 100644
    --- a/src/makemon.c
+
--- a/src/makemon.c
    +++ b/src/makemon.c
+
+++ b/src/makemon.c
    @@ -927,16 +927,23 @@ register struct monst *mtmp;
+
@@ -927,16 +927,23 @@ register struct monst *mtmp;
                received = m_carrying(mtmp, item);
+
              received = m_carrying(mtmp, item);
                if (received)
+
              if (received)
                    received->material = GOLD;
+
                  received->material = GOLD;
    -            int item2 = rn2(2) ? HELMET : DWARVISH_HELM;
+
-            int item2 = rn2(2) ? HELMET : DWARVISH_HELM;
    -            (void) mongets(mtmp, item2);
+
-            (void) mongets(mtmp, item2);
    -            received = m_carrying(mtmp, item2);
+
-            received = m_carrying(mtmp, item2);
    +            item = rn2(2) ? HELMET : DWARVISH_HELM;
+
+            item = rn2(2) ? HELMET : DWARVISH_HELM;
    +            (void) mongets(mtmp, item);
+
+            (void) mongets(mtmp, item);
    +            received = m_carrying(mtmp, item);
+
+            received = m_carrying(mtmp, item);
                if (received)
+
              if (received)
                    received->material = GOLD;
+
                  received->material = GOLD;
    -            int item3 = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
+
-            int item3 = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
    -            (void) mongets(mtmp, item3);
+
-            (void) mongets(mtmp, item3);
    -            received = m_carrying(mtmp, item3);
+
-            received = m_carrying(mtmp, item3);
    +            item = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
+
+            item = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
    +            (void) mongets(mtmp, item);
+
+            (void) mongets(mtmp, item);
    +            received = m_carrying(mtmp, item);
+
+            received = m_carrying(mtmp, item);
                if (received)
+
              if (received)
                    received->material = GOLD;
+
                  received->material = GOLD;
    +            otmp = mksobj(GAUNTLETS, FALSE, FALSE);
+
+            otmp = mksobj(GAUNTLETS, FALSE, FALSE);
    +            otmp->material = GOLD;
+
+            otmp->material = GOLD;
    +            if (!rn2(2)) {
+
+            if (!rn2(2)) {
    +                otmp = oname(otmp, artiname(ART_MIDAS_TOUCH));
+
+                otmp = oname(otmp, artiname(ART_MIDAS_TOUCH));
    +                curse(otmp);
+
+                curse(otmp);
    +            }
+
+            }
    +            (void) mpickobj(mtmp, otmp);
+
+            (void) mpickobj(mtmp, otmp);
            }
+
          }
            break;
+
          break;
   
+
 
    diff --git a/src/mkobj.c b/src/mkobj.c
+
diff --git a/src/mkobj.c b/src/mkobj.c
    index c977853a..0f1c7ed1 100644
+
index c977853a..0f1c7ed1 100644
    --- a/src/mkobj.c
+
--- a/src/mkobj.c
    +++ b/src/mkobj.c
+
+++ b/src/mkobj.c
    @@ -1459,7 +1459,6 @@ unsigned onoff; /* 1 or 0 */
+
@@ -1459,7 +1459,6 @@ unsigned onoff; /* 1 or 0 */
      * counterpart, and things such as wooden plate mails were incredibly
+
  * counterpart, and things such as wooden plate mails were incredibly
      * overpowered by weighing about one-tenth as much as the iron counterpart.
+
  * overpowered by weighing about one-tenth as much as the iron counterpart.
      * Instead, use arbitrary units. */
+
  * Instead, use arbitrary units. */
    -STATIC_DCL
+
-STATIC_DCL
    const int matdensities[] = {
+
  const int matdensities[] = {
        0,  // will cause div/0 errors if anything is this material
+
      0,  // will cause div/0 errors if anything is this material
        10,  // LIQUID
+
      10,  // LIQUID
    @@ -3093,6 +3092,11 @@ static const struct icp metal_materials[] = {
+
@@ -3093,6 +3092,11 @@ static const struct icp metal_materials[] = {
   
+
 
    /* for objects which are normally wooden */
+
  /* for objects which are normally wooden */
    static const struct icp wood_materials[] = {
+
  static const struct icp wood_materials[] = {
    +    { 0, GOLD},
+
+    { 0, GOLD},
    +    /* Gold items of this nature can't be generated normally, but can be
+
+    /* Gold items of this nature can't be generated normally, but can be
    +    * wished for. The gold entry must be placed before the last normal
+
+    * wished for. The gold entry must be placed before the last normal
    +    * material to be considered valid.
+
+    * material to be considered valid.
    +    */
+
+    */
        {80, WOOD},
+
      {80, WOOD},
        {10, MINERAL},
+
      {10, MINERAL},
        { 4, IRON},
+
      { 4, IRON},
    @@ -3138,6 +3142,7 @@ static const struct icp elven_materials[] = {
+
@@ -3138,6 +3142,7 @@ static const struct icp elven_materials[] = {
   
+
 
    /* for objects of orcish make - no mithril! */
+
  /* for objects of orcish make - no mithril! */
    static const struct icp orcish_materials[] = {
+
  static const struct icp orcish_materials[] = {
    +    { 0, GOLD},
+
+    { 0, GOLD},
        {65, IRON},
+
      {65, IRON},
        {25, BONE},
+
      {25, BONE},
        {10, MINERAL}
+
      {10, MINERAL}
    @@ -3180,6 +3185,7 @@ static const struct icp horn_materials[] = {
+
@@ -3180,6 +3185,7 @@ static const struct icp horn_materials[] = {
    /* hacks for specific objects... not great because it's a lot of data, but it's
+
  /* hacks for specific objects... not great because it's a lot of data, but it's
      * a relatively clean solution */
+
  * a relatively clean solution */
    static const struct icp elven_helm_boots_materials[] = {
+
  static const struct icp elven_helm_boots_materials[] = {
    +    { 0, GOLD},
+
+    { 0, GOLD},
        {70, LEATHER},
+
      {70, LEATHER},
        {15, MITHRIL},
+
      {15, MITHRIL},
        {10, COPPER},
+
      {10, COPPER},
    @@ -3188,6 +3194,7 @@ static const struct icp elven_helm_boots_materials[] = {
+
@@ -3188,6 +3194,7 @@ static const struct icp elven_helm_boots_materials[] = {
    };
+
  };
   
+
 
    static const struct icp dwarvish_weapon_materials[] = {
+
  static const struct icp dwarvish_weapon_materials[] = {
    +    { 0, GOLD},
+
+    { 0, GOLD},
        {70, IRON},
+
      {70, IRON},
        {25, MITHRIL},
+
      {25, MITHRIL},
        { 5, GEMSTONE} /* gemstone is very hard and very sharp */
+
      { 5, GEMSTONE} /* gemstone is very hard and very sharp */
    diff --git a/src/uhitm.c b/src/uhitm.c
+
diff --git a/src/uhitm.c b/src/uhitm.c
    index ec354b83..47c684a0 100644
+
index ec354b83..47c684a0 100644
    --- a/src/uhitm.c
+
--- a/src/uhitm.c
    +++ b/src/uhitm.c
+
+++ b/src/uhitm.c
    @@ -1397,6 +1397,23 @@ int dieroll;
+
@@ -1397,6 +1397,23 @@ int dieroll;
            }
+
          }
        }
+
      }
   
+
 
    +    if ((mdat == &mons[PM_IRON_GOLEM] || mdat == &mons[PM_STONE_GOLEM])
+
+    if ((mdat == &mons[PM_IRON_GOLEM] || mdat == &mons[PM_STONE_GOLEM])
    +        && !uwep && !thrown && uarmg && uarmg->oartifact == ART_MIDAS_TOUCH) {
+
+        && !uwep && !thrown && uarmg && uarmg->oartifact == ART_MIDAS_TOUCH) {
    +        char *name = Monnam(mon);
+
+        char *name = Monnam(mon);
    +
+
+
    +        if (newcham(mon, &mons[PM_GOLD_GOLEM], FALSE, FALSE)) {
+
+        if (newcham(mon, &mons[PM_GOLD_GOLEM], FALSE, FALSE)) {
    +            if (canseemon(mon)) {
+
+            if (canseemon(mon)) {
    +                pline("%s turns to gold as you hit it!", name);
+
+                pline("%s turns to gold as you hit it!", name);
    +                hittxt = TRUE;
+
+                hittxt = TRUE;
    +            }
+
+            }
    +        } else {
+
+        } else {
    +            if (canseemon(mon)) {
+
+            if (canseemon(mon)) {
    +                pline("%s seems to sparkle with gold as you hit it.", name);
+
+                pline("%s seems to sparkle with gold as you hit it.", name);
    +                hittxt = TRUE;
+
+                hittxt = TRUE;
    +            }
+
+            }
    +        }
+
+        }
    +    }
+
+    }
    +
+
+
        if (!hittxt /*( thrown => obj exists )*/
+
      if (!hittxt /*( thrown => obj exists )*/
            && (!destroyed
+
          && (!destroyed
                || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
+
              || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
    diff --git a/src/weapon.c b/src/weapon.c
+
diff --git a/src/weapon.c b/src/weapon.c
    index 6f28d6dc..62ea0e23 100644
+
index 6f28d6dc..62ea0e23 100644
    --- a/src/weapon.c
+
--- a/src/weapon.c
    +++ b/src/weapon.c
+
+++ b/src/weapon.c
    @@ -1016,6 +1016,9 @@ register struct monst *mon;
+
@@ -1016,6 +1016,9 @@ register struct monst *mon;
                              ? "nearby"
+
                            ? "nearby"
                              : "in the distance");
+
                            : "in the distance");
            }
+
          }
    +        if (which_armor(mon, W_ARMG)
+
+        if (which_armor(mon, W_ARMG)
    +            && which_armor(mon, W_ARMG)->oartifact == ART_MIDAS_TOUCH)
+
+            && which_armor(mon, W_ARMG)->oartifact == ART_MIDAS_TOUCH)
    +            turn_to_gold(obj, mon);
+
+            turn_to_gold(obj, mon);
            obj->owornmask = W_WEP;
+
          obj->owornmask = W_WEP;
            return 1;
+
          return 1;
        }
+
      }
    diff --git a/src/wield.c b/src/wield.c
+
diff --git a/src/wield.c b/src/wield.c
    index 7d57fad5..af3902d3 100644
+
index 7d57fad5..af3902d3 100644
    --- a/src/wield.c
+
--- a/src/wield.c
    +++ b/src/wield.c
+
+++ b/src/wield.c
    @@ -106,6 +106,10 @@ register struct obj *obj;
+
@@ -106,6 +106,10 @@ register struct obj *obj;
            && ((uwep && uwep->oartifact == ART_GIANTSLAYER)
+
          && ((uwep && uwep->oartifact == ART_GIANTSLAYER)
                || (olduwep && olduwep->oartifact == ART_GIANTSLAYER)))
+
              || (olduwep && olduwep->oartifact == ART_GIANTSLAYER)))
            context.botl = 1;
+
          context.botl = 1;
    +
+
+
    +    if (uwep == obj && (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH))
+
+    if (uwep == obj && (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH))
    +        turn_to_gold(obj, 0);
+
+        turn_to_gold(obj, 0);
    +
+
+
        /* Note: Explicitly wielding a pick-axe will not give a "bashing"
+
      /* Note: Explicitly wielding a pick-axe will not give a "bashing"
          * message.  Wielding one via 'a'pplying it will.
+
      * message.  Wielding one via 'a'pplying it will.
          * 3.2.2:  Wielding arbitrary objects will give bashing message too.
+
      * 3.2.2:  Wielding arbitrary objects will give bashing message too.
    @@ -697,6 +701,8 @@ dotwoweapon()
+
@@ -697,6 +701,8 @@ dotwoweapon()
            /* Success! */
+
          /* Success! */
            You("begin two-weapon combat.");
+
          You("begin two-weapon combat.");
            u.twoweap = 1;
+
          u.twoweap = 1;
    +        if (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH)
+
+        if (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH)
    +            turn_to_gold(uswapwep, 0);
+
+            turn_to_gold(uswapwep, 0);
            update_inventory();
+
          update_inventory();
            return (rnd(20) > ACURR(A_DEX));
+
          return (rnd(20) > ACURR(A_DEX));
        }
+
      }
    diff --git a/src/worn.c b/src/worn.c
+
diff --git a/src/worn.c b/src/worn.c
    index 6fd44fe7..79d37ffb 100644
+
index 6fd44fe7..79d37ffb 100644
    --- a/src/worn.c
+
--- a/src/worn.c
    +++ b/src/worn.c
+
+++ b/src/worn.c
    @@ -799,6 +799,9 @@ outer_break:
+
@@ -799,6 +799,9 @@ outer_break:
            } /* else if (!mon->minvis) pline("%s suddenly appears!",
+
          } /* else if (!mon->minvis) pline("%s suddenly appears!",
                  Amonnam(mon)); */
+
              Amonnam(mon)); */
        }
+
      }
    +    if (flag == W_ARMG && best->oartifact == ART_MIDAS_TOUCH) {
+
+    if (flag == W_ARMG && best->oartifact == ART_MIDAS_TOUCH) {
    +        turn_to_gold(MON_WEP(mon), mon);
+
+        turn_to_gold(MON_WEP(mon), mon);
    +    }
+
+    }
    }
+
  }
    #undef RACE_EXCEPTION
+
  #undef RACE_EXCEPTION

Revision as of 02:01, 1 October 2019

diff --git a/include/artilist.h b/include/artilist.h
index d2a8c447..f487df63 100644
--- a/include/artilist.h
+++ b/include/artilist.h
@@ -221,6 +221,10 @@ STATIC_OVL NEARDATA struct artifact artilist[] = {
     A("Luck Blade", BROADSWORD, (SPFX_RESTR | SPFX_LUCK | SPFX_INTEL), 0, 0,
       PHYS(5,6), NO_DFNS, NO_CARY, 0, A_CHAOTIC, PM_CONVICT, NON_PM, 3000L,
       NO_COLOR),
+    /* Golden gauntlets that turn wielded items into gold. These belong to Croesus.
+     */
+    A("Midas Touch", GAUNTLETS, (SPFX_NOGEN | SPFX_RESTR), 0, 0, NO_ATTK, NO_DFNS,
+      NO_CARY, 0, A_NEUTRAL, NON_PM, NON_PM, 5000L, NO_COLOR),
 
     /*
      *      The artifacts for the quest dungeon, all self-willed.
diff --git a/include/extern.h b/include/extern.h
index 13ce605c..787bf329 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -104,6 +104,7 @@ E void FDECL(retouch_equipment, (int));
 E void NDECL(mkot_trap_warn);
 E boolean FDECL(is_magic_key, (struct monst *, struct obj *));
 E struct obj *FDECL(has_magic_key, (struct monst *));
+E boolean FDECL(turn_to_gold, (struct obj *, struct monst *));
 
 /* ### attrib.c ### */
 
diff --git a/src/artifact.c b/src/artifact.c
index 1f9ebdd0..078eaadd 100644
--- a/src/artifact.c
+++ b/src/artifact.c
@@ -15,6 +15,8 @@
  */
 
 extern boolean notonhead; /* for long worms */
+extern const int matprices[];
+extern const int matdensities[];
 
 #define get_artifact(o) \
     (((o) && (o)->oartifact) ? &artilist[(int) (o)->oartifact] : 0)
@@ -2802,4 +2804,27 @@ struct monst *mon; /* if null, hero assumed */
     return (struct obj *) 0;
 }
 
+boolean
+turn_to_gold(obj, mon)
+struct obj *obj;
+struct monst *mon; /* if null, hero assumed */
+{
+    if (obj && (obj->material != GOLD) && valid_obj_material(obj, GOLD)
+        && !obj->oartifact) {
+        if ((mon && canseemon(mon)) || (!mon && !Blind))
+            pline("%s to gold!", Tobjnam(obj, "turn"));
+        else if ((obj == uwep || obj == uswapwep)
+                 && (matdensities[obj->material] != matdensities[GOLD]))
+            pline("%s %s.", Tobjnam(obj, "feel"),
+                  matdensities[obj->material] > matdensities[GOLD]
+                  ? "lighter" : "heavier");
+        if (!mon && matprices[obj->material] > matprices[GOLD])
+            costly_alteration(obj, COST_DEGRD);
+        set_material(obj, GOLD);
+        return TRUE;
+    } else {
+        return FALSE;
+    }
+}
+
 /*artifact.c*/
diff --git a/src/do_name.c b/src/do_name.c
index 8e037c37..2eea2482 100644
--- a/src/do_name.c
+++ b/src/do_name.c
@@ -1350,6 +1350,9 @@ const char *name;
         case ART_IRON_BALL_OF_LIBERATION:
             set_material(obj, IRON);
             break;
+        case ART_MIDAS_TOUCH:
+            set_material(obj, GOLD);
+            break;
         default:
             /* prevent any wishes for materials on an artifact */
             set_material(obj, objects[obj->otyp].oc_material);
diff --git a/src/do_wear.c b/src/do_wear.c
index da2274a5..803150a0 100644
--- a/src/do_wear.c
+++ b/src/do_wear.c
@@ -610,6 +610,15 @@ Gloves_on(VOID_ARGS)
     if (uarmg->greased)
         Glib |= FROMOUTSIDE;
     uarmg->known = 1; /* gloves' +/- evident because of status line AC */
+
+    if (uarmg->oartifact == ART_MIDAS_TOUCH) {
+        if (uwep) {
+            turn_to_gold(uwep, 0);
+        }
+        if (uswapwep && u.twoweap) {
+            turn_to_gold(uswapwep, 0);
+        }
+    }
     return 0;
 }
 
diff --git a/src/makemon.c b/src/makemon.c
index ea2c0bbe..8fbbad1b 100644
--- a/src/makemon.c
+++ b/src/makemon.c
@@ -927,16 +927,23 @@ register struct monst *mtmp;
             received = m_carrying(mtmp, item);
             if (received)
                 received->material = GOLD;
-            int item2 = rn2(2) ? HELMET : DWARVISH_HELM;
-            (void) mongets(mtmp, item2);
-            received = m_carrying(mtmp, item2);
+            item = rn2(2) ? HELMET : DWARVISH_HELM;
+            (void) mongets(mtmp, item);
+            received = m_carrying(mtmp, item);
             if (received)
                 received->material = GOLD;
-            int item3 = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
-            (void) mongets(mtmp, item3);
-            received = m_carrying(mtmp, item3);
+            item = rn2(2) ? KICKING_BOOTS : DWARVISH_BOOTS;
+            (void) mongets(mtmp, item);
+            received = m_carrying(mtmp, item);
             if (received)
                 received->material = GOLD;
+            otmp = mksobj(GAUNTLETS, FALSE, FALSE);
+            otmp->material = GOLD;
+            if (!rn2(2)) {
+                otmp = oname(otmp, artiname(ART_MIDAS_TOUCH));
+                curse(otmp);
+            }
+            (void) mpickobj(mtmp, otmp);
         }
         break;
 
diff --git a/src/mkobj.c b/src/mkobj.c
index c977853a..0f1c7ed1 100644
--- a/src/mkobj.c
+++ b/src/mkobj.c
@@ -1459,7 +1459,6 @@ unsigned onoff; /* 1 or 0 */
  * counterpart, and things such as wooden plate mails were incredibly
  * overpowered by weighing about one-tenth as much as the iron counterpart.
  * Instead, use arbitrary units. */
-STATIC_DCL
 const int matdensities[] = {
     0,   // will cause div/0 errors if anything is this material
     10,  // LIQUID
@@ -3093,6 +3092,11 @@ static const struct icp metal_materials[] = {
 
 /* for objects which are normally wooden */
 static const struct icp wood_materials[] = {
+    { 0, GOLD},
+    /* Gold items of this nature can't be generated normally, but can be
+     * wished for. The gold entry must be placed before the last normal
+     * material to be considered valid.
+     */
     {80, WOOD},
     {10, MINERAL},
     { 4, IRON},
@@ -3138,6 +3142,7 @@ static const struct icp elven_materials[] = {
 
 /* for objects of orcish make - no mithril! */
 static const struct icp orcish_materials[] = {
+    { 0, GOLD},
     {65, IRON},
     {25, BONE},
     {10, MINERAL}
@@ -3180,6 +3185,7 @@ static const struct icp horn_materials[] = {
 /* hacks for specific objects... not great because it's a lot of data, but it's
  * a relatively clean solution */
 static const struct icp elven_helm_boots_materials[] = {
+    { 0, GOLD},
     {70, LEATHER},
     {15, MITHRIL},
     {10, COPPER},
@@ -3188,6 +3194,7 @@ static const struct icp elven_helm_boots_materials[] = {
 };
 
 static const struct icp dwarvish_weapon_materials[] = {
+    { 0, GOLD},
     {70, IRON},
     {25, MITHRIL},
     { 5, GEMSTONE} /* gemstone is very hard and very sharp */
diff --git a/src/uhitm.c b/src/uhitm.c
index ec354b83..47c684a0 100644
--- a/src/uhitm.c
+++ b/src/uhitm.c
@@ -1397,6 +1397,23 @@ int dieroll;
         }
     }
 
+    if ((mdat == &mons[PM_IRON_GOLEM] || mdat == &mons[PM_STONE_GOLEM])
+        && !uwep && !thrown && uarmg && uarmg->oartifact == ART_MIDAS_TOUCH) {
+        char *name = Monnam(mon);
+
+        if (newcham(mon, &mons[PM_GOLD_GOLEM], FALSE, FALSE)) {
+            if (canseemon(mon)) {
+                pline("%s turns to gold as you hit it!", name);
+                hittxt = TRUE;
+            }
+        } else {
+            if (canseemon(mon)) {
+                pline("%s seems to sparkle with gold as you hit it.", name);
+                hittxt = TRUE;
+            }
+        }
+    }
+
     if (!hittxt /*( thrown => obj exists )*/
         && (!destroyed
             || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
diff --git a/src/weapon.c b/src/weapon.c
index 6f28d6dc..62ea0e23 100644
--- a/src/weapon.c
+++ b/src/weapon.c
@@ -1016,6 +1016,9 @@ register struct monst *mon;
                           ? "nearby"
                           : "in the distance");
         }
+        if (which_armor(mon, W_ARMG)
+            && which_armor(mon, W_ARMG)->oartifact == ART_MIDAS_TOUCH)
+            turn_to_gold(obj, mon);
         obj->owornmask = W_WEP;
         return 1;
     }
diff --git a/src/wield.c b/src/wield.c
index 7d57fad5..af3902d3 100644
--- a/src/wield.c
+++ b/src/wield.c
@@ -106,6 +106,10 @@ register struct obj *obj;
         && ((uwep && uwep->oartifact == ART_GIANTSLAYER)
             || (olduwep && olduwep->oartifact == ART_GIANTSLAYER)))
         context.botl = 1;
+
+    if (uwep == obj && (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH))
+        turn_to_gold(obj, 0);
+
     /* Note: Explicitly wielding a pick-axe will not give a "bashing"
      * message.  Wielding one via 'a'pplying it will.
      * 3.2.2:  Wielding arbitrary objects will give bashing message too.
@@ -697,6 +701,8 @@ dotwoweapon()
         /* Success! */
         You("begin two-weapon combat.");
         u.twoweap = 1;
+        if (uarmg && uarmg->oartifact == ART_MIDAS_TOUCH)
+            turn_to_gold(uswapwep, 0);
         update_inventory();
         return (rnd(20) > ACURR(A_DEX));
     }
diff --git a/src/worn.c b/src/worn.c
index 6fd44fe7..79d37ffb 100644
--- a/src/worn.c
+++ b/src/worn.c
@@ -799,6 +799,9 @@ outer_break:
         } /* else if (!mon->minvis) pline("%s suddenly appears!",
              Amonnam(mon)); */
     }
+    if (flag == W_ARMG && best->oartifact == ART_MIDAS_TOUCH) {
+        turn_to_gold(MON_WEP(mon), mon);
+    }
 }
 #undef RACE_EXCEPTION