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

Function domindblast

src/polyself.c:1893–1938  ·  view source on GitHub ↗

#monster for hero-as-mind_flayer giving psychic blast */

Source from the content-addressed store, hash-verified

1891
1892/* #monster for hero-as-mind_flayer giving psychic blast */
1893int
1894domindblast(void)
1895{
1896 struct monst *mtmp, *nmon;
1897 int dmg;
1898
1899 if (u.uen < 10) {
1900 You("concentrate but lack the energy to maintain doing so.");
1901 return ECMD_OK;
1902 }
1903 u.uen -= 10;
1904 disp.botl = TRUE;
1905
1906 You("concentrate.");
1907 pline("A wave of psychic energy pours out.");
1908 for (mtmp = fmon; mtmp; mtmp = nmon) {
1909 int u_sen;
1910
1911 nmon = mtmp->nmon;
1912 if (DEADMONSTER(mtmp))
1913 continue;
1914 if (mdistu(mtmp) > BOLT_LIM * BOLT_LIM)
1915 continue;
1916 if (mtmp->mpeaceful)
1917 continue;
1918 if (mindless(mtmp->data))
1919 continue;
1920 u_sen = telepathic(mtmp->data) && !mtmp->mcansee;
1921 if (u_sen || (telepathic(mtmp->data) && rn2(2)) || !rn2(10)) {
1922 dmg = rnd(15);
1923 /* wake it up first, to bring hidden monster out of hiding;
1924 but in case it is currently peaceful, don't make it hostile
1925 unless it will survive the psychic blast, otherwise hero
1926 would avoid the penalty for killing it while peaceful */
1927 wakeup(mtmp, (dmg > mtmp->mhp) ? TRUE : FALSE);
1928 You("lock in on %s %s.", s_suffix(mon_nam(mtmp)),
1929 u_sen ? "telepathy"
1930 : telepathic(mtmp->data) ? "latent telepathy"
1931 : "mind");
1932 mtmp->mhp -= dmg;
1933 if (DEADMONSTER(mtmp))
1934 killed(mtmp);
1935 }
1936 }
1937 return ECMD_TIME;
1938}
1939
1940void
1941uunstick(void)

Callers 1

domonabilityFunction · 0.85

Calls 8

YouFunction · 0.85
rn2Function · 0.85
rndFunction · 0.85
wakeupFunction · 0.85
s_suffixFunction · 0.85
mon_namFunction · 0.85
killedFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected