diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 406c81d99..ab7498665 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1392,6 +1392,7 @@ Sunsword can be invoked to create a blinding ray Excalibur is much harder to get if hero is not a knight pets considered any noise made by hero made as whistling silent monsters in stinking clouds don't cough +unblind telepathy range depends on number of telepathy granting items worn Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/include/display.h b/include/display.h index aaefeea66..649ca6837 100644 --- a/include/display.h +++ b/include/display.h @@ -47,7 +47,7 @@ /* OR 2b. hero is using a telepathy inducing */ \ /* object and in range */ \ || (Unblind_telepat \ - && (mdistu(mon) <= (BOLT_LIM * BOLT_LIM))))) + && (mdistu(mon) <= u.unblind_telepat_range)))) /* organized to perform cheaper tests first; is_pool() vs is_pool_or_lava(): hero who is underwater can see adjacent diff --git a/include/patchlevel.h b/include/patchlevel.h index 54e30beb2..54cf108a1 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 101 +#define EDITLEVEL 102 /* * Development status possibilities. diff --git a/include/you.h b/include/you.h index d455366ff..8efaea587 100644 --- a/include/you.h +++ b/include/you.h @@ -389,6 +389,7 @@ struct you { /* These ranges can never be more than MAX_RANGE (vision.h). */ int nv_range; /* current night vision range */ int xray_range; /* current xray vision range */ + int unblind_telepat_range; /* * These variables are valid globally only when punished and blind. diff --git a/src/u_init.c b/src/u_init.c index 5900675e7..443587c47 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -928,6 +928,8 @@ u_init(void) */ u.nv_range = 1; u.xray_range = -1; + u.unblind_telepat_range = -1; + /* OPTIONS:blind results in permanent blindness (unless overridden by the Eyes of the Overworld, which will clear 'u.uroleplay.blind' to void the conduct, but will leave the PermaBlind bit set so that diff --git a/src/worn.c b/src/worn.c index e356fb8e2..3ab06ac2b 100644 --- a/src/worn.c +++ b/src/worn.c @@ -5,6 +5,7 @@ #include "hack.h" +staticfn void recalc_telepat_range(void); staticfn void m_lose_armor(struct monst *, struct obj *, boolean) NONNULLPTRS; staticfn void clear_bypass(struct obj *) NO_NNARGS; staticfn void m_dowear_type(struct monst *, long, boolean, boolean) NONNULLARG1; @@ -44,6 +45,25 @@ static const struct worn { /* note: monsters don't have clairvoyance, so dependency on hero's role here has no significant effect on their use of w_blocks() */ +/* calc the range of hero's unblind telepathy */ +staticfn void +recalc_telepat_range(void) +{ + const struct worn *wp; + int nobjs = 0; + + for (wp = worn; wp->w_mask; wp++) { + struct obj *oobj = *(wp->w_obj); + + if (oobj && objects[oobj->otyp].oc_oprop == TELEPAT) + nobjs++; + } + if (nobjs) + u.unblind_telepat_range = (BOLT_LIM * BOLT_LIM) * nobjs; + else + u.unblind_telepat_range = -1; +} + /* Updated to use the extrinsic and blocked fields. */ void setworn(struct obj *obj, long mask) @@ -114,6 +134,7 @@ setworn(struct obj *obj, long mask) iflags.tux_penalty = (uarm && Role_if(PM_MONK) && gu.urole.spelarmr); } update_inventory(); + recalc_telepat_range(); } /* called e.g. when obj is destroyed */ @@ -147,6 +168,7 @@ setnotworn(struct obj *obj) if (!uarm) iflags.tux_penalty = FALSE; update_inventory(); + recalc_telepat_range(); } /* called when saving with FREEING flag set has just discarded inventory */