unleashing untame monsters

Fix several cases that earlier patches didn't address.
If a leashed monster becomes untame, detach the leash.
This commit is contained in:
nethack.rankin
2002-03-11 08:46:54 +00:00
parent afae7f931c
commit 085498ba28
4 changed files with 32 additions and 17 deletions

View File

@@ -332,7 +332,8 @@ keep monster from forgetting its weapon is cursed every other round
multiple shot throwing stops immediately whenever you hurtle backwards
don't panic if being billed for a burning or other timed object
food that makes a monster peaceful should not re-anger it at the same time
abusing a leashed pet can result in a leashed peaceful monster
abusing a leashed pet could result in a leashed peaceful monster
couldn't unleash steed while mounted
trying and failing to wield an item could leave current weapon flagged as both
"weapon in hand" and "alternate weapon" when `pushweapon' option is set
handle OBJ_CONTAINED case for corpse revival so that trolls can revive

View File

@@ -91,6 +91,7 @@ boolean quietly;
if (!quietly)
You("get a bad feeling about this.");
mtmp->mpeaceful = 0;
set_malign(mtmp);
}
}
/* if figurine has been named, give same name to the monster */
@@ -413,6 +414,13 @@ long nmv; /* number of moves */
mtmp->mtame = mtmp->mpeaceful = 0;
}
if (!mtmp->mtame && mtmp->mleashed) {
/* leashed monsters should always be with hero, consequently
never losing any time to be accounted for later */
impossible("catching up for leashed monster?");
m_unleash(mtmp, FALSE);
}
/* recover lost hit points */
if (!regenerates(mtmp->data)) imv /= 20;
if (mtmp->mhp + imv >= mtmp->mhpmax)
@@ -463,11 +471,10 @@ boolean pets_only; /* true for ascension or final escape */
pline("%s is still trapped.", Monnam(mtmp));
stay_behind = TRUE;
}
if (stay_behind
#ifdef STEED
&& mtmp != u.usteed
if (mtmp == u.usteed) stay_behind = FALSE;
#endif
) {
if (stay_behind) {
if (mtmp->mleashed) {
pline("%s leash suddenly comes loose.",
humanoid(mtmp->data)
@@ -550,14 +557,13 @@ migrate_to_level(mtmp, tolev, xyloc, cc)
obj->no_charge = 0;
}
if (mtmp->mleashed) {
mtmp->mtame--;
m_unleash(mtmp, TRUE);
}
relmon(mtmp);
mtmp->nmon = migrating_mons;
migrating_mons = mtmp;
if (mtmp->mleashed) {
m_unleash(mtmp, FALSE);
mtmp->mtame--;
pline_The("leash comes off!");
}
newsym(mtmp->mx,mtmp->my);
new_lev.dnum = ledger_to_dnum((xchar)tolev);
@@ -809,7 +815,12 @@ boolean quietly;
mtmp->mpeaceful = mtmp->mtame = 0;
}
}
if (!mtmp->mtame) newsym(mtmp->mx, mtmp->my);
if (!mtmp->mtame) {
newsym(mtmp->mx, mtmp->my);
/* a life-saved monster might be leashed;
don't leave it that way if it's no longer tame */
if (mtmp->mleashed) m_unleash(mtmp, TRUE);
}
/* if its still a pet, start a clean pet-slate now */
if (has_edog && mtmp->mtame) {
@@ -831,10 +842,8 @@ struct monst *mtmp;
if (mtmp->mtame && !mtmp->isminion)
EDOG(mtmp)->abuse++;
if (!mtmp->mtame && mtmp->mleashed) {
pline("%s breaks loose of %s leash!", Monnam(mtmp), mhis(mtmp));
m_unleash(mtmp, FALSE);
}
if (!mtmp->mtame && mtmp->mleashed)
m_unleash(mtmp, TRUE);
/* don't make a sound if pet is in the middle of leaving the level */
/* newsym isn't necessary in this case either */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hack.c 3.4 2002/02/05 */
/* SCCS Id: @(#)hack.c 3.4 2002/03/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1166,6 +1166,7 @@ domove()
if (mtmp->mtrapped) {
if (!rn2(mtmp->mtame)) {
mtmp->mtame = mtmp->mpeaceful = mtmp->msleeping = 0;
if (mtmp->mleashed) m_unleash(mtmp, TRUE);
growl(mtmp);
} else {
yelp(mtmp);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)steed.c 3.4 2001/04/12 */
/* SCCS Id: @(#)steed.c 3.4 2002/03/09 */
/* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */
@@ -272,8 +272,11 @@ mount_steed(mtmp, force)
return (FALSE);
}
if (!force && !Role_if(PM_KNIGHT) && !(--mtmp->mtame)) {
/* no longer tame */
newsym(mtmp->mx, mtmp->my);
pline("%s resists!", Monnam(mtmp));
pline("%s resists%s!", Monnam(mtmp),
mtmp->mleashed ? " and its leash comes off" : "");
if (mtmp->mleashed) m_unleash(mtmp, FALSE);
return (FALSE);
}
if (!force && Underwater && !is_swimmer(ptr)) {
@@ -385,6 +388,7 @@ kick_steed()
/* Make the steed less tame and check if it resists */
if (u.usteed->mtame) u.usteed->mtame--;
if (!u.usteed->mtame && u.usteed->mleashed) m_unleash(u.usteed, TRUE);
if (!u.usteed->mtame || (u.ulevel+u.usteed->mtame < rnd(MAXULEV/2+5))) {
newsym(u.usteed->mx, u.usteed->my);
dismount_steed(DISMOUNT_THROWN);