protection enlightenment (trunk only)

Yesterday's change to have enlightenment give "you have a <small,
moderate,&> 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.
This commit is contained in:
nethack.rankin
2006-05-27 01:26:50 +00:00
parent eb9d19497d
commit 3d40afff02

View File

@@ -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 <foo>" (to hit) vs "<bar> 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 */