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

Function vamprises

src/mon.c:2889–2987  ·  view source on GitHub ↗

when a shape-shifted vampire is killed, it reverts to base form instead of dying; returns True if mtmp successfully revives, False otherwise; "successfully revived" vampire might be killed by a booby trapped door */

Source from the content-addressed store, hash-verified

2887 of dying; returns True if mtmp successfully revives, False otherwise;
2888 "successfully revived" vampire might be killed by a booby trapped door */
2889staticfn boolean
2890vamprises(struct monst *mtmp)
2891{
2892 int mndx = mtmp->cham;
2893
2894 /*
2895 * Protection from shape changers protects against this because
2896 * the vampire will always be in normal form instead of shifted.
2897 * So there's no need to check for that attribute being active.
2898 */
2899 if (ismnum(mndx) && mndx != monsndx(mtmp->data)
2900 && !(svm.mvitals[mndx].mvflags & G_GENOD)) {
2901 char action[BUFSZ];
2902 /* alternate message phrasing for some monster types */
2903 boolean spec_mon = (nonliving(mtmp->data)
2904 || noncorporeal(mtmp->data)
2905 || amorphous(mtmp->data)),
2906 spec_death = (gd.disintegested /* disintegrated/digested */
2907 || noncorporeal(mtmp->data)
2908 || amorphous(mtmp->data));
2909 coordxy x = mtmp->mx, y = mtmp->my;
2910
2911 /* construct a 'before' argument to pass to pline(); this used
2912 to construct a dynamic format string but that's overkill */
2913 Snprintf(action, sizeof action, "%s%s %s%s and rises as",
2914 Unaware ? "you dream that " : "",
2915 x_monnam(mtmp, ARTICLE_THE,
2916 spec_mon ? (char *) 0 : "seemingly dead",
2917 (SUPPRESS_INVISIBLE | AUGMENT_IT), FALSE),
2918 Unaware ? "" : "suddenly ",
2919 spec_death ? "reconstitutes" : "transforms");
2920 mtmp->mcanmove = 1;
2921 mtmp->mfrozen = 0;
2922 set_mon_min_mhpmax(mtmp, 10); /* mtmp->mhpmax=max(m_lev+1,10) */
2923 mtmp->mhp = mtmp->mhpmax;
2924 /* mtmp==u.ustuck can happen if previously a fog cloud or if
2925 poly'd hero is hugging a vampire bat */
2926 if (mtmp == u.ustuck) {
2927 if (u.uswallow)
2928 expels(mtmp, mtmp->data, FALSE);
2929 else
2930 uunstick();
2931 }
2932
2933 if (!newcham(mtmp, &mons[mndx], NO_NC_FLAGS))
2934 return !DEADMONSTER(mtmp);
2935 mtmp->cham = (mtmp->data == &mons[mndx]) ? NON_PM : mndx;
2936
2937 if (canspotmon(mtmp)) {
2938 /* 3.6.0 used a_monnam(mtmp); that was weird if mtmp was
2939 named: "Dracula suddenly transforms and rises as Dracula";
2940 3.6.1 used mtmp->data->mname; that ignored hallucination */
2941 pline_mon(mtmp, "%s %s!", upstart(action),
2942 x_monnam(mtmp, ARTICLE_A, (char *) 0,
2943 (SUPPRESS_NAME | SUPPRESS_IT | SUPPRESS_INVISIBLE),
2944 FALSE));
2945 gv.vamp_rise_msg = TRUE;
2946 }

Callers 1

mondeadFunction · 0.85

Calls 15

set_mon_min_mhpmaxFunction · 0.85
expelsFunction · 0.85
uunstickFunction · 0.85
newchamFunction · 0.85
pline_monFunction · 0.85
upstartFunction · 0.85
closed_doorFunction · 0.85
set_msg_xyFunction · 0.85
You_hearFunction · 0.85
You_seeFunction · 0.85
pline_TheFunction · 0.85
recalc_block_pointFunction · 0.85

Tested by

no test coverage detected