tweak levitation timeout if trap is being triggered on same turn it is to end
if Rider corpse revival fails, usually try again later instead of rotting away
worn item transformed by polymorph remains worn if feasible
+can't dip or apply grease to a worn item that's covered by another worn item
Platform- and/or Interface-Specific Fixes
E int NDECL(doddoremarm);
E int FDECL(destroy_arm, (struct obj *));
E void FDECL(adj_abon, (struct obj *,SCHAR_P));
+E boolean FDECL(inaccessible_equipment, (struct obj *,const char *,BOOLEAN_P));
/* ### dog.c ### */
-/* SCCS Id: @(#)apply.c 3.5 2006/10/21 */
+/* SCCS Id: @(#)apply.c 3.5 2006/11/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
}
static NEARDATA const char lubricables[] = { ALL_CLASSES, ALLOW_NONE, 0 };
-static NEARDATA const char need_to_remove_outer_armor[] =
- "need to remove %s to grease %s.";
STATIC_OVL void
use_grease(obj)
struct obj *obj;
{
struct obj *otmp;
- char buf[BUFSZ];
if (Glib) {
pline("%s from your %s.", Tobjnam(obj, "slip"),
}
otmp = getobj(lubricables, "grease");
if (!otmp) return;
- if ((otmp->owornmask & WORN_ARMOR) && uarmc) {
- Strcpy(buf, yname(uarmc));
- You(need_to_remove_outer_armor, buf, yname(otmp));
- return;
- }
-#ifdef TOURIST
- if ((otmp->owornmask & WORN_SHIRT) && (uarmc || uarm)) {
- Strcpy(buf, uarmc ? yname(uarmc) : "");
- if (uarmc && uarm)
- Strcat(strcat(buf, " and "), xname(uarm));
- else Strcat(buf, uarm ? yname(uarm) : "");
- You(need_to_remove_outer_armor, buf, yname(otmp));
- return;
- }
-#endif
+ if (inaccessible_equipment(otmp, "grease", FALSE)) return;
consume_obj_charge(obj, TRUE);
if (otmp != &zeroobj) {
}
}
+/* decide whether a worn item is covered up by some other worn item,
+ used for dipping into liquid and applying grease;
+ some criteria are different than select_off()'s */
+boolean
+inaccessible_equipment(obj, verb, only_if_cursed)
+struct obj *obj;
+const char *verb; /* "dip" or "grease", or null to avoid messages */
+boolean only_if_cursed; /* true => ignore non-cursed covering gear */
+{
+ static NEARDATA const char need_to_take_off_outer_armor[] =
+ "need to take off %s to %s %s.";
+ char buf[BUFSZ];
+
+ if (!obj || !obj->owornmask) return FALSE; /* not inaccessible */
+
+ /* check for suit covered by cloak */
+ if (obj == uarm && uarmc && (uarmc->cursed || !only_if_cursed)) {
+ if (verb) {
+ Strcpy(buf, yname(uarmc));
+ You(need_to_take_off_outer_armor, buf, verb, yname(obj));
+ }
+ return TRUE;
+ }
+#ifdef TOURIST
+ /* check for shirt covered by suit and/or cloak */
+ if (obj == uarmu && ((uarm && (uarm->cursed || !only_if_cursed)) ||
+ (uarmc && (uarmc->cursed || !only_if_cursed)))) {
+ if (verb) {
+ char cloaktmp[QBUFSZ], suittmp[QBUFSZ];
+ /* if sameprefix, use yname and xname to get "your cloak and suit"
+ or "Manlobbi's cloak and suit"; otherwise, use yname and yname
+ to get "your cloak and Manlobbi's suit" or vice versa */
+ boolean sameprefix = (uarm && uarmc &&
+ !strcmp(shk_your(cloaktmp, uarmc),
+ shk_your(suittmp, uarm)));
+
+ *buf = '\0';
+ if (uarmc) Strcat(buf, yname(uarmc));
+ if (uarm && uarmc) Strcat(buf, " and ");
+ if (uarm) Strcat(buf, sameprefix ? xname(uarm) : yname(uarm));
+ You(need_to_take_off_outer_armor, buf, verb, yname(obj));
+ }
+ return TRUE;
+ }
+#endif
+ /* check for ring covered by gloves */
+ if ((obj == uleft || obj == uright) &&
+ uarmg && (uarmg->cursed || !only_if_cursed)) {
+ if (verb) {
+ Strcpy(buf, yname(uarmg));
+ You(need_to_take_off_outer_armor, buf, verb, yname(obj));
+ }
+ return TRUE;
+ }
+ /* item is not inaccessible */
+ return FALSE;
+}
+
/*do_wear.c*/
-/* SCCS Id: @(#)invent.c 3.5 2006/07/08 */
+/* SCCS Id: @(#)invent.c 3.5 2006/11/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* ugly check: remove inappropriate things */
if ((taking_off(word) &&
(!(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))
- || (otmp==uarm && uarmc)
-#ifdef TOURIST
- || (otmp==uarmu && (uarm || uarmc))
-#endif
- ))
+ || inaccessible_equipment(otmp, (const char *)0, FALSE)))
|| (putting_on(word) &&
(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)))
/* already worn */
#endif
|| (!strcmp(word, "ready") &&
(otmp == uwep || (otmp == uswapwep && u.twoweap)))
+ || ((!strcmp(word, "dip") || !strcmp(word, "grease")) &&
+ inaccessible_equipment(otmp, (const char *)0 , FALSE))
) {
foo--;
foox++;
-/* SCCS Id: @(#)potion.c 3.5 2006/08/18 */
+/* SCCS Id: @(#)potion.c 3.5 2006/11/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
allowall[0] = ALL_CLASSES; allowall[1] = '\0';
if(!(obj = getobj(allowall, "dip")))
return(0);
+ if (inaccessible_equipment(obj, "dip", FALSE)) return 0;
here = levl[u.ux][u.uy].typ;
/* Is there a fountain to dip into here? */