hats vs horns

Some recent newsgroup discussion claiming that a pet ki-rin was
wearing a helmet (I think poster was hallucinating) caused me to look
at some of the hat handling code.  There were a couple of noticeable
problems and one latent one in code added for 3.4.1.  Polymorphing
into a minotaur pushes hard helmets off hero's head, but nothing
prevented you from putting one right back on.  Helmet wearing monsters
who polymorphed into minotaurs weren't affected at all.  And message
handling always assumed multiple horns even though we have some singled
horned monsters, but since all those have no hands they can't wear any
armor and that potential pluralization issue wasn't noticeable.
This commit is contained in:
nethack.rankin
2003-01-09 01:20:49 +00:00
parent 9988440b2e
commit f52b94336f
6 changed files with 58 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)polyself.c 3.4 2002/07/11 */
/* SCCS Id: @(#)polyself.c 3.4 2003/01/08 */
/* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -617,18 +617,20 @@ break_armor()
#endif
}
if (has_horns(youmonst.data)) {
if ((otmp = uarmh) != 0) {
if (is_flimsy(otmp) && !donning(otmp)) {
char yourbuf[BUFSZ];
/* Future possiblities: This could damage/destroy helmet*/
Your("horns pierce through %s %s.", shk_your(yourbuf, otmp),
xname(otmp));
} else {
if (donning(otmp)) cancel_don();
Your("helmet falls to the %s!", surface(u.ux, u.uy));
(void) Helmet_off();
dropx(otmp);
}
if ((otmp = uarmh) != 0) {
if (is_flimsy(otmp) && !donning(otmp)) {
char hornbuf[BUFSZ], yourbuf[BUFSZ];
/* Future possiblities: This could damage/destroy helmet */
Sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data)));
Your("%s %s through %s %s.", vtense(hornbuf, "pierce"),
shk_your(yourbuf, otmp), xname(otmp));
} else {
if (donning(otmp)) cancel_don();
Your("helmet falls to the %s!", surface(u.ux, u.uy));
(void) Helmet_off();
dropx(otmp);
}
}
}
if (nohands(youmonst.data) || verysmall(youmonst.data)) {