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

Function mind_blast

src/monmove.c:582–645  ·  view source on GitHub ↗

a mind flayer unleashes a mind blast */

Source from the content-addressed store, hash-verified

580
581/* a mind flayer unleashes a mind blast */
582staticfn void
583mind_blast(struct monst *mtmp)
584{
585 struct monst *m2, *nmon = (struct monst *) 0;
586
587 if (canseemon(mtmp))
588 pline_mon(mtmp, "%s concentrates.", Monnam(mtmp));
589 if (mdistu(mtmp) > BOLT_LIM * BOLT_LIM) {
590 You("sense a faint wave of psychic energy.");
591 return;
592 }
593 pline("A wave of psychic energy pours over you!");
594 if (mtmp->mpeaceful
595 && (!Conflict || resist_conflict(mtmp))) {
596 pline("It feels quite soothing.");
597 } else if (!u.uinvulnerable) {
598 int dmg;
599 boolean m_sen = sensemon(mtmp);
600
601 if (m_sen || (Blind_telepat && rn2(2)) || !rn2(10)) {
602 /* hiding monsters are brought out of hiding when hit by
603 a psychic blast, so do the same for hiding poly'd hero */
604 if (u.uundetected) {
605 u.uundetected = 0;
606 newsym(u.ux, u.uy);
607 } else if (U_AP_TYPE != M_AP_NOTHING
608 /* hero has no way to hide as monster but
609 check for that theoretical case anyway */
610 && U_AP_TYPE != M_AP_MONSTER) {
611 gy.youmonst.m_ap_type = M_AP_NOTHING;
612 gy.youmonst.mappearance = 0;
613 newsym(u.ux, u.uy);
614 }
615 pline("It locks on to your %s!",
616 m_sen ? "telepathy"
617 : Blind_telepat ? "latent telepathy"
618 : "mind"); /* note: hero is never mindless */
619 dmg = rnd(15);
620 if (Half_spell_damage)
621 dmg = (dmg + 1) / 2;
622 losehp(dmg, "psychic blast", KILLED_BY_AN);
623 }
624 }
625 for (m2 = fmon; m2; m2 = nmon) {
626 nmon = m2->nmon;
627 if (DEADMONSTER(m2))
628 continue;
629 if (m2->mpeaceful == mtmp->mpeaceful)
630 continue;
631 if (mindless(m2->data))
632 continue;
633 if (m2 == mtmp)
634 continue;
635 if ((telepathic(m2->data) && (rn2(2) || m2->mblinded)) || !rn2(10)) {
636 /* wake it up first, to bring hidden monster out of hiding */
637 wakeup(m2, FALSE);
638 if (cansee(m2->mx, m2->my))
639 pline("It locks on to %s.", mon_nam(m2));

Callers 1

dochugFunction · 0.85

Calls 14

canseemonFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
YouFunction · 0.85
resist_conflictFunction · 0.85
sensemonFunction · 0.85
rn2Function · 0.85
newsymFunction · 0.85
rndFunction · 0.85
losehpFunction · 0.85
wakeupFunction · 0.85
mon_namFunction · 0.85

Tested by

no test coverage detected