From 3d40afff023d02335fdbad9326c26e2bc5faf51f Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sat, 27 May 2006 01:26:50 +0000 Subject: [PATCH] protection enlightenment (trunk only) Yesterday's change to have enlightenment give "you have a defense bonus" instead of "you are protected" would yield "you have a small defense penalty" if the combined protection value (from rings, divine gift, and spell) was 0. This changes the formatting routine to give "you have no defense bonus" in that situation, then changes the caller to only display the protection/defense attribute when non-zero so the "no bonus" case will never actually happen. --- src/cmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 2388a0421..23ddcba6f 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1008,11 +1008,12 @@ char *outbuf; else if (absamt <= 12) modif = "large"; else modif = "huge"; - bonus = (incamt > 0) ? "bonus" : "penalty"; + modif = !incamt ? "no" : an(modif); /* ("no" case shouldn't happen) */ + bonus = (incamt >= 0) ? "bonus" : "penalty"; /* "bonus " (to hit) vs " bonus" (damage, defense) */ invrt = strcmp(inctyp, "to hit") ? TRUE : FALSE; - Sprintf(outbuf, "%s %s %s", an(modif), + Sprintf(outbuf, "%s %s %s", modif, invrt ? inctyp : bonus, invrt ? bonus : inctyp); if (final || wizard) Sprintf(eos(outbuf), " (%s%d)", @@ -1235,7 +1236,8 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ if(uright && uright->otyp == RIN_PROTECTION) prot += uright->spe; if (HProtection & INTRINSIC) prot += u.ublessed; prot += u.uspellprot; - you_have(enlght_combatinc("defense", prot, final, buf), ""); + if (prot) + you_have(enlght_combatinc("defense", prot, final, buf), ""); } if ((armpro = magic_negation(&youmonst)) > 0) { /* magic cancellation factor, conferred by worn armor */ -- 2.40.0