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

Function shk_move

src/shk.c:4879–4993  ·  view source on GitHub ↗

* shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died */

Source from the content-addressed store, hash-verified

4877 * shk_move: return 1: moved 0: didn't -1: let m_move do it -2: died
4878 */
4879int
4880shk_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;

Callers 1

m_moveFunction · 0.85

Calls 15

inhishopFunction · 0.85
shk_fixes_damageFunction · 0.85
resist_conflictFunction · 0.85
YourFunction · 0.85
shknameFunction · 0.85
mattackuFunction · 0.85
verbalizeFunction · 0.85
HelloFunction · 0.85
ShknamFunction · 0.85
mbodypartFunction · 0.85
rn2Function · 0.85
rile_shkFunction · 0.85

Tested by

no test coverage detected