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

Function chat_with_leader

src/quest.c:281–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281staticfn void
282chat_with_leader(struct monst *mtmp)
283{
284 if (!mtmp->mpeaceful || Qstat(pissed_off))
285 return;
286
287 /* Rule 0: Cheater checks. */
288 if (u.uhave.questart && !Qstat(met_nemesis))
289 Qstat(cheater) = TRUE;
290
291 /* It is possible for you to get the amulet without completing
292 * the quest. If so, try to induce the player to quest.
293 */
294 if (Qstat(got_thanks)) {
295 /* Rule 1: You've gone back with/without the amulet. */
296 if (u.uhave.amulet)
297 finish_quest((struct obj *) 0);
298
299 /* Rule 2: You've gone back before going for the amulet. */
300 else
301 qt_pager("posthanks");
302
303 /* Rule 3: You've got the artifact and are back to return it. */
304 } else if (u.uhave.questart) {
305 struct obj *otmp;
306
307 for (otmp = gi.invent; otmp; otmp = otmp->nobj)
308 if (is_quest_artifact(otmp))
309 break;
310
311 finish_quest(otmp);
312
313 /* Rule 4: You haven't got the artifact yet. */
314 } else if (Qstat(got_quest)) {
315 qt_pager("encourage");
316
317 /* Rule 5: You aren't yet acceptable - or are you? */
318 } else {
319 int purity = 0;
320
321 if (!Qstat(met_leader)) {
322 qt_pager("leader_first");
323 Qstat(met_leader) = TRUE;
324 Qstat(not_ready) = 0;
325 } else
326 qt_pager("leader_next");
327
328 /* the quest leader might have passed through the portal into
329 the regular dungeon; none of the remaining make sense there */
330 if (!on_level(&u.uz, &qstart_level))
331 return;
332
333 if (not_capable()) {
334 qt_pager("badlevel");
335 exercise(A_WIS, TRUE);
336 expulsion(FALSE);
337 } else if ((purity = is_pure(TRUE)) < 0) {
338 if (!Qstat(pissed_off)) {

Callers 2

leader_speaksFunction · 0.85
quest_chatFunction · 0.85

Calls 11

finish_questFunction · 0.85
qt_pagerFunction · 0.85
is_quest_artifactFunction · 0.85
on_levelFunction · 0.85
not_capableFunction · 0.85
exerciseFunction · 0.85
expulsionFunction · 0.85
is_pureFunction · 0.85
com_pagerFunction · 0.85
livelog_printfFunction · 0.85
noit_mon_namFunction · 0.85

Tested by

no test coverage detected