enlightenment about temp resist and item resist
For timed acid resistance and timed stoning resistance, report
"You {are,were} temporarily {acid,petrification} resistant."
For items being protected by worn equipment, add "by your {armor,&c}"
similar to the existing feeback about you being protected "because
<some-reason>". Wizard mode only.
This commit is contained in:
@@ -3306,6 +3306,7 @@ extern int zap_over_floor(xchar, xchar, int, boolean *, short);
|
|||||||
extern void fracture_rock(struct obj *);
|
extern void fracture_rock(struct obj *);
|
||||||
extern boolean break_statue(struct obj *);
|
extern boolean break_statue(struct obj *);
|
||||||
extern boolean u_adtyp_resistance_obj(int);
|
extern boolean u_adtyp_resistance_obj(int);
|
||||||
|
extern char *item_what(int);
|
||||||
extern void destroy_item(int, int);
|
extern void destroy_item(int, int);
|
||||||
extern int destroy_mitem(struct monst *, int, int);
|
extern int destroy_mitem(struct monst *, int, int);
|
||||||
extern int resist(struct monst *, char, int, int);
|
extern int resist(struct monst *, char, int, int);
|
||||||
|
|||||||
+24
-11
@@ -1402,8 +1402,8 @@ weapon_insight(int final)
|
|||||||
static void
|
static void
|
||||||
attributes_enlightenment(int unused_mode UNUSED, int final)
|
attributes_enlightenment(int unused_mode UNUSED, int final)
|
||||||
{
|
{
|
||||||
static NEARDATA const char if_surroundings_permitted[] =
|
static NEARDATA const char
|
||||||
" if surroundings permitted";
|
if_surroundings_permitted[] = " if surroundings permitted";
|
||||||
int ltmp, armpro;
|
int ltmp, armpro;
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
|
|
||||||
@@ -1439,33 +1439,46 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
|
|||||||
if (Fire_resistance)
|
if (Fire_resistance)
|
||||||
you_are("fire resistant", from_what(FIRE_RES));
|
you_are("fire resistant", from_what(FIRE_RES));
|
||||||
if (u_adtyp_resistance_obj(AD_FIRE))
|
if (u_adtyp_resistance_obj(AD_FIRE))
|
||||||
enl_msg("Your items ", "are", "were", " protected from fire", "");
|
enl_msg("Your items ", "are", "were", " protected from fire",
|
||||||
|
item_what(AD_FIRE));
|
||||||
if (Cold_resistance)
|
if (Cold_resistance)
|
||||||
you_are("cold resistant", from_what(COLD_RES));
|
you_are("cold resistant", from_what(COLD_RES));
|
||||||
if (u_adtyp_resistance_obj(AD_COLD))
|
if (u_adtyp_resistance_obj(AD_COLD))
|
||||||
enl_msg("Your items ", "are", "were", " protected from cold", "");
|
enl_msg("Your items ", "are", "were", " protected from cold",
|
||||||
|
item_what(AD_COLD));
|
||||||
if (Sleep_resistance)
|
if (Sleep_resistance)
|
||||||
you_are("sleep resistant", from_what(SLEEP_RES));
|
you_are("sleep resistant", from_what(SLEEP_RES));
|
||||||
if (Disint_resistance)
|
if (Disint_resistance)
|
||||||
you_are("disintegration-resistant", from_what(DISINT_RES));
|
you_are("disintegration-resistant", from_what(DISINT_RES));
|
||||||
if (u_adtyp_resistance_obj(AD_DISN))
|
if (u_adtyp_resistance_obj(AD_DISN))
|
||||||
enl_msg("Your items ", "are", "were", " protected from disintegration", "");
|
enl_msg("Your items ", "are", "were",
|
||||||
|
" protected from disintegration", item_what(AD_DISN));
|
||||||
if (Shock_resistance)
|
if (Shock_resistance)
|
||||||
you_are("shock resistant", from_what(SHOCK_RES));
|
you_are("shock resistant", from_what(SHOCK_RES));
|
||||||
if (u_adtyp_resistance_obj(AD_ELEC))
|
if (u_adtyp_resistance_obj(AD_ELEC))
|
||||||
enl_msg("Your items ", "are", "were", " protected from electric shocks", "");
|
enl_msg("Your items ", "are", "were",
|
||||||
|
" protected from electric shocks", item_what(AD_ELEC));
|
||||||
if (Poison_resistance)
|
if (Poison_resistance)
|
||||||
you_are("poison resistant", from_what(POISON_RES));
|
you_are("poison resistant", from_what(POISON_RES));
|
||||||
if (Acid_resistance)
|
if (Acid_resistance) {
|
||||||
you_are("acid resistant", from_what(ACID_RES));
|
Sprintf(buf, "%.20s%.30s",
|
||||||
|
temp_resist(ACID_RES) ? "temporarily " : "",
|
||||||
|
"acid resistant");
|
||||||
|
you_are(buf, from_what(ACID_RES));
|
||||||
|
}
|
||||||
if (u_adtyp_resistance_obj(AD_ACID))
|
if (u_adtyp_resistance_obj(AD_ACID))
|
||||||
enl_msg("Your items ", "are", "were", " protected from acid", "");
|
enl_msg("Your items ", "are", "were", " protected from acid",
|
||||||
|
item_what(AD_ACID));
|
||||||
if (Drain_resistance)
|
if (Drain_resistance)
|
||||||
you_are("level-drain resistant", from_what(DRAIN_RES));
|
you_are("level-drain resistant", from_what(DRAIN_RES));
|
||||||
if (Sick_resistance)
|
if (Sick_resistance)
|
||||||
you_are("immune to sickness", from_what(SICK_RES));
|
you_are("immune to sickness", from_what(SICK_RES));
|
||||||
if (Stone_resistance)
|
if (Stone_resistance) {
|
||||||
you_are("petrification resistant", from_what(STONE_RES));
|
Sprintf(buf, "%.20s%.30s",
|
||||||
|
temp_resist(STONE_RES) ? "temporarily " : "",
|
||||||
|
"petrification resistant");
|
||||||
|
you_are(buf, from_what(STONE_RES));
|
||||||
|
}
|
||||||
if (Halluc_resistance)
|
if (Halluc_resistance)
|
||||||
enl_msg(You_, "resist", "resisted", " hallucinations",
|
enl_msg(You_, "resist", "resisted", " hallucinations",
|
||||||
from_what(HALLUC_RES));
|
from_what(HALLUC_RES));
|
||||||
|
|||||||
@@ -5014,13 +5014,20 @@ static int
|
|||||||
adtyp_to_prop(int dmgtyp)
|
adtyp_to_prop(int dmgtyp)
|
||||||
{
|
{
|
||||||
switch (dmgtyp) {
|
switch (dmgtyp) {
|
||||||
case AD_COLD: return COLD_RES;
|
case AD_COLD:
|
||||||
case AD_FIRE: return FIRE_RES;
|
return COLD_RES;
|
||||||
case AD_ELEC: return SHOCK_RES;
|
case AD_FIRE:
|
||||||
case AD_ACID: return ACID_RES;
|
return FIRE_RES;
|
||||||
case AD_DISN: return DISINT_RES;
|
case AD_ELEC:
|
||||||
default: return 0; /* prop_types start at 1 */
|
return SHOCK_RES;
|
||||||
|
case AD_ACID:
|
||||||
|
return ACID_RES;
|
||||||
|
case AD_DISN:
|
||||||
|
return DISINT_RES;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
return 0; /* prop_types start at 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is hero wearing or wielding an object with resistance
|
/* is hero wearing or wielding an object with resistance
|
||||||
@@ -5039,6 +5046,51 @@ u_adtyp_resistance_obj(int dmgtyp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* for enlightenment; currently only useful in wizard mode; cf from_what() */
|
||||||
|
char *
|
||||||
|
item_what(int dmgtyp)
|
||||||
|
{
|
||||||
|
static char whatbuf[50];
|
||||||
|
const char *what = 0;
|
||||||
|
int prop = adtyp_to_prop(dmgtyp);
|
||||||
|
long xtrinsic = u.uprops[prop].extrinsic;
|
||||||
|
|
||||||
|
whatbuf[0] = '\0';
|
||||||
|
if (wizard) {
|
||||||
|
if (!prop || !xtrinsic) {
|
||||||
|
; /* 'what' stays Null */
|
||||||
|
} else if (xtrinsic & W_ARMC) {
|
||||||
|
what = cloak_simple_name(uarmc);
|
||||||
|
} else if (xtrinsic & W_ARM) {
|
||||||
|
what = suit_simple_name(uarm); /* "dragon {scales,mail}" */
|
||||||
|
} else if (xtrinsic & W_ARMU) {
|
||||||
|
what = shirt_simple_name(uarmu);
|
||||||
|
} else if (xtrinsic & W_ARMH) {
|
||||||
|
what = helm_simple_name(uarmh);
|
||||||
|
} else if (xtrinsic & W_ARMG) {
|
||||||
|
what = gloves_simple_name(uarmg);
|
||||||
|
} else if (xtrinsic & W_ARMF) {
|
||||||
|
what = boots_simple_name(uarmf);
|
||||||
|
} else if (xtrinsic & W_ARMS) {
|
||||||
|
what = shield_simple_name(uarms);
|
||||||
|
} else if (xtrinsic & (W_AMUL | W_TOOL)) {
|
||||||
|
what = simpleonames((xtrinsic & W_AMUL) ? uamul : ublindf);
|
||||||
|
} else if (xtrinsic & W_RING) {
|
||||||
|
if ((xtrinsic & W_RING) == W_RING) /* both */
|
||||||
|
what = "rings";
|
||||||
|
else
|
||||||
|
what = simpleonames((xtrinsic & W_RINGL) ? uleft : uright);
|
||||||
|
} else if (xtrinsic & W_WEP) {
|
||||||
|
what = simpleonames(uwep);
|
||||||
|
}
|
||||||
|
/* format the output to be ready for enl_msg() to append it to
|
||||||
|
"Your items {are,were} protected against <damage-type>" */
|
||||||
|
if (what) /* strlen(what) will be less than 30 */
|
||||||
|
Sprintf(whatbuf, " by your %.40s", what);
|
||||||
|
}
|
||||||
|
return whatbuf;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* destroy_strings[dindx][0:singular,1:plural,2:killer_reason]
|
* destroy_strings[dindx][0:singular,1:plural,2:killer_reason]
|
||||||
* [0] freezing potion
|
* [0] freezing potion
|
||||||
|
|||||||
Reference in New Issue
Block a user