]> granicus.if.org Git - nethack/commitdiff
more #U1233 - taming feedback (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 12 Apr 2007 05:31:25 +0000 (05:31 +0000)
committernethack.rankin <nethack.rankin>
Thu, 12 Apr 2007 05:31:25 +0000 (05:31 +0000)
     One of the complaints included in the Dec'04 report from <email deleted> was that spell of charm monster doesn't give
any feedback.  This makes that spell, and scroll of taming, always give a
message.  And the scroll will become discovered if a visible or sensed
monster gets converted from hostile or peaceful to tame, or from hostile
to peaceful.

     Scroll of taming/spell of charm monster didn't hit steed when hero
is mounted; now it does.  I don't know whether that matters though.  You
can saddle a non-tame monster, but you can't ride one even in wizard mode.
However, I'm not sure whether a tame steed you're already riding can
become untame, let alone if it can do so without throwing you.  If latter
is possible then re-taming while still mounted has now become feasible.

doc/fixes35.0
src/read.c

index 00e69a6b496ef34d48d5b5ed3f6f9707fdaa56ec..9618a15f23fa66510317b0df883670ec5b381be7 100644 (file)
@@ -312,6 +312,7 @@ acid can destroy iron bars
 OPTIONS=playmode:normal|explore|debug to choose mode without command-line
 score bonus for ascending is reduced or denied for changing alignment
 player can give a monster class when asked for type of monster to poly into
+scroll of taming/spell of charm monster now gives some feedback
 
 
 Platform- and/or Interface-Specific New Features
index 8172cc152c4142f9af08bcde6d2ad58471f17033..2ae669f02c7d38b3e973298d1d490fa0a6f3c7ec 100644 (file)
@@ -26,7 +26,7 @@ STATIC_DCL void FDECL(p_glow2,(struct obj *,const char *));
 STATIC_DCL void FDECL(randomize,(int *, int));
 STATIC_DCL void FDECL(forget_single_object, (int));
 STATIC_DCL void FDECL(forget, (int));
-STATIC_DCL void FDECL(maybe_tame, (struct monst *,struct obj *));
+STATIC_DCL int FDECL(maybe_tame, (struct monst *,struct obj *));
 
 STATIC_PTR void FDECL(set_lit, (int,int,genericptr_t));
 
@@ -661,19 +661,26 @@ int howmuch;
 }
 
 /* monster is hit by scroll of taming's effect */
-STATIC_OVL void
+STATIC_OVL int
 maybe_tame(mtmp, sobj)
 struct monst *mtmp;
 struct obj *sobj;
 {
+       int was_tame = mtmp->mtame;
+       unsigned was_peaceful = mtmp->mpeaceful;
+
        if (sobj->cursed) {
            setmangry(mtmp);
+           if (was_peaceful && !mtmp->mpeaceful) return -1;
        } else {
            if (mtmp->isshk)
                make_happy_shk(mtmp, FALSE);
            else if (!resist(mtmp, sobj->oclass, 0, NOTELL))
                (void) tamedog(mtmp, (struct obj *) 0);
+           if ((!was_peaceful && mtmp->mpeaceful) ||
+               (!was_tame && mtmp->mtame)) return 1;
        }
+       return 0;
 }
 
 /* scroll effects; return 1 if we use up the scroll and possibly make it
@@ -1086,18 +1093,43 @@ struct obj *sobj; /* scroll, or fake spellbook object for scroll-like spell */
                break;
        case SCR_TAMING:
        case SPE_CHARM_MONSTER:
+           {
+               int candidates, res, results, vis_results;
+
                if (u.uswallow) {
-                   maybe_tame(u.ustuck, sobj);
+                   candidates = 1;
+                   results = vis_results = maybe_tame(u.ustuck, sobj);
                } else {
                    int i, j, bd = confused ? 5 : 1;
                    struct monst *mtmp;
 
+                   /* note: maybe_tame() can return either positive or
+                      negative values, but not both for the same scroll */
+                   candidates = results = vis_results = 0;
                    for (i = -bd; i <= bd; i++) for(j = -bd; j <= bd; j++) {
                        if (!isok(u.ux + i, u.uy + j)) continue;
-                       if ((mtmp = m_at(u.ux + i, u.uy + j)) != 0)
-                           maybe_tame(mtmp, sobj);
+                       if ((mtmp = m_at(u.ux + i, u.uy + j)) != 0
+#ifdef STEED
+                           || (!i && !j && (mtmp = u.usteed) != 0)
+#endif
+                          ) {
+                           ++candidates;
+                           res = maybe_tame(mtmp, sobj);
+                           results += res;
+                           if (canspotmon(mtmp)) vis_results += res;
+                       }
                    }
                }
+               if (!results) {
+                   pline("Nothing interesting %s.",
+                         !candidates ? "happens" : "seems to happen");
+               } else {
+                   pline_The("neighborhood %s %sfriendlier.",
+                         vis_results ? "is" : "seems",
+                         (results < 0) ? "un" : "");
+                   if (vis_results > 0) known = TRUE;
+               }
+           }
                break;
        case SCR_GENOCIDE:
                if (!already_known)