enlightment for protection and magic cancellation (trunk only)

The bug report about losing/regaining the Protection intrinsic reminded
me of a couple of things.  First, as an intrinsic, Protection seems to be
completely useless and we ought to redo it.  Second, periodically people in
the newsgroup have complained about how it's nearly impossible to figure
out the important--possibly crucial--armor attribute of magic cancellation.
Wearing a cloak greatly increases characters' survival rates, but beyond
that, magic cancellation is just spoiler fodder.

     This doesn't do much about Protection other than to change "you are
protected" into "you have a <small,moderate,&c> defense bonus" similar to
how the attributes conferred by rings of increase damage and increase
accuracy are handled.  For magic cancellation, it adds new feedback:
  You are protected.  -- mc factor 3
  You are guarded.    -- mc factor 2
  You are warded.     -- mc factor 1
(with no extra feedback for mc factor 0, the normal naked state.  The mc 3
case might cause some confusion over the changed meaning of a previously
existing item, but I think it'll be ok and not need re-wording.)
This commit is contained in:
nethack.rankin
2006-05-26 03:31:57 +00:00
parent 949d71e3e0
commit eb9d19497d
2 changed files with 38 additions and 31 deletions
+1
View File
@@ -207,6 +207,7 @@ digging can activate or disarm some types of traps
some monsters can eat tins in addition to corpses to cure some ailments some monsters can eat tins in addition to corpses to cure some ailments
add Roderick Schertler's pickup_thrown patch add Roderick Schertler's pickup_thrown patch
add ability to sort the list when viewing known spells with '+' command add ability to sort the list when viewing known spells with '+' command
describe magic cancellation from worn armor in enlightment/end-of-game feedback
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+37 -31
View File
@@ -985,7 +985,7 @@ char *ps;
putstr(en_win, 0, buf); putstr(en_win, 0, buf);
} }
/* format increased damage or chance to hit */ /* format increased chance to hit or damage or defense (Protection) */
static char * static char *
enlght_combatinc(inctyp, incamt, final, outbuf) enlght_combatinc(inctyp, incamt, final, outbuf)
const char *inctyp; const char *inctyp;
@@ -994,31 +994,30 @@ char *outbuf;
{ {
char numbuf[24]; char numbuf[24];
const char *modif, *bonus; const char *modif, *bonus;
boolean invrt;
int absamt;
if (final absamt = abs(incamt);
#ifdef WIZARD /* Protection amount is typically larger than damage or to-hit;
|| wizard reduce magnitude by a third in order to stretch modifier ranges
#endif (small:1..5, moderate:6..10, large:11..19, huge:20+) */
) { if (!strcmp(inctyp, "defense")) absamt = (absamt * 2) / 3;
Sprintf(numbuf, "%s%d",
(incamt > 0) ? "+" : "", incamt); if (absamt <= 3) modif = "small";
modif = (const char *) numbuf; else if (absamt <= 6) modif = "moderate";
} else { else if (absamt <= 12) modif = "large";
int absamt = abs(incamt); else modif = "huge";
if (absamt <= 3) modif = "small";
else if (absamt <= 6) modif = "moderate";
else if (absamt <= 12) modif = "large";
else modif = "huge";
}
bonus = (incamt > 0) ? "bonus" : "penalty"; bonus = (incamt > 0) ? "bonus" : "penalty";
/* "bonus to hit" vs "damage bonus" */ /* "bonus <foo>" (to hit) vs "<bar> bonus" (damage, defense) */
if (!strcmp(inctyp, "damage")) { invrt = strcmp(inctyp, "to hit") ? TRUE : FALSE;
const char *ctmp = inctyp;
inctyp = bonus; Sprintf(outbuf, "%s %s %s", an(modif),
bonus = ctmp; invrt ? inctyp : bonus, invrt ? bonus : inctyp);
} if (final || wizard)
Sprintf(outbuf, "%s %s %s", an(modif), bonus, inctyp); Sprintf(eos(outbuf), " (%s%d)",
(incamt > 0) ? "+" : "", incamt);
return outbuf; return outbuf;
} }
@@ -1026,7 +1025,7 @@ void
enlightenment(final) enlightenment(final)
int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */
{ {
int ltmp; int ltmp, armpro;
char buf[BUFSZ]; char buf[BUFSZ];
en_win = create_nhwindow(NHW_MENU); en_win = create_nhwindow(NHW_MENU);
@@ -1221,12 +1220,14 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */
} }
/*** Physical attributes ***/ /*** Physical attributes ***/
if (Regeneration)
enl_msg("You regenerate", "", "d", "",from_what(REGENERATION));
if (Slow_digestion)
you_have("slower digestion",from_what(SLOW_DIGESTION));
if (u.uhitinc) if (u.uhitinc)
you_have(enlght_combatinc("to hit", u.uhitinc, final, buf),""); you_have(enlght_combatinc("to hit", u.uhitinc, final, buf),"");
if (u.udaminc) if (u.udaminc)
you_have(enlght_combatinc("damage", u.udaminc, final, buf),""); you_have(enlght_combatinc("damage", u.udaminc, final, buf),"");
if (Slow_digestion) you_have("slower digestion",from_what(SLOW_DIGESTION));
if (Regeneration) enl_msg("You regenerate", "", "d", "",from_what(REGENERATION));
if (u.uspellprot || Protection) { if (u.uspellprot || Protection) {
int prot = 0; int prot = 0;
@@ -1234,11 +1235,16 @@ int final; /* 0 => still in progress; 1 => over, survived; 2 => dead */
if(uright && uright->otyp == RIN_PROTECTION) prot += uright->spe; if(uright && uright->otyp == RIN_PROTECTION) prot += uright->spe;
if (HProtection & INTRINSIC) prot += u.ublessed; if (HProtection & INTRINSIC) prot += u.ublessed;
prot += u.uspellprot; prot += u.uspellprot;
you_have(enlght_combatinc("defense", prot, final, buf), "");
if (prot < 0) }
you_are("ineffectively protected",""); if ((armpro = magic_negation(&youmonst)) > 0) {
else /* magic cancellation factor, conferred by worn armor */
you_are("protected",""); static const char * const mc_types[] = {
"" /*ordinary*/, "warded", "guarded", "protected",
};
/* sanity check */
if (armpro >= SIZE(mc_types)) armpro = SIZE(mc_types) - 1;
you_are(mc_types[armpro],"");
} }
if (Protection_from_shape_changers) if (Protection_from_shape_changers)
you_are("protected from shape changers",""); you_are("protected from shape changers","");