blindness overhaul
I was working on this at the time 3.6.0 was released and set it aside until later. Later has finally arrived. Redo the Blind, Blinded, Blindfolded,&c macros to make more complete use of intrinsic property handling. Blinded was being treated as a number which could be added to or subtracted from; now that has to be done via TIMEOUT mask because it has FROMOUTSIDE (OPTIONS:blind) and FROMFORM (poly'd into !haseyes() form) bits included. Object definitions for blindfold and towel now specify the BLINDED property; overriding blindness via the Eyes of the Overworld is accomplished via props[BLINDED].blocked. Code generated for the scores of Blind and !Blind tests throughout the program should be smaller. One bug that has been fixed is that putting on the Eyes of the Overworld cured permanent blindness (from OPTIONS:blind). The u.uroleplay.blind flag was cleared and stayed so after taking them off. Putting the Eyes on still breaks blind-from-birth conduct but now blindness will resume when they are removed. This was untested at the time it was set aside and is only lightly tested now. A large number of the changes here are just to switch from Blinded to BlindedTimeout for current timed value and to call set_itimeout() for setting a new value.
This commit is contained in:
@@ -850,10 +850,16 @@ MARKER(LAST_AMULET, AMULET_OF_YENDOR)
|
||||
OBJECT(OBJ(name, desc), \
|
||||
BITS(kn, 0, chg, 1, mgc, chg, 0, 0, 0, 0, 0, P_NONE, mat), \
|
||||
0, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn)
|
||||
#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,sub,mat,clr,sn)\
|
||||
#define EYEWEAR(name,desc,kn,prop,prob,wt,cost,mat,color,sn) \
|
||||
OBJECT(OBJ(name, desc), \
|
||||
BITS(kn, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, mat), \
|
||||
prop, TOOL_CLASS, prob, 0, wt, cost, 0, 0, 0, 0, wt, color, sn)
|
||||
#define WEPTOOL(name,desc,kn,mgc,bi,prob,wt,cost,sdam,ldam,hitbon,sub, \
|
||||
mat,clr,sn) \
|
||||
OBJECT(OBJ(name, desc), \
|
||||
BITS(kn, 0, 1, 0, mgc, 1, 0, 0, bi, 0, hitbon, sub, mat), \
|
||||
0, TOOL_CLASS, prob, 0, wt, cost, sdam, ldam, hitbon, 0, wt, clr, sn)
|
||||
0, TOOL_CLASS, prob, 0, wt, cost, sdam, ldam, hitbon, 0, wt, \
|
||||
clr, sn)
|
||||
/* containers */
|
||||
CONTAINER("large box", NoDes, 1, 0, 0, 40, 350, 8, WOOD, HI_WOOD,
|
||||
LARGE_BOX),
|
||||
@@ -891,17 +897,24 @@ TOOL("magic lamp", "lamp", 0, 0, 1, 0, 15, 20, 50, COPPER, CLR_YELLOW,
|
||||
MAGIC_LAMP),
|
||||
/* other tools */
|
||||
TOOL("expensive camera", NoDes, 1, 0, 0, 1, 15, 12,200, PLASTIC, CLR_BLACK,
|
||||
EXPENSIVE_CAMERA),
|
||||
EXPENSIVE_CAMERA),
|
||||
TOOL("mirror", "looking glass", 0, 0, 0, 0, 45, 13, 10, GLASS, HI_SILVER,
|
||||
MIRROR),
|
||||
TOOL("crystal ball", "glass orb", 0, 0, 1, 1, 15,150, 60, GLASS, HI_GLASS,
|
||||
CRYSTAL_BALL),
|
||||
TOOL("lenses", NoDes, 1, 0, 0, 0, 5, 3, 80, GLASS, HI_GLASS,
|
||||
/* eyewear - tools which can be worn on the face; (!mrg, !chg, !mgc)
|
||||
worn lenses don't confer the Blinded property, blindfolds and towels do;
|
||||
wet towel can be used as a weapon but is not a weptool and uses obj->spe
|
||||
differently from weapons and weptools */
|
||||
EYEWEAR("lenses", NoDes, 1, 0, 5, 3, 80, GLASS, HI_GLASS,
|
||||
LENSES),
|
||||
TOOL("blindfold", NoDes, 1, 0, 0, 0, 50, 2, 20, CLOTH, CLR_BLACK,
|
||||
EYEWEAR("blindfold", NoDes, 1, BLINDED, 50, 2, 20, CLOTH, CLR_BLACK,
|
||||
BLINDFOLD),
|
||||
TOOL("towel", NoDes, 1, 0, 0, 0, 50, 5, 50, CLOTH, CLR_MAGENTA,
|
||||
EYEWEAR("towel", NoDes, 1, BLINDED, 50, 2, 50, CLOTH, CLR_MAGENTA,
|
||||
TOWEL),
|
||||
#undef EYEWEAR
|
||||
|
||||
/* still other tools */
|
||||
TOOL("saddle", NoDes, 1, 0, 0, 0, 5,200,150, LEATHER, HI_LEATHER,
|
||||
SADDLE),
|
||||
TOOL("leash", NoDes, 1, 0, 0, 0, 65, 12, 20, LEATHER, HI_LEATHER,
|
||||
@@ -1540,7 +1553,7 @@ ROCK("luckstone", "gray", 0, 10, 10, 60, 3, 3, 1, 10, 7, MINERAL, CLR_GRAY,
|
||||
ROCK("loadstone", "gray", 0, 10, 500, 1, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY,
|
||||
LOADSTONE),
|
||||
ROCK("touchstone", "gray", 0, 8, 10, 45, 3, 3, 1, 10, 6, MINERAL, CLR_GRAY,
|
||||
TOUCHSTONE),
|
||||
TOUCHSTONE),
|
||||
ROCK("flint", "gray", 0, 10, 10, 1, 6, 6, 0, 10, 7, MINERAL, CLR_GRAY,
|
||||
FLINT),
|
||||
ROCK("rock", NoDes, 1, 100, 10, 0, 3, 3, 0, 10, 7, MINERAL, CLR_GRAY,
|
||||
|
||||
@@ -83,20 +83,28 @@
|
||||
#define HConfusion u.uprops[CONFUSION].intrinsic
|
||||
#define Confusion HConfusion
|
||||
|
||||
#define Blinded u.uprops[BLINDED].intrinsic
|
||||
#define Blindfolded (ublindf && ublindf->otyp != LENSES)
|
||||
/* ...means blind because of a cover */
|
||||
#define Blind \
|
||||
((u.uroleplay.blind || Blinded || Blindfolded \
|
||||
|| !haseyes(gy.youmonst.data)) \
|
||||
&& !(ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD))
|
||||
/* ...the Eyes operate even when you really are blind
|
||||
or don't have any eyes */
|
||||
#define Blindfolded_only \
|
||||
(Blindfolded && ublindf->oartifact != ART_EYES_OF_THE_OVERWORLD \
|
||||
&& !u.uroleplay.blind && !Blinded && haseyes(gy.youmonst.data))
|
||||
/* ...blind because of a blindfold, and *only* that */
|
||||
/* Blindness is more complex than other properties */
|
||||
#define HBlinded u.uprops[BLINDED].intrinsic /* TIMEOUT|FROMOUTSIDE|FROMFORM */
|
||||
#define EBlinded u.uprops[BLINDED].extrinsic /* W_TOOL */
|
||||
/* wearing the Eyes of the Overworld overrides blindness */
|
||||
#define BBlinded u.uprops[BLINDED].blocked /* W_TOOL */
|
||||
/* non-blindfold: timed effect | u.uroleplay.blind | !haseyes() */
|
||||
#define Blinded (HBlinded && !BBlinded)
|
||||
#define BlindedTimeout (HBlinded & TIMEOUT)
|
||||
#define PermaBlind ((HBlinded & FROMOUTSIDE) != 0L) /* OPTIONS:blind */
|
||||
/* worn blindfold (or towel; lenses don't set [BLINDED].extrinsic) */
|
||||
#define Blindfolded EBlinded
|
||||
#define Blindfolded_only (Blindfolded && !Blinded)
|
||||
/* '#define Blind (Blinded || Blindfolded)' would work, but only
|
||||
because BBlinded (conferred by artifact lenses) and Blindfolded
|
||||
are mutually exclusive; explicitly applying !BBlinded to both
|
||||
internal and external blindness should be more robust in case
|
||||
of future changes */
|
||||
#define Blind ((HBlinded || EBlinded) && !BBlinded)
|
||||
|
||||
/*
|
||||
* Maladies
|
||||
*/
|
||||
#define Sick u.uprops[SICK].intrinsic
|
||||
#define Stoned u.uprops[STONED].intrinsic
|
||||
#define Strangled u.uprops[STRANGLED].intrinsic
|
||||
|
||||
Reference in New Issue
Block a user