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

Function demon_talk

src/minion.c:262–358  ·  view source on GitHub ↗

returns 1 if it won't attack. */

Source from the content-addressed store, hash-verified

260
261/* returns 1 if it won't attack. */
262int
263demon_talk(struct monst *mtmp)
264{
265 long cash, demand, offer;
266
267 if (u_wield_art(ART_EXCALIBUR) || u_wield_art(ART_DEMONBANE)) {
268 if (canspotmon(mtmp))
269 pline("%s looks very angry.", Amonnam(mtmp));
270 else
271 You_feel("tension building.");
272 mtmp->mpeaceful = mtmp->mtame = 0;
273 set_malign(mtmp);
274 newsym(mtmp->mx, mtmp->my);
275 return 0;
276 }
277
278 if (is_fainted()) {
279 reset_faint(); /* if fainted - wake up */
280 } else {
281 stop_occupation();
282 if (gm.multi > 0) {
283 nomul(0);
284 unmul((char *) 0);
285 }
286 }
287
288 /* Slight advantage given. */
289 if (is_dprince(mtmp->data) && mtmp->minvis) {
290 boolean wasunseen = !canspotmon(mtmp);
291
292 mtmp->minvis = mtmp->perminvis = 0;
293 if (wasunseen && canspotmon(mtmp)) {
294 pline("%s appears before you.", Amonnam(mtmp));
295 mtmp->mstrategy &= ~STRAT_APPEARMSG;
296 }
297 newsym(mtmp->mx, mtmp->my);
298 }
299 if (gy.youmonst.data->mlet == S_DEMON) { /* Won't blackmail their own. */
300 if (!Deaf)
301 pline("%s says, \"Good hunting, %s.\"", Amonnam(mtmp),
302 flags.female ? "Sister" : "Brother");
303 else if (canseemon(mtmp))
304 pline("%s says something.", Amonnam(mtmp));
305 if (!tele_restrict(mtmp))
306 (void) rloc(mtmp, RLOC_MSG);
307 return 1;
308 }
309 cash = money_cnt(gi.invent);
310 demand = (cash * (rnd(80) + 20 * Athome))
311 / (100 * (1 + (sgn(u.ualign.type) == sgn(mtmp->data->maligntyp))));
312
313 if (!demand || gm.multi < 0) { /* you have no gold or can't move */
314 mtmp->mpeaceful = 0;
315 set_malign(mtmp);
316 return 0;
317 } else {
318 /* make sure that the demand is unmeetable if the monster
319 has the Amulet, preventing monster from being satisfied

Callers 2

domonnoiseFunction · 0.85
dochugFunction · 0.85

Calls 15

AmonnamFunction · 0.85
You_feelFunction · 0.85
set_malignFunction · 0.85
newsymFunction · 0.85
is_faintedFunction · 0.85
reset_faintFunction · 0.85
stop_occupationFunction · 0.85
nomulFunction · 0.85
unmulFunction · 0.85
canseemonFunction · 0.85
tele_restrictFunction · 0.85
rlocFunction · 0.85

Tested by

no test coverage detected