From 7aaf588ef7fc50eb42ae27be295c11390781a5f9 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 12 Apr 2007 05:31:25 +0000 Subject: [PATCH] more #U1233 - taming feedback (trunk only) One of the complaints included in the Dec'04 report from 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 | 1 + src/read.c | 42 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 00e69a6b4..9618a15f2 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/read.c b/src/read.c index 8172cc152..2ae669f02 100644 --- a/src/read.c +++ b/src/read.c @@ -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)