fix github issue #1082 - Prot from shape changers
vs lycanthropes Issue reported by Umbire: when hero had Protection_from_shape_changers extrinsic, a lycanthrope in human form that attacked could change into critter form. It would change back to human on its next move. Prevent werecreatures from transforming from human form to critter form if hero has Protection_from_shape_changers. That attribute does not prevent a human werecreature from summoning animal companions. Fixes #1082
This commit is contained in:
13
src/mhitu.c
13
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];
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user