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

Function pri_move

src/priest.c:176–216  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

174 * pri_move: return 1: moved 0: didn't -1: let m_move do it -2: died
175 */
176int
177pri_move(struct monst *priest)
178{
179 coordxy ggx, ggy, omx, omy;
180 schar temple;
181 boolean avoid = TRUE;
182
183 omx = priest->mx;
184 omy = priest->my;
185
186 if (!histemple_at(priest, omx, omy))
187 return -1;
188
189 temple = EPRI(priest)->shroom;
190
191 ggx = EPRI(priest)->shrpos.x;
192 ggy = EPRI(priest)->shrpos.y;
193
194 ggx += rn1(3, -1); /* mill around the altar */
195 ggy += rn1(3, -1);
196
197 if (!priest->mpeaceful
198 || (Conflict && !resist_conflict(priest))) {
199 if (monnear(priest, u.ux, u.uy)) {
200 if (Displaced)
201 Your("displaced image doesn't fool %s!", mon_nam(priest));
202 (void) mattacku(priest);
203 return 0;
204 } else if (strchr(u.urooms, temple)) {
205 /* chase player if inside temple & can see him */
206 if (priest->mcansee && m_canseeu(priest)) {
207 ggx = u.ux;
208 ggy = u.uy;
209 }
210 avoid = FALSE;
211 }
212 } else if (Invis)
213 avoid = FALSE;
214
215 return move_special(priest, FALSE, TRUE, FALSE, avoid, omx, omy, ggx, ggy);
216}
217
218/* exclusively for mktemple() */
219void

Callers 1

m_moveFunction · 0.85

Calls 7

histemple_atFunction · 0.85
resist_conflictFunction · 0.85
monnearFunction · 0.85
YourFunction · 0.85
mon_namFunction · 0.85
mattackuFunction · 0.85
move_specialFunction · 0.85

Tested by

no test coverage detected