Unblind telepathy range

Unblind telepathy range depends on the number of telepathy granting
items worn.

Breaks saves.
This commit is contained in:
Pasi Kallinen
2024-04-04 23:22:24 +03:00
parent 12873e2773
commit 28ed8e7962
6 changed files with 28 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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 */