* shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died */
| 4877 | * shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died |
| 4878 | */ |
| 4879 | int |
| 4880 | shk_move(struct monst *shkp) |
| 4881 | { |
| 4882 | coordxy gtx, gty, omx, omy; |
| 4883 | int udist; |
| 4884 | schar appr; |
| 4885 | struct eshk *eshkp = ESHK(shkp); |
| 4886 | int z; |
| 4887 | boolean uondoor = FALSE, satdoor, avoid = FALSE, badinv; |
| 4888 | |
| 4889 | omx = shkp->mx; |
| 4890 | omy = shkp->my; |
| 4891 | |
| 4892 | if (inhishop(shkp)) |
| 4893 | shk_fixes_damage(shkp); |
| 4894 | |
| 4895 | if ((udist = distu(omx, omy)) < 3 && (shkp->data != &mons[PM_GRID_BUG] |
| 4896 | || (omx == u.ux || omy == u.uy))) { |
| 4897 | if (ANGRY(shkp) || (Conflict && !resist_conflict(shkp))) { |
| 4898 | if (Displaced) |
| 4899 | Your("displaced image doesn't fool %s!", shkname(shkp)); |
| 4900 | (void) mattacku(shkp); |
| 4901 | return 0; |
| 4902 | } |
| 4903 | if (eshkp->following) { |
| 4904 | if (strncmp(eshkp->customer, svp.plname, PL_NSIZ)) { |
| 4905 | if (!Deaf && !muteshk(shkp)) { |
| 4906 | SetVoice(shkp, 0, 80, 0); |
| 4907 | verbalize("%s, %s! I was looking for %s.", Hello(shkp), |
| 4908 | svp.plname, eshkp->customer); |
| 4909 | } |
| 4910 | eshkp->following = 0; |
| 4911 | return 0; |
| 4912 | } |
| 4913 | if (svm.moves > gf.followmsg + 4) { |
| 4914 | if (!Deaf && !muteshk(shkp)) { |
| 4915 | SetVoice(shkp, 0, 80, 0); |
| 4916 | verbalize("%s, %s! Didn't you forget to pay?", |
| 4917 | Hello(shkp), svp.plname); |
| 4918 | } else { |
| 4919 | pline("%s holds out %s upturned %s.", |
| 4920 | Shknam(shkp), noit_mhis(shkp), |
| 4921 | mbodypart(shkp, HAND)); |
| 4922 | } |
| 4923 | gf.followmsg = svm.moves; |
| 4924 | if (!rn2(9)) { |
| 4925 | pline("%s doesn't like customers who don't pay.", |
| 4926 | Shknam(shkp)); |
| 4927 | rile_shk(shkp); |
| 4928 | } |
| 4929 | } |
| 4930 | if (udist < 2) |
| 4931 | return 0; |
| 4932 | } |
| 4933 | } |
| 4934 | |
| 4935 | appr = 1; |
| 4936 | gtx = eshkp->shk.x; |
no test coverage detected