new property: BLND_RES

Add enlightenment feedback for Sunsword's blocking of becoming blind
from light flashes.  It uses an extra property so that wizard mode
can report the reason.

EDITLEVEL is being incremented, so existing save and bones files are
invalidated.
This commit is contained in:
PatR
2024-11-26 20:57:11 -08:00
parent 15e70035d0
commit d32ab55b84
9 changed files with 72 additions and 37 deletions

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 109
#define EDITLEVEL 110
/*
* Development status possibilities.

View File

@@ -55,41 +55,42 @@ enum prop_types {
CLAIRVOYANT = 35,
INFRAVISION = 36,
DETECT_MONSTERS = 37,
BLND_RES = 38,
/* Appearance and behavior */
ADORNED = 38,
INVIS = 39,
DISPLACED = 40,
STEALTH = 41,
AGGRAVATE_MONSTER = 42,
CONFLICT = 43,
ADORNED = 39,
INVIS = 40,
DISPLACED = 41,
STEALTH = 42,
AGGRAVATE_MONSTER = 43,
CONFLICT = 44,
/* Transportation */
JUMPING = 44,
TELEPORT = 45,
TELEPORT_CONTROL = 46,
LEVITATION = 47,
FLYING = 48,
WWALKING = 49,
SWIMMING = 50,
MAGICAL_BREATHING = 51,
PASSES_WALLS = 52,
JUMPING = 45,
TELEPORT = 46,
TELEPORT_CONTROL = 47,
LEVITATION = 48,
FLYING = 49,
WWALKING = 50,
SWIMMING = 51,
MAGICAL_BREATHING = 52,
PASSES_WALLS = 53,
/* Physical attributes */
SLOW_DIGESTION = 53,
HALF_SPDAM = 54,
HALF_PHDAM = 55,
REGENERATION = 56,
ENERGY_REGENERATION = 57,
PROTECTION = 58,
PROT_FROM_SHAPE_CHANGERS = 59,
POLYMORPH = 60,
POLYMORPH_CONTROL = 61,
UNCHANGING = 62,
FAST = 63,
REFLECTING = 64,
FREE_ACTION = 65,
FIXED_ABIL = 66,
LIFESAVED = 67
SLOW_DIGESTION = 54,
HALF_SPDAM = 55,
HALF_PHDAM = 56,
REGENERATION = 57,
ENERGY_REGENERATION = 58,
PROTECTION = 59,
PROT_FROM_SHAPE_CHANGERS = 60,
POLYMORPH = 61,
POLYMORPH_CONTROL = 62,
UNCHANGING = 63,
FAST = 64,
REFLECTING = 65,
FREE_ACTION = 66,
FIXED_ABIL = 67,
LIFESAVED = 68,
LAST_PROP = LIFESAVED
};
#define LAST_PROP (LIFESAVED)
/*** Where the properties come from ***/
/* Definitions were moved here from obj.h and you.h */

View File

@@ -156,6 +156,10 @@
#define Blind_telepat (HTelepat || ETelepat)
#define Unblind_telepat (ETelepat)
#define HBlnd_resist u.uprops[BLND_RES].intrinsic /* from form */
#define EBlnd_resist u.uprops[BLND_RES].extrinsic /* wielding Sunsword */
#define Blnd_resist (HBlnd_resist || EBlnd_resist)
#define HWarning u.uprops[WARNING].intrinsic
#define EWarning u.uprops[WARNING].extrinsic
#define Warning (HWarning || EWarning)

View File

@@ -629,7 +629,10 @@ protects(struct obj *otmp, boolean being_worn)
* unworn/unwielded/dropped. Pickup/drop only set/reset the W_ART mask.
*/
void
set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
set_artifact_intrinsic(
struct obj *otmp,
boolean on,
long wp_mask)
{
long *mask = 0;
const struct artifact *art, *oart = get_artifact(otmp);
@@ -796,6 +799,13 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
&& (u.uprops[oart->inv_prop].extrinsic & W_ARTI))
(void) arti_invoke(otmp);
}
if (wp_mask == W_WEP && is_art(otmp, ART_SUNSWORD)) {
if (on)
EBlnd_resist |= wp_mask;
else
EBlnd_resist &= ~wp_mask;
}
}
/* touch_artifact()'s return value isn't sufficient to tell whether it
@@ -2210,6 +2220,10 @@ what_gives(long *abil)
if ((art->spfx & spfx) == spfx && obj->owornmask)
return obj;
}
if (obj == uwep && abil == &EBlnd_resist
&& (*abil & W_WEP) != 0L) {
return obj; /* Sunsword */
}
}
} else {
if (wornbits && wornbits == (wornmask & obj->owornmask))

View File

@@ -889,7 +889,8 @@ is_innate(int propidx)
ignore innateness if equipment is going to claim responsibility */
&& !u.uprops[propidx].extrinsic)
return FROM_ROLE;
if (propidx == BLINDED && !haseyes(gy.youmonst.data))
if ((propidx == BLINDED && !haseyes(gy.youmonst.data))
|| (propidx == BLND_RES && (HBlnd_resist & FROMFORM) != 0))
return FROM_FORM;
return FROM_NONE;
}
@@ -897,7 +898,8 @@ is_innate(int propidx)
DISABLE_WARNING_FORMAT_NONLITERAL
char *
from_what(int propidx) /* special cases can have negative values */
from_what(
int propidx) /* special cases can have negative values */
{
static char buf[BUFSZ];
@@ -939,7 +941,7 @@ from_what(int propidx) /* special cases can have negative values */
else if (innateness == FROM_LYCN)
Strcpy(buf, " due to your lycanthropy");
else if (innateness == FROM_FORM)
Strcpy(buf, " from current creature form");
Strcpy(buf, " from your creature form");
else if (propidx == FAST && Very_fast)
Sprintf(buf, because_of,
((HFast & TIMEOUT) != 0L) ? "a potion or spell"

View File

@@ -1533,6 +1533,9 @@ attributes_enlightenment(
/*** Vision and senses ***/
if ((HBlinded || EBlinded) && BBlinded) /* blind w/ blindness blocked */
you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
if (Blnd_resist && !Blind) /* skip if no eyes or blindfolded */
you_are("not subject to light-induced blindness",
from_what(BLND_RES));
if (See_invisible) {
if (!Blind)
enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS));

View File

@@ -187,7 +187,15 @@ resists_blnd(struct monst *mon)
if (dmgtype_fromattack(ptr, AD_BLND, AT_EXPL)
|| dmgtype_fromattack(ptr, AD_BLND, AT_GAZE))
return TRUE;
return resists_blnd_by_arti(mon);
/* Sunsword */
if (resists_blnd_by_arti(mon))
return TRUE;
/* catchall */
if (is_you && Blnd_resist) {
impossible("'Blnd_resist' but not resists_blnd()?");
return TRUE;
}
return FALSE;
}
/* True iff monster is resistant to light-induced blindness due to worn

View File

@@ -103,6 +103,8 @@ set_uasmon(void)
PROPSET(REGENERATION, regenerates(mdat));
PROPSET(REFLECTING, (mdat == &mons[PM_SILVER_DRAGON]));
PROPSET(BLINDED, !haseyes(mdat));
PROPSET(BLND_RES, (dmgtype_fromattack(mdat, AD_BLND, AT_EXPL)
|| dmgtype_fromattack(mdat, AD_BLND, AT_GAZE)));
#undef PROPSET
/* whether the player is flying/floating depends on their steed,

View File

@@ -79,6 +79,7 @@ static const struct propname {
{ SICK_RES, "sickness resistance" },
{ ANTIMAGIC, "magic resistance" },
{ HALLUC_RES, "hallucination resistance" },
{ BLND_RES, "light-induced blindness resistance" },
{ FUMBLING, "fumbling" },
{ HUNGER, "voracious hunger" },
{ TELEPAT, "telepathic" },