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

Function mdamageu

src/mhitu.c:1901–1927  ·  view source on GitHub ↗

mtmp hits you for n points damage */

Source from the content-addressed store, hash-verified

1899
1900/* mtmp hits you for n points damage */
1901void
1902mdamageu(struct monst *mtmp, int n)
1903{
1904 if (n < 0) {
1905 impossible("mdamageu for negative damage? (%d)", n);
1906 n = 0;
1907 }
1908
1909 disp.botl = TRUE;
1910 if (Upolyd) {
1911 u.mh -= n;
1912 showdamage(n);
1913 /* caller might have reduced mhmax before calling mdamageu() */
1914 if (u.mh > u.mhmax)
1915 u.mh = u.mhmax;
1916 if (u.mh < 1)
1917 rehumanize();
1918 } else {
1919 u.uhp -= n;
1920 showdamage(n);
1921 /* caller might have reduced uhpmax before calling mdamageu() */
1922 if (u.uhp > u.uhpmax)
1923 u.uhp = u.uhpmax;
1924 if (u.uhp < 1)
1925 done_in_by(mtmp, DIED);
1926 }
1927}
1928
1929/* returns 0 if seduction impossible,
1930 * 1 if fine,

Callers 9

mhitm_ad_drinFunction · 0.85
hmonasFunction · 0.85
passiveFunction · 0.85
castmuFunction · 0.85
mcast_spellFunction · 0.85
spoteffectsFunction · 0.85
hitmuFunction · 0.85
gulpmuFunction · 0.85
gazemuFunction · 0.85

Calls 3

showdamageFunction · 0.85
rehumanizeFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected