Another tamedog message
Give a different message when a peaceful creature was tamed. Allow suppressing this and the previous message, when the caller handles messaging.
This commit is contained in:
10
src/dog.c
10
src/dog.c
@@ -1069,7 +1069,7 @@ dogfood(struct monst *mon, struct obj *obj)
|
||||
* on the original mtmp. It now returns TRUE if the taming succeeded.
|
||||
*/
|
||||
boolean
|
||||
tamedog(struct monst *mtmp, struct obj *obj)
|
||||
tamedog(struct monst *mtmp, struct obj *obj, boolean givemsg)
|
||||
{
|
||||
/* reduce timed sleep or paralysis, leaving mtmp->mcanmove as-is
|
||||
(note: if mtmp is donning armor, this will reduce its busy time) */
|
||||
@@ -1085,9 +1085,11 @@ tamedog(struct monst *mtmp, struct obj *obj)
|
||||
return FALSE;
|
||||
|
||||
/* worst case, at least it'll be peaceful. */
|
||||
if (!mtmp->mpeaceful && canspotmon(mtmp))
|
||||
if (givemsg && !mtmp->mpeaceful && canspotmon(mtmp)) {
|
||||
pline("%s seems %s.", Monnam(mtmp),
|
||||
Hallucination ? "really chill" : "more amiable");
|
||||
givemsg = FALSE; /* don't give another message below */
|
||||
}
|
||||
mtmp->mpeaceful = 1;
|
||||
set_malign(mtmp);
|
||||
if (flags.moonphase == FULL_MOON && night() && rn2(6) && obj
|
||||
@@ -1173,6 +1175,10 @@ tamedog(struct monst *mtmp, struct obj *obj)
|
||||
/* `obj' is now obsolete */
|
||||
}
|
||||
|
||||
if (givemsg && canspotmon(mtmp))
|
||||
pline("%s seems quite %s.", Monnam(mtmp),
|
||||
Hallucination ? "approachable" : "friendly");
|
||||
|
||||
newsym(mtmp->mx, mtmp->my);
|
||||
if (attacktype(mtmp->data, AT_WEAP)) {
|
||||
mtmp->weapon_check = NEED_HTH_WEAPON;
|
||||
|
||||
@@ -2220,7 +2220,7 @@ thitmonst(
|
||||
|
||||
} else if (befriend_with_obj(mon->data, obj)
|
||||
|| (mon->mtame && dogfood(mon, obj) <= ACCFOOD)) {
|
||||
if (tamedog(mon, obj)) {
|
||||
if (tamedog(mon, obj, TRUE)) {
|
||||
return 1; /* obj is gone */
|
||||
} else {
|
||||
tmiss(obj, mon, FALSE);
|
||||
|
||||
@@ -915,7 +915,7 @@ clone_mon(struct monst *mon,
|
||||
However, tamedog() will not re-tame a tame dog, so m2
|
||||
must be made non-tame to get initialized properly. */
|
||||
m2->mtame = 0;
|
||||
if (tamedog(m2, (struct obj *) 0)) {
|
||||
if (tamedog(m2, (struct obj *) 0, FALSE)) {
|
||||
assert(has_edog(m2) && has_edog(mon));
|
||||
*EDOG(m2) = *EDOG(mon);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ charm_monsters(int distance)
|
||||
one; do that even if mtmp resists in order to behave the same
|
||||
as a non-cursed scroll of taming or spell of charm monster */
|
||||
if (!resist(mtmp, TOOL_CLASS, 0, NOTELL) || mtmp->isshk)
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2789,7 +2789,7 @@ djinni_from_bottle(struct obj *obj)
|
||||
break;
|
||||
case 1:
|
||||
verbalize("Thank you for freeing me!");
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, FALSE);
|
||||
break;
|
||||
case 2:
|
||||
verbalize("You freed me!");
|
||||
|
||||
@@ -1037,7 +1037,7 @@ maybe_tame(struct monst *mtmp, struct obj *sobj)
|
||||
/* for a shopkeeper, tamedog() will call make_happy_shk() but
|
||||
not tame the target, so call it even if taming gets resisted */
|
||||
if (!resist(mtmp, sobj->oclass, 0, NOTELL) || mtmp->isshk)
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, FALSE);
|
||||
if ((!was_peaceful && mtmp->mpeaceful) || (!was_tame && mtmp->mtame))
|
||||
return 1;
|
||||
}
|
||||
@@ -3194,7 +3194,7 @@ create_particular_creation(
|
||||
}
|
||||
mx = mtmp->mx, my = mtmp->my;
|
||||
if (d->maketame) {
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, FALSE);
|
||||
} else if (d->makepeaceful || d->makehostile) {
|
||||
mtmp->mtame = 0; /* sanity precaution */
|
||||
mtmp->mpeaceful = d->makepeaceful ? 1 : 0;
|
||||
|
||||
@@ -218,7 +218,7 @@ deadbook_pacify_undead(struct monst *mtmp)
|
||||
if (mtmp->mtame < 20)
|
||||
mtmp->mtame++;
|
||||
} else
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, TRUE);
|
||||
else
|
||||
monflee(mtmp, 0, FALSE, TRUE);
|
||||
}
|
||||
|
||||
@@ -1004,7 +1004,7 @@ hatch_egg(anything *arg, long timeout)
|
||||
while it's in your inventory */
|
||||
if ((yours && !silent)
|
||||
|| (carried(egg) && mon->data->mlet == S_DRAGON)) {
|
||||
if (tamedog(mon, (struct obj *) 0)) {
|
||||
if (tamedog(mon, (struct obj *) 0, FALSE)) {
|
||||
if (carried(egg) && mon->data->mlet != S_DRAGON)
|
||||
mon->mtame = 20;
|
||||
}
|
||||
|
||||
@@ -4228,7 +4228,7 @@ domagictrap(void)
|
||||
continue;
|
||||
mtmp = m_at(u.ux + i, u.uy + j);
|
||||
if (mtmp)
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2047,7 +2047,7 @@ demonpet(void)
|
||||
i = !rn2(6) ? ndemon(u.ualign.type) : NON_PM;
|
||||
pm = i != NON_PM ? &mons[i] : gy.youmonst.data;
|
||||
if ((dtmp = makemon(pm, u.ux, u.uy, NO_MM_FLAGS)) != 0)
|
||||
(void) tamedog(dtmp, (struct obj *) 0);
|
||||
(void) tamedog(dtmp, (struct obj *) 0, FALSE);
|
||||
exercise(A_WIS, TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ were_summon(
|
||||
*visible += 1;
|
||||
}
|
||||
if (yours && mtmp)
|
||||
(void) tamedog(mtmp, (struct obj *) 0);
|
||||
(void) tamedog(mtmp, (struct obj *) 0, FALSE);
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ revive(struct obj *corpse, boolean by_hero)
|
||||
}
|
||||
/* tame the revived monster if its ghost was tame */
|
||||
if (ghost->mtame && !mtmp->mtame) {
|
||||
if (tamedog(mtmp, (struct obj *) 0)) {
|
||||
if (tamedog(mtmp, (struct obj *) 0, FALSE)) {
|
||||
/* ghost's edog data is ignored */
|
||||
mtmp->mtame = ghost->mtame;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user