<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">diff -Ndru nethack-3.4.3\src\monmove.c nethack-patched\src\monmove.c
--- nethack-3.4.3\src\monmove.c	2005-12-19 17:51:30.000000000 +0000
+++ nethack-patched\src\monmove.c	2006-03-02 21:17:18.000000000 +0000
@@ -584,6 +584,22 @@
 	return(FALSE);
 }
 
+
+boolean
+is_teleporting(mtmp)
+register struct monst *mtmp;
+{
+    if (mtmp-&gt;mcan || tele_restrict(mtmp)) return FALSE;
+    if (mtmp-&gt;data == &amp;mons[PM_TENGU]) return TRUE;
+    /* Look for a ring of teleportation worn by this monster. */
+    if (mtmp-&gt;misc_worn_check &amp; W_RINGL) {
+        struct obj *obj = which_armor(mtmp, W_RINGL);
+        if (obj &amp;&amp; obj-&gt;otyp == RIN_TELEPORTATION) return TRUE;
+    }
+    return FALSE;
+}
+
+
 /* Return values:
  * 0: did not move, but can still attack and do other stuff.
  * 1: moved, possibly can attack.
@@ -698,8 +714,7 @@
 #endif
 
 	/* teleport if that lies in our nature */
-	if(ptr == &amp;mons[PM_TENGU] &amp;&amp; !rn2(5) &amp;&amp; !mtmp-&gt;mcan &amp;&amp;
-	   !tele_restrict(mtmp)) {
+	if(is_teleporting(mtmp) &amp;&amp; !rn2(5)) {
 	    if(mtmp-&gt;mhp &lt; 7 || mtmp-&gt;mpeaceful || rn2(2))
 		(void) rloc(mtmp, FALSE);
 	    else
diff -Ndru nethack-3.4.3\src\muse.c nethack-patched\src\muse.c
--- nethack-3.4.3\src\muse.c	2005-12-19 17:51:30.000000000 +0000
+++ nethack-patched\src\muse.c	2006-03-03 01:28:40.000000000 +0000
@@ -1953,7 +1953,8 @@
 		mon-&gt;data == &amp;mons[PM_GHOST])	/* don't loot bones piles */
 	    return FALSE;
 
-	if (typ == WAN_MAKE_INVISIBLE || typ == POT_INVISIBILITY)
+	if (typ == WAN_MAKE_INVISIBLE || typ == POT_INVISIBILITY ||
+                                         typ == RIN_INVISIBILITY)
 	    return (boolean)(!mon-&gt;minvis &amp;&amp; !mon-&gt;invis_blkd &amp;&amp; !attacktype(mon-&gt;data, AT_GAZE));
 	if (typ == WAN_SPEED_MONSTER || typ == POT_SPEED)
 	    return (boolean)(mon-&gt;mspeed != MFAST);
@@ -2016,6 +2017,31 @@
 	    if (typ == EGG)
 		return (boolean)(touch_petrifies(&amp;mons[obj-&gt;corpsenm]));
 	    break;
+        case RING_CLASS:
+            /* Should match the list in m_dowear_type */
+            /* Shopkeepers don't go for invisibility or teleportation */
+            if (typ == RIN_PROTECTION)
+                return (obj-&gt;spe &gt; 0);
+            if (typ == RIN_FIRE_RESISTANCE)
+                return (!resists_fire(mon));
+            if (typ == RIN_COLD_RESISTANCE)
+                return (!resists_cold(mon));
+            if (typ == RIN_SHOCK_RESISTANCE)
+                return (!resists_elec(mon));
+            if (typ == RIN_POISON_RESISTANCE)
+                return (!resists_poison(mon));
+            if (typ == RIN_SLOW_DIGESTION)
+                return (youmonst.data == &amp;mons[PM_PURPLE_WORM]);
+            /* Below this line are off-limits to shks and uniques */
+            if (is_covetous(mon-&gt;data) || (mon-&gt;data-&gt;geno &amp; G_UNIQ))
+                return (FALSE);
+            if (typ == RIN_REGENERATION)
+                return (!is_reviver(mon-&gt;data));
+            if (typ == RIN_INVISIBILITY)
+                return (!(mon-&gt;minvis) &amp;&amp; !HSee_invisible);
+            if (typ == RIN_TELEPORTATION)
+                return (mon-&gt;data != &amp;mons[PM_TENGU]);
+            break;
 	default:
 	    break;
 	}
diff -Ndru nethack-3.4.3\src\uhitm.c nethack-patched\src\uhitm.c
--- nethack-3.4.3\src\uhitm.c	2005-12-19 17:51:44.000000000 +0000
+++ nethack-patched\src\uhitm.c	2006-03-03 01:04:34.000000000 +0000
@@ -1732,6 +1732,16 @@
 	}
 }
 
+STATIC_OVL boolean
+has_slow_digestion(mdef)
+struct monst *mdef;
+{
+    register struct obj *obj;
+    if (!(mdef-&gt;misc_worn_check &amp; W_RINGL)) return (FALSE);
+    obj = which_armor(mdef, W_RINGL);
+    return (obj-&gt;otyp == RIN_SLOW_DIGESTION);
+}
+
 STATIC_OVL int
 gulpum(mdef,mattk)
 register struct monst *mdef;
@@ -1763,6 +1773,14 @@
 		start_engulf(mdef);
 		switch(mattk-&gt;adtyp) {
 		    case AD_DGST:
+                        /* slow digestion protects against engulfing */
+                        if (has_slow_digestion(mdef)) {
+			    You("hurriedly regurgitate the sizzling in your %s.",
+				body_part(STOMACH));
+                            end_engulf();
+                            return (2);
+                        }
+
 			/* eating a Rider or its corpse is fatal */
 			if (is_rider(mdef-&gt;data)) {
 			 pline("Unfortunately, digesting any of it is fatal.");
diff -Ndru nethack-3.4.3\src\worn.c nethack-patched\src\worn.c
--- nethack-3.4.3\src\worn.c	2005-12-19 17:51:46.000000000 +0000
+++ nethack-patched\src\worn.c	2006-03-03 01:23:12.000000000 +0000
@@ -386,6 +386,12 @@
 	m_dowear_type(mon, W_ARMH, creation, FALSE);
 	if (!MON_WEP(mon) || !bimanual(MON_WEP(mon)))
 	    m_dowear_type(mon, W_ARMS, creation, FALSE);
+        /* One ring per monster; ring takes up a "hand" slot (always W_RINGL) */
+        if (!(mon-&gt;misc_worn_check &amp; W_RINGL) &amp;&amp;
+            (!MON_WEP(mon) ||
+             !(bimanual(MON_WEP(mon)) || (mon-&gt;misc_worn_check &amp; W_ARMS))
+           ))
+          m_dowear_type(mon, W_RINGL, creation, FALSE);
 	m_dowear_type(mon, W_ARMG, creation, FALSE);
 	if (!slithy(mon-&gt;data) &amp;&amp; mon-&gt;data-&gt;mlet != S_CENTAUR)
 	    m_dowear_type(mon, W_ARMF, creation, FALSE);
@@ -452,6 +458,22 @@
 		    if (!is_suit(obj)) continue;
 		    if (racialexception &amp;&amp; (racial_exception(mon, obj) &lt; 1)) continue;
 		    break;
+                case W_RINGL:
+                    /* Monsters can put on only the following rings. */
+                    if (obj-&gt;oclass != RING_CLASS ||
+			(obj-&gt;otyp != RIN_INVISIBILITY &amp;&amp;
+			 obj-&gt;otyp != RIN_FIRE_RESISTANCE &amp;&amp;
+			 obj-&gt;otyp != RIN_COLD_RESISTANCE &amp;&amp;
+			 obj-&gt;otyp != RIN_POISON_RESISTANCE &amp;&amp;
+			 obj-&gt;otyp != RIN_SHOCK_RESISTANCE &amp;&amp;
+			 obj-&gt;otyp != RIN_REGENERATION &amp;&amp;
+			 obj-&gt;otyp != RIN_TELEPORTATION &amp;&amp;
+			 obj-&gt;otyp != RIN_SLOW_DIGESTION &amp;&amp;
+			 obj-&gt;otyp != RIN_PROTECTION))
+			continue;
+                    if (obj-&gt;otyp == RIN_SLOW_DIGESTION &amp;&amp;
+                        youmonst.data != &amp;mons[PM_PURPLE_WORM]) continue;
+                    break;
 	    }
 	    if (obj-&gt;owornmask) continue;
 	    /* I'd like to define a VISIBLE_ARM_BONUS which doesn't assume the
@@ -752,19 +774,68 @@
 	return;
 }
 
-/* bias a monster's preferences towards armor that has special benefits. */
-/* currently only does speed boots, but might be expanded if monsters get to
-   use more armor abilities */
+/*
+ * Bias a monster's preferences towards armor that has special benefits.
+ * Currently does speed boots and various rings.
+ */
 static int
 extra_pref(mon, obj)
 struct monst *mon;
 struct obj *obj;
 {
-    if (obj) {
-	if (obj-&gt;otyp == SPEED_BOOTS &amp;&amp; mon-&gt;permspeed != MFAST)
-	    return 20;
+    struct obj *old;
+    int rc = 1;
+
+    if (!obj) return 0;
+
+    if (obj-&gt;otyp == SPEED_BOOTS &amp;&amp; mon-&gt;permspeed != MFAST)
+        return 20;
+    if (obj-&gt;oclass != RING_CLASS)
+        return 0;
+
+    /* Find out whether the monster already has some resistance. */
+    old = which_armor(mon, W_RINGL);
+    if (old) update_mon_intrinsics(mon, old, FALSE, TRUE);
+    /* This list should match the list in m_dowear_type. */
+    switch (obj-&gt;otyp) {
+        case RIN_FIRE_RESISTANCE:
+            if (!resists_fire(mon))
+                rc = 12;
+            break;
+        case RIN_COLD_RESISTANCE:
+            if (!resists_cold(mon))
+                rc = 12;
+            break;
+	case RIN_POISON_RESISTANCE:
+            if (!resists_poison(mon))
+                rc = 10;
+            break;
+	case RIN_SHOCK_RESISTANCE:
+            if (!resists_elec(mon))
+                rc = (uwep &amp;&amp; uwep-&gt;oartifact == ART_MJOLLNIR)? 20: 10;
+            break;
+	case RIN_REGENERATION:
+            rc = 20; break;
+	case RIN_INVISIBILITY:
+            if (!is_covetous(mon-&gt;data))
+                rc = See_invisible? 4: 30;
+            break;
+	case RIN_PROTECTION:
+            if (obj-&gt;spe &gt; 0)
+                rc = 10 + 3*(obj-&gt;spe);
+            else rc = 0;
+            break;
+        case RIN_TELEPORTATION:
+            if (mon-&gt;data != &amp;mons[PM_TENGU] &amp;&amp; !is_covetous(mon-&gt;data))
+                rc = (obj-&gt;cursed)? 5: 15;
+            break;
+        case RIN_SLOW_DIGESTION:
+            /* If we're here, the player is polyed into a purple worm. */
+            rc = 25;
+            break;
     }
-    return 0;
+    if (old) update_mon_intrinsics(mon, old, TRUE, TRUE);
+    return rc;
 }
 
 /*
</pre></body></html>