artifacts which subsequently evade your grasp/control after already being
worn or wielded become unworn/unwielded
hero with lycanthropy is vulnerable to silver in human form as well as beast
+changing alignment or shape triggers a check for equipment evading hero's grasp
Platform- and/or Interface-Specific Fixes
E struct obj *FDECL(what_gives, (long *));
E void FDECL(Sting_effects, (int));
E int FDECL(retouch_object, (struct obj **,BOOLEAN_P));
+E void FDECL(retouch_equipment, (int));
/* ### attrib.c ### */
E void FDECL(adjalign, (int));
E int FDECL(is_innate, (int));
E char *FDECL(from_what, (int));
+E void FDECL(uchangealign, (int,int));
/* ### ball.c ### */
}
/* called when hero is wielding/applying/invoking a carried item, or
- after undergoing a transformation (alignment change, lycanthropy)
- which might affect item access */
+ after undergoing a transformation (alignment change, lycanthropy,
+ polymorph) which might affect item access */
int
retouch_object(objp, loseit)
struct obj **objp; /* might be destroyed or unintentionally dropped */
return 0;
}
+void
+retouch_equipment(dropflag)
+int dropflag; /* 0==don't drop, 1==drop all, 2==drop weapon */
+{
+ boolean dropit;
+
+ dropit = (dropflag > 0); /* drop all or drop weapon */
+ /* check secondary weapon first, before possibly unwielding primary */
+ if (u.twoweap) (void)retouch_object(&uswapwep, dropit);
+ /* check primary weapon next so that they're handled together */
+ if (uwep) (void)retouch_object(&uwep, dropit);
+}
+
/*artifact.c*/
-/* SCCS Id: @(#)attrib.c 3.5 2006/05/20 */
+/* SCCS Id: @(#)attrib.c 3.5 2007/03/19 */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
}
}
+/* change hero's alignment type, possibly losing use of artifacts */
+void
+uchangealign(newalign, reason)
+int newalign;
+int reason; /* 0==conversion, 1==helm-of-OA on, 2==helm-of-OA off */
+{
+ aligntyp oldalign = u.ualign.type;
+
+ u.ublessed = 0; /* lose divine protection */
+ context.botl = 1; /* status line needs updating */
+ if (reason == 0) {
+ /* conversion via altar */
+ u.ualignbase[A_CURRENT] = (aligntyp)newalign;
+ /* worn helm of opposite alignment might block change */
+ if (!uarmh || uarmh->otyp != HELM_OF_OPPOSITE_ALIGNMENT)
+ u.ualign.type = u.ualignbase[A_CURRENT];
+ You("have a %ssense of a new direction.",
+ (u.ualign.type != oldalign) ? "sudden " : "");
+ } else {
+ /* putting on or taking off a helm of opposite alignment */
+ u.ualign.type = (aligntyp)newalign;
+ if (reason == 1)
+ Your("mind oscillates %s.", Hallucination ? "wildly" : "briefly");
+ else if (reason == 2)
+ Your("mind is %s.", Hallucination ? "much of a muchness" :
+ "back in sync with your body");
+ }
+
+ if (u.ualign.type != oldalign) retouch_equipment(0);
+}
+
/*attrib.c*/
-/* SCCS Id: @(#)do_wear.c 3.5 2007/02/17 */
+/* SCCS Id: @(#)do_wear.c 3.5 2007/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
makeknown(uarmh->otyp);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
- if (u.ualign.type == A_NEUTRAL)
- u.ualign.type = rn2(2) ? A_CHAOTIC : A_LAWFUL;
- else u.ualign.type = -(u.ualign.type);
- u.ublessed = 0; /* lose your god's protection */
+ /* changing alignment can toggle off active artifact
+ properties, including levitation; uarmh could get
+ dropped or destroyed here */
+ uchangealign((u.ualign.type != A_NEUTRAL) ? -u.ualign.type :
+ rn2(2) ? A_CHAOTIC : A_LAWFUL, 1);
/* makeknown(uarmh->otyp); -- moved below, after xname() */
/*FALLTHRU*/
case DUNCE_CAP:
- if (!uarmh->cursed) {
+ if (uarmh && !uarmh->cursed) {
if (Blind)
pline("%s for a moment.", Tobjnam(uarmh, "vibrate"));
else
context.botl = 1; /* reveal new alignment or INT & WIS */
if (Hallucination) {
pline("My brain hurts!"); /* Monty Python's Flying Circus */
- } else if (uarmh->otyp == DUNCE_CAP) {
+ } else if (uarmh && uarmh->otyp == DUNCE_CAP) {
You_feel("%s.", /* track INT change; ignore WIS */
ACURR(A_INT) <= (ABASE(A_INT) + ABON(A_INT) + ATEMP(A_INT)) ?
"like sitting in a corner" : "giddy");
} else {
- Your("mind oscillates briefly.");
+ /* [message moved to uchangealign()] */
makeknown(HELM_OF_OPPOSITE_ALIGNMENT);
}
break;
if (!context.takeoff.cancelled_don) adj_abon(uarmh, -uarmh->spe);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
- u.ualign.type = u.ualignbase[A_CURRENT];
- u.ublessed = 0; /* lose the other god's protection */
- context.botl = 1;
+ /* changing alignment can toggle off active artifact
+ properties, including levitation; uarmh could get
+ dropped or destroyed here */
+ uchangealign(u.ualignbase[A_CURRENT], 2);
break;
default: impossible(unknown_type, c_helmet, uarmh->otyp);
}
-/* SCCS Id: @(#)eat.c 3.5 2007/02/05 */
+/* SCCS Id: @(#)eat.c 3.5 2007/03/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
}
- if (catch_lycanthropy) {
- if (u.twoweap) (void)retouch_object(&uswapwep, TRUE);
- if (uwep) (void)retouch_object(&uwep, TRUE);
- }
+ if (catch_lycanthropy) retouch_equipment(2);
return;
}
You_feel("feverish.");
exercise(A_CON, FALSE);
u.ulycn = monsndx(mdat);
- if (u.twoweap) (void)retouch_object(&uswapwep, TRUE);
- if (uwep) (void)retouch_object(&uwep, TRUE);
+ retouch_equipment(2);
}
break;
case AD_SGLD:
-/* SCCS Id: @(#)polyself.c 3.5 2007/02/12 */
+/* SCCS Id: @(#)polyself.c 3.5 2007/03/19 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
* Note: the light source handling code assumes that both youmonst.m_id
* and youmonst.mx will always remain 0 when it handles the case of the
* player polymorphed into a light-emitting monster.
+ *
+ * Transformation sequences:
+ * /-> polymon poly into monster form
+ * polyself =
+ * \-> newman -> polyman fail to poly, get human form
+ *
+ * rehumanize -> polyman return to original form
+ *
+ * polymon (called directly) usually golem petrification
*/
#include "hack.h"
Your("body transforms, but there is still slime on you.");
make_slimed(10L, (const char*) 0);
}
+
(void) polysense(youmonst.data);
context.botl = 1;
see_monsters();
(void) encumber_msg();
+
+ retouch_equipment(2);
+ if (!uarmg) selftouch(no_longer_petrify_resistant);
}
void
}
made_change:
- if (!uarmg) selftouch(no_longer_petrify_resistant);
new_light = emits_light(youmonst.data);
if (old_light != new_light) {
if (old_light)
see_monsters();
(void) encumber_msg();
+ retouch_equipment(2);
/* this might trigger a recursize call to polymon() [stone golem
wielding cockatrice corpse and hit by stone-to-flesh, becomes
flesh golem above, now gets transformed back into stone golem] */
killer.format = KILLED_BY;
done(DIED);
}
- if (!uarmg) selftouch(no_longer_petrify_resistant);
nomul(0);
context.botl = 1;
vision_full_recalc = 1;
(void) encumber_msg();
+
+ retouch_equipment(2);
+ if (!uarmg) selftouch(no_longer_petrify_resistant);
}
int
-/* SCCS Id: @(#)pray.c 3.5 2006/08/21 */
+/* SCCS Id: @(#)pray.c 3.5 2007/03/19 */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
consume_offering(otmp);
pline("%s accepts your allegiance.", a_gname());
- /* The player wears a helm of opposite alignment? */
- if (uarmh && uarmh->otyp == HELM_OF_OPPOSITE_ALIGNMENT)
- u.ualignbase[A_CURRENT] = altaralign;
- else
- u.ualign.type = u.ualignbase[A_CURRENT] = altaralign;
- u.ublessed = 0;
- context.botl = 1;
-
- You("have a sudden sense of a new direction.");
+ uchangealign(altaralign, 0);
/* Beware, Conversion is costly */
change_luck(-3);
u.ublesscnt += 300;