Glib messages when dropping weapons

<Someone> reported that she got "your weapon slips from your hands" when
inflicted with slippery fingers while wielding multiple daggers.  That
should be "weapons" plural and they're only being dropped from one "hand"
singular.  Fix that and also give more specific feedback than "weapon"
for non-swords based on their weapon skill category names.  This works
pretty well for most common weapons but might need some more tweaking for
ones where different types have gotten lumped together in the skills.

old feedback:
  Your weapon slips from your hands.
  Your tool slips from your hands.
  Your food slips from your hands.
twoweapon:
  Your sword slips from your hands.
  Your other sword also slips from your hands.

new feedback:
  Your daggers slip from your hand.
  Your <one-hander> slips from your hand.
  Your <two-hander> slips from your hands.
  Your pick-axe slips from your hand.
  The corpse slips from your hand.
twoweapon:
  Your sword slips from your left hand.
  Your other sword also slips from your right hand.
This commit is contained in:
nethack.rankin
2004-11-02 05:15:33 +00:00
parent a6182d9c2b
commit aa58ee1ab7
4 changed files with 86 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)weapon.c 3.4 2004/06/12 */
/* SCCS Id: @(#)weapon.c 3.4 2004/10/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -101,6 +101,47 @@ static NEARDATA const char kebabable[] = {
S_XORN, S_DRAGON, S_JABBERWOCK, S_NAGA, S_GIANT, '\0'
};
/* weapon's skill category name for use as generalized description of weapon */
const char *weapon_descr(obj)
struct obj *obj;
{
int skill = weapon_type(obj);
const char *descr = P_NAME(skill);
/* assorted special cases */
switch (skill) {
case P_NONE:
/* not a weapon: use item class name; override "food" for corpses */
descr = (obj->otyp == CORPSE) ? "corpse" :
oclass_names[(int)obj->oclass];
break;
case P_SLING:
if (is_ammo(obj))
descr = (obj->otyp == ROCK || is_graystone(obj)) ? "stone" :
/* avoid "rock"; what about known glass? */
(obj->oclass == GEM_CLASS) ? "gem" :
/* in case somebody adds odd sling ammo */
oclass_names[(int)obj->oclass];
break;
case P_BOW:
if (is_ammo(obj)) descr = "arrow";
break;
case P_CROSSBOW:
if (is_ammo(obj)) descr = "bolt";
break;
case P_FLAIL:
if (obj->otyp == GRAPPLING_HOOK) descr = "hook";
break;
case P_PICK_AXE:
/* even if "dwarvish mattock" hasn't been discovered yet */
if (obj->otyp == DWARVISH_MATTOCK) descr = "mattock";
break;
default:
break;
}
return makesingular(descr);
}
/*
* hitval returns an integer representing the "to hit" bonuses
* of "otmp" against the monster.