diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index aacc24dd0..35fb06ae0 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -DT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1220 $ $NHDT-Date: 1689180503 2023/07/12 16:48:23 $ +DT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1222 $ $NHDT-Date: 1689448843 2023/07/15 19:20:43 $ General Fixes and Modified Features ----------------------------------- @@ -1223,6 +1223,8 @@ restore the ability for trap creation via magic which creates pits to destroy 'furniture' allow #sit while flying over a squeaky board trap to trigger it weight of statues of wraiths and of monsters which never leave a corpse was 0 +when a werecreature in human form attacked hero, it could transform to critter + despite hero having the Protection_from_shape_changers_attibute Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/mhitu.c b/src/mhitu.c index fd28433b1..95919276c 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mhitu.c $NHDT-Date: 1625838648 2021/07/09 13:50:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.246 $ */ +/* NetHack 3.7 mhitu.c $NHDT-Date: 1689448844 2023/07/15 19:20:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.301 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -877,16 +877,21 @@ summonmu(struct monst *mtmp, boolean youseeit) } if (is_were(mdat)) { + /* if hero has Protection_from_shape_changers, new_were() will work + in the critter-to-human direction but be a no-op the other way; + we repeat the criteria here for clarity */ if (is_human(mdat)) { /* maybe switch to animal form */ - if (!rn2(5 - (night() * 2))) + if (!Protection_from_shape_changers && !rn2(5 - (night() * 2))) new_were(mtmp); } else { /* maybe switch to back human form */ - if (!rn2(30)) + if (Protection_from_shape_changers || !rn2(30)) new_were(mtmp); } mdat = mtmp->data; /* form change invalidates cached value */ - if (!rn2(10)) { /* maybe summon compatible critters */ + /* maybe summon compatible critters; + not blocked by Protection_from_shape_changers */ + if (!rn2(10)) { int numseen, numhelp; char buf[BUFSZ], genericwere[BUFSZ]; diff --git a/src/were.c b/src/were.c index c888752e0..563225810 100644 --- a/src/were.c +++ b/src/were.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 were.c $NHDT-Date: 1596498227 2020/08/03 23:43:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.25 $ */ +/* NetHack 3.7 were.c $NHDT-Date: 1689448846 2023/07/15 19:20:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.34 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -96,6 +96,12 @@ new_were(struct monst *mon) { int pm; + /* neither hero nor werecreature can change from human form to + critter form if hero has Protection_from_shape_changers extrinsic; + if already in critter form, always change to human form for that */ + if (Protection_from_shape_changers && is_human(mon->data)) + return; + pm = counter_were(monsndx(mon->data)); if (pm < LOW_PM) { impossible("unknown lycanthrope %s.", @@ -106,6 +112,7 @@ new_were(struct monst *mon) if (canseemon(mon) && !Hallucination) pline("%s changes into a %s.", Monnam(mon), is_human(&mons[pm]) ? "human" + /* pmname()+4: skip past "were" prefix */ : pmname(&mons[pm], Mgender(mon)) + 4); set_mon_data(mon, &mons[pm]);