fix #H4146 - more enlightenment vs drain resistance

Duplicate of another recent report as far as drain resistance from
Excalibur/Stormbringer/Staff of Aesculapius not being shown by
enlightenment goes, but this one mentioned that it also wasn't being
shown for lycanthropy.  Being inflicted by that does confers level-
drain resistance.  were_change() wasn't calling set_uasmon() since
it isn't changing youmonst.data, but set_uasmon() is were intrinsics
conferred by creature form are set up.  So call it when changing
were-form.  Direct access to u.ulycn wasn't calling it either, so add
a new routine to assign the value to that instead doing so directly.
This commit is contained in:
PatR
2015-12-25 16:46:02 -08:00
parent 0d36c443a3
commit 1c80503938
7 changed files with 36 additions and 22 deletions

View File

@@ -57,7 +57,7 @@ death due an unseen gas spore's explosion resulted in "killed by a died"
allow optional parameter "true", "yes", "false", or "no" for boolean options
actually make the castle chest not trapped
level-drain resistance wasn't shown during enlightenment if it was conferred
by worn/wielded equipment
by worn/wielded equipment or by lycanthropy
wizard mode enlightenment now shows more reasons for various intrinsics
rehumanizing after being poly'd into vampire left hero with ability to sense
humans and elves

View File

@@ -2609,6 +2609,7 @@ E void FDECL(new_were, (struct monst *));
E int FDECL(were_summon, (struct permonst *, BOOLEAN_P, int *, char *));
E void NDECL(you_were);
E void FDECL(you_unwere, (BOOLEAN_P));
E void FDECL(set_ulycn, (int));
/* ### wield.c ### */

View File

@@ -770,7 +770,9 @@ int propidx; /* special cases can have negative values */
if (innateness == FROM_EXP)
Strcpy(buf, " because of your experience");
else if (innateness == FROM_FORM)
Strcpy(buf, " from current creature form");
Strcpy(buf, (u.ulycn >= LOW_PM)
? " due to your lycanthropy"
: " from current creature form");
else if (innateness == FROM_ROLE || innateness == FROM_RACE)
Strcpy(buf, " innately");
else if (wizard

View File

@@ -903,7 +903,7 @@ cpostfx(pm)
register int pm;
{
register int tmp = 0;
boolean catch_lycanthropy = FALSE;
int catch_lycanthropy = NON_PM;
/* in case `afternmv' didn't get called for previously mimicking
gold, clean up now to avoid `eatmbuf' memory leak */
@@ -931,16 +931,13 @@ register int pm;
pluslvl(FALSE);
break;
case PM_HUMAN_WERERAT:
catch_lycanthropy = TRUE;
u.ulycn = PM_WERERAT;
catch_lycanthropy = PM_WERERAT;
break;
case PM_HUMAN_WEREJACKAL:
catch_lycanthropy = TRUE;
u.ulycn = PM_WEREJACKAL;
catch_lycanthropy = PM_WEREJACKAL;
break;
case PM_HUMAN_WEREWOLF:
catch_lycanthropy = TRUE;
u.ulycn = PM_WEREWOLF;
catch_lycanthropy = PM_WEREWOLF;
break;
case PM_NURSE:
if (Upolyd)
@@ -1096,12 +1093,14 @@ register int pm;
gainstr((struct obj *) 0, 0, TRUE);
else if (tmp > 0)
givit(tmp, ptr);
} break;
}
break;
} /* default case */
} /* switch */
if (catch_lycanthropy)
if (catch_lycanthropy >= LOW_PM) {
set_ulycn(catch_lycanthropy);
retouch_equipment(2);
}
return;
}

View File

@@ -1248,7 +1248,7 @@ register struct attack *mattk;
&& !Protection_from_shape_changers && !defends(AD_WERE, uwep)) {
You_feel("feverish.");
exercise(A_CON, FALSE);
u.ulycn = monsndx(mdat);
set_ulycn(monsndx(mdat));
retouch_equipment(2);
}
break;

View File

@@ -604,7 +604,7 @@ register struct obj *otmp;
makeplural(mons[u.ulycn].mname));
if (youmonst.data == &mons[u.ulycn])
you_unwere(FALSE);
u.ulycn = NON_PM; /* cure lycanthropy */
set_ulycn(NON_PM); /* cure lycanthropy */
}
losehp(Maybe_Half_Phys(d(2, 6)), "potion of holy water",
KILLED_BY_AN);

View File

@@ -37,6 +37,8 @@ register struct monst *mon;
} else if (!rn2(30) || Protection_from_shape_changers) {
new_were(mon); /* change back into human form */
}
/* update innate intrinsics (mainly Drain_resistance) */
set_uasmon(); /* new_were() doesn't do this */
}
int
@@ -118,15 +120,15 @@ register struct monst *mon;
possibly_unwield(mon, FALSE);
}
int were_summon(ptr, yours, visible,
genbuf) /* were-creature (even you) summons a horde */
register struct permonst *ptr;
register boolean yours;
/* were-creature (even you) summons a horde */
int were_summon(ptr, yours, visible, genbuf)
struct permonst *ptr;
boolean yours;
int *visible; /* number of visible helpers created */
char *genbuf;
{
register int i, typ, pm = monsndx(ptr);
register struct monst *mtmp;
int i, typ, pm = monsndx(ptr);
struct monst *mtmp;
int total = 0;
*visible = 0;
@@ -194,11 +196,21 @@ boolean purify;
if (purify) {
You_feel("purified.");
u.ulycn = NON_PM; /* cure lycanthropy */
set_ulycn(NON_PM); /* cure lycanthropy */
}
if (!Unchanging && is_were(youmonst.data)
&& (!controllable_poly || yn("Remain in beast form?") == 'n'))
rehumanize();
}
/* lycanthropy is being caught or cured, but no shape change is involved */
void
set_ulycn(which)
int which;
{
u.ulycn = which;
/* add or remove lycanthrope's innate intrinsics (Drain_resistance) */
set_uasmon();
}
/*were.c*/