]> granicus.if.org Git - nethack/commitdiff
Prevent certain items from random erosion
authorPasi Kallinen <paxed@alt.org>
Sun, 5 Feb 2023 14:46:49 +0000 (16:46 +0200)
committerPasi Kallinen <paxed@alt.org>
Sun, 5 Feb 2023 14:46:54 +0000 (16:46 +0200)
Prevent wished for items (unless specified), artifacts,
armor and weapons of NPC heroes, and ammo from Longbow of Diana
being generated eroded.

src/artifact.c
src/mplayer.c
src/objnam.c

index 82e8bbd3732d94f60b3a996c7687aba83bac6e17..216c08e93e6c32d8a39258c130576f0d37f778b7 100644 (file)
@@ -213,6 +213,8 @@ mk_artifact(
             otmp = mksobj((int) a->otyp, TRUE, FALSE);
 
         if (otmp) {
+            /* prevent erosion from generating */
+            otmp->oeroded = otmp->oeroded2 = 0;
             otmp = oname(otmp, a->name, ONAME_NO_FLAGS);
             otmp->oartifact = m;
             /* set existence and reason for creation bits */
@@ -1819,6 +1821,7 @@ arti_invoke(struct obj *obj)
             otmp->blessed = obj->blessed;
             otmp->cursed = obj->cursed;
             otmp->bknown = obj->bknown;
+            otmp->oeroded = otmp->oeroded2 = 0;
             if (obj->blessed) {
                 if (otmp->spe < 0)
                     otmp->spe = 0;
index 49f87d7201d4b1bf0a0fac15953e4c12b8ed90a2..30870c89dd80bb4b49711b62170c69747c29f0c5 100644 (file)
@@ -99,6 +99,7 @@ mk_mplayer_armor(struct monst* mon, short typ)
     if (typ == STRANGE_OBJECT)
         return;
     obj = mksobj(typ, FALSE, FALSE);
+    obj->oeroded = obj->oeroded2 = 0;
     if (!rn2(3))
         obj->oerodeproof = 1;
     if (!rn2(3))
@@ -254,6 +255,7 @@ mk_mplayer(struct permonst *ptr, coordxy x, coordxy y, boolean special)
 
         if (weapon != STRANGE_OBJECT) {
             otmp = mksobj(weapon, TRUE, FALSE);
+            otmp->oeroded = otmp->oeroded2 = 0;
             otmp->spe = (special ? rn1(5, 4) : rn2(4));
             if (!rn2(3))
                 otmp->oerodeproof = 1;
index 707d022f4533687b82ac36ed7fbe067360ed11a3..185314c4f851b6e0148f57d2a11fd1fc95bc8db8 100644 (file)
@@ -4829,6 +4829,8 @@ readobjnam(char *bp, struct obj *no_wish)
 
     /* set eroded and erodeproof */
     if (erosion_matters(d.otmp)) {
+        /* wished-for item shouldn't be eroded unless specified */
+        d.otmp->oeroded = d.otmp->oeroded2 = 0;
         if (d.eroded && (is_flammable(d.otmp) || is_rustprone(d.otmp)))
             d.otmp->oeroded = d.eroded;
         if (d.eroded2 && (is_corrodeable(d.otmp) || is_rottable(d.otmp)))