MCPcopy Index your code
hub / github.com/NetHack/NetHack / vamp_stone

Function vamp_stone

src/mon.c:3765–3830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3763}
3764
3765boolean
3766vamp_stone(struct monst *mtmp)
3767{
3768 if (is_vampshifter(mtmp)) {
3769 int mndx = mtmp->cham;
3770 coordxy x = mtmp->mx, y = mtmp->my;
3771
3772 /* this only happens if shapeshifted */
3773 if (mndx >= LOW_PM && mndx != monsndx(mtmp->data)
3774 && !(svm.mvitals[mndx].mvflags & G_GENOD)) {
3775 char buf[BUFSZ];
3776
3777 /* construct a format string before transformation */
3778 Sprintf(buf, "The lapidifying %s %s %s",
3779 x_monnam(mtmp, ARTICLE_NONE, (char *) 0,
3780 (SUPPRESS_SADDLE | SUPPRESS_HALLUCINATION
3781 | SUPPRESS_INVISIBLE | SUPPRESS_IT), FALSE),
3782 amorphous(mtmp->data) ? "coalesces on the"
3783 : is_flyer(mtmp->data) ? "drops to the"
3784 : "writhes on the",
3785 surface(x, y));
3786 mtmp->mcanmove = 1;
3787 mtmp->mfrozen = 0;
3788 set_mon_min_mhpmax(mtmp, 10); /* mtmp->mhpmax=max(m_lev+1,10) */
3789 mtmp->mhp = mtmp->mhpmax;
3790 /* this can happen if previously a fog cloud */
3791 if (engulfing_u(mtmp))
3792 expels(mtmp, mtmp->data, FALSE);
3793 if (amorphous(mtmp->data) && closed_door(mtmp->mx, mtmp->my)) {
3794 coord new_xy;
3795
3796 if (enexto(&new_xy, mtmp->mx, mtmp->my, &mons[mndx])) {
3797 rloc_to(mtmp, new_xy.x, new_xy.y);
3798 }
3799 }
3800 if (canspotmon(mtmp)) {
3801 pline_mon(mtmp, "%s!", buf);
3802 display_nhwindow(WIN_MESSAGE, FALSE);
3803 }
3804 (void) newcham(mtmp, &mons[mndx], NO_NC_FLAGS);
3805 if (mtmp->data == &mons[mndx])
3806 mtmp->cham = NON_PM;
3807 else
3808 mtmp->cham = mndx;
3809 if (canspotmon(mtmp)) {
3810 pline_mon(mtmp,
3811 "%s rises from the %s with renewed agility!",
3812 Amonnam(mtmp), surface(mtmp->mx, mtmp->my));
3813 }
3814 newsym(mtmp->mx, mtmp->my);
3815 return FALSE; /* didn't petrify */
3816 }
3817 } else if (ismnum(mtmp->cham)
3818 && (mons[mtmp->cham].mresists & MR_STONE)) {
3819 /* sandestins are stoning-immune so if hit by stoning damage
3820 they revert to innate shape rather than become a statue */
3821 mtmp->mcanmove = 1;
3822 mtmp->mfrozen = 0;

Callers 2

monstoneFunction · 0.85
minstapetrifyFunction · 0.85

Calls 10

surfaceFunction · 0.85
set_mon_min_mhpmaxFunction · 0.85
expelsFunction · 0.85
closed_doorFunction · 0.85
enextoFunction · 0.85
rloc_toFunction · 0.85
pline_monFunction · 0.85
newchamFunction · 0.85
AmonnamFunction · 0.85
newsymFunction · 0.85

Tested by

no test coverage detected