MCPcopy Create free account
hub / github.com/NetHack/NetHack / maybe_tame

Function maybe_tame

src/read.c:1043–1063  ·  view source on GitHub ↗

monster is hit by scroll of taming's effect */

Source from the content-addressed store, hash-verified

1041
1042/* monster is hit by scroll of taming's effect */
1043staticfn int
1044maybe_tame(struct monst *mtmp, struct obj *sobj)
1045{
1046 int was_tame = mtmp->mtame;
1047 unsigned was_peaceful = mtmp->mpeaceful;
1048
1049 if (sobj->cursed) {
1050 setmangry(mtmp, FALSE);
1051 if (was_peaceful && !mtmp->mpeaceful)
1052 return -1;
1053 } else {
1054 /* for a shopkeeper, tamedog() will call make_happy_shk() but
1055 not tame the target, so call it even if taming gets resisted */
1056 if (!resist(mtmp, sobj->oclass, 0, NOTELL) || mtmp->isshk)
1057 (void) tamedog(mtmp, sobj, FALSE);
1058
1059 if ((!was_peaceful && mtmp->mpeaceful) || was_tame != mtmp->mtame)
1060 return 1;
1061 }
1062 return 0;
1063}
1064
1065/* Can a stinking cloud physically exist at a certain position?
1066 * NOT the same thing as can_center_cloud.

Callers 1

seffect_tamingFunction · 0.85

Calls 3

setmangryFunction · 0.85
resistFunction · 0.85
tamedogFunction · 0.85

Tested by

no test coverage detected