monster is hit by scroll of taming's effect */
| 1041 | |
| 1042 | /* monster is hit by scroll of taming's effect */ |
| 1043 | staticfn int |
| 1044 | maybe_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. |
no test coverage detected