github issue #819 - magic harp vs shopkeeper

Issue reported by youkan700:  for shopkeepers, taming via magic harp
behaved differently than taming via scroll or spell.

Make magic harp's taming be the same as [non-cursed] scroll of taming
and spell of charm monster:  angry shopkeepers will be pacified (even
though they can't be tamed).

Also, add something I've been sitting on for ages:  when taming magic
hits an already tame monster, give that monster a chance to become
tamer.  Not significant for monsters that eat (unless being starved
for some reason) but matters for ones who don't eat.  For tameness N
(which has a maximum of 20), if N is less than 10, have any taming
yield a 10-N out of 10 chance to increase the tameness by 1.  So the
closer a pet is to becoming feral, the more likely for it to improve
tameness a little.

Closes #819
This commit is contained in:
PatR
2022-07-16 05:08:26 -07:00
parent 29afd90bad
commit 231bd75b7f
4 changed files with 36 additions and 21 deletions

View File

@@ -189,27 +189,24 @@ awaken_soldiers(struct monst* bugler /* monster that played instrument */)
}
}
/* Charm monsters in range. Note that they may resist the spell.
* If swallowed, range is reduced to 0.
*/
/* Charm monsters in range. Note that they may resist the spell. */
static void
charm_monsters(int distance)
{
struct monst *mtmp, *mtmp2;
if (u.uswallow) {
if (!resist(u.ustuck, TOOL_CLASS, 0, NOTELL))
(void) tamedog(u.ustuck, (struct obj *) 0);
} else {
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
mtmp2 = mtmp->nmon;
if (DEADMONSTER(mtmp))
continue;
if (u.uswallow)
distance = 0; /* only u.ustuck will be affected (u.usteed is Null
* since hero gets forcibly dismounted when engulfed) */
if (distu(mtmp->mx, mtmp->my) <= distance) {
if (!resist(mtmp, TOOL_CLASS, 0, NOTELL))
(void) tamedog(mtmp, (struct obj *) 0);
}
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
mtmp2 = mtmp->nmon;
if (DEADMONSTER(mtmp))
continue;
if (distu(mtmp->mx, mtmp->my) <= distance) {
if (!resist(mtmp, TOOL_CLASS, 0, NOTELL))
(void) tamedog(mtmp, (struct obj *) 0);
}
}
}