partial vampire fix

From a followup comment to a reddit post:  a vampire who has gained
levels loses them when reverting to base form.  This fixes the case
where it grows into a vampire lord; change the base form from plain
vampire to lord when that happens.

It does not fix the case where shapechanging to fog or bat or wolf
and then back to base form yields a new vampire or vampire lord
instead of the one that built itself up.  Mainly affects pet vampires
since wild oees don't tend to grow very much.
This commit is contained in:
PatR
2022-06-25 11:26:05 -07:00
parent 2770223d10
commit 174cac42a6
2 changed files with 6 additions and 1 deletions

View File

@@ -934,6 +934,9 @@ the u.ustuck hierarchy is: swallowed by ustuck, hero poly'd into sticky form
could make formerly sticky pold'd hero clear ustuck, leaving hero
swallowed by nothing (u.uswallow==1 with u.ustuck==NULL); that could
cause a crash if u.ustuck got dereferenced
when a vampire gains levels and grows into a vampire lord, change its cham
field (shapechanger base type) from vampire to vampire lord so that if
it revives in base form it won't revert to plain vampire
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1963,13 +1963,15 @@ grow_up(struct monst *mtmp, struct monst *victim)
an(buf));
}
set_mon_data(mtmp, ptr);
if (mtmp->cham == oldtype && is_shapeshifter(ptr))
mtmp->cham = newtype; /* vampire growing into vampire lord */
newsym(mtmp->mx, mtmp->my); /* color may change */
lev_limit = (int) mtmp->m_lev; /* never undo increment */
mtmp->female = fem; /* gender might be changing */
/* if 'mtmp' is leashed, persistent inventory window needs updating */
if (mtmp->mleashed)
update_inventory(); /* x - leash (attached to a <mon> */
update_inventory(); /* x - leash (attached to a <mon>) */
}
/* sanity checks */