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

@@ -1622,8 +1622,8 @@ int orc_count;
}
/* 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 */
@@ -1686,4 +1686,17 @@ boolean loseit; /* whether to drop it if hero can longer touch it */
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*/