E void FDECL(zapnodir, (struct obj *));
E int NDECL(dozap);
E int FDECL(zapyourself, (struct obj *,BOOLEAN_P));
-E void FDECL(cancel_monst, (struct monst *,struct obj *,
- BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
+E boolean FDECL(cancel_monst, (struct monst *,struct obj *,
+ BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
E void FDECL(weffects, (struct obj *));
E int NDECL(spell_damage_bonus);
E const char *FDECL(exclam, (int force));
-/* SCCS Id: @(#)objnam.c 3.4 2002/09/21 */
+/* SCCS Id: @(#)objnam.c 3.4 2003/02/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
return buf;
}
+/* various singular words that vtense would otherwise categorize as plural */
+static const char * const special_subjs[] = {
+ "erinys",
+ "manes", /* this one is ambiguous */
+ "Cyclops",
+ "Hippocrates",
+ "Pelias",
+ "aklys",
+ "amnesia",
+ "paralysis",
+ 0
+};
+
/* return form of the verb (input plural) for present tense 3rd person subj */
char *
vtense(subj, verb)
{
char *buf = nextobuf();
int len;
- const char *spot;
- const char *sp;
+ const char *sp, *spot;
+ const char * const *spec;
/*
* verb is given in plural (without trailing s). Return as input
spot = (const char *)0;
for (sp = subj; (sp = index(sp, ' ')) != 0; ++sp) {
if (!strncmp(sp, " of ", 4) ||
+ !strncmp(sp, " from ", 6) ||
!strncmp(sp, " called ", 8) ||
!strncmp(sp, " named ", 7) ||
!strncmp(sp, " labeled ", 9)) {
break;
}
}
- len = strlen(subj);
+ len = (int) strlen(subj);
if (!spot) spot = subj + len - 1;
/*
((spot - subj) >= 3 && !strncmp(spot-3, "feet", 4)) ||
((spot - subj) >= 2 && !strncmp(spot-1, "ia", 2)) ||
((spot - subj) >= 2 && !strncmp(spot-1, "ae", 2))) {
- Strcpy(buf, verb);
- return buf;
+ /* check for special cases to avoid false matches */
+ len = (int)(spot - subj) + 1;
+ for (spec = special_subjs; *spec; spec++)
+ if (!strncmpi(*spec, subj, len)) goto sing;
+
+ return strcpy(buf, verb);
}
+ /*
+ * 2nd person singular behaves as if plural.
+ */
+ if (!strcmpi(subj, "you")) return strcpy(buf, verb);
}
+ sing:
len = strlen(verb);
spot = verb + len - 1;
-/* SCCS Id: @(#)zap.c 3.4 2003/01/08 */
+/* SCCS Id: @(#)zap.c 3.4 2003/02/08 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
break;
case WAN_CANCELLATION:
case SPE_CANCELLATION:
- cancel_monst(mtmp, otmp, TRUE, TRUE, FALSE);
+ (void) cancel_monst(mtmp, otmp, TRUE, TRUE, FALSE);
break;
case WAN_TELEPORTATION:
case SPE_TELEPORT_AWAY:
case WAN_CANCELLATION:
case SPE_CANCELLATION:
- cancel_monst(&youmonst, obj, TRUE, FALSE, TRUE);
+ (void) cancel_monst(&youmonst, obj, TRUE, FALSE, TRUE);
break;
case SPE_DRAIN_LIFE:
* effect is too strong. currently non-hero monsters do not zap
* themselves with cancellation.
*/
-void
+boolean
cancel_monst(mdef, obj, youattack, allow_cancel_kill, self_cancel)
register struct monst *mdef;
register struct obj *obj;
if (youdefend ? (!youattack && Antimagic)
: resist(mdef, obj->oclass, 0, NOTELL))
- return; /* resisted cancellation */
+ return FALSE; /* resisted cancellation */
if (self_cancel) { /* 1st cancel inventory */
struct obj *otmp;
}
}
}
+ return TRUE;
}
/* you've zapped an immediate type wand up or down */
/* attack level */
switch (oclass) {
case WAND_CLASS: alev = 12; break;
- case TOOL_CLASS: alev = 10; break;
+ case TOOL_CLASS: alev = 10; break; /* instrument */
+ case WEAPON_CLASS: alev = 10; break; /* artifact */
case SCROLL_CLASS: alev = 9; break;
case POTION_CLASS: alev = 6; break;
case RING_CLASS: alev = 5; break;
- default: alev = u.ulevel; break; /* spell */
+ default: alev = u.ulevel; break; /* spell */
}
/* defense level */
dlev = (int)mtmp->m_lev;