include rocks as likely candidates for quivering if alternate weapon is a sling
Asmodeus fails an is_armed() check, so code in m_initweap() to give him wands
of fire and cold never got called; move the code to m_initinv()
+#rub would wield the target tool even when already being worn as eyewear
Platform- and/or Interface-Specific Fixes
E boolean NDECL(next_to_u);
E struct obj *FDECL(get_mleash, (struct monst *));
E void FDECL(check_leash, (XCHAR_P,XCHAR_P));
-E boolean FDECL(wield_tool, (struct obj *));
E boolean FDECL(um_dist, (XCHAR_P,XCHAR_P,XCHAR_P));
E boolean FDECL(snuff_candle, (struct obj *));
E boolean FDECL(snuff_lit, (struct obj *));
E int NDECL(dowield);
E int NDECL(doswapweapon);
E int NDECL(dowieldquiver);
-E int NDECL(dotwoweapon);
+E boolean FDECL(wield_tool, (struct obj *,const char *));
E int NDECL(can_twoweapon);
-E void NDECL(untwoweapon);
+E void NDECL(drop_uswapwep);
+E int NDECL(dotwoweapon);
E void NDECL(uwepgone);
E void NDECL(uswapwepgone);
E void NDECL(uqwepgone);
+E void NDECL(untwoweapon);
E void FDECL(erode_obj, (struct obj *,BOOLEAN_P,BOOLEAN_P));
E int FDECL(chwepon, (struct obj *,int));
E int FDECL(welded, (struct obj *));
E void FDECL(weldmsg, (struct obj *));
E void FDECL(setmnotwielded, (struct monst *,struct obj *));
-E void NDECL(drop_uswapwep);
/* ### windows.c ### */
-/* SCCS Id: @(#)apply.c 3.4 2003/01/08 */
+/* SCCS Id: @(#)apply.c 3.4 2003/01/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#endif /* OVL0 */
#ifdef OVLB
-boolean
-wield_tool(obj)
-struct obj *obj;
-{
- if(welded(uwep)) {
- /* Andreas Bormann - ihnp4!decvax!mcvax!unido!ab */
- if(flags.verbose) {
- pline("Since your weapon is welded to your %s,",
- bimanual(uwep) ?
- (const char *)makeplural(body_part(HAND))
- : body_part(HAND));
- pline("you cannot wield that %s.", xname(obj));
- }
- return(FALSE);
- }
- if (cantwield(youmonst.data)) {
- You_cant("hold it strongly enough.");
- return(FALSE);
- }
- /* Check shield */
- if (uarms && bimanual(obj)) {
- You("cannot wield a two-handed tool while wearing a shield.");
- return(FALSE);
- }
- if(uquiver == obj) setuqwep((struct obj *)0);
- if(uswapwep == obj) {
- (void) doswapweapon();
- /* If doswapweapon failed... */
- if(uswapwep == obj) return (FALSE);
- } else {
- You("now wield %s.", doname(obj));
- setuwep(obj);
- }
- if (uwep != obj) return(FALSE); /* rewielded old object after dying */
- /* applying weapon or tool that gets wielded ends two-weapon combat */
- if (u.twoweap)
- untwoweapon();
- if (obj->oclass != WEAPON_CLASS)
- unweapon = TRUE;
- return(TRUE);
-}
-
#define WEAK 3 /* from eat.c */
static const char look_str[] = "look %s.";
}
}
- if(!obj || (obj != uwep && !wield_tool(obj))) return 0;
+ if (!obj || !wield_tool(obj, "rub")) return 0;
/* now uwep is obj */
if (uwep->otyp == MAGIC_LAMP) {
const char *msg_snap = "Snap!";
if (obj != uwep) {
- if (!wield_tool(obj)) return 0;
+ if (!wield_tool(obj, "lash")) return 0;
else res = 1;
- /* prevent bashing msg */
- unweapon = FALSE;
}
if (!getdir((char *)0)) return res;
return (0);
}
if (obj != uwep) {
- if (!wield_tool(obj)) return(0);
+ if (!wield_tool(obj, "swing")) return(0);
else res = 1;
}
/* assert(obj == uwep); */
return (0);
}
if (obj != uwep) {
- if (!wield_tool(obj)) return(0);
+ if (!wield_tool(obj, "cast")) return(0);
else res = 1;
}
/* assert(obj == uwep); */
-/* SCCS Id: @(#)dig.c 3.4 2003/01/08 */
+/* SCCS Id: @(#)dig.c 3.4 2003/01/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* Check tool */
if (obj != uwep) {
- if (!wield_tool(obj)) return(0);
+ if (!wield_tool(obj, "swing")) return 0;
else res = 1;
}
ispick = is_pick(obj);
-/* SCCS Id: @(#)wield.c 3.4 2002/08/03 */
+/* SCCS Id: @(#)wield.c 3.4 2003/01/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return (0);
}
+/* used for #rub and for applying pick-axe, whip, grappling hook, or polearm */
+/* (moved from apply.c) */
+boolean
+wield_tool(obj, verb)
+struct obj *obj;
+const char *verb; /* "rub",&c */
+{
+ const char *what;
+ boolean more_than_1;
+
+ if (obj == uwep) return TRUE; /* nothing to do if already wielding it */
+
+ if (!verb) verb = "wield";
+ what = xname(obj);
+ more_than_1 = (obj->quan > 1L ||
+ strstri(what, "pair of ") != 0 ||
+ strstri(what, "s of ") != 0);
+
+ if (obj->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL)) {
+ char yourbuf[BUFSZ];
+
+ You_cant("%s %s %s while wearing %s.",
+ verb, shk_your(yourbuf, obj), what,
+ more_than_1 ? "them" : "it");
+ return FALSE;
+ }
+ if (welded(uwep)) {
+ if (flags.verbose) {
+ const char *hand = body_part(HAND);
+
+ if (bimanual(uwep)) hand = makeplural(hand);
+ if (strstri(what, "pair of ") != 0) more_than_1 = FALSE;
+ pline(
+ "Since your weapon is welded to your %s, you cannot %s %s %s.",
+ hand, verb, more_than_1 ? "those" : "that", xname(obj));
+ } else {
+ You_cant("do that.");
+ }
+ return FALSE;
+ }
+ if (cantwield(youmonst.data)) {
+ You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
+ return FALSE;
+ }
+ /* check shield */
+ if (uarms && bimanual(obj)) {
+ You("cannot %s a two-handed %s while wearing a shield.",
+ verb, (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
+ return FALSE;
+ }
+ if (uquiver == obj) setuqwep((struct obj *)0);
+ if (uswapwep == obj) {
+ (void) doswapweapon();
+ /* doswapweapon might fail */
+ if (uswapwep == obj) return FALSE;
+ } else {
+ You("now wield %s.", doname(obj));
+ setuwep(obj);
+ }
+ if (uwep != obj) return FALSE; /* rewielded old object after dying */
+ /* applying weapon or tool that gets wielded ends two-weapon combat */
+ if (u.twoweap)
+ untwoweapon();
+ if (obj->oclass != WEAPON_CLASS)
+ unweapon = TRUE;
+ return TRUE;
+}
+
int
can_twoweapon()
{