worn gear after polymorph alignment change [1 of 2] (trunk only)

Make polymorphing or changing alignment perform a touch check (as is
done when catching lycanthropy) on wielded weapon(s) to see whether the
hero can still use them in his new form.  Part [2 of 2] will update
retouch_equipment() to check all items in use rather than just weapon(s).
(A comment or two in part 1 already refers to expected behavior of part 2.)
This commit is contained in:
nethack.rankin
2007-03-20 03:58:27 +00:00
parent b410a0e514
commit c86f9ff008
9 changed files with 86 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
/* 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. */
@@ -316,14 +316,15 @@ Helmet_on(VOID_ARGS)
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
@@ -334,12 +335,12 @@ Helmet_on(VOID_ARGS)
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;
@@ -379,9 +380,10 @@ Helmet_off(VOID_ARGS)
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);
}