From: PatR Date: Sat, 26 Dec 2015 00:46:02 +0000 (-0800) Subject: fix #H4146 - more enlightenment vs drain resistance X-Git-Tag: NetHack-3.6.1_RC01~1114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c80503938330c414907c5ee4356dfa13320ca5e;p=nethack 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. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index c308855e5..0c9ff48a9 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/include/extern.h b/include/extern.h index 4839a9c20..5bfae6080 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 ### */ diff --git a/src/attrib.c b/src/attrib.c index 76a9fc0e7..611456f90 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -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 diff --git a/src/eat.c b/src/eat.c index bea0ccc4c..d041976dd 100644 --- a/src/eat.c +++ b/src/eat.c @@ -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; } diff --git a/src/mhitu.c b/src/mhitu.c index 1e620dc7d..814061ccd 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -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; diff --git a/src/potion.c b/src/potion.c index 2631955b5..c18c560b9 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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); diff --git a/src/were.c b/src/were.c index 7ab1051ba..b9e58dd2b 100644 --- a/src/were.c +++ b/src/were.c @@ -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*/