MCPcopy Index your code
hub / github.com/NetHack/NetHack / bribe

Function bribe

src/minion.c:360–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360long
361bribe(struct monst *mtmp, const char *prompt)
362{
363 char buf[BUFSZ] = DUMMY;
364 long offer;
365 long umoney = money_cnt(gi.invent);
366
367 getlin(prompt, buf);
368 if (sscanf(buf, "%ld", &offer) != 1)
369 offer = 0L;
370
371 /*Michael Paddon -- fix for negative offer to monster*/
372 /*JAR880815 - */
373 if (offer < 0L) {
374 You("try to shortchange %s, but fumble.", mon_nam(mtmp));
375 return 0L;
376 } else if (offer == 0L) {
377 You("refuse.");
378 return 0L;
379 } else if (offer >= umoney) {
380 You("give %s all your gold.", mon_nam(mtmp));
381 offer = umoney;
382 } else {
383 You("give %s %ld %s.", mon_nam(mtmp), offer, currency(offer));
384 }
385 (void) money2mon(mtmp, offer);
386 disp.botl = TRUE;
387 return offer;
388}
389
390int
391dprince(aligntyp atyp)

Callers 2

demon_talkFunction · 0.85
priest_talkFunction · 0.85

Calls 6

money_cntFunction · 0.85
getlinFunction · 0.85
YouFunction · 0.85
mon_namFunction · 0.85
currencyFunction · 0.85
money2monFunction · 0.85

Tested by

no test coverage detected